Kaydet (Commit) 7839633f authored tarafından Andras Timar's avatar Andras Timar

fdo#85889 handle pc, pca and mac rtf keywords in writerfilter

Change-Id: Ic54f2233a37562bdc516e440af0b4b7973f56342
üst 8dc47538
{\rtf1\mac \deff0{\fonttbl{\f0\fmodern Helvetica;}}
\pard\f0\fs20 \'f1\'f2\'f3\par
}
{\rtf1\pc \deff0{\fonttbl{\f0\fmodern Helvetica;}}
\pard\f0\fs20 \'f1\'f2\'f3\par
}
{\rtf1\pca \deff0{\fonttbl{\f0\fmodern Helvetica;}}
\pard\f0\fs20 \'f1\'f2\'f3\par
}
...@@ -2181,6 +2181,32 @@ DECLARE_RTFIMPORT_TEST(testChtOutlineNumberingRtf, "chtoutline.rtf") ...@@ -2181,6 +2181,32 @@ DECLARE_RTFIMPORT_TEST(testChtOutlineNumberingRtf, "chtoutline.rtf")
CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix,SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix,SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix);
CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix);
} }
DECLARE_RTFIMPORT_TEST(testFdo85889pc, "fdo85889-pc.rtf")
{
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
OUString aExpected("\xc2\xb1\xe2\x89\xa5\xe2\x89\xa4", 8, RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
DECLARE_RTFIMPORT_TEST(testFdo85889pca, "fdo85889-pca.rtf")
{
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
OUString aExpected("\xc2\xb1\xe2\x80\x97\xc2\xbe", 7, RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
DECLARE_RTFIMPORT_TEST(testFdo85889mac, "fdo85889-mac.rtf")
{
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
OUString aExpected("\xc3\x92\xc3\x9a\xc3\x9b", 6, RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -2913,6 +2913,18 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -2913,6 +2913,18 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_ANSI: case RTF_ANSI:
m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252; m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252;
break; break;
case RTF_MAC:
m_nCurrentEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
break;
case RTF_PC:
m_nCurrentEncoding = RTL_TEXTENCODING_IBM_437;
m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
break;
case RTF_PCA:
m_nCurrentEncoding = RTL_TEXTENCODING_IBM_850;
m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
break;
case RTF_PLAIN: case RTF_PLAIN:
{ {
m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms;
......
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