diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-03-03 18:54:01 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-05-18 22:11:44 +0200 |
commit | 7355cba2c619c203ba1962aa710cb47273e08184 (patch) | |
tree | e4fd33826a3078636f91e463f3070c101df972ad /writerfilter | |
parent | 703262de20ea73409ec3de332b8a2df41ab40e16 (diff) |
fdo#78313 RTF import: retain font colors
This is a cherry-pick of two master commits:
RTFValue::equals: consider the number of attributes/sprms as well
(cherry picked from commit 4452fa9a2e741834a19c9b322fc8d9c8b06450de)
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.
(cherry picked from commit 8e8f9388c323ad3c32cef3f91609ad19386b7d56)
Conflicts:
writerfilter/source/rtftok/rtfsprm.hxx
Change-Id: I351de414b6734336b31c1334dbd2349072f16002
Reviewed-on: https://gerrit.libreoffice.org/9316
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfsprm.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsprm.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfvalue.cxx | 12 |
3 files changed, 21 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index c6d917294c4e..c79c6e25a217 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -143,6 +143,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) { diff --git a/writerfilter/source/rtftok/rtfsprm.hxx b/writerfilter/source/rtftok/rtfsprm.hxx index 19f0514f5a39..a8892071a094 100644 --- a/writerfilter/source/rtftok/rtfsprm.hxx +++ b/writerfilter/source/rtftok/rtfsprm.hxx @@ -60,6 +60,7 @@ namespace writerfilter { Iterator_t begin() { return m_pSprms->begin(); } Iterator_t end() { return m_pSprms->end(); } void clear(); + bool equals(RTFValue& rOther); private: void ensureCopyBeforeWrite(); boost::intrusive_ptr<RTFSprmsImpl> m_pSprms; diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx index 7af638ff8219..132233c7940c 100644 --- a/writerfilter/source/rtftok/rtfvalue.cxx +++ b/writerfilter/source/rtftok/rtfvalue.cxx @@ -210,7 +210,17 @@ RTFValue* RTFValue::Clone() bool RTFValue::equals(RTFValue& rOther) { - return m_nValue == rOther.m_nValue; + if (m_nValue != rOther.m_nValue) + 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; } RTFSprms& RTFValue::getAttributes() |