[Libreoffice-commits] .: sc/source

Caolán McNamara caolan at kemper.freedesktop.org
Wed Jun 15 08:49:27 PDT 2011


 sc/source/ui/inc/spelldialog.hxx  |    5 ++++-
 sc/source/ui/view/spelldialog.cxx |   13 ++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 7286ac718b3673bc470d4a6dd68daf40bfb8c0ac
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 15 10:43:50 2011 +0100

    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.

diff --git a/sc/source/ui/inc/spelldialog.hxx b/sc/source/ui/inc/spelldialog.hxx
index 1024344..dc8f7ba 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 586a751..04073c7 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);
 }
 
 // ============================================================================


More information about the Libreoffice-commits mailing list