sw/qa/extras/odfexport/data/deleted_table.fodt | 47 +++++++++++++++++++++++++ sw/qa/extras/odfexport/odfexport2.cxx | 7 +++ sw/source/filter/xml/xmlfmte.cxx | 6 --- xmloff/source/text/txtparae.cxx | 3 + 4 files changed, 57 insertions(+), 6 deletions(-)
New commits: commit 105ce47a695cb7ea7e6abf879e1c632b7d81f054 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Apr 26 16:47:26 2024 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Apr 26 21:19:57 2024 +0200 Make sure that collecting redline autostyles succeeds This step was called separately in SwXMLExport::ExportAutoStyles_, after collectAutoStyles. collectTextAutoStylesAndNodeExportOrder (which is called from collectAutoStyles) sets mbCollected to true, and then all the code checking mbCollected/isAutoStylesCollected stops collecting autostyles. This moves exportTrackedChanges call to the place where all auto- styles are collected. Change-Id: I3f4bd0e0ff906a35b69c052e34adb6d66ef80d48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166735 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/sw/qa/extras/odfexport/data/deleted_table.fodt b/sw/qa/extras/odfexport/data/deleted_table.fodt new file mode 100644 index 000000000000..830eb278ce18 --- /dev/null +++ b/sw/qa/extras/odfexport/data/deleted_table.fodt @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:settings> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:name="ShowRedlineChanges" config:type="boolean">false</config:config-item> + </config:config-item-set> + </office:settings> + <office:automatic-styles> + <style:style style:name="Table1" style:family="table"> + <style:table-properties table:align="margins"/> + </style:style> + <style:style style:name="Table1.A" style:family="table-column"> + <style:table-column-properties style:rel-column-width="65535*"/> + </style:style> + <style:style style:name="Table1.1" style:family="table-row"> + <style:table-row-properties style:min-row-height="1cm"/> + </style:style> + <style:style style:name="Table1.A1" style:family="table-cell"> + <style:table-cell-properties fo:padding="1mm" fo:border-left="none" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <text:tracked-changes text:track-changes="false"> + <text:changed-region xml:id="ct1" text:id="ct1"> + <text:deletion> + <office:change-info> + <dc:creator>John Doe</dc:creator> + <dc:date>2001-01-01T01:00:00</dc:date> + </office:change-info> + </text:deletion> + </text:changed-region> + </text:tracked-changes> + <text:p><text:change-start text:change-id="ct1"/></text:p> + <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>Deleted table</text:p> + </table:table-cell> + </table:table-row> + </table:table> + <text:p><text:change-end text:change-id="ct1"/></text:p> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index be3f891b4e81..01016b5b8ad2 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -1602,6 +1602,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTableInFrameAnchoredToPage) assertXPath(pXmlDoc, P + "/style:text-properties", "font-style"_ostr, u"italic"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testDeletedTableAutostylesExport) +{ + // Given a document with deleted table: + // it must not assert on export because of missing format for an exported table + loadAndReload("deleted_table.fodt"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index d64810724cf8..4a70f2953868 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -263,12 +263,6 @@ void SwXMLExport::ExportAutoStyles_() if( !(getExportFlags() & SvXMLExportFlags::STYLES) ) GetTextParagraphExport()->exportUsedDeclarations(); - // exported in ExportContent_ - if( getExportFlags() & SvXMLExportFlags::CONTENT ) - { - GetTextParagraphExport()->exportTrackedChanges( true ); - } - GetTextParagraphExport()->exportTextAutoStyles(); GetShapeExport()->exportAutoStyles(); if( getExportFlags() & SvXMLExportFlags::MASTERSTYLES ) diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index df324c16acad..b0671175e547 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1684,6 +1684,9 @@ void XMLTextParagraphExport::collectTextAutoStylesAndNodeExportOrder(bool bIsPro } } + if (GetExport().getExportFlags() & SvXMLExportFlags::CONTENT) + exportTrackedChanges(true); + mbCollected = true; }