diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-15 10:43:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-15 16:48:50 +0100 |
commit | d32843c9b79b4b9c26a5f59c0e2b5cf2441218c4 (patch) | |
tree | 2fa74d0565a2cf868381290af75d0a5d2b038f76 /sc/source | |
parent | d3d15d512c18a8bbd130019d1921f36f42cf6e35 (diff) |
Resolves: fdo#33636 spell-checker dialog itself can munge the selection
It can create/activate an editview, and GetSheetSelection will take an active
editview as the current selection. So from GetSheetSelection's POV activating
the spellchecker changes the selection, and the SpellChecker dialog detects a
selection change as indicating that the spell-checking needs to be restarted on
the new selection.
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/inc/spelldialog.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/spelldialog.cxx | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/sc/source/ui/inc/spelldialog.hxx b/sc/source/ui/inc/spelldialog.hxx index 3639007655a9..8bf217243795 100644 --- a/sc/source/ui/inc/spelldialog.hxx +++ b/sc/source/ui/inc/spelldialog.hxx @@ -38,6 +38,7 @@ class ScConversionEngineBase; class ScSelectionState; class ScTabViewShell; class ScViewData; +class ScRangeList; class ScDocShell; class ScDocument; @@ -85,11 +86,13 @@ private: typedef ::std::auto_ptr< ScConversionEngineBase > ScConvEnginePtr; typedef ::std::auto_ptr< ScDocument > ScDocumentPtr; typedef ::std::auto_ptr< ScSelectionState > ScSelectionStatePtr; + typedef ::std::auto_ptr< ScRangeList > ScRangeListPtr; ScConvEnginePtr mxEngine; ScDocumentPtr mxUndoDoc; ScDocumentPtr mxRedoDoc; - ScSelectionStatePtr mxOldSel; /// Old selection state for comparison. + ScSelectionStatePtr mxOldSel; /// For cursor position in selection + ScRangeListPtr mxOldRangeList; /// Original selection range for comparison. ScTabViewShell* mpViewShell; ScViewData* mpViewData; ScDocShell* mpDocShell; diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index 8a1e5d963d4f..25c3b859ad62 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -158,6 +158,7 @@ void ScSpellDialogChildWindow::Reset() mxUndoDoc.reset(); mxRedoDoc.reset(); mxOldSel.reset(); + mxOldRangeList.reset(); mpViewShell = 0; mpViewData = 0; mpDocShell = 0; @@ -190,6 +191,10 @@ void ScSpellDialogChildWindow::Init() SCTAB nTab = rCursor.Tab(); ScMarkData& rMarkData = mpViewData->GetMarkData(); + + mxOldRangeList.reset(new ScRangeList); + rMarkData.FillRangeListWithMarks(mxOldRangeList.get(), true); + rMarkData.MarkToMulti(); switch( mxOldSel->GetSelectionType() ) @@ -265,15 +270,17 @@ void ScSpellDialogChildWindow::Init() bool ScSpellDialogChildWindow::IsSelectionChanged() { - if( !mxOldSel.get() || !mpViewShell || (mpViewShell != PTR_CAST( ScTabViewShell, SfxViewShell::Current() )) ) + if( !mxOldRangeList.get() || !mpViewShell || (mpViewShell != PTR_CAST( ScTabViewShell, SfxViewShell::Current() )) ) return true; if( EditView* pEditView = mpViewData->GetSpellingView() ) if( pEditView->GetEditEngine() != mxEngine.get() ) return true; - ScSelectionState aNewSel( *mpViewData ); - return mxOldSel->GetSheetSelection() != aNewSel.GetSheetSelection(); + ScRangeList aCurrentRangeList; + mpViewData->GetMarkData().FillRangeListWithMarks(&aCurrentRangeList, true); + + return (*mxOldRangeList != aCurrentRangeList); } // ============================================================================ |