Kaydet (Commit) 305ecd18 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#79959 RTF import: trim whitespace around style names

Change-Id: Id23cbd62b057442c577fef124a5705e4d551076f
üst 9f05a870
{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\stylesheet{\s0 Test;}}
\viewkind4\uc1\pard\s0\slmult1\lang9\f0\fs22 Hello world!\par
}
......@@ -1928,6 +1928,12 @@ DECLARE_RTFIMPORT_TEST(testFdo74229, "fdo74229.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(67)), getProperty<sal_Int32>(xCell, "RightBorderDistance"));
}
DECLARE_RTFIMPORT_TEST(testFdo79959, "fdo79959.rtf")
{
// This was false, as the style was imported as " Test", i.e. no whitespace stripping.
CPPUNIT_ASSERT_EQUAL(true, static_cast<bool>(getStyles("ParagraphStyles")->hasByName("Test")));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1162,8 +1162,9 @@ void RTFDocumentImpl::text(OUString& rString)
case DESTINATION_STYLEENTRY:
if (m_aStates.top().aTableAttributes.find(NS_ooxml::LN_CT_Style_type))
{
m_aStyleNames[m_nCurrentStyleIndex] = aName;
RTFValue::Pointer_t pValue(new RTFValue(aName));
// Word strips whitespace around style names.
m_aStyleNames[m_nCurrentStyleIndex] = aName.trim();
RTFValue::Pointer_t pValue(new RTFValue(aName.trim()));
m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, pValue);
m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue);
......
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