[Libreoffice-commits] .: sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Dec 4 01:59:38 PST 2012
sw/qa/extras/rtfimport/data/fdo54473.rtf | 10 ++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 9 +++++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 2 +-
3 files changed, 20 insertions(+), 1 deletion(-)
New commits:
commit 41890bf714803969515578b47e63fa9730ea7090
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Dec 4 10:38:53 2012 +0100
fdo#54473 fdo#57133 fix RTF import of character styles
Regression from commit d2d77fd86e6cb7341e113557e2cfe3d7948759bd
Change-Id: I7accc5c383de3fa53c12527766c3fc155bfa9863
diff --git a/sw/qa/extras/rtfimport/data/fdo54473.rtf b/sw/qa/extras/rtfimport/data/fdo54473.rtf
new file mode 100644
index 0000000..7bb6208
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo54473.rtf
@@ -0,0 +1,10 @@
+{\rtf1\ansi
+{\stylesheet
+{\*\cs16\ul Anot;}
+{\*\cs15\i ForeignTxt;}
+}
+{\cs16\ul Text }
+with
+{\cs15\i character }
+formatting
+\par }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 7853fc3..826ca96 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -127,6 +127,7 @@ public:
void testFdo48442();
void testFdo55525();
void testFdo57708();
+ void testFdo54473();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -204,6 +205,7 @@ void Test::run()
{"fdo48442.rtf", &Test::testFdo48442},
{"fdo55525.rtf", &Test::testFdo55525},
{"fdo57708.rtf", &Test::testFdo57708},
+ {"fdo54473.rtf", &Test::testFdo54473},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
@@ -941,6 +943,13 @@ void Test::testFdo57708()
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_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9c988d7..aa90d3b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2673,7 +2673,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aStates.top().aParagraphAttributes.set(NS_rtf::LN_ISTD, pIntValue);
break;
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_aStates.top().aTableAttributes.set(NS_rtf::LN_ISTD, pIntValue);
More information about the Libreoffice-commits
mailing list