[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/svx svx/source sw/inc sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 11 09:29:56 UTC 2019


 include/svx/ctredlin.hxx           |   19 ++++++++++++++++++-
 svx/source/dialog/ctredlin.cxx     |   23 ++++++++++++++++++++---
 sw/inc/IDocumentRedlineAccess.hxx  |   16 +---------------
 sw/source/uibase/misc/redlndlg.cxx |    2 ++
 4 files changed, 41 insertions(+), 19 deletions(-)

New commits:
commit 2f6fb28ded84878c5a19453f5076309505e30f0a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 10 10:40:22 2019 +0000
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Dec 11 10:29:12 2019 +0100

    Resolves: tdf#129250 move redline type into RedlinData so we can sort on it
    
    Change-Id: Ia8e6744c1679655240a9a9cee9425030e994e16b
    Reviewed-on: https://gerrit.libreoffice.org/84808
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
index 238207c72723..cc63771d2af6 100644
--- a/include/svx/ctredlin.hxx
+++ b/include/svx/ctredlin.hxx
@@ -48,15 +48,32 @@ enum class SvxRedlinDateMode
     BEFORE, SINCE, EQUAL, NOTEQUAL, BETWEEN, SAVE, NONE
 };
 
+enum class RedlineType : sal_uInt16
+{
+    // Range of RedlineTypes is 0 to 127.
+    Insert = 0x0,// Content has been inserted.
+    Delete = 0x1,// Content has been deleted.
+    Format = 0x2,// Attributes have been applied.
+    Table = 0x3,// Table structure has been altered.
+    FmtColl = 0x4,// Style has been altered (Autoformat!).
+    ParagraphFormat = 0x5,// Paragraph attributes have been changed.
+    TableRowInsert = 0x6,// Table row has been inserted.
+    TableRowDelete = 0x7,// Table row has been deleted.
+    TableCellInsert = 0x8,// Table cell has been inserted.
+    TableCellDelete = 0x9,// Table cell has been deleted.
+    Any = USHRT_MAX // special value to indicate any redline type in some method calls
+};
+
 /// Struct for sorting data.
 class SAL_WARN_UNUSED SVX_DLLPUBLIC RedlinData
 {
 public:
                     RedlinData();
     virtual         ~RedlinData();
-    bool            bDisabled;
     DateTime        aDateTime;
     void*           pData;
+    RedlineType     eType;
+    bool            bDisabled;
 };
 
 /// Class for the representation of Strings depending on the font.
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index e4e8eeb654df..f2d119b0005c 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -37,10 +37,12 @@
 #define WRITER_DATE     2
 #define CALC_DATE       3
 
-RedlinData::RedlinData() : aDateTime(DateTime::EMPTY)
+RedlinData::RedlinData()
+    : aDateTime(DateTime::EMPTY)
+    , pData(nullptr)
+    , eType(RedlineType::Any)
+    , bDisabled(false)
 {
-    bDisabled=false;
-    pData=nullptr;
 }
 
 RedlinData::~RedlinData()
@@ -155,6 +157,21 @@ int SvxRedlinTable::ColCompare(const weld::TreeIter& rLeft, const weld::TreeIter
 
     int nSortCol = pTreeView->get_sort_column();
 
+    if (pTreeView == xWriterTreeView.get() && nSortCol == 0)
+    {
+        RedlinData *pLeftData = reinterpret_cast<RedlinData*>(pTreeView->get_id(rLeft).toInt64());
+        RedlinData *pRightData = reinterpret_cast<RedlinData*>(pTreeView->get_id(rRight).toInt64());
+
+        if (pLeftData && pRightData)
+        {
+            if (pLeftData->eType < pRightData->eType)
+                nCompare = -1;
+            else if (pLeftData->eType > pRightData->eType)
+                nCompare = 1;
+            return nCompare;
+        }
+    }
+
     if (nSortCol == nDatePos)
     {
         RedlinData *pLeftData = reinterpret_cast<RedlinData*>(pTreeView->get_id(rLeft).toInt64());
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx
index 20c6d5b97210..f446184d37ce 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -28,6 +28,7 @@
 
 #include <com/sun/star/uno/Sequence.h>
 #include <o3tl/typed_flags_set.hxx>
+#include <svx/ctredlin.hxx>
 
 #include "docary.hxx"
 
@@ -60,21 +61,6 @@ namespace o3tl
     template<> struct typed_flags<RedlineFlags> : is_typed_flags<RedlineFlags, 0x533> {};
 }
 
-enum class RedlineType : sal_uInt16
-{
-    // Range of RedlineTypes is 0 to 127.
-    Insert = 0x0,// Content has been inserted.
-    Delete = 0x1,// Content has been deleted.
-    Format = 0x2,// Attributes have been applied.
-    Table = 0x3,// Table structure has been altered.
-    FmtColl = 0x4,// Style has been altered (Autoformat!).
-    ParagraphFormat = 0x5,// Paragraph attributes have been changed.
-    TableRowInsert = 0x6,// Table row has been inserted.
-    TableRowDelete = 0x7,// Table row has been deleted.
-    TableCellInsert = 0x8,// Table cell has been inserted.
-    TableCellDelete = 0x9,// Table cell has been deleted.
-    Any = USHRT_MAX // special value to indicate any redline type in some method calls
-};
 inline OUString SwRedlineTypeToOUString(RedlineType eType)
 {
     OUString sRet;
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 9d2db971da19..0dcf42280092 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -573,6 +573,7 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa
             OUString sImage(GetActionImage(rRedln, nStack));
             OUString sAuthor = rRedln.GetAuthorString(nStack);
             pData->aDateTime = rRedln.GetTimeStamp(nStack);
+            pData->eType = rRedln.GetType(nStack);
             OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
             OUString sComment = rRedln.GetComment(nStack);
 
@@ -735,6 +736,7 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli
         OUString sImage = GetActionImage(rRedln);
         OUString sAuthor = rRedln.GetAuthorString(0);
         pData->aDateTime = rRedln.GetTimeStamp(0);
+        pData->eType = rRedln.GetType(0);
         OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
 
         OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pData.release()));


More information about the Libreoffice-commits mailing list