summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-09-13 15:21:14 +0200
committerTünde Tóth <toth.tunde@nisz.hu>2021-10-21 14:51:01 +0200
commit09e313704dea1298173c85b692370c4a4911e597 (patch)
tree63297b4042b275dd323d61d8c65eb55be1688f11
parentaa804a272af40c785bcb0e6739400fed1cb9cdbe (diff)
tdf#144057 sw track changes: hide deleted table rows
and tables in Hide Changes mode. Previously it was possible to "hide" them only by accepting all the deletions, because Hide Changes mode hid only the cell content, but not the deleted rows and tables, leaving empty rows and tables in the document. Follow-up of commit 05366b8e6683363688de8708a3d88cf144c7a2bf "tdf#60382 sw offapi: add change tracking of table/row deletion". Change-Id: Ib0424f5a17f2213fc7466e966d8ce6812ffde5e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122079 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123993 Tested-by: Tünde Tóth <toth.tunde@nisz.hu> Reviewed-by: Tünde Tóth <toth.tunde@nisz.hu>
-rw-r--r--sw/inc/swtable.hxx10
-rw-r--r--sw/qa/extras/layout/data/tdf144057.fodt387
-rw-r--r--sw/qa/extras/layout/layout.cxx43
-rw-r--r--sw/source/core/docnode/ndtbl.cxx3
-rw-r--r--sw/source/core/layout/frmtool.cxx11
-rw-r--r--sw/source/core/layout/tabfrm.cxx8
-rw-r--r--sw/source/core/layout/wsfrm.cxx30
-rw-r--r--sw/source/core/table/swtable.cxx90
8 files changed, 576 insertions, 6 deletions
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 94d33eaa6914..e1c7bdaf6383 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -26,6 +26,7 @@
#include "calbck.hxx"
#include "swrect.hxx"
#include "swtblfmt.hxx"
+#include "docary.hxx"
#include <memory>
#include <vector>
@@ -345,6 +346,11 @@ public:
bool CanConvertSubtables() const;
void ConvertSubtables();
+
+ // is it a table deleted completely with change tracking
+ bool IsDeleted() const;
+ // is it a table with deleted row(s)
+ bool HasDeletedRow() const;
};
/// SwTableLine is one table row in the document model.
@@ -390,6 +396,10 @@ public:
// it doesn't contain box content
bool IsEmpty() const;
+
+ // is it a tracked deleted row
+ // (search its first redline from rRedlinePos to speed up SwTable::IsDeleted())
+ bool IsDeleted(SwRedlineTable::size_type& rRedlinePos) const;
};
/// SwTableBox is one table cell in the document model.
diff --git a/sw/qa/extras/layout/data/tdf144057.fodt b/sw/qa/extras/layout/data/tdf144057.fodt
new file mode 100644
index 000000000000..66deaa9c27d8
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf144057.fodt
@@ -0,0 +1,387 @@
+<?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="&apos;Liberation Sans&apos;" 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="&apos;Noto Sans CJK SC&apos;" 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="&apos;Lohit Devanagari&apos;" 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="&apos;Lohit Devanagari&apos;"/>
+ </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="&apos;Lohit Devanagari&apos;" 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="&apos;Lohit Devanagari&apos;" 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"/>
+ </style:style>
+ <style:style style:name="Table1.A" style:family="table-column">
+ <style:table-column-properties style:column-width="17cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table1.1" style:family="table-row">
+ <style:table-row-properties loext:text-changes-only="false"/>
+ </style:style>
+ <style:style style:name="Table1.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
+ </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="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
+ </style:style>
+ <style:style style:name="Table2" style:family="table">
+ <style:table-properties style:width="17cm" table:align="margins"/>
+ </style:style>
+ <style:style style:name="Table2.A" style:family="table-column">
+ <style:table-column-properties style:column-width="17cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table2.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
+ </style:style>
+ <style:style style:name="Table2.2" style:family="table-row">
+ <style:table-row-properties loext:text-changes-only="false"/>
+ </style:style>
+ <style:style style:name="Table2.A2" style:family="table-cell">
+ <style:table-cell-properties 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:style>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:text-properties officeooo:paragraph-rsid="001444e4"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Table_20_Contents">
+ <style:text-properties fo:font-size="96pt" officeooo:rsid="001444e4" officeooo:paragraph-rsid="001444e4" style:font-size-asian="96pt" style:font-size-complex="96pt"/>
+ </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:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" 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>
+ <style:style style:name="dp1" style:family="drawing-page">
+ <style:drawing-page-properties draw:background-size="full"/>
+ </style:style>
+ </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:use-soft-page-breaks="true">
+ <text:tracked-changes text:track-changes="false">
+ <text:changed-region xml:id="ct94575160241328" text:id="ct94575160241328">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160237104" text:id="ct94575160237104">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160236256" text:id="ct94575160236256">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160250512" text:id="ct94575160250512">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160243136" text:id="ct94575160243136">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160240416" text:id="ct94575160240416">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160269216" text:id="ct94575160269216">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160247680" text:id="ct94575160247680">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160268688" text:id="ct94575160268688">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160246240" text:id="ct94575160246240">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160272032" text:id="ct94575160272032">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160238720" text:id="ct94575160238720">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:20</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160293824" text:id="ct94575160293824">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:26</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160296240" text:id="ct94575160296240">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:30</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160292400" text:id="ct94575160292400">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:30</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160292064" text:id="ct94575160292064">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:38</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160463408" text:id="ct94575160463408">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:38</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160464880" text:id="ct94575160464880">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:38</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94575160290112" text:id="ct94575160290112">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>xxx2</dc:creator>
+ <dc:date>2021-09-13T16:10:38</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ </text:tracked-changes>
+ <table:table table:name="Table1" table:style-name="Table1">
+ <table:table-column table:style-name="Table1.A"/>
+ <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="P2"><text:change-start text:change-id="ct94575160241328"/>A1<text:change-end text:change-id="ct94575160241328"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160237104"/>A2<text:change-end text:change-id="ct94575160237104"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160236256"/>A3<text:change-end text:change-id="ct94575160236256"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160250512"/>A4<text:change-end text:change-id="ct94575160250512"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160243136"/>A5<text:change-end text:change-id="ct94575160243136"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160240416"/>A6<text:change-end text:change-id="ct94575160240416"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160269216"/>A7<text:change-end text:change-id="ct94575160269216"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160247680"/>A8<text:change-end text:change-id="ct94575160247680"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160268688"/>A9<text:change-end text:change-id="ct94575160268688"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160246240"/>A10<text:change-end text:change-id="ct94575160246240"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160272032"/>A11<text:change-end text:change-id="ct94575160272032"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160238720"/>A12<text:change-end text:change-id="ct94575160238720"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p text:style-name="P1"/>
+ <table:table table:name="Table2" table:style-name="Table2">
+ <table:table-column table:style-name="Table2.A"/>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="TableLine94575160286304">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:p text:style-name="P2">B1</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.2">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160293824"/>B2<text:change-end text:change-id="ct94575160293824"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="TableLine94575160289680">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2">B3</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.2">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160296240"/>B4<text:change-end text:change-id="ct94575160296240"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.2">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160292400"/>B5<text:change-end text:change-id="ct94575160292400"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="TableLine94575160299120">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2">B6</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="Table2.2">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160292064"/>B7<text:change-end text:change-id="ct94575160292064"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.2">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160463408"/>B8<text:change-end text:change-id="ct94575160463408"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.2">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160464880"/>B9<text:change-end text:change-id="ct94575160464880"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.2">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2"><text:change-start text:change-id="ct94575160290112"/>B10<text:change-end text:change-id="ct94575160290112"/></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="TableLine94575160471152">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2">B11</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="TableLine94575160471824">
+ <table:table-cell table:style-name="Table2.A2" office:value-type="string">
+ <text:p text:style-name="P2">B12</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p text:style-name="P1"/>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index cd1a2ae80511..3d4809dd6dcc 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2302,6 +2302,49 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables)
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foar");
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057)
+{
+ createSwDoc(DATA_DIRECTORY, "tdf144057.fodt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc());
+ SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
+ CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+ discardDumpedLayout();
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ // show tracked row deletions
+ assertXPath(pXmlDoc, "/root/page", 4);
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[6]/cell/txt/Text", "Portion", "A6");
+ assertXPath(pXmlDoc, "/root/page[2]/body/tab/row[6]/cell/txt/Text", "Portion", "A12");
+ assertXPath(pXmlDoc, "/root/page[3]/body/tab/row[6]/cell/txt/Text", "Portion", "B6");
+ assertXPath(pXmlDoc, "/root/page[4]/body/tab/row[6]/cell/txt/Text", "Portion", "B12");
+
+ // hide tracked table and table row deletions
+ dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+ CPPUNIT_ASSERT(pLayout->IsHideRedlines());
+ pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+
+ // This was 4 (unhidden tracked table and table row deletions)
+ assertXPath(pXmlDoc, "/root/page", 1);
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 5);
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[5]/cell/txt/Text", "Portion", "B12");
+
+ // show tracked table and table row deletions again
+ dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+ CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+ pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "/root/page", 4);
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[6]/cell/txt/Text", "Portion", "A6");
+ assertXPath(pXmlDoc, "/root/page[2]/body/tab/row[6]/cell/txt/Text", "Portion", "A12");
+ assertXPath(pXmlDoc, "/root/page[3]/body/tab/row[6]/cell/txt/Text", "Portion", "B6");
+ assertXPath(pXmlDoc, "/root/page[4]/body/tab/row[6]/cell/txt/Text", "Portion", "B12");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index acca43916522..53c06ddefde6 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2464,7 +2464,8 @@ void SwTableNode::DelFrames(SwRootFrame const*const pLayout)
dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
}
}
- pFrame->Cut();
+ if (pFrame->GetUpper())
+ pFrame->Cut();
SwFrame::DestroyFrame(pFrame);
bAgain = true;
}
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index e74188501f33..6df63ed59bbf 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1626,6 +1626,15 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
continue; // skip it
}
+ pFrame = pTableNode->MakeFrame( pLay );
+
+ // skip tables deleted with track changes
+ if ( !static_cast<SwTabFrame*>(pFrame)->Lower() )
+ {
+ nIndex = pTableNode->EndOfSectionIndex();
+ continue; // skip it
+ }
+
// #108116# loading may produce table structures that GCLines
// needs to clean up. To keep table formulas correct, change
// all table formulas to internal (BOXPTR) representation.
@@ -1634,8 +1643,6 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
pDoc->getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
pTableNode->GetTable().GCLines();
- pFrame = pTableNode->MakeFrame( pLay );
-
if( pPageMaker )
pPageMaker->CheckInsert( nIndex );
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 13ba152f12fe..9ce03fdf98e5 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -20,6 +20,7 @@
#include <pagefrm.hxx>
#include <rootfrm.hxx>
#include <IDocumentFieldsAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <viewimp.hxx>
#include <fesh.hxx>
#include <swtable.hxx>
@@ -92,8 +93,15 @@ SwTabFrame::SwTabFrame( SwTable &rTab, SwFrame* pSib )
//Create the lines and insert them.
const SwTableLines &rLines = rTab.GetTabLines();
SwFrame *pTmpPrev = nullptr;
+ bool bHiddenRedlines = getRootFrame()->IsHideRedlines() &&
+ !GetFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().empty();
+ SwRedlineTable::size_type nRedlinePos = 0;
for ( size_t i = 0; i < rLines.size(); ++i )
{
+ // skip lines deleted with track changes
+ if ( bHiddenRedlines && rLines[i]->IsDeleted(nRedlinePos) )
+ continue;
+
SwRowFrame *pNew = new SwRowFrame( *rLines[i], this );
if( pNew->Lower() )
{
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 184ee0d6c9a8..f57d963bb141 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -60,6 +60,7 @@
#include <layact.hxx>
#include <ndtxt.hxx>
#include <swtable.hxx>
+#include <tblsel.hxx>
// RotateFlyFrame3
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -4335,7 +4336,9 @@ static void UnHideRedlines(SwRootFrame & rLayout,
if (rLayout.HasMergedParas())
{
assert(!pFrame->GetMergedPara() ||
- !rNode.IsCreateFrameWhenHidingRedlines());
+ !rNode.IsCreateFrameWhenHidingRedlines() ||
+ // FIXME: skip this assert in tables with deleted rows
+ pFrame->IsInTab());
if (rNode.IsCreateFrameWhenHidingRedlines())
{
{
@@ -4427,6 +4430,7 @@ static void UnHideRedlines(SwRootFrame & rLayout,
}
else if (rNode.IsTableNode() && rLayout.IsHideRedlines())
{
+ SwTableNode * pTableNd = rNode.GetTableNode();
SwPosition const tmp(rNode);
SwRangeRedline const*const pRedline(
rLayout.GetFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedline(tmp, nullptr));
@@ -4440,9 +4444,27 @@ static void UnHideRedlines(SwRootFrame & rLayout,
{
rNode.GetNodes()[j]->SetRedlineMergeFlag(SwNode::Merge::Hidden);
}
- rNode.GetTableNode()->DelFrames(&rLayout);
+ pTableNd->DelFrames(&rLayout);
+ }
+ else if ( pTableNd->GetTable().HasDeletedRow() )
+ {
+ pTableNd->DelFrames(&rLayout);
+ if ( !pTableNd->GetTable().IsDeleted() )
+ {
+ SwNodeIndex aIdx( *pTableNd->EndOfSectionNode(), 1 );
+ pTableNd->MakeOwnFrames(&aIdx);
+ }
}
}
+ else if (rNode.IsTableNode() && !rLayout.IsHideRedlines() &&
+ rNode.GetTableNode()->GetTable().HasDeletedRow() )
+ {
+ SwTableNode * pTableNd = rNode.GetTableNode();
+ pTableNd->DelFrames(&rLayout);
+ SwNodeIndex aIdx( *pTableNd->EndOfSectionNode(), 1 );
+ pTableNd->MakeOwnFrames(&aIdx);
+ }
+
if (!rNode.IsCreateFrameWhenHidingRedlines())
{
if (rLayout.HasMergedParas())
@@ -4458,7 +4480,9 @@ static void UnHideRedlines(SwRootFrame & rLayout,
}
else
{
- assert(!rNode.IsContentNode() || !rNode.GetContentNode()->getLayoutFrame(&rLayout));
+ assert(!rNode.IsContentNode() || !rNode.GetContentNode()->getLayoutFrame(&rLayout) ||
+ // FIXME: skip this assert in tables with deleted rows
+ rNode.GetContentNode()->getLayoutFrame(&rLayout)->IsInTab());
sal_uLong j = i + 1;
for ( ; j < rEndOfSectionNode.GetIndex(); ++j)
{
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 3dd49c394783..c0567ff15e7d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1588,6 +1588,96 @@ bool SwTableLine::IsEmpty() const
return true;
}
+bool SwTable::HasDeletedRow() const
+{
+ const SwRedlineTable& aRedlineTable = GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+ if ( aRedlineTable.empty() )
+ return false;
+
+ SwRedlineTable::size_type nRedlinePos = 0;
+ for (size_t i = 0; i < m_aLines.size(); ++i)
+ {
+ if ( m_aLines[i]->IsDeleted(nRedlinePos) )
+ return true;
+ }
+ return false;
+}
+
+bool SwTable::IsDeleted() const
+{
+ const SwRedlineTable& aRedlineTable = GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+ if ( aRedlineTable.empty() )
+ return false;
+
+ SwRedlineTable::size_type nRedlinePos = 0;
+ for (size_t i = 0; i < m_aLines.size(); ++i)
+ {
+ if ( !m_aLines[i]->IsDeleted(nRedlinePos) )
+ return false;
+ }
+ return true;
+}
+
+bool SwTableLine::IsDeleted(SwRedlineTable::size_type& rRedlinePos) const
+{
+ bool bRet = false;
+ const SwRedlineTable& aRedlineTable = GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+ if ( aRedlineTable.empty() )
+ return false;
+
+ // check table row property "HasTextChangesOnly", if it's defined and its
+ // value is false, and all text content is in delete redlines, the row is deleted
+ const SvxPrintItem *pHasTextChangesOnlyProp =
+ GetFrameFormat()->GetAttrSet().GetItem<SvxPrintItem>(RES_PRINT);
+ if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() )
+ {
+ const SwTableBoxes & rBoxes = GetTabBoxes();
+ size_t nBoxes = rBoxes.size();
+ for (size_t nBoxIndex = 0; nBoxIndex < nBoxes && rRedlinePos < aRedlineTable.size(); ++nBoxIndex)
+ {
+ auto pBox = rBoxes[nBoxIndex];
+ if ( pBox->IsEmpty() )
+ {
+ // no text content, check the next cells
+ continue;
+ }
+
+ SwPosition aCellStart( SwNodeIndex( *pBox->GetSttNd(), 0 ) );
+ SwPosition aCellEnd( SwNodeIndex( *pBox->GetSttNd()->EndOfSectionNode(), -1 ) );
+ SwNodeIndex pEndNodeIndex(aCellEnd.nNode.GetNode());
+ for( bRet = false ; rRedlinePos < aRedlineTable.size(); ++rRedlinePos )
+ {
+ const SwRangeRedline* pRedline = aRedlineTable[ rRedlinePos ];
+
+ if ( pRedline->Start()->nNode > pEndNodeIndex )
+ {
+ // no more redlines in the actual cell,
+ // check the next ones
+ break;
+ }
+
+ // redline in the cell, it must be a delete redline
+ if ( aCellStart <= *pRedline->Start() )
+ {
+ bRet = RedlineType::Delete == pRedline->GetType();
+ if ( !bRet )
+ // other type of redline, e.g. tracked row insertion
+ // contains an insert redline at the beginning of the first cell
+ return false;
+ }
+ }
+
+ if ( !bRet )
+ {
+ // not deleted cell content: the row is not empty
+ return false;
+ }
+ // TODO: check also text outside of the redlines
+ }
+ }
+ return bRet;
+}
+
SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, sal_uInt16 nLines, SwTableLine *pUp )
: SwClient(nullptr)
, m_aLines()