diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-17 17:56:33 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-17 18:27:16 +0200 |
commit | 4bb872b1924453f22e90bdd14e2898a3e66d5551 (patch) | |
tree | 9ed875ad96b344601290db59ac0d73eff8acbb8d /sw/qa/extras/ooxmlexport | |
parent | f55a0a54b235d55db3f6e839053be04bfc1ed2d4 (diff) |
DOCX export: fix handling of paragraph mark on empty paragraphs
The problem was that in case a paragraph is empty, and it has both a
character style and direct formatting, then the doc model created by the
ODT and DOCX import is like this:
<text>
<attrset>
<item whichId="8" which="character font size" value="nHeight: 240, nProp: 100"/>
</attrset>
<hints>
<hint end="0" whichId="52" which="character format" value="name: hello"/>
</hints>
</text>
I.e. the direct formatting is stored in the attribute set of the text
node directly, while the character style is stored as a hint.
MSWordExportBase::OutputTextNode() tried to read the hints and if there
were not any, then tried to read the attribute set, while in this
situation we need both.
Change-Id: I71fd10f6d00246348e77fee5431cb4e2a7c9b349
Diffstat (limited to 'sw/qa/extras/ooxmlexport')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/paragraph-mark.docx | bin | 0 -> 13113 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 |
2 files changed, 10 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/paragraph-mark.docx b/sw/qa/extras/ooxmlexport/data/paragraph-mark.docx Binary files differnew file mode 100644 index 000000000000..4636e4d36802 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/paragraph-mark.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 395c753a4c20..b35f97b4bc8a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -483,6 +483,16 @@ DECLARE_OOXMLEXPORT_TEST(testAfterlines, "afterlines.docx") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(423), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); } +DECLARE_OOXMLEXPORT_TEST(testParagraphMark, "paragraph-mark.docx") +{ + // The problem was that we didn't handle the situation when an empty paragraph's marker had both a char style and some direct formatting. + + // This was 11. + CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getParagraph(1), "CharHeight")); + // This was empty. + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(getRun(getParagraph(1), 1), "CharStyleName")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |