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.1...@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.1...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/38310 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@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 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits