tdf#146120 sw: show tracked table changes with different color
In Change Tracking, show deleted table rows in cyan and
inserted rows in pink. In this case, don't show original
table row or cell background.
Follow-up to commit f481c2c8e74bded11fac754e493560391229dbcd
"tdf#144057 sw track changes: hide deleted table rows".
Change-Id: Ib9cc411b62b92bc8a83dda7589f3e798f7e96f41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126482
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index 6ab0fa3..5fcf840 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -499,6 +499,8 @@ constexpr ::Color COL_AUTHOR8_LIGHT ( 0xE2, 0xEA, 0xF1 );
constexpr ::Color COL_AUTHOR9_DARK ( 0xD1, 0x76, 0x00 );
constexpr ::Color COL_AUTHOR9_NORMAL ( 0xFF, 0xE2, 0xB9 );
constexpr ::Color COL_AUTHOR9_LIGHT ( 0xFF, 0xE7, 0xC7 );
constexpr ::Color COL_AUTHOR_TABLE_INS ( 0xE1, 0xF2, 0xFA );
constexpr ::Color COL_AUTHOR_TABLE_DEL ( 0xFC, 0xE6, 0xF4 );
template<typename charT, typename traits>
inline std::basic_ostream<charT, traits>& operator <<(std::basic_ostream<charT, traits>& rStream, const Color& rColor)
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index e4ba92a..652b254 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -359,6 +359,7 @@ class SW_DLLPUBLIC SwTableLine final : public SwClient // Client of FrameFor
{
SwTableBoxes m_aBoxes;
SwTableBox *m_pUpper;
RedlineType m_eRedlineType;
public:
@@ -402,9 +403,13 @@ public:
// Return with the redline, which associated to the row change (latest deletion
// in the case of deleted row, the first insertion in the case of row insertion
// or npos, if TextChangesOnly is true, i.e. the table row is not deleted or inserted).
// Cache also the type of the redline associated to the changed table row.
SwRedlineTable::size_type UpdateTextChangesOnly(SwRedlineTable::size_type& rRedlinePos) const;
// is it a tracked deleted row
bool IsDeleted(SwRedlineTable::size_type& rRedlinePos) const;
// set/get (if it's possible, cached) redline type
RedlineType GetRedlineType() const;
void SetRedlineType(RedlineType eType) { m_eRedlineType = eType; }
};
/// SwTableBox is one table cell in the document model.
diff --git a/sw/qa/extras/layout/data/changed_table_rows.fodt b/sw/qa/extras/layout/data/changed_table_rows.fodt
new file mode 100644
index 0000000..43e3a83
--- /dev/null
+++ b/sw/qa/extras/layout/data/changed_table_rows.fodt
@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta><meta:creation-date>2021-09-13T16:07:05.221699428</meta:creation-date><dc:date>2021-09-13T16:10:52.148997944</dc:date><meta:editing-duration>PT3M46S</meta:editing-duration><meta:editing-cycles>3</meta:editing-cycles><meta:generator>LibreOfficeDev/7.3.0.0.alpha0$Linux_X86_64 LibreOffice_project/ba346227f1c4f896b717676a7eae22fea222f3e4</meta:generator><meta:document-statistic meta:table-count="2" meta:image-count="0" meta:object-count="0" meta:page-count="4" meta:paragraph-count="5" meta:word-count="5" meta:character-count="12" meta:non-whitespace-character-count="12"/></office:meta>
<office:styles>
<style:default-style style:family="graphic">
<style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
<style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false">
<style:tab-stops/>
</style:paragraph-properties>
<style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="hu" fo:country="HU" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
</style:default-style>
<style:default-style style:family="paragraph">
<style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
<style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="hu" fo:country="HU" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
</style:default-style>
<style:default-style style:family="table">
<style:table-properties table:border-model="collapsing"/>
</style:default-style>
<style:default-style style:family="table-row">
<style:table-row-properties fo:keep-together="auto"/>
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text"/>
<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:keep-with-next="always"/>
<style:text-properties style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt" style:font-name-asian="Noto Sans CJK SC" style:font-family-asian="'Noto Sans CJK SC'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Lohit Devanagari" style:font-family-complex="'Lohit Devanagari'" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/>
</style:style>
<style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" style:contextual-spacing="false" fo:line-height="115%"/>
</style:style>
<style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
<style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lohit Devanagari1" style:font-family-complex="'Lohit Devanagari'"/>
</style:style>
<style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" text:number-lines="false" text:line-number="0"/>
<style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Lohit Devanagari1" style:font-family-complex="'Lohit Devanagari'" style:font-size-complex="12pt" style:font-style-complex="italic"/>
</style:style>
<style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
<style:paragraph-properties text:number-lines="false" text:line-number="0"/>
<style:text-properties fo:language="zxx" fo:country="none" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Lohit Devanagari1" style:font-family-complex="'Lohit Devanagari'" style:language-complex="zxx" style:country-complex="none"/>
</style:style>
<style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties fo:orphans="0" fo:widows="0" text:number-lines="false" text:line-number="0"/>
</style:style>
<style:style style:name="Line_20_numbering" style:display-name="Line numbering" style:family="text"/>
</office:styles>
<office:automatic-styles>
<style:style style:name="Table1" style:family="table">
<style:table-properties style:width="17cm" table:align="margins" fo:background-color="transparent">
<style:background-image/>
</style:table-properties>
</style:style>
<style:style style:name="Table1.A" style:family="table-column">
<style:table-column-properties style:column-width="5.667cm" style:rel-column-width="21845*"/>
</style:style>
<style:style style:name="Table1.1" style:family="table-row">
<style:table-row-properties loext:text-changes-only="false" fo:background-color="transparent">
<style:background-image/>
</style:table-row-properties>
</style:style>
<style:style style:name="Table1.A1" style:family="table-cell">
<style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.C1" style:family="table-cell">
<style:table-cell-properties fo:background-color="#3faf46" fo:padding="0.097cm" fo:border="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table1.2" style:family="table-row">
<style:table-row-properties fo:background-color="transparent">
<style:background-image/>
</style:table-row-properties>
</style:style>
<style:style style:name="Table1.A2" style:family="table-cell">
<style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.B2" style:family="table-cell">
<style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.C2" style:family="table-cell">
<style:table-cell-properties fo:background-color="#3faf46" fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table1.A3" style:family="table-cell">
<style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.B3" style:family="table-cell">
<style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:text-properties officeooo:rsid="00039297" officeooo:paragraph-rsid="00039297"/>
</style:style>
<style:page-layout style:name="pm1">
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/>
</office:master-styles>
<office:body>
<office:text>
<text:tracked-changes text:track-changes="false">
<text:changed-region xml:id="ct94301112152528" text:id="ct94301112152528">
<text:deletion>
<office:change-info>
<dc:creator>x</dc:creator>
<dc:date>2021-12-07T11:51:09</dc:date>
</office:change-info>
</text:deletion>
</text:changed-region>
<text:changed-region xml:id="ct94301107251280" text:id="ct94301107251280">
<text:deletion>
<office:change-info>
<dc:creator>x</dc:creator>
<dc:date>2021-12-07T11:51:09</dc:date>
</office:change-info>
</text:deletion>
</text:changed-region>
<text:changed-region xml:id="ct94301038852272" text:id="ct94301038852272">
<text:deletion>
<office:change-info>
<dc:creator>x</dc:creator>
<dc:date>2021-12-07T11:51:09</dc:date>
</office:change-info>
</text:deletion>
</text:changed-region>
<text:changed-region xml:id="ct94301110886240" text:id="ct94301110886240">
<text:insertion>
<office:change-info>
<dc:creator>x</dc:creator>
<dc:date>2021-12-07T11:51:14</dc:date>
</office:change-info>
</text:insertion>
</text:changed-region>
<text:changed-region xml:id="ct94301114435136" text:id="ct94301114435136">
<text:insertion>
<office:change-info>
<dc:creator>x</dc:creator>
<dc:date>2021-12-07T11:51:19</dc:date>
</office:change-info>
</text:insertion>
</text:changed-region>
<text:changed-region xml:id="ct94301112304320" text:id="ct94301112304320">
<text:insertion>
<office:change-info>
<dc:creator>x</dc:creator>
<dc:date>2021-12-07T11:51:21</dc:date>
</office:change-info>
</text:insertion>
</text:changed-region>
</text:tracked-changes>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
<text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
</text:sequence-decls>
<table:table table:name="Table1" table:style-name="Table1">
<table:table-column table:style-name="Table1.A" table:number-columns-repeated="3"/>
<table:table-row table:style-name="Table1.1">
<table:table-cell table:style-name="Table1.A1" office:value-type="string">
<text:p text:style-name="P1"><text:change-start text:change-id="ct94301112152528"/>a<text:change-end text:change-id="ct94301112152528"/></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.A1" office:value-type="string">
<text:p text:style-name="P1"><text:change-start text:change-id="ct94301107251280"/>b<text:change-end text:change-id="ct94301107251280"/></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.C1" office:value-type="string">
<text:p text:style-name="P1"><text:change-start text:change-id="ct94301038852272"/>c<text:change-end text:change-id="ct94301038852272"/></text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="Table1.2">
<table:table-cell table:style-name="Table1.B3" office:value-type="string">
<text:p text:style-name="P1">d</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.B3" office:value-type="string">
<text:p text:style-name="P1">e</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.C2" office:value-type="string">
<text:p text:style-name="P1">f</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="Table1.1">
<table:table-cell table:style-name="Table1.B3" office:value-type="string">
<text:p text:style-name="P1"><text:change-start text:change-id="ct94301110886240"/>g<text:change-end text:change-id="ct94301110886240"/></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.B3" office:value-type="string">
<text:p text:style-name="P1"><text:change-start text:change-id="ct94301114435136"/>h<text:change-end text:change-id="ct94301114435136"/></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.C2" office:value-type="string">
<text:p text:style-name="P1"><text:change-start text:change-id="ct94301112304320"/>i<text:change-end text:change-id="ct94301112304320"/></text:p>
</table:table-cell>
</table:table-row>
</table:table>
<text:p text:style-name="Standard"/>
</office:text>
</office:body>
</office:document>
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 3ca1abc..9291043 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -366,6 +366,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145719)
assertXPath(pXmlDoc, "/metafile/push/push/push/textcolor[@color='#008000']", 4);
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testChangedTableRows)
{
SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "changed_table_rows.fodt");
SwDocShell* pShell = pDoc->GetDocShell();
// Dump the rendering of the first page as an XML file.
std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
MetafileXmlDump dumper;
xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
CPPUNIT_ASSERT(pXmlDoc);
// This was 0 (other color, not COL_AUTHOR_TABLE_DEL, color of the tracked row deletion)
assertXPath(pXmlDoc, "/metafile/push/push/push/push/push/fillcolor[@color='#fce6f4']", 1);
// This was 0 (other color, not COL_AUTHOR_TABLE_INS, color of the tracked row insertion)
assertXPath(pXmlDoc, "/metafile/push/push/push/push/push/fillcolor[@color='#e1f2fa']", 1);
// This was 3 (color of the cells of the last column, 2 of them disabled by change tracking )
assertXPath(pXmlDoc, "/metafile/push/push/push/push/push/fillcolor[@color='#3faf46']", 1);
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145225_RedlineMovingWithBadInsertion)
{
SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf42748.fodt");
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index d50869e..5811a0f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -75,6 +75,7 @@
#include <DocumentSettingManager.hxx>
#include <IDocumentDeviceAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <ndole.hxx>
#include <PostItMgr.hxx>
@@ -6318,6 +6319,24 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP
drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode, /*bConsiderTextBox=*/false );
// show track changes of table row
if( IsRowFrame() && !getRootFrame()->IsHideRedlines() )
{
RedlineType eType = static_cast<const SwRowFrame*>(this)->GetTabLine()->GetRedlineType();
if ( RedlineType::Delete == eType || RedlineType::Insert == eType )
{
pCol = RedlineType::Delete == eType ? COL_AUTHOR_TABLE_DEL : COL_AUTHOR_TABLE_INS;
bBack = true;
}
}
else if ( bBack && IsCellFrame() && !getRootFrame()->IsHideRedlines() &&
// skip cell background to show the row colored according to its tracked change
RedlineType::None != static_cast<const SwRowFrame*>(GetUpper())->GetTabLine()->GetRedlineType() )
{
return;
}
//- Output if a separate background is used.
bool bNoFlyBackground = !gProp.bSFlyMetafile && !bBack && IsFlyFrame();
if ( bNoFlyBackground )
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index a2726421..63d6062 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1451,8 +1451,9 @@ bool SwTable::IsTableComplex() const
SwTableLine::SwTableLine( SwTableLineFormat *pFormat, sal_uInt16 nBoxes,
SwTableBox *pUp )
: SwClient( pFormat ),
m_pUpper( pUp )
: SwClient( pFormat )
, m_pUpper( pUp )
, m_eRedlineType( RedlineType::None )
{
m_aBoxes.reserve( nBoxes );
}
@@ -1679,6 +1680,12 @@ SwRedlineTable::size_type SwTableLine::UpdateTextChangesOnly(SwRedlineTable::siz
// TODO: check also text outside of the redlines
}
}
// cache the result
const_cast<SwTableLine*>(this)->SetRedlineType( SwRedlineTable::npos == nRet
? RedlineType::None
: aRedlineTable[ nRet ]->GetType());
return nRet;
}
@@ -1695,6 +1702,33 @@ bool SwTableLine::IsDeleted(SwRedlineTable::size_type& rRedlinePos) const
return false;
}
RedlineType SwTableLine::GetRedlineType() const
{
const SwRedlineTable& aRedlineTable = GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
if ( aRedlineTable.empty() )
return RedlineType::None;
// check table row property "HasTextChangesOnly", if it's defined and its value is
// false, return with the cached redline type, if it exists, otherwise calculate it
const SvxPrintItem *pHasTextChangesOnlyProp =
GetFrameFormat()->GetAttrSet().GetItem<SvxPrintItem>(RES_PRINT);
if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() )
{
if ( RedlineType::None != m_eRedlineType )
return m_eRedlineType;
SwRedlineTable::size_type nPos = 0;
nPos = UpdateTextChangesOnly(nPos);
if ( nPos != SwRedlineTable::npos )
return aRedlineTable[nPos]->GetType();
}
else if ( RedlineType::None != m_eRedlineType )
// empty the cache
const_cast<SwTableLine*>(this)->SetRedlineType( RedlineType::None );
return RedlineType::None;
}
SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, sal_uInt16 nLines, SwTableLine *pUp )
: SwClient(nullptr)
, m_aLines()