include/svx/ctredlin.hxx               |   17 ++++++-
 sc/source/ui/miscdlgs/conflictsdlg.cxx |    3 -
 solenv/sanitizers/ui/svx.suppr         |    1 
 svx/source/dialog/ctredlin.cxx         |   22 ++++++++-
 svx/uiconfig/ui/redlineviewpage.ui     |   75 ++++++++++++++++++++++++++-------
 sw/source/uibase/inc/redlndlg.hxx      |    2 
 sw/source/uibase/misc/redlndlg.cxx     |   22 +++++++++
 7 files changed, 123 insertions(+), 19 deletions(-)

New commits:
commit 2c46d3c2ff6bbdcd387771f823aa5b3b812c80a8
Author:     Jim Raykowski <[email protected]>
AuthorDate: Thu Jul 11 17:06:50 2024 -0800
Commit:     Jim Raykowski <[email protected]>
CommitDate: Sun Jul 14 05:31:46 2024 +0200

    tdf#161811 Changes in TC manager dialog should be in order of
    
    appearance in document
    
    Adds a drop down control to the Writer Manage Changes dialog/sidebar
    panel that can be used to select how the changes list is sorted.
    
    Change-Id: I9602322ec61ae6e15a08fbc26aa69de1b64294e5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170390
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <[email protected]>

diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
index f852a4886bd7..c098efa6a11b 100644
--- a/include/svx/ctredlin.hxx
+++ b/include/svx/ctredlin.hxx
@@ -83,6 +83,8 @@ private:
     std::unique_ptr<weld::TreeView> xCalcTreeView;
     weld::TreeView* pTreeView;
 
+    weld::ComboBox* m_pSortByComboBox;
+
     sal_uInt16      nDatePos;
     bool            bAuthor;
     bool            bDate;
@@ -100,7 +102,8 @@ private:
 
 public:
     SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
-                   std::unique_ptr<weld::TreeView> xCalcControl);
+                   std::unique_ptr<weld::TreeView> xCalcControl,
+                   weld::ComboBox* pSortByControl);
 
     weld::TreeView& GetWidget() { return *pTreeView; }
     bool IsSorted() const { return bSorted; }
