[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - officecfg/registry sw/inc sw/sdi sw/source sw/uiconfig

Pranam Lashkari (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 15 20:05:37 UTC 2020


 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |    8 +++
 sw/inc/AnnotationWin.hxx                                             |    1 
 sw/inc/PostItMgr.hxx                                                 |    1 
 sw/inc/cmdid.h                                                       |    1 
 sw/sdi/_annotsh.sdi                                                  |    6 ++
 sw/sdi/_textsh.sdi                                                   |    5 ++
 sw/sdi/swriter.sdi                                                   |   17 +++++++
 sw/source/uibase/docvw/AnnotationMenuButton.cxx                      |    4 +
 sw/source/uibase/docvw/AnnotationWin.cxx                             |   16 ++++++
 sw/source/uibase/docvw/AnnotationWin2.cxx                            |    3 +
 sw/source/uibase/docvw/PostItMgr.cxx                                 |   24 ++++++++++
 sw/source/uibase/shells/annotsh.cxx                                  |    2 
 sw/source/uibase/shells/textfld.cxx                                  |   16 ++++++
 sw/uiconfig/sglobal/menubar/menubar.xml                              |    1 
 sw/uiconfig/sglobal/popupmenu/annotation.xml                         |    1 
 sw/uiconfig/swriter/menubar/menubar.xml                              |    1 
 sw/uiconfig/swriter/popupmenu/annotation.xml                         |    1 
 sw/uiconfig/swriter/ui/annotationmenu.ui                             |    8 +++
 sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui                |    7 ++
 19 files changed, 122 insertions(+), 1 deletion(-)

New commits:
commit 3f43df0d6d18cc22991677c0855a9f4f2ab3246f
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Tue Sep 15 10:07:27 2020 +0530
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Sep 15 22:05:02 2020 +0200

    Added new command to delete the comment thread
    
    Change-Id: I16d46787a6972afb0c3ab2e56482888082af1d27
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102780
    Tested-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index e08845edb265..a9c962b136e1 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6285,6 +6285,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:DeleteCommentThread" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Delete Comment Thread</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:ResolveComment" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Resolved</value>
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 5c0fb100b9c3..a785e72908f2 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -194,6 +194,7 @@ class SwAnnotationWin : public vcl::Window
         void SetResolved(bool resolved);
         void ToggleResolved();
         void ToggleResolvedForThread();
+        void DeleteThread();
         bool IsResolved() const;
         bool IsThreadResolved();
 
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index c660abef9385..56f107faacbc 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -204,6 +204,7 @@ class SwPostItMgr: public SfxListener
         void Delete(const OUString& aAuthor);
         void Delete(sal_uInt32 nPostItId);
         void Delete();
+        void DeleteCommentThread(sal_uInt32 nPostItId);
         void ToggleResolved(sal_uInt32 nPostItId);
         void ToggleResolvedForThread(sal_uInt32 nPostItId);
 
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 2da785572f61..64b84b9ce9a1 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -732,6 +732,7 @@
 #define FN_FORMAT_ALL_NOTES         (FN_NOTES+8)
 #define FN_RESOLVE_NOTE             (FN_NOTES+9)
 #define FN_RESOLVE_NOTE_THREAD      (FN_NOTES+10)
+#define FN_DELETE_COMMENT_THREAD    (FN_NOTES+11)
 
 // Region: Parameter
 #define FN_PARAM_MOVE_COUNT         (FN_PARAM+2)
diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi
index fa1772a4c46e..6397720e63e5 100644
--- a/sw/sdi/_annotsh.sdi
+++ b/sw/sdi/_annotsh.sdi
@@ -24,6 +24,12 @@ interface _Annotation
         StateMethod = GetNoteState ;
     ]
 
+    FN_DELETE_COMMENT_THREAD
+    [
+        ExecMethod = NoteExec ;
+        StateMethod = GetNoteState ;
+    ]
+
     FN_DELETE_NOTE_AUTHOR
     [
         ExecMethod = NoteExec ;
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 864fac076efc..ad353ad5e099 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -946,6 +946,11 @@ interface BaseText
         ExecMethod = ExecField ;
         StateMethod = StateField;
     ]
+    FN_DELETE_COMMENT_THREAD
+    [
+        ExecMethod = ExecField ;
+        StateMethod = StateField;
+    ]
     FN_RESOLVE_NOTE
     [
         ExecMethod = ExecField ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 15000529d5f7..68fe312b9105 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7069,6 +7069,23 @@ SfxVoidItem DeleteComment FN_DELETE_COMMENT
     GroupId = SfxGroupId::Edit;
 ]
 
+SfxVoidItem DeleteCommentThread FN_DELETE_COMMENT_THREAD
+(SvxPostItIdItem Id SID_ATTR_POSTIT_ID)
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Edit;
+]
+
 SfxVoidItem ResolveComment FN_RESOLVE_NOTE
 (SvxPostItIdItem Id SID_ATTR_POSTIT_ID)
 [
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
index e634496bb40b..759414c4727b 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
@@ -76,6 +76,8 @@ void AnnotationMenuButton::Select()
         mrSidebarWin.ExecuteCommand(FN_RESOLVE_NOTE_THREAD);
     else if (sIdent == "delete")
         mrSidebarWin.ExecuteCommand(FN_DELETE_COMMENT);
+    else if (sIdent == "deletethread")
+        mrSidebarWin.ExecuteCommand(FN_DELETE_COMMENT_THREAD);
     else if (sIdent == "deleteby")
         mrSidebarWin.ExecuteCommand(FN_DELETE_NOTE_AUTHOR);
     else if (sIdent == "deleteall")
@@ -95,6 +97,7 @@ void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt )
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolvethread"), false);
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolvethread"), false);
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("delete"), false );
+        pButtonPopup->EnableItem(pButtonPopup->GetItemId("deletethread"), false );
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteby"), false );
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteall"), false );
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("formatall"), false );
@@ -106,6 +109,7 @@ void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt )
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolvethread"), !mrSidebarWin.IsThreadResolved());
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolvethread"), mrSidebarWin.IsThreadResolved());
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("delete"), !mrSidebarWin.IsProtected());
+        pButtonPopup->EnableItem(pButtonPopup->GetItemId("deletethread"));
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteby"));
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteall"));
         pButtonPopup->EnableItem(pButtonPopup->GetItemId("formatall"));
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 2701a46cca2e..fdadd1f01e44 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -250,6 +250,22 @@ void SwAnnotationWin::ToggleResolvedForThread()
     mrMgr.LayoutPostIts();
 }
 
