diff options
author | Gulsah Kose <gulsah.1004@gmail.com> | 2017-03-09 21:41:17 +0300 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-04-11 13:49:06 +0200 |
commit | ec25d34fa3ac900950ff24fcb224f7e827352803 (patch) | |
tree | 45a415a68cb3f7b699784e51a013be2c3d57888b /sc/source | |
parent | 9e8598c42a1a6f2fbd88711aa9bea5961eaf7b4a (diff) |
tdf#84837 Add Show/Hide all comments commands to Calc.
Change-Id: I1e38335ff1269d0d464f03d23bfc5eba6e3b1532
Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/35020
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/document.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/src/globstr.src | 8 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 33 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 2 |
5 files changed, 79 insertions, 0 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 0c680fe9faa3..92c9645cf03c 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6577,6 +6577,15 @@ void ScDocument::GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const } } +void ScDocument::GetAllNoteEntries( SCTAB nTab, std::vector<sc::NoteEntry>& rNotes ) const +{ + const ScTable* pTab = FetchTable(nTab); + if (!pTab) + return; + + return pTab->GetAllNoteEntries( rNotes ); +} + void ScDocument::GetNotesInRange( const ScRangeList& rRange, std::vector<sc::NoteEntry>& rNotes ) const { for( size_t i = 0; i < rRange.size(); ++i) diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index 79365253deb6..56b44ec86a41 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -299,6 +299,14 @@ String STR_UNDO_HIDENOTE+RID_GLOBSTR_OFFSET { Text [ en-US ] = "Hide Comment" ; }; +String STR_UNDO_SHOWALLNOTES+RID_GLOBSTR_OFFSET +{ + Text [ en-US ] = "Show All Comments" ; +}; +String STR_UNDO_HIDEALLNOTES+RID_GLOBSTR_OFFSET +{ + Text [ en-US ] = "Hide All Comments" ; +}; String STR_UNDO_EDITNOTE+RID_GLOBSTR_OFFSET { Text [ en-US ] = "Edit Comment" ; diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 6dda629fbec5..ed5389bcf9b6 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -1043,6 +1043,33 @@ void ScCellShell::GetState(SfxItemSet &rSet) } break; + case FID_SHOW_ALL_NOTES: + case FID_HIDE_ALL_NOTES: + { + bool bHasNotes = false; + SCTAB nFirstSelected = rMark.GetFirstSelected(); + SCTAB nLastSelected = rMark.GetLastSelected(); + + for( SCTAB aTab = nFirstSelected; aTab<=nLastSelected; aTab++ ) + { + if (rMark.GetTableSelect(aTab) ) + { + if (pDoc->HasTabNotes( aTab )) + { + bHasNotes = true; + break; + } + } + + if( bHasNotes ) //for break nested loop + break; + } + + if ( !bHasNotes ) + rSet.DisableItem( nWhich ); + } + break; + case SID_DELETE_NOTE: { bool bEnable = false; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 81b63f69678c..1903df9fda74 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2324,6 +2324,39 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) else rReq.Ignore(); } + + } + break; + + case FID_SHOW_ALL_NOTES: + case FID_HIDE_ALL_NOTES: + { + bool bShowNote = nSlot == FID_SHOW_ALL_NOTES; + ScViewData* pData = GetViewData(); + ScMarkData& rMark = pData->GetMarkData(); + ScDocument* pDoc = pData->GetDocument(); + std::vector<sc::NoteEntry> aNotes; + + OUString aUndo = ScGlobal::GetRscString( bShowNote ? STR_UNDO_SHOWALLNOTES : STR_UNDO_HIDEALLNOTES ); + pData->GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pData->GetViewShell()->GetViewShellId() ); + + SCTAB nFirstSelected = rMark.GetFirstSelected(); + SCTAB nLastSelected = rMark.GetLastSelected(); + + for( SCTAB aTab = nFirstSelected; aTab<=nLastSelected; aTab++ ) + { + if (rMark.GetTableSelect(aTab)) + pDoc->GetAllNoteEntries(aTab, aNotes); + } + + 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(); } break; diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 71204128ce60..e60dbbd08fcf 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -482,6 +482,8 @@ void ScTabView::SelectionChanged() rBindings.Invalidate( FID_NOTE_VISIBLE ); rBindings.Invalidate( FID_SHOW_NOTE ); rBindings.Invalidate( FID_HIDE_NOTE ); + rBindings.Invalidate( FID_SHOW_ALL_NOTES ); + rBindings.Invalidate( FID_HIDE_ALL_NOTES ); rBindings.Invalidate( SID_DELETE_NOTE ); rBindings.Invalidate( SID_ROWCOL_SELCOUNT ); |