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

fdo#79959 RTF import: trim whitespace around style names

(cherry picked from commit 305ecd18)

Conflicts:
	writerfilter/source/rtftok/rtfdocumentimpl.cxx

Change-Id: Id23cbd62b057442c577fef124a5705e4d551076f
üst ed0af187
{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\stylesheet{\s0 Test;}}
\viewkind4\uc1\pard\s0\slmult1\lang9\f0\fs22 Hello world!\par
}
......@@ -1689,6 +1689,12 @@ DECLARE_RTFIMPORT_TEST(testFdo74229, "fdo74229.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(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: */
......@@ -1121,8 +1121,8 @@ void RTFDocumentImpl::text(OUString& rString)
if (m_aStates.top().aTableAttributes.find(NS_rtf::LN_SGC))
{
OUString aName = m_aStates.top().aDestinationText.makeStringAndClear();
m_aStyleNames[m_nCurrentStyleIndex] = aName;
RTFValue::Pointer_t pValue(new RTFValue(aName));
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