+void SwAnnotationWin::DeleteThread()
+{
+    // Go to the top and delete each comment one by one
+    SwAnnotationWin *current, *topNote;
+    current = topNote = GetTopReplyNote();
+    SwAnnotationWin* next = mrMgr.GetNextPostIt(KEY_PAGEDOWN, current);
+
+    while(next && next->GetTopReplyNote() == topNote)
+    {
+        current->mnEventId = Application::PostUserEvent( LINK( current, SwAnnotationWin, DeleteHdl), nullptr, true );
+        current = next;
+        next = mrMgr.GetNextPostIt(KEY_PAGEDOWN, current);
+    }
+    current->mnEventId = Application::PostUserEvent( LINK( current, SwAnnotationWin, DeleteHdl), nullptr, true );
+}
+
 bool SwAnnotationWin::IsResolved() const
 {
     return static_cast<SwPostItField*>(mpFormatField->GetField())->GetResolved();
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 52af97f096a8..bf49c851a961 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1261,6 +1261,9 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
             //Delete(); // do not kill the parent of our open popup menu
             mnEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
             break;
+        case FN_DELETE_COMMENT_THREAD:
+            DeleteThread();
+            break;
         case FN_RESOLVE_NOTE:
             ToggleResolved();
             DoResize();
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 22a62e07cc54..039e6f05b8e1 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1583,6 +1583,30 @@ void SwPostItMgr::Delete(sal_uInt32 nPostItId)
     LayoutPostIts();
 }
 
