summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-03-05 23:29:06 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-07 05:21:35 -0600
commit155397041b1a5687259605de1e33ed86ed955821 (patch)
tree5ce70e73c37007b467c399ce44dce3295b878dc9
parent7f98508ec2d20042725790468c5fc39a19c6ecec (diff)
rhbz#988516: DOCX import: fix context stack when importing header/footer
When a header/footer substream is parsed, a ParagraphGroup is started, but not ended; so the properties of the last paragraph in the header/footer are applied to a paragraph in the body. The obvious fix to add a call to endParagraphGroup() at the end of w:p element breaks table cells. So add a call to endParagraphGroup() at the end of the "hdr"/"ftr" element. (The problem in the bugdoc became much more visible with commit ca555c596043c88894b964ac5e21f5a7271d5f3b, but was there before) (cherry picked from commit 2b78f2cd7b9e4bab0f3b3b9119238f36a1bbc7b2) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Ib054f1882793049b39424c1076ba5d4b319cd027 Reviewed-on: https://gerrit.libreoffice.org/8476 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ooxmlimport/data/rhbz988516.docxbin0 -> 15513 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx14
-rw-r--r--writerfilter/source/ooxml/model.xml4
3 files changed, 17 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/rhbz988516.docx b/sw/qa/extras/ooxmlimport/data/rhbz988516.docx
new file mode 100644
index 000000000000..38e2dcff3240
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/rhbz988516.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index dee45c9dd263..9a35a3ed83d6 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -139,6 +139,7 @@ public:
void testRPrChangeClosed();
void testFdo65090();
void testFdo73389();
+ void testRhbz988516();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -243,6 +244,7 @@ void Test::run()
{"rprchange_closed.docx", &Test::testRPrChangeClosed},
{"fdo65090.docx", &Test::testFdo65090},
{"fdo73389.docx", &Test::testFdo73389},
+ {"rhbz988516.docx", &Test::testRhbz988516},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -376,6 +378,18 @@ void Test::testN757890()
CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
}
+void Test::testRhbz988516()
+{
+ // The problem was that the list properties of the footer leaked into body
+ CPPUNIT_ASSERT_EQUAL(OUString(),
+ getProperty<OUString>(getParagraph(1), "NumberingStyleName"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), getParagraph(2)->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString(),
+ getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
+ CPPUNIT_ASSERT_EQUAL(OUString(),
+ getProperty<OUString>(getParagraph(3), "NumberingStyleName"));
+}
+
void Test::testFdo49940()
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index d368dabf3334..a42ab94856fe 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -22508,7 +22508,9 @@
<element name="headerReference" tokenid="ooxml:EG_HdrFtrReferences_headerReference"/>
<element name="footerReference" tokenid="ooxml:EG_HdrFtrReferences_footerReference"/>
</resource>
- <resource name="CT_HdrFtr" resource="Stream" tag="header"/>
+ <resource name="CT_HdrFtr" resource="Stream" tag="header">
+ <action name="end" action="endParagraphGroup"/>
+ </resource>
<resource name="EG_SectPrContents" resource="Properties" tag="section">
<element name="bidi" tokenid="ooxml:EG_SectPrContents_bidi"/>
<element name="cols" tokenid="ooxml:EG_SectPrContents_cols"/>