@@ -256,13 +259,14 @@ public:
 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPView final : public SvxTPage
 {
 private:
-
     Link<SvxTPView*,void>          AcceptClickLk;
     Link<SvxTPView*,void>          AcceptAllClickLk;
     Link<SvxTPView*,void>          RejectClickLk;
     Link<SvxTPView*,void>          RejectAllClickLk;
     Link<SvxTPView*,void>          UndoClickLk;
 
+    Link<SvxTPView*,void> SortByComboBoxChangedLk;
+
     bool bEnableAccept;
     bool bEnableAcceptAll;
     bool bEnableReject;
@@ -277,9 +281,11 @@ private:
     std::unique_ptr<weld::Button> m_xAcceptAll;
     std::unique_ptr<weld::Button> m_xRejectAll;
     std::unique_ptr<weld::Button> m_xUndo;
+    std::unique_ptr<weld::ComboBox> m_xSortByComboBox;
     std::unique_ptr<SvxRedlinTable> m_xViewData;
 
     DECL_DLLPRIVATE_LINK( PbClickHdl, weld::Button&, void );
+    DECL_DLLPRIVATE_LINK(SortByComboBoxChangedHdl, weld::ComboBox&, void);
 
 public:
     SvxTPView(weld::Container* pParent);
@@ -287,6 +293,8 @@ public:
 
     SvxRedlinTable* GetTableControl() { return m_xViewData.get(); }
 
+    weld::ComboBox* GetSortByComboBoxControl() { return 
m_xSortByComboBox.get(); }
+
     void            EnableAccept(bool bFlag);
     void            EnableAcceptAll(bool bFlag);
     void            EnableReject(bool bFlag);
@@ -307,6 +315,11 @@ public:
 
     void            SetUndoClickHdl( const Link<SvxTPView*,void>& rLink ) { 
UndoClickLk = rLink; }
 
+    void SetSortByComboBoxChangedHdl(const Link<SvxTPView*, void>& rLink)
+    {
+        SortByComboBoxChangedLk = rLink;
+    }
+
     virtual void    ActivatePage() override;
     void            DeactivatePage();
 };
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx 
b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index a70cff4641b0..6e20e04e0414 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -334,7 +334,8 @@ ScConflictsDlg::ScConflictsDlg(weld::Window* pParent, 
ScViewData* pViewData, ScD
     , m_xBtnKeepOther(m_xBuilder->weld_button(u"keepother"_ustr))
     , m_xBtnKeepAllMine(m_xBuilder->weld_button(u"keepallmine"_ustr))
     , m_xBtnKeepAllOthers(m_xBuilder->weld_button(u"keepallothers"_ustr))
-    , m_xLbConflicts(new 
SvxRedlinTable(m_xBuilder->weld_tree_view(u"container"_ustr), nullptr))
+    , m_xLbConflicts(new 
SvxRedlinTable(m_xBuilder->weld_tree_view(u"container"_ustr), nullptr,
+                                        nullptr))
 {
     OSL_ENSURE( mpViewData, "ScConflictsDlg CTOR: mpViewData is null!" );
     mpOwnDoc = ( mpViewData ? &mpViewData->GetDocument() : nullptr );
diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr
index 0c952e5dc460..5f2d0d8a8bc6 100644
--- a/solenv/sanitizers/ui/svx.suppr
+++ b/solenv/sanitizers/ui/svx.suppr
@@ -72,6 +72,7 @@ 
svx/uiconfig/ui/redlinefilterpage.ui://GtkComboBoxText[@id='authorlist'] missing
 svx/uiconfig/ui/redlinefilterpage.ui://GtkEntry[@id='rangeedit'] 
missing-label-for
 svx/uiconfig/ui/redlinefilterpage.ui://GtkComboBoxText[@id='datecond'] 
missing-label-for
 svx/uiconfig/ui/redlinefilterpage.ui://GtkLabel[@id='and'] orphan-label
+svx/uiconfig/ui/redlineviewpage.ui://GtkLabel[@id='sortbylabel'] orphan-label
 svx/uiconfig/ui/safemodedialog.ui://GtkLabel[@id='label1'] orphan-label
 svx/uiconfig/ui/safemodedialog.ui://GtkLabel[@id='label3'] orphan-label
 svx/uiconfig/ui/safemodedialog.ui://GtkLabel[@id='label4'] orphan-label
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 49091e01578a..1657bdd53c04 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -47,12 +47,14 @@ RedlinData::~RedlinData()
 }
 
 SvxRedlinTable::SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
-                               std::unique_ptr<weld::TreeView> xCalcControl)
+                               std::unique_ptr<weld::TreeView> xCalcControl,
+                               weld::ComboBox* pSortByControl)
     : xSorter(new 
comphelper::string::NaturalStringSorter(::comphelper::getProcessComponentContext(),
         Application::GetSettings().GetUILanguageTag().getLocale()))
     , xWriterTreeView(std::move(xWriterControl))
     , xCalcTreeView(std::move(xCalcControl))
     , pTreeView(nullptr)
+    , m_pSortByComboBox(pSortByControl)
     , nDatePos(WRITER_DATE)
     , bAuthor(false)
     , bDate(false)
@@ -121,6 +123,8 @@ IMPL_LINK(SvxRedlinTable, HeaderBarClick, int, nColumn, 
void)
     {
         //sort lists
         pTreeView->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : 
TRISTATE_FALSE, nColumn);
+        if (m_pSortByComboBox)
+            m_pSortByComboBox->set_active(nColumn);
     }
 }
 
@@ -311,9 +315,13 @@ SvxTPView::SvxTPView(weld::Container* pParent)
     , m_xAcceptAll(m_xBuilder->weld_button(u"acceptall"_ustr))
     , m_xRejectAll(m_xBuilder->weld_button(u"rejectall"_ustr))
     , m_xUndo(m_xBuilder->weld_button(u"undo"_ustr))
+    , m_xSortByComboBox(m_xBuilder->weld_combo_box(u"sortbycombobox"_ustr))
     , m_xViewData(new 
SvxRedlinTable(m_xBuilder->weld_tree_view(u"writerchanges"_ustr),
-                                     
m_xBuilder->weld_tree_view(u"calcchanges"_ustr)))
+                                     
m_xBuilder->weld_tree_view(u"calcchanges"_ustr),
+                                     m_xSortByComboBox.get()))
 {
+    m_xSortByComboBox->connect_changed(LINK(this, SvxTPView, 
SortByComboBoxChangedHdl));
+
     Link<weld::Button&,void> aLink=LINK( this, SvxTPView, PbClickHdl);
 
     m_xAccept->connect_clicked(aLink);
@@ -351,6 +359,8 @@ void SvxRedlinTable::SetWriterView()
     if (xCalcTreeView)
         xCalcTreeView->hide();
     xWriterTreeView->show();
+    if (m_pSortByComboBox)
+        m_pSortByComboBox->weld_parent()->show();
     pTreeView = xWriterTreeView.get();
 
     auto nDigitWidth = pTreeView->get_approximate_digit_width();
@@ -368,6 +378,8 @@ void SvxRedlinTable::SetCalcView()
     nDatePos = CALC_DATE;
     if (xWriterTreeView)
         xWriterTreeView->hide();
+    if (m_pSortByComboBox)
+        m_pSortByComboBox->weld_parent()->hide();
     xCalcTreeView->show();
     pTreeView = xCalcTreeView.get();
 
@@ -431,6 +443,12 @@ void SvxTPView::EnableUndo(bool bFlag)
     m_xUndo->set_sensitive(bFlag);
 }
 
+IMPL_LINK_NOARG(SvxTPView, SortByComboBoxChangedHdl, weld::ComboBox&, void)
+{
+    if (SortByComboBoxChangedLk.IsSet())
+        SortByComboBoxChangedLk.Call(this);
+}
+
 IMPL_LINK( SvxTPView, PbClickHdl, weld::Button&, rPushB, void)
 {
     if (&rPushB == m_xAccept.get())
diff --git a/svx/uiconfig/ui/redlineviewpage.ui 
b/svx/uiconfig/ui/redlineviewpage.ui
index ee49056c02c8..ddf87a9d4185 100644
--- a/svx/uiconfig/ui/redlineviewpage.ui
+++ b/svx/uiconfig/ui/redlineviewpage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="svx">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkTreeStore" id="liststore1">
@@ -46,6 +46,53 @@
     <property name="border-width">6</property>
     <property name="orientation">vertical</property>
     <property name="spacing">12</property>
+    <child>
+      <object class="GtkBox">
+        <property name="can-focus">False</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkLabel" id="sortbylabel">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="label" translatable="yes" 
context="redlineviewpage|sortbylabel">Sort by:</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkComboBoxText" id="sortbycombobox">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="active">4</property>
+            <items>
+              <item id="action" translatable="yes" 
context="redlineviewpage|sortbycombobox">Action</item>
+              <item id="author" translatable="yes" 
context="redlineviewpage|sortbycombobox">Author</item>
+              <item id="date" translatable="yes" 
context="redlineviewpage|sortbycombobox">Date</item>
+              <item id="comment" translatable="yes" 
context="redlineviewpage|sortbycombox">Comment</item>
+              <item id="documentposition" translatable="yes" 
context="redlineviewpage|sortbycombobox">Document Position</item>
+            </items>
+            <child internal-child="accessible">
+              <object class="AtkObject" id="sortbycombobox-atkobject">
+                <property name="AtkObject::accessible-description" 
translatable="yes" context="redlineviewpage|extended_tip|SortByComboBox">How to 
sort the changes list.</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
     <child>
       <object class="GtkScrolledWindow">
         <property name="can-focus">True</property>
@@ -128,18 +175,18 @@
                 </child>
               </object>
             </child>
-          </object>
-        </child>
-        <child internal-child="accessible">
-          <object class="AtkObject">
-            <property name="AtkObject::accessible-name" translatable="yes" 
context="redlineviewpage|writerchanges-atkobject">Changes</property>
+            <child internal-child="accessible">
+              <object class="AtkObject" id="writerchanges-atkobject">
+                <property name="AtkObject::accessible-name" translatable="yes" 
context="redlineviewpage|writerchanges-atkobject">Changes</property>
+              </object>
+            </child>
           </object>
         </child>
       </object>
       <packing>
         <property name="expand">True</property>
         <property name="fill">True</property>
-        <property name="position">0</property>
+        <property name="position">1</property>
       </packing>
     </child>
     <child>
@@ -234,18 +281,18 @@
                 </child>
               </object>
             </child>
-          </object>
-        </child>
-        <child internal-child="accessible">
-          <object class="AtkObject">
-            <property name="AtkObject::accessible-name" translatable="yes" 
context="redlineviewpage|calcchanges-atkobject">Changes</property>
+            <child internal-child="accessible">
+              <object class="AtkObject" id="calcchanges-atkobject">
+                <property name="AtkObject::accessible-name" translatable="yes" 
context="redlineviewpage|calcchanges-atkobject">Changes</property>
+              </object>
+            </child>
           </object>
         </child>
       </object>
       <packing>
         <property name="expand">True</property>
         <property name="fill">True</property>
-        <property name="position">1</property>
+        <property name="position">2</property>
       </packing>
     </child>
     <child>
@@ -354,7 +401,7 @@
       <packing>
         <property name="expand">False</property>
         <property name="fill">True</property>
-        <property name="position">2</property>
+        <property name="position">3</property>
       </packing>
     </child>
     <child internal-child="accessible">
diff --git a/sw/source/uibase/inc/redlndlg.hxx 
b/sw/source/uibase/inc/redlndlg.hxx
index b0c53e00f350..ef8c0cd8dce3 100644
--- a/sw/source/uibase/inc/redlndlg.hxx
+++ b/sw/source/uibase/inc/redlndlg.hxx
@@ -85,6 +85,8 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg final : public 
SfxListener
     SvxTPView* m_pTPView;
     SvxRedlinTable* m_pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
 
+    DECL_DLLPRIVATE_LINK(SortByComboBoxChangedHdl, SvxTPView*, void);
+
     DECL_DLLPRIVATE_LINK( AcceptHdl,     SvxTPView*, void );
     DECL_DLLPRIVATE_LINK( AcceptAllHdl,  SvxTPView*, void );
     DECL_DLLPRIVATE_LINK( RejectHdl,     SvxTPView*, void );
diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index 5efd064889ab..26b40b917e50 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -167,6 +167,11 @@ 
SwRedlineAcceptDlg::SwRedlineAcceptDlg(std::shared_ptr<weld::Window> xParent, we
     m_pTable = m_pTPView->GetTableControl();
     m_pTable->SetWriterView();
 
+    m_pTPView->GetSortByComboBoxControl()->set_active(4);
+
+    m_pTPView->SetSortByComboBoxChangedHdl(
+        LINK(this, SwRedlineAcceptDlg, SortByComboBoxChangedHdl));
+
     m_pTPView->SetAcceptClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptHdl));
     m_pTPView->SetAcceptAllClickHdl(LINK(this, SwRedlineAcceptDlg, 
AcceptAllHdl));
     m_pTPView->SetRejectClickHdl(LINK(this, SwRedlineAcceptDlg, RejectHdl));
