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

Pranam Lashkari (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 23 12:45:50 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 b4ca42983f6d1d474c8703264428a8c462b8d1b9
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Tue Sep 15 10:07:27 2020 +0530
Commit:     Pranam Lashkari <lpranam at collabora.com>
CommitDate: Wed Sep 23 14:45:12 2020 +0200

    Added new command to delete the comment thread
    
    Change-Id: I16d46787a6972afb0c3ab2e56482888082af1d27
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102894
    Tested-by: Jenkins
    Reviewed-by: Pranam Lashkari <lpranam 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 41b746b81fcd..1d807a9d9673 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6402,6 +6402,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 c2cc2298fcd3..a11ec583792f 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -192,6 +192,7 @@ class SAL_DLLPUBLIC_RTTI 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 9108fac28c01..6b3d1161cda3 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -200,6 +200,7 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : 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 ac6c43be767e..fd199598c949 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -753,6 +753,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 9a78988dee2a..66242a1f52ca 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 67fc2776e5d0..e0bcfff65360 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -959,6 +959,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 843cba4530b9..3d29704f8f1b 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7278,6 +7278,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 f80551430d23..9ee6ac0ec805 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
@@ -82,6 +82,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")
@@ -101,6 +103,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 );
@@ -112,6 +115,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 2ed76eb300dd..5bd82dab6bc6 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -277,6 +277,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 613f0bf880f0..ef1248ae1bde 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1258,6 +1258,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 6df734b2ec2d..7d78333a91c2 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1551,6 +1551,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 7115c3b4e5ca..f2cc6592df86 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1087,6 +1087,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() )
@@ -1139,6 +1140,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 b214a11a2eba..c3169a40ede0 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -325,8 +325,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 34c028540c3e..8ff298b603d5 100644
--- a/sw/uiconfig/sglobal/menubar/menubar.xml
+++ b/sw/uiconfig/sglobal/menubar/menubar.xml
@@ -147,6 +147,7 @@
           <menu:menuitem menu:id=".uno:ResolveComment" menu:style="text"/>
           <menu:menuitem menu:id=".uno:ResolveCommentThread" menu:style="text"/>
           <menu:menuitem menu:id=".uno:DeleteComment" menu:style="text"/>
+          <menu:menuitem menu:id=".uno:DeleteCommentThread" menu:style="text"/>
           <menu:menuitem menu:id=".uno:DeleteAuthor" menu:style="text"/>
           <menu:menuitem menu:id=".uno:DeleteAllNotes" menu:style="text"/>
         </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 4ecdabc774dd..e4b4cc375c0c 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -152,6 +152,7 @@
           <menu:menuitem menu:id=".uno:ResolveComment" menu:style="text"/>
           <menu:menuitem menu:id=".uno:ResolveCommentThread" menu:style="text"/>
           <menu:menuitem menu:id=".uno:DeleteComment" menu:style="text"/>
+          <menu:menuitem menu:id=".uno:DeleteCommentThread" menu:style="text"/>
           <menu:menuitem menu:id=".uno:DeleteAuthor" menu:style="text"/>
           <menu:menuitem menu:id=".uno:DeleteAllNotes" menu:style="text"/>
         </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 7a049a001e27..80179f254fce 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