diff options
author | László Németh <nemeth@numbertext.org> | 2014-01-22 10:05:46 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2014-01-22 10:40:51 +0100 |
commit | c49543cf31c14d4f94f01620244dd7e3ba0919ea (patch) | |
tree | 407d84fa00cab740d8e2214dfe90da25e8639741 /cui/source | |
parent | 0ff31c26f3ebbad1d61c7033e946a287e3910bae (diff) |
fdo#73917 spelling dialog: don't report fully ignored words again
Change-Id: I2a8503fd2c3babab844e9cd026a57c438e015254
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/SpellDialog.cxx | 13 | ||||
-rw-r--r-- | cui/source/inc/SpellDialog.hxx | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 97829c7a356d..85c04d3db2ad 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 5f88f3b526cb..550f9c400576 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; |