summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/SpellDialog.cxx13
-rw-r--r--cui/source/inc/SpellDialog.hxx2
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;