예제 #1
0
int MpViewLabelData::write (ostream& os) const
{
  MpContextSave ctx;
  DefineContext(this,ctx);
  return ctx.SaveContext(os,"MpViewLabelData");
}
예제 #2
0
wxString HunspellInterface::CheckSpelling(wxString strText)
{
  if (m_pHunspell == NULL)
    return wxEmptyString;

  int nDiff = 0;

  strText += _T(" ");

  wxString strDelimiters = _T(" \t\r\n.,?!@#$%^&*()-=_+[]{}\\|;:\"<>/~0123456789");
  wxStringTokenizer tkz(strText, strDelimiters);
  while ( tkz.HasMoreTokens() )
  {
    wxString token = tkz.GetNextToken();
    int TokenStart = tkz.GetPosition() - token.Length() - 1;
    TokenStart += nDiff;  // Take into account any changes to the size of the strText

    // process token here
    if (!IsWordInDictionary(token))
    {
      // If this word is in the always ignore list, then just move on
      if (m_AlwaysIgnoreList.Index(token) != wxNOT_FOUND)
        continue;

/* dealt with by IsWordInDictionary - JACS
       // If this word is in the personal dictionary, then just move on
       if (m_PersonalDictionary.IsWordInDictionary(token))
         continue;
*/

      bool bReplaceFromMap = false;
      StringToStringMap::iterator WordFinder = m_AlwaysReplaceMap.find(token);
      if (WordFinder != m_AlwaysReplaceMap.end())
        bReplaceFromMap = true;

      int nUserReturnValue = 0;

      if (!bReplaceFromMap)
      {
        // Define the context of the word
        DefineContext(strText, TokenStart, token.Length());

        // Print out the misspelling and get a replasment from the user
        // Present the dialog so the user can tell us what to do with this word
        nUserReturnValue = GetUserCorrection(token);  //Show function will show the dialog and not return until the user makes a decision
      }

      if (nUserReturnValue == wxSpellCheckUserInterface::ACTION_CLOSE)
      {
        break;
      }
      else if ((nUserReturnValue == wxSpellCheckUserInterface::ACTION_REPLACE) || bReplaceFromMap)
      {
        wxString strReplacementText = (bReplaceFromMap) ? (*WordFinder).second : m_pSpellUserInterface->GetReplacementText();
        // Increase/Decreate the character difference so that the next loop is on track
        nDiff += strReplacementText.Length() - token.Length();
        // Replace the misspelled word with the replacement */
        strText.replace(TokenStart, token.Length(), strReplacementText);
      }
    }
  }

  strText = strText.Left(strText.Len() - 1);

  return strText;
}
예제 #3
0
int MpViewLabelData::read  (istream& is)
{
  MpContextSave ctx;
  DefineContext(this,ctx);
  return ctx.RestoreContext(is,"MpViewLabelData");
}