summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/cellsh1.cxx
diff options
context:
space:
mode:
authorGulsah Kose <gulsah.1004@gmail.com>2017-04-19 16:29:43 +0300
committerEike Rathke <erack@redhat.com>2017-05-11 16:12:11 +0200
commit198f5a16fd4c5bf691a3450bbf16e88c000f9baa (patch)
tree347f5ca8aab1e0ebb4e720b03d62989b7dd86bd1 /sc/source/ui/view/cellsh1.cxx
parent0496587f1bf271ef0540f3cd8155889311480d70 (diff)
tdf#107258 Create show/hide all comments toggle button.
Created new show/hide all comments button for calc by ShowAnnotations command. Unifyied writer, calc and impress's ShowAnnotations slot. Change-Id: I27149d09ee1763b84258c5e0c890a9628c8874c0 Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/36697 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/view/cellsh1.cxx')
-rw-r--r--sc/source/ui/view/cellsh1.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 05f6397a4ed3..ce3fe707a663 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2356,6 +2356,41 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
break;
+ case SID_TOGGLE_NOTES:
+ {
+ ScViewData* pData = GetViewData();
+ ScMarkData& rMark = pData->GetMarkData();
+ ScDocument* pDoc = pData->GetDocument();
+ ScRangeList aRanges;
+ std::vector<sc::NoteEntry> aNotes;
+
+ for (auto const& rTab : rMark.GetSelectedTabs())
+ aRanges.Append(ScRange(0,0,rTab,MAXCOL,MAXROW,rTab));
+
+ CommentCaptionState eState = pDoc->GetAllNoteCaptionsState( aRanges );
+ pDoc->GetNotesInRange(aRanges, aNotes);
+ bool bShowNote = (eState == ALLHIDDEN || eState == MIXED);
+
+ OUString aUndo = ScGlobal::GetRscString( bShowNote ? STR_UNDO_SHOWALLNOTES : STR_UNDO_HIDEALLNOTES );
+ pData->GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pData->GetViewShell()->GetViewShellId() );
+
+ for(std::vector<sc::NoteEntry>::const_iterator itr = aNotes.begin(),
+ itrEnd = aNotes.end(); itr != itrEnd; ++itr)
+ {
+ const ScAddress& rAdr = itr->maPos;
+ pData->GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote );
+ }
+
+ pData->GetDocShell()->GetUndoManager()->LeaveListAction();
+
+ if (!pReqArgs)
+ rReq.AppendItem( SfxBoolItem( SID_TOGGLE_NOTES, bShowNote ) );
+
+ rReq.Done();
+ rBindings.Invalidate( SID_TOGGLE_NOTES );
+ }
+ break;
+
case SID_DELETE_NOTE:
{
const SfxPoolItem* pId;