summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGulsah Kose <gulsah.1004@gmail.com>2017-06-01 16:02:53 +0300
committerEike Rathke <erack@redhat.com>2017-06-07 18:36:20 +0200
commit57bdb06703ecf233d12304d4e71e1f40d29da327 (patch)
tree21b54c0c6e907b9906a31f56998cf779a708f6ce
parent28d760e5220a175a5eb8e859498baa4c7f97f3e2 (diff)
tdf#108098 Correct detection of MIXED state.
Change-Id: I212b908b8b7b2e8933dd5f923b0a2d8890bceed6 Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/38310 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/core/data/document.cxx23
-rw-r--r--sc/source/ui/view/tabview3.cxx1
2 files changed, 14 insertions, 10 deletions
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 );