summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
authorThomas Lange [tl] <tl@openoffice.org>2010-04-22 13:08:19 +0200
committerThomas Lange [tl] <tl@openoffice.org>2010-04-22 13:08:19 +0200
commitbbb1428e3666acc7503d86704bbf1e1a4ac04795 (patch)
treedb00266a3e13de318d4c5a41437f6e19ef4df673 /cui/source
parent60c0e59fd450e39902d85918d2243fb83c02a21d (diff)
cws tl80: #i110341# problems with spell check dialog fixed
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/dialogs/SpellDialog.cxx42
-rw-r--r--cui/source/inc/SpellDialog.hxx13
2 files changed, 30 insertions, 25 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index d243ce96f27c..81fee79663e5 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -389,14 +389,14 @@ void SpellDialog::UpdateBoxes_Impl()
}
// -----------------------------------------------------------------------
-void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence)
+void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrentError )
{
//initially or after the last error of a sentence MarkNextError will fail
//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((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError()) ||
- true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence) && aSentenceED.MarkNextError()))
+ if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError( bIgnoreCurrentError )) ||
+ true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, aSentenceED.IsUndoEditMode()) && aSentenceED.MarkNextError( false )))
{
const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
if( pSpellErrorDescription )
@@ -795,14 +795,12 @@ IMPL_LINK( SpellDialog, IgnoreHdl, Button *, EMPTYARG )
}
else
{
- //in case the error has been changed manually it has to be restored
+ //in case the error has been changed manually it has to be restored,
+ // since the users choice now was to ignore the error
aSentenceED.RestoreCurrentError();
- rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true));
- aSentenceED.ResetModified();
// the word is being ignored
- SpellContinue_Impl();
- bModified = false;
+ SpellContinue_Impl( false, true );
}
return 1;
}
@@ -1074,11 +1072,8 @@ IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd)
-----------------------------------------------------------------------*/
IMPL_LINK(SpellDialog, CancelHdl, Button *, EMPTYARG )
{
- //apply changes first - if there are any
- if(aSentenceED.IsModified())
- {
- rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false));
- }
+ //apply changes and ignored text parts first - if there are any
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), false);
Close();
return 0;
}
@@ -1158,15 +1153,17 @@ void SpellDialog::InvalidateDialog()
/*-- 10.09.2003 08:35:56---------------------------------------------------
-----------------------------------------------------------------------*/
-bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence)
+bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
{
bool bRet = false;
- if(!bUseSavedSentence && aSentenceED.IsModified())
+ if(!bUseSavedSentence /*&& aSentenceED.IsModified()*/)
{
- rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false));
+ //apply changes and ignored text parts
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), bRecheck);
}
+ aSentenceED.ResetIgnoreErrorsAt();
aSentenceED.ResetModified();
- SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence();
+ SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence( bRecheck );
if(!bUseSavedSentence)
m_aSavedSentence = aSentence;
bool bHasReplaced = false;
@@ -1177,8 +1174,8 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence)
if(!ApplyChangeAllList_Impl(aSentence, bHasReplaced))
{
- rParent.ApplyChangedSentence(aSentence);
- aSentence = rParent.GetNextWrongSentence();
+ rParent.ApplyChangedSentence(aSentence, bRecheck);
+ aSentence = rParent.GetNextWrongSentence( bRecheck );
}
else
break;
@@ -1642,8 +1639,10 @@ long SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
/*-- 10.09.2003 13:38:14---------------------------------------------------
-----------------------------------------------------------------------*/
-bool SentenceEditWindow_Impl::MarkNextError()
+bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
{
+ if (bIgnoreCurrentError)
+ m_aIgnoreErrorsAt.insert( m_nErrorStart );
ExtTextEngine* pTextEngine = GetTextEngine();
USHORT nTextLen = pTextEngine->GetTextLen(0);
if(m_nErrorEnd >= nTextLen - 1)
@@ -1981,7 +1980,8 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnore
aPortion1.eLanguage = eLang;
aPortion1.sText = pTextEngine->GetText(
TextSelection(TextPaM(0, nStart), TextPaM(0, aStart->nPosition)));
- if( bSetIgnoreFlag && m_nErrorStart == nStart )
+ bool bIsIgnoreError = m_aIgnoreErrorsAt.find( nStart ) != m_aIgnoreErrorsAt.end();
+ if( bSetIgnoreFlag && bIsIgnoreError /*m_nErrorStart == nStart*/ )
{
aPortion1.bIgnoreThisError = true;
}
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index a2deb5192389..8d233b71e890 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -50,6 +50,8 @@
#include <svtools/xtextedt.hxx>
#include <editeng/SpellPortions.hxx>
+#include <set>
+
class ScrollBar;
class TextEngine;
class ExtTextView;
@@ -72,11 +74,12 @@ class SentenceEditWindow_Impl : public MultiLineEdit/*, public SfxListener*/
using MultiLineEdit::SetText;
private:
+ std::set< USHORT > m_aIgnoreErrorsAt;
USHORT m_nErrorStart;
USHORT m_nErrorEnd;
bool m_bIsUndoEditMode;
- Link m_aModifyLink;
+ Link m_aModifyLink;
void CallModifyLink() {m_aModifyLink.Call(this);}
@@ -93,7 +96,7 @@ public:
void SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd );
void SetText( const String& rStr );
- bool MarkNextError();
+ bool MarkNextError( bool bIgnoreCurrentError );
void ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage);
void MoveErrorMarkTo(USHORT nErrorStart, USHORT nErrorEnd, bool bGrammar);
String GetErrorText() const;
@@ -121,6 +124,8 @@ public:
void UndoActionEnd( USHORT nId );
void MoveErrorEnd(long nOffset);
+
+ void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); }
};
@@ -221,7 +226,7 @@ private:
void InitUserDicts();
void UpdateBoxes_Impl();
void Init_Impl();
- void SpellContinue_Impl(bool UseSavedSentence = false);
+ void SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false );
void LockFocusChanges( bool bLock ) {bFocusLocked = bLock;}
void Impl_Restore();
@@ -230,7 +235,7 @@ private:
/** Retrieves the next sentence.
*/
- bool GetNextSentence_Impl(bool bUseSavedSentence);
+ bool GetNextSentence_Impl(bool bUseSavedSentence, bool bRechek /*for rechecking the curretn sentence*/);
/** Corrects all errors that have been selected to be changed always
*/
bool ApplyChangeAllList_Impl(SpellPortions& rSentence, bool& bHasReplaced);