[Libreoffice-commits] core.git: sc/source

Gulsah Kose gulsah.1004 at gmail.com
Wed Jun 7 16:36:40 UTC 2017


 sc/source/core/data/document.cxx |   23 +++++++++++++----------
 sc/source/ui/view/tabview3.cxx   |    1 +
 2 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 57bdb06703ecf233d12304d4e71e1f40d29da327
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date:   Thu Jun 1 16:02:53 2017 +0300

    tdf#108098 Correct detection of MIXED state.
    
    Change-Id: I212b908b8b7b2e8933dd5f923b0a2d8890bceed6
    Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/38310
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 647db469ae87..18553d326575 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6518,7 +6518,9 @@ void ScDocument::ForgetNoteCaptions( const ScRangeList& rRanges, bool bPreserveD
 
 CommentCaptionState ScDocument::GetAllNoteCaptionsState( const ScRangeList& rRanges )
 {
-    CommentCaptionState aOldState, aState = CommentCaptionState::ALLHIDDEN; //because of Werror=maybe-uninitialized
+    CommentCaptionState aTmpState = CommentCaptionState::ALLHIDDEN;
+    CommentCaptionState aState = CommentCaptionState::ALLHIDDEN;
+    bool bFirstControl = true;
     std::vector<sc::NoteEntry> aNotes;
 
     for (size_t i = 0, n = rRanges.size(); i < n; ++i)
@@ -6528,18 +6530,19 @@ CommentCaptionState ScDocument::GetAllNoteCaptionsState( const ScRangeList& rRan
         for( SCTAB nTab = pRange->aStart.Tab(); nTab <= pRange->aEnd.Tab(); ++nTab )
         {
             aState = maTabs[nTab]->GetAllNoteCaptionsState( *pRange, aNotes );
+
             if (aState == CommentCaptionState::MIXED)
                 return aState;
 
-            if (nTab - 1 >= 0)  // it is possible that a range is ALLSHOWN, another range is ALLHIDDEN,
-            {                   // we have to detect that situation as mixed.
-                aOldState = maTabs[nTab-1]->GetAllNoteCaptionsState( *pRange, aNotes );
-
-                if (aState != aOldState)
-                {
-                    aState = CommentCaptionState::MIXED;
-                    return aState;
-                }
+            if (bFirstControl)                      // it is possible that a range is ALLSHOWN, another range is ALLHIDDEN,
+            {                                       // we have to detect that situation as mixed.
+                aTmpState = aState;
+                bFirstControl = false;
+            }
+            else if(aTmpState != aState)
+            {
+                aState = CommentCaptionState::MIXED;
+                return aState;
             }
         }
     }
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index de638447b567..c2ab34842137 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -485,6 +485,7 @@ void ScTabView::SelectionChanged()
     rBindings.Invalidate( FID_HIDE_NOTE );
     rBindings.Invalidate( FID_SHOW_ALL_NOTES );
     rBindings.Invalidate( FID_HIDE_ALL_NOTES );
+    rBindings.Invalidate( SID_TOGGLE_NOTES );
     rBindings.Invalidate( SID_DELETE_NOTE );
     rBindings.Invalidate( SID_ROWCOL_SELCOUNT );
 


More information about the Libreoffice-commits mailing list