summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-10-12 16:17:40 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-10-12 16:26:01 +0200
commitf99ebf4681ceb8803ea32f70835dafa368d74722 (patch)
tree33d885f74dd6de1468b48995a0dc9d5cc37d0e1a
parent997ce52eb7ef5d1418784bc16afb495ec43fe64c (diff)
RTF filter: fix \acc* handling
The exporter didn't write circle and underdot at all. Change-Id: Ia8f45f2b03fb14e9a0027ec24ee7f36adc8c018d
-rw-r--r--include/svtools/rtfkeywd.hxx2
-rw-r--r--sw/qa/extras/rtfexport/data/em.rtf8
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx13
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx12
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx10
5 files changed, 37 insertions, 8 deletions
diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx
index 8518f69f1330..cffa6499397c 100644
--- a/include/svtools/rtfkeywd.hxx
+++ b/include/svtools/rtfkeywd.hxx
@@ -1047,6 +1047,8 @@
#define OOO_STRING_SVTOOLS_RTF_ACCNONE "\\accnone"
#define OOO_STRING_SVTOOLS_RTF_ACCDOT "\\accdot"
#define OOO_STRING_SVTOOLS_RTF_ACCCOMMA "\\acccomma"
+#define OOO_STRING_SVTOOLS_RTF_ACCCIRCLE "\\acccircle"
+#define OOO_STRING_SVTOOLS_RTF_ACCUNDERDOT "\\accunderdot"
#define OOO_STRING_SVTOOLS_RTF_TWOINONE "\\twoinone"
#define OOO_STRING_SVTOOLS_RTF_HORZVERT "\\horzvert"
#define OOO_STRING_SVTOOLS_RTF_FAHANG "\\fahang"
diff --git a/sw/qa/extras/rtfexport/data/em.rtf b/sw/qa/extras/rtfexport/data/em.rtf
new file mode 100644
index 000000000000..c255105d6f32
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/em.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+none
+{\accdot dot}
+{\acccomma comma}
+{\acccircle circle}
+{\accunderdot underDot}
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 954dc2fac3ab..5c74c5385b68 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -16,6 +16,7 @@
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/text/FontEmphasis.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/text/XFootnotesSupplier.hpp>
@@ -689,6 +690,18 @@ DECLARE_RTFEXPORT_TEST(testAbi10076, "abi10076.odt")
// Just make sure that we don't crash after exporting a fully calculated layout.
}
+DECLARE_RTFEXPORT_TEST(testEm, "em.rtf")
+{
+ // Test all possible \acc* control words.
+ CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE, getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharEmphasis"));
+ CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEmphasis"));
+ CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 3), "CharEmphasis"));
+ // This was missing.
+ CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 4), "CharEmphasis"));
+ // This one, too.
+ CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW, getProperty<sal_Int16>(getRun(getParagraph(1), 5), "CharEmphasis"));
+}
+
DECLARE_RTFEXPORT_TEST(testNumberingFont, "numbering-font.rtf")
{
uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName("ListLabel 1"), uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index a576ddcd9f10..a7eecbca3f0c 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2330,11 +2330,17 @@ void RtfAttributeOutput::CharEmphasisMark(const SvxEmphasisMarkItem& rEmphasisMa
case EMPHASISMARK_NONE:
pStr = OOO_STRING_SVTOOLS_RTF_ACCNONE;
break;
- case EMPHASISMARK_SIDE_DOTS:
+ case EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE:
+ pStr = OOO_STRING_SVTOOLS_RTF_ACCDOT;
+ break;
+ case EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE:
pStr = OOO_STRING_SVTOOLS_RTF_ACCCOMMA;
break;
- default:
- pStr = OOO_STRING_SVTOOLS_RTF_ACCDOT;
+ case EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE:
+ pStr = OOO_STRING_SVTOOLS_RTF_ACCCIRCLE;
+ break;
+ case EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW:
+ pStr = OOO_STRING_SVTOOLS_RTF_ACCUNDERDOT;
break;
}
m_aStyles.append(pStr);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d2661837374f..85884f945245 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4714,19 +4714,19 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
switch (nKeyword)
{
case RTF_ACCNONE:
- nSprm = 0;
+ nSprm = NS_ooxml::LN_Value_ST_Em_none;
break;
case RTF_ACCDOT:
- nSprm = 1;
+ nSprm = NS_ooxml::LN_Value_ST_Em_dot;
break;
case RTF_ACCCOMMA:
- nSprm = 2;
+ nSprm = NS_ooxml::LN_Value_ST_Em_comma;
break;
case RTF_ACCCIRCLE:
- nSprm = 3;
+ nSprm = NS_ooxml::LN_Value_ST_Em_circle;
break;
case RTF_ACCUNDERDOT:
- nSprm = 4;
+ nSprm = NS_ooxml::LN_Value_ST_Em_underDot;
break;
default:
break;