+void SwPostItMgr::DeleteCommentThread(sal_uInt32 nPostItId)
+{
+    mpWrtShell->StartAllAction();
+
+    SwRewriter aRewriter;
+    aRewriter.AddRule(UndoArg1, SwResId(STR_CONTENT_TYPE_SINGLE_POSTIT));
+
+    // We have no undo ID at the moment.
+
+    IsPostitFieldWithPostitId aFilter(nPostItId);
+    FieldDocWatchingStack aStack(mvPostItFields, *mpView->GetDocShell(), aFilter);
+    const SwFormatField* pField = aStack.pop();
+    // pField now contains our AnnotationWin object
+    if (pField) {
+        SwAnnotationWin* pWin = GetSidebarWin(pField);
+        pWin->DeleteThread();
+    }
+    PrepareView();
+    mpWrtShell->EndAllAction();
+    mbLayout = true;
+    CalcRects();
+    LayoutPostIts();
+}
+
 void SwPostItMgr::ToggleResolved(sal_uInt32 nPostItId)
 {
     mpWrtShell->StartAllAction();
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index f112affe5c69..949a036d27e0 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1108,6 +1108,7 @@ void SwAnnotationShell::NoteExec(SfxRequest const &rReq)
         case FN_REPLY:
         case FN_POSTIT:
         case FN_DELETE_COMMENT:
+        case FN_DELETE_COMMENT_THREAD:
         case FN_RESOLVE_NOTE:
         case FN_RESOLVE_NOTE_THREAD:
             if ( pPostItMgr->HasActiveSidebarWin() )
@@ -1160,6 +1161,7 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
         case FN_HIDE_NOTE:
         case FN_HIDE_ALL_NOTES:
         case FN_DELETE_COMMENT:
+        case FN_DELETE_COMMENT_THREAD:
             {
                 if( !pPostItMgr
                     || !pPostItMgr->HasActiveAnnotationWin() )
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 5331ac1a5331..35a55766ddab 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -340,8 +340,22 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                 {
                     GetView().GetPostItMgr()->DeleteActiveSidebarWin();
                 }
+                break;
+            }
+            case FN_DELETE_COMMENT_THREAD:
+            {
+                const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
+                if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
+                {
+                    GetView().GetPostItMgr()->DeleteCommentThread(pIdItem->GetValue().toUInt32());
+                }
+                else if ( GetView().GetPostItMgr() &&
+                          GetView().GetPostItMgr()->HasActiveSidebarWin() )
+                {
+                    GetView().GetPostItMgr()->DeleteActiveSidebarWin();
+                }
+                break;
             }
-            break;
             case FN_RESOLVE_NOTE:
             {
                 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml
index 696e9f29b4d3..fd9fae6f2351 100644
--- a/sw/uiconfig/sglobal/menubar/menubar.xml
+++ b/sw/uiconfig/sglobal/menubar/menubar.xml
@@ -150,6 +150,7 @@
           <menu:menuitem menu:id=".uno:ResolveComment"/>
           <menu:menuitem menu:id=".uno:ResolveCommentThread"/>
           <menu:menuitem menu:id=".uno:DeleteComment"/>
+          <menu:menuitem menu:id=".uno:DeleteCommentThread"/>
           <menu:menuitem menu:id=".uno:DeleteAuthor"/>
           <menu:menuitem menu:id=".uno:DeleteAllNotes"/>
         </menu:menupopup>
diff --git a/sw/uiconfig/sglobal/popupmenu/annotation.xml b/sw/uiconfig/sglobal/popupmenu/annotation.xml
index 1805d2d62f7c..42c89cd7c8bc 100644
--- a/sw/uiconfig/sglobal/popupmenu/annotation.xml
+++ b/sw/uiconfig/sglobal/popupmenu/annotation.xml
@@ -23,6 +23,7 @@
   <menu:menuitem menu:id=".uno:ResolveCommentThread"/>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:DeleteComment"/>
+  <menu:menuitem menu:id=".uno:DeleteCommentThread"/>
   <menu:menuitem menu:id=".uno:DeleteAuthor"/>
   <menu:menuitem menu:id=".uno:DeleteAllNotes"/>
   <menu:menuitem menu:id=".uno:FormatAllNotes"/>
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index f16aa7bfd362..c1f6d1f04c2a 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -150,6 +150,7 @@
           <menu:menuitem menu:id=".uno:ResolveComment"/>
           <menu:menuitem menu:id=".uno:ResolveCommentThread"/>
           <menu:menuitem menu:id=".uno:DeleteComment"/>
+          <menu:menuitem menu:id=".uno:DeleteCommentThread"/>
           <menu:menuitem menu:id=".uno:DeleteAuthor"/>
           <menu:menuitem menu:id=".uno:DeleteAllNotes"/>
         </menu:menupopup>
diff --git a/sw/uiconfig/swriter/popupmenu/annotation.xml b/sw/uiconfig/swriter/popupmenu/annotation.xml
index 87a294bc50c0..acdc6551ea97 100644
--- a/sw/uiconfig/swriter/popupmenu/annotation.xml
+++ b/sw/uiconfig/swriter/popupmenu/annotation.xml
@@ -23,6 +23,7 @@
   <menu:menuitem menu:id=".uno:ResolveComment"/>
   <menu:menuitem menu:id=".uno:ResolveCommentThread"/>
   <menu:menuitem menu:id=".uno:DeleteComment"/>
+  <menu:menuitem menu:id=".uno:DeleteCommentThread"/>
   <menu:menuitem menu:id=".uno:DeleteAuthor"/>
   <menu:menuitem menu:id=".uno:DeleteAllNotes"/>
   <menu:menuitem menu:id=".uno:FormatAllNotes"/>
diff --git a/sw/uiconfig/swriter/ui/annotationmenu.ui b/sw/uiconfig/swriter/ui/annotationmenu.ui
index 7e669fc13f4b..b4b719a59398 100644
--- a/sw/uiconfig/swriter/ui/annotationmenu.ui
+++ b/sw/uiconfig/swriter/ui/annotationmenu.ui
@@ -59,6 +59,14 @@
         <property name="use_underline">True</property>
       </object>
     </child>
+    <child>
+      <object class="GtkMenuItem" id="deletethread">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" context="annotationmenu|deletethread">Delete _Comment Thread</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
     <child>
       <object class="GtkMenuItem" id="deleteby">
         <property name="visible">True</property>
diff --git a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui
index 8df69eec8aba..335acb48acad 100644
--- a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui
+++ b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui
@@ -322,6 +322,13 @@
         <property name="action_name">.uno:DeleteComment</property>
       </object>
     </child>
+    <child>
+      <object class="GtkMenuItem" id="MenuComments-DeleteCommentThread">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="action_name">.uno:DeleteCommentThread</property>
+      </object>
+    </child>
     <child>
       <object class="GtkMenuItem" id="MenuComments-ResolveComment">
         <property name="visible">True</property>


More information about the Libreoffice-commits mailing list