diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-12 16:17:01 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-12 16:26:01 +0200 |
commit | 997ce52eb7ef5d1418784bc16afb495ec43fe64c (patch) | |
tree | 8e5e8f73b1d0b8f4cd0ce558d4d0eedd014bc1db /sw | |
parent | 352958b7c6bbfeb8352570b28487cc1713f5a850 (diff) |
DOCX filter: fix <w:em> handling
The real news here is that "comma" and "dot" was swapped on export, the
rest is just a fixup of recent breakage.
Change-Id: I54045f5837652dc38a30361e21ced25aeaf58257
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/em.docx | bin | 0 -> 10016 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 20 |
3 files changed, 28 insertions, 5 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/em.docx b/sw/qa/extras/ooxmlexport/data/em.docx Binary files differnew file mode 100644 index 000000000000..ee3137e70cce --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/em.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 1277f7b4759a..1101e2d6765b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/XTextRangeCompare.hpp> +#include <com/sun/star/text/FontEmphasis.hpp> #include <string> @@ -456,6 +457,18 @@ DECLARE_OOXMLEXPORT_TEST(testEffectExtent, "effect-extent.docx") assertXPath(pXmlDoc, "//wp:effectExtent", "l", "114300"); } +DECLARE_OOXMLEXPORT_TEST(testEm, "em.docx") +{ + // Test all possible <w:em> arguments. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE, getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharEmphasis")); + // This was ACCENT_ABOVE. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEmphasis")); + // This was DOT_ABOVE. + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 3), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 4), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW, getProperty<sal_Int16>(getRun(getParagraph(1), 5), "CharEmphasis")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 015531e065e4..88433313bf54 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6332,11 +6332,21 @@ void DocxAttributeOutput::CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasis switch ( rEmphasisMark.GetValue() ) { - case EMPHASISMARK_NONE: pEmphasis = "none"; break; - case EMPHASISMARK_SIDE_DOTS: pEmphasis = "dot"; break; - case EMPHASISMARK_CIRCLE_ABOVE: pEmphasis = "circle"; break; - case EMPHASISMARK_DOTS_BELOW: pEmphasis = "underDot"; break; - default: pEmphasis = "comma"; break; + case EMPHASISMARK_NONE: + pEmphasis = "none"; + break; + case EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE: + pEmphasis = "dot"; + break; + case EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE: + pEmphasis = "comma"; + break; + case EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE: + pEmphasis = "circle"; + break; + case EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW: + pEmphasis = "underDot"; + break; } m_pSerializer->singleElementNS( XML_w, XML_em, FSNS( XML_w, XML_val ), pEmphasis, FSEND ); |