@@ -1174,6 +1179,20 @@ SwRedlineTable::size_type 
SwRedlineAcceptDlg::GetRedlinePos(const weld::TreeIter
                                     rTreeView.get_id(rEntry))->pData)->pData );
 }
 
+IMPL_LINK_NOARG(SwRedlineAcceptDlg, SortByComboBoxChangedHdl, SvxTPView*, void)
+{
+    SwView* pView = GetActiveView();
+    if (!pView)
+        return;
+    SwWait aWait(*pView->GetDocShell(), false);
+    auto nSortMode = m_pTPView->GetSortByComboBoxControl()->get_active();
+    if (nSortMode == 4)
+        nSortMode = -1;
+    m_pTable->HeaderBarClick(nSortMode);
+    if (nSortMode == -1)
+        Init();
+}
+
 IMPL_LINK_NOARG(SwRedlineAcceptDlg, AcceptHdl, SvxTPView*, void)
 {
     CallAcceptReject( true, true );
@@ -1455,6 +1474,9 @@ IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const 
CommandEvent&, rCEvt, bool)
 
         if (nSortMode == 4 && nColumn == 4)
             return true;  // we already have it
+
+        m_pTPView->GetSortByComboBoxControl()->set_active(nSortMode);
+
         if (nSortMode == 4)
             nSortMode = -1; // unsorted / sorted by position
 

Reply via email to