[Libreoffice-commits] core.git: officecfg/registry sc/inc sc/sdi sc/source sc/uiconfig

Gulsah Kose gulsah.1004 at gmail.com
Tue Apr 11 11:49:29 UTC 2017


 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |   10 ++
 sc/inc/document.hxx                                               |    1 
 sc/inc/globstr.hrc                                                |    2 
 sc/inc/sc.hrc                                                     |    2 
 sc/sdi/cellsh.sdi                                                 |    2 
 sc/sdi/scalc.sdi                                                  |   35 ++++++++++
 sc/source/core/data/document.cxx                                  |    9 ++
 sc/source/ui/src/globstr.src                                      |    8 ++
 sc/source/ui/view/cellsh.cxx                                      |   27 +++++++
 sc/source/ui/view/cellsh1.cxx                                     |   33 +++++++++
 sc/source/ui/view/tabview3.cxx                                    |    2 
 sc/uiconfig/scalc/menubar/menubar.xml                             |    2 
 12 files changed, 133 insertions(+)

New commits:
commit ec25d34fa3ac900950ff24fcb224f7e827352803
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date:   Thu Mar 9 21:41:17 2017 +0300

    tdf#84837 Add Show/Hide all comments commands to Calc.
    
    Change-Id: I1e38335ff1269d0d464f03d23bfc5eba6e3b1532
    Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/35020
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 6c168337d199..80cedf097f18 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -951,6 +951,16 @@
           <value xml:lang="en-US">Hide Comment</value>
         </prop>
       </node>
+      <node oor:name=".uno:ShowAllNotes" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Show All Comments</value>
+        </prop>
+      </node>
+      <node oor:name=".uno:HideAllNotes" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Hide All Comments</value>
+        </prop>
+      </node>
       <node oor:name=".uno:InsertAnnotation" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Comm~ent</value>
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index bb28fb5a0fd0..2751c6ab79ce 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1104,6 +1104,7 @@ public:
     SCROW     GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
 
     SC_DLLPUBLIC void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
+    SC_DLLPUBLIC void GetAllNoteEntries( SCTAB nTab, std::vector<sc::NoteEntry>& rNotes ) const;
     void              GetNotesInRange( const ScRangeList& rRange, std::vector<sc::NoteEntry>& rNotes ) const;
     bool              ContainsNotesInRange( const ScRangeList& rRange ) const;
 
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 6696945b7b23..eadfc9f5737c 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -232,6 +232,8 @@
 #define STR_UNDO_SHOWNOTE           176
 #define STR_UNDO_HIDENOTE           177
 #define STR_UNDO_DRAGDROP           178
+#define STR_UNDO_SHOWALLNOTES       179
+#define STR_UNDO_HIDEALLNOTES       180
 
 #define STR_IMPORT_LOTUS            182
 #define STR_IMPORT_DBF              183
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 1fed6947dc9e..b6f24ae319c0 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -643,6 +643,8 @@
 
 #define FID_SHOW_NOTE           (SID_NEW_SLOTS+100)
 #define FID_HIDE_NOTE           (SID_NEW_SLOTS+101)
+#define FID_SHOW_ALL_NOTES      (SID_NEW_SLOTS+102)
+#define FID_HIDE_ALL_NOTES      (SID_NEW_SLOTS+103)
 
 // idl parameter
 
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 1daea78cf6c4..0ec5226d746b 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -210,6 +210,8 @@ interface CellSelection
     FID_NOTE_VISIBLE        [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
     FID_HIDE_NOTE           [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
     FID_SHOW_NOTE           [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
+    FID_HIDE_ALL_NOTES      [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
+    FID_SHOW_ALL_NOTES      [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
     SID_DELETE_NOTE         [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
     SID_DEC_INDENT          [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
     SID_INC_INDENT          [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index e95b7474b3c7..e57338fdd315 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -3616,6 +3616,41 @@ SfxBoolItem HideNote FID_HIDE_NOTE
     GroupId = GID_VIEW;
 ]
 
+SfxVoidItem ShowAllNotes FID_SHOW_ALL_NOTES
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_VIEW;
+]
+
+SfxVoidItem HideAllNotes FID_HIDE_ALL_NOTES
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_VIEW;
+]
 
 SfxVoidItem DeleteNote SID_DELETE_NOTE
 (SvxPostItIdItem Id SID_ATTR_POSTIT_ID)
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 );
 
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index bbac5a0a1d69..e2405cc8a3c4 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -544,6 +544,8 @@
                     <menu:menuitem menu:id=".uno:EditAnnotation"/>
                     <menu:menuitem menu:id=".uno:HideNote"/>
                     <menu:menuitem menu:id=".uno:ShowNote"/>
+                    <menu:menuitem menu:id=".uno:HideAllNotes"/>
+                    <menu:menuitem menu:id=".uno:ShowAllNotes"/>
                     <menu:menuitem menu:id=".uno:DeleteNote"/>
                 </menu:menupopup>
             </menu:menu>


More information about the Libreoffice-commits mailing list