Resolves: tdf#129250 move redline type into RedlinData so we can sort on it
Change-Id: Ia8e6744c1679655240a9a9cee9425030e994e16b
Reviewed-on: https://gerrit.libreoffice.org/84805
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
index 884ce5a..91c95fa 100644
--- a/include/svx/ctredlin.hxx
+++ b/include/svx/ctredlin.hxx
@@ -46,15 +46,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 SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRedlinTable
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index a045af3..f5defbb 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -35,10 +35,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()
@@ -128,6 +130,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 7f9eeee..395fae8 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 431441c..1fc7a35 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()));