[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Mar 17 10:09:16 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf103931.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 8 ++++++++
writerfilter/source/ooxml/model.xml | 1 +
3 files changed, 9 insertions(+)
New commits:
commit 1e88c10327642e6867db5708e3fd0fb7065bc74c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Feb 28 09:16:48 2017 +0100
tdf#103931 DOCX import: fix lost section break
When there are multiple sections in a document, every <w:p> element
triggers a handleLastParagraphInSection() call, and that's how the
previous section is ended and the next one is started if necessary. In
case the section contains no paragraphs at all, the section was lost on
import. Fix this by also calling handleLastParagraphInSection() on
<w:sectPr> as well.
It's not a problem if there are both <w:p> and <w:sectPr> in a section
(which is the usual situation) as only the first call closes the
previous section / starts the next one.
(cherry picked from commit 6603947329a7b372a173a3c60e013e532d0bc5cf)
Change-Id: I64f2c403dcb2ceca76d444ab06df3052235d2795
Reviewed-on: https://gerrit.libreoffice.org/34718
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf103931.docx b/sw/qa/extras/ooxmlexport/data/tdf103931.docx
new file mode 100644
index 000000000000..094fe1ba91cf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103931.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index ef278f245757..001f5b026251 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -207,6 +207,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106001, "tdf106001.docx")
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>( 100 ), getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharScaleWidth" ));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf103931, "tdf103931.docx")
+{
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+ // This was 2, the last (empty) section of the document was lost on import.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xTextSections->getCount());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 24a020b1bc58..19339d3ee040 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17822,6 +17822,7 @@
</resource>
<resource name="CT_SectPrBase" resource="Properties"/>
<resource name="CT_SectPr" resource="Properties">
+ <action name="start" action="handleLastParagraphInSection"/>
<element name="sectPrChange" tokenid="ooxml:CT_SectPr_sectPrChange"/>
<action name="start" action="setLastParagraphInSection"/>
</resource>
More information about the Libreoffice-commits
mailing list