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

Related: fdo#77600 RTF import: RTFValue::equals: compare attribute content

Previously only the number of nested sprms / attributes was compared.
With this, the font of the bugdoc is correctly Arial, not Times.

Change-Id: I351de414b6734336b31c1334dbd2349072f16002
üst 88c3b4bb
{\rtf1\ansi\deff4\adeflang1025
{\fonttbl
{\f0\froman\fprq2\fcharset0 Times New Roman;}
{\f1\froman\fprq2\fcharset2 Symbol;}
{\f2\fswiss\fprq2\fcharset0 Arial;}
{\f3\froman\fprq2\fcharset0 Liberation Serif
{\*\falt Times New Roman}
;}
{\f4\froman\fprq2\fcharset0 Times New Roman;}
{\f5\fswiss\fprq2\fcharset0 Liberation Sans
{\*\falt Arial}
;}
{\f6\froman\fprq2\fcharset0 Tahoma;}
{\f7\froman\fprq2\fcharset0 Arial;}
{\f8\fnil\fprq2\fcharset0 Droid Sans Fallback;}
{\f9\fnil\fprq2\fcharset0 Lucida Sans;}
{\f10\fswiss\fprq0\fcharset1 Lucida Sans;}
{\f11\fnil\fprq2\fcharset0 Arial;}
}
{\colortbl;\red0\green0\blue0;\red5\green99\blue193;\red128\green128\blue128;\red0\green0\blue10;}
{\stylesheet
{\s0\snext0\ql\widctlpar\ltrpar
\cf0\kerning1\dbch\af12\langfe1033\dbch\af12\afs20\alang1025\fs24\loch\f4\lang1033 Normal;}
}
\pard\plain\s0
{\af11\f7
This should be Arial.}
\par }
......@@ -1663,6 +1663,12 @@ DECLARE_RTFIMPORT_TEST(testFdo75735, "fdo75735.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty< uno::Sequence<style::TabStop> >(getParagraph(2), "ParaTabStops").getLength());
}
DECLARE_RTFIMPORT_TEST(testFontOverride, "font-override.rtf")
{
// This was "Times New Roman".
CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -156,6 +156,15 @@ void RTFSprms::deduplicate(RTFSprms& rReference)
}
}
bool RTFSprms::equals(RTFValue& rOther)
{
RTFSprms::Iterator_t i = m_pSprms->begin();
while (i != m_pSprms->end())
if (!i->second->equals(rOther))
return false;
return true;
}
void RTFSprms::ensureCopyBeforeWrite()
{
if (m_pSprms->m_nRefCount > 1)
......
......@@ -90,6 +90,7 @@ public:
return m_pSprms->end();
}
void clear();
bool equals(RTFValue& rOther);
private:
void ensureCopyBeforeWrite();
boost::intrusive_ptr<RTFSprmsImpl> m_pSprms;
......
......@@ -227,8 +227,12 @@ bool RTFValue::equals(RTFValue& rOther)
return false;
if (m_pAttributes->size() != rOther.m_pAttributes->size())
return false;
else if (!m_pAttributes->equals(rOther))
return false;
if (m_pSprms->size() != rOther.m_pSprms->size())
return false;
else if (!m_pSprms->equals(rOther))
return false;
return true;
}
......
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