RTF filter: fix \acc* handling

The exporter didn't write circle and underdot at all.

Change-Id: Ia8f45f2b03fb14e9a0027ec24ee7f36adc8c018d
This commit is contained in:
Miklos Vajna
2014-10-12 16:17:40 +02:00
parent 997ce52eb7
commit f99ebf4681
5 changed files with 37 additions and 8 deletions

View File

@@ -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"

View File

@@ -0,0 +1,8 @@
{\rtf1
none
{\accdot dot}
{\acccomma comma}
{\acccircle circle}
{\accunderdot underDot}
\par
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;