Kaydet (Commit) 41890bf7 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#54473 fdo#57133 fix RTF import of character styles

Regression from commit d2d77fd8

Change-Id: I7accc5c383de3fa53c12527766c3fc155bfa9863
üst 5da8bdb4
{\rtf1\ansi
{\stylesheet
{\*\cs16\ul Anot;}
{\*\cs15\i ForeignTxt;}
}
{\cs16\ul Text }
with
{\cs15\i character }
formatting
\par }
...@@ -127,6 +127,7 @@ public: ...@@ -127,6 +127,7 @@ public:
void testFdo48442(); void testFdo48442();
void testFdo55525(); void testFdo55525();
void testFdo57708(); void testFdo57708();
void testFdo54473();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -204,6 +205,7 @@ void Test::run() ...@@ -204,6 +205,7 @@ void Test::run()
{"fdo48442.rtf", &Test::testFdo48442}, {"fdo48442.rtf", &Test::testFdo48442},
{"fdo55525.rtf", &Test::testFdo55525}, {"fdo55525.rtf", &Test::testFdo55525},
{"fdo57708.rtf", &Test::testFdo57708}, {"fdo57708.rtf", &Test::testFdo57708},
{"fdo54473.rtf", &Test::testFdo54473},
}; };
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{ {
...@@ -941,6 +943,13 @@ void Test::testFdo57708() ...@@ -941,6 +943,13 @@ void Test::testFdo57708()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
} }
void Test::testFdo54473()
{
// The problem was that character styles were not imported due to a typo.
CPPUNIT_ASSERT_EQUAL(OUString("Anot"), getProperty<OUString>(getRun(getParagraph(1), 1, "Text "), "CharStyleName"));
CPPUNIT_ASSERT_EQUAL(OUString("ForeignTxt"), getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName"));
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -2673,7 +2673,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -2673,7 +2673,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aStates.top().aParagraphAttributes.set(NS_rtf::LN_ISTD, pIntValue); m_aStates.top().aParagraphAttributes.set(NS_rtf::LN_ISTD, pIntValue);
break; break;
case RTF_CS: case RTF_CS:
if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET) if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
{ {
m_nCurrentStyleIndex = nParam; m_nCurrentStyleIndex = nParam;
m_aStates.top().aTableAttributes.set(NS_rtf::LN_ISTD, pIntValue); m_aStates.top().aTableAttributes.set(NS_rtf::LN_ISTD, pIntValue);
......
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