Kaydet (Commit) 2b78f2cd authored tarafından Michael Stahl's avatar Michael Stahl

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
ca555c59, but was there before)

Change-Id: Ib054f1882793049b39424c1076ba5d4b319cd027
üst d3fcaef7
...@@ -198,6 +198,18 @@ DECLARE_OOXMLIMPORT_TEST(testN757890, "n757890.docx") ...@@ -198,6 +198,18 @@ DECLARE_OOXMLIMPORT_TEST(testN757890, "n757890.docx")
CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
} }
DECLARE_OOXMLIMPORT_TEST(testRhbz988516, "rhbz988516.docx")
{
// 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"));
}
DECLARE_OOXMLIMPORT_TEST(testFdo49940, "fdo49940.docx") DECLARE_OOXMLIMPORT_TEST(testFdo49940, "fdo49940.docx")
{ {
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
......
...@@ -24210,7 +24210,9 @@ ...@@ -24210,7 +24210,9 @@
<element name="headerReference" tokenid="ooxml:EG_HdrFtrReferences_headerReference"/> <element name="headerReference" tokenid="ooxml:EG_HdrFtrReferences_headerReference"/>
<element name="footerReference" tokenid="ooxml:EG_HdrFtrReferences_footerReference"/> <element name="footerReference" tokenid="ooxml:EG_HdrFtrReferences_footerReference"/>
</resource> </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"> <resource name="EG_SectPrContents" resource="Properties" tag="section">
<element name="bidi" tokenid="ooxml:EG_SectPrContents_bidi"/> <element name="bidi" tokenid="ooxml:EG_SectPrContents_bidi"/>
<element name="cols" tokenid="ooxml:EG_SectPrContents_cols"/> <element name="cols" tokenid="ooxml:EG_SectPrContents_cols"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment