Kaydet (Commit) d32843c9 authored tarafından Caolán McNamara's avatar Caolán McNamara

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.
üst d3d15d51
...@@ -38,6 +38,7 @@ class ScConversionEngineBase; ...@@ -38,6 +38,7 @@ class ScConversionEngineBase;
class ScSelectionState; class ScSelectionState;
class ScTabViewShell; class ScTabViewShell;
class ScViewData; class ScViewData;
class ScRangeList;
class ScDocShell; class ScDocShell;
class ScDocument; class ScDocument;
...@@ -85,11 +86,13 @@ private: ...@@ -85,11 +86,13 @@ private:
typedef ::std::auto_ptr< ScConversionEngineBase > ScConvEnginePtr; typedef ::std::auto_ptr< ScConversionEngineBase > ScConvEnginePtr;
typedef ::std::auto_ptr< ScDocument > ScDocumentPtr; typedef ::std::auto_ptr< ScDocument > ScDocumentPtr;
typedef ::std::auto_ptr< ScSelectionState > ScSelectionStatePtr; typedef ::std::auto_ptr< ScSelectionState > ScSelectionStatePtr;
typedef ::std::auto_ptr< ScRangeList > ScRangeListPtr;
ScConvEnginePtr mxEngine; ScConvEnginePtr mxEngine;
ScDocumentPtr mxUndoDoc; ScDocumentPtr mxUndoDoc;
ScDocumentPtr mxRedoDoc; 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; ScTabViewShell* mpViewShell;
ScViewData* mpViewData; ScViewData* mpViewData;
ScDocShell* mpDocShell; ScDocShell* mpDocShell;
......
...@@ -158,6 +158,7 @@ void ScSpellDialogChildWindow::Reset() ...@@ -158,6 +158,7 @@ void ScSpellDialogChildWindow::Reset()
mxUndoDoc.reset(); mxUndoDoc.reset();
mxRedoDoc.reset(); mxRedoDoc.reset();
mxOldSel.reset(); mxOldSel.reset();
mxOldRangeList.reset();
mpViewShell = 0; mpViewShell = 0;
mpViewData = 0; mpViewData = 0;
mpDocShell = 0; mpDocShell = 0;
...@@ -190,6 +191,10 @@ void ScSpellDialogChildWindow::Init() ...@@ -190,6 +191,10 @@ void ScSpellDialogChildWindow::Init()
SCTAB nTab = rCursor.Tab(); SCTAB nTab = rCursor.Tab();
ScMarkData& rMarkData = mpViewData->GetMarkData(); ScMarkData& rMarkData = mpViewData->GetMarkData();
mxOldRangeList.reset(new ScRangeList);
rMarkData.FillRangeListWithMarks(mxOldRangeList.get(), true);
rMarkData.MarkToMulti(); rMarkData.MarkToMulti();
switch( mxOldSel->GetSelectionType() ) switch( mxOldSel->GetSelectionType() )
...@@ -265,15 +270,17 @@ void ScSpellDialogChildWindow::Init() ...@@ -265,15 +270,17 @@ void ScSpellDialogChildWindow::Init()
bool ScSpellDialogChildWindow::IsSelectionChanged() 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; return true;
if( EditView* pEditView = mpViewData->GetSpellingView() ) if( EditView* pEditView = mpViewData->GetSpellingView() )
if( pEditView->GetEditEngine() != mxEngine.get() ) if( pEditView->GetEditEngine() != mxEngine.get() )
return true; return true;
ScSelectionState aNewSel( *mpViewData ); ScRangeList aCurrentRangeList;
return mxOldSel->GetSheetSelection() != aNewSel.GetSheetSelection(); mpViewData->GetMarkData().FillRangeListWithMarks(&aCurrentRangeList, true);
return (*mxOldRangeList != aCurrentRangeList);
} }
// ============================================================================ // ============================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment