[Libreoffice-commits] core.git: cui/source
László Németh
nemeth at numbertext.org
Wed Jan 22 01:41:20 PST 2014
cui/source/dialogs/SpellDialog.cxx | 13 ++++++++-----
cui/source/inc/SpellDialog.hxx | 2 +-
2 files changed, 9 insertions(+), 6 deletions(-)
New commits:
commit c49543cf31c14d4f94f01620244dd7e3ba0919ea
Author: László Németh <nemeth at numbertext.org>
Date: Wed Jan 22 10:05:46 2014 +0100
fdo#73917 spelling dialog: don't report fully ignored words again
Change-Id: I2a8503fd2c3babab844e9cd026a57c438e015254
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 97829c7..85c04d3 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -386,8 +386,8 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent
//then GetNextSentence() has to be called followed again by MarkNextError()
//MarkNextError is not initally called if the UndoEdit mode is active
bool bNextSentence = false;
- if((!m_pSentenceED->IsUndoEditMode() && m_pSentenceED->MarkNextError( bIgnoreCurrentError )) ||
- true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, m_pSentenceED->IsUndoEditMode()) && m_pSentenceED->MarkNextError( false )))
+ if((!m_pSentenceED->IsUndoEditMode() && m_pSentenceED->MarkNextError( bIgnoreCurrentError, xSpell )) ||
+ true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, m_pSentenceED->IsUndoEditMode()) && m_pSentenceED->MarkNextError( false, xSpell )))
{
const SpellErrorDescription* pSpellErrorDescription = m_pSentenceED->GetAlternatives();
if( pSpellErrorDescription )
@@ -1542,7 +1542,7 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
}
//-----------------------------------------------------------------------
-bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
+bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellChecker1> xSpell )
{
if (bIgnoreCurrentError)
m_aIgnoreErrorsAt.insert( m_nErrorStart );
@@ -1582,18 +1582,21 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
{
pSpellErrorDescription = &static_cast<const SpellErrorAttrib&>(pNextError->GetAttr()).GetErrorDescription();
bGrammarError = pSpellErrorDescription->bIsGrammarError;
+ m_nErrorStart = pNextError->GetStart();
+ m_nErrorEnd = pNextError->GetEnd();
}
if(xChangeAll->getCount() && pSpellErrorDescription &&
(xEntry = xChangeAll->getEntry( pSpellErrorDescription->sErrorText )).is())
{
- m_nErrorStart = pNextError->GetStart();
- m_nErrorEnd = pNextError->GetEnd();
OUString sReplacement(getDotReplacementString(GetErrorText(), xEntry->getReplacementText()));
ChangeMarkedWord(sReplacement, LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale ));
aCursor.GetIndex() = aCursor.GetIndex() + (sal_uInt16)(xEntry->getReplacementText().getLength());
+ // maybe the error found here is already added to the dictionary and has to be ignored
+ } else if(pSpellErrorDescription && !bGrammarError && xSpell->isValid( GetErrorText(), LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale ), Sequence< PropertyValue >() )) {
+ aCursor.GetIndex() = aCursor.GetIndex() + 1;
}
else
break;
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 5f88f3b..550f9c4 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -83,7 +83,7 @@ public:
void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
void SetText( const OUString& rStr );
- bool MarkNextError( bool bIgnoreCurrentError );
+ bool MarkNextError( bool bIgnoreCurrentError, com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellChecker1> );
void ChangeMarkedWord(const OUString& rNewWord, LanguageType eLanguage);
void MoveErrorMarkTo(sal_uInt16 nErrorStart, sal_uInt16 nErrorEnd, bool bGrammar);
OUString GetErrorText() const;
More information about the Libreoffice-commits
mailing list