summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfvalue.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-06-17 18:40:04 +0200
committerMichael Stahl <mstahl@redhat.com>2014-06-17 18:42:07 +0200
commit1be0a3fa9ebb22b607c54b47739d4467acfed259 (patch)
tree2bbc7ba198f537bb058fb140a70b30146c8e2074 /writerfilter/source/rtftok/rtfvalue.cxx
parent6c0e1270889deb513f961f864dfc1c02ee8705f4 (diff)
n#825305: writerfilter RTF import: override style properties like Word
It would certainly be immediately obvious to any reader of the RTF spec that \sN will apply the style with index N to the current paragraph. But actually, that is not what Word does when it reads \sN... what it really does is to apply the style with index N, and then for every attribute in that style, apply the same attribute with a default value to the paragraph, effectively overriding what's in the style. If that doesn't make any sense to you, well, have you heard the joke about how many Microsoft engineers it takes to change a light bulb? Also, \pard apparently implies \s0. To implement that, change RTFSprms::deduplicate() to recursively look for style SPRMs that are missing in the properties, and put in default ones, currently just for 2 keywords \sa and \sb. This requires changing deduplicate() to be const and return a new value, since it is no longer idempotent, as the erased SPRMs would get defaulted on the next run. While at it, fix RTFValue::equals() which did not compare m_sValue. This fixes the testParaBottomMargin test that was broken by the fix for fdo#70578. Change-Id: I4ced38628d76f6c41b488d608a804883493ff00b
Diffstat (limited to 'writerfilter/source/rtftok/rtfvalue.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfvalue.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx
index 5d038828a031..adf7a7781e10 100644
--- a/writerfilter/source/rtftok/rtfvalue.cxx
+++ b/writerfilter/source/rtftok/rtfvalue.cxx
@@ -223,10 +223,18 @@ RTFValue* RTFValue::Clone()
return new RTFValue(m_nValue, m_sValue, *m_pAttributes, *m_pSprms, m_xShape, m_xStream, m_xObject, m_bForceString, *m_pShape);
}
+RTFValue* RTFValue::CloneWithSprms(
+ RTFSprms const& rAttributes, RTFSprms const& rSprms)
+{
+ return new RTFValue(m_nValue, m_sValue, rAttributes, rSprms, m_xShape, m_xStream, m_xObject, m_bForceString, *m_pShape);
+}
+
bool RTFValue::equals(RTFValue& rOther)
{
if (m_nValue != rOther.m_nValue)
return false;
+ if (m_sValue != rOther.m_sValue)
+ return false;
if (m_pAttributes->size() != rOther.m_pAttributes->size())
return false;
else if (!m_pAttributes->equals(rOther))