[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

Gulsah Kose gulsah.1004 at gmail.com
Wed Jun 7 22:06:23 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 81e7ef8d3941de527f21c1508389c9e09518680b
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>
    (cherry picked from commit 57bdb06703ecf233d12304d4e71e1f40d29da327)
    Reviewed-on: https://gerrit.libreoffice.org/38537

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9d68bb5a5564..0aff3b5e9469 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 390e8ef37a53..226eb8d91d4c 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