summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfdocumentimpl.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-09-24 23:07:16 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-09-25 08:40:12 +0200
commit49614a9ea971ff7f370f863ce8a2735aab973cee (patch)
treecb4dcde41909007d9f9c31d0b0d9e1cef2e0a43b /writerfilter/source/rtftok/rtfdocumentimpl.cxx
parent7a8acab1ee7a9396b514e901b1e4fbd51bacb586 (diff)
tdf#119599 RTF import: fix missing deduplication of font size
Deciding when to and when not to deduplicate repeated direct formatting of paragraph / character properties is stricky, this bug is about a case when deduplication should happen and did not, since commit 1970a686273c5d4fc1eeb4430283e37085d9f647 (tdf#113408 RTF import style dedup: separate paragraph and character handling, 2017-10-31). Especially that deduplication works in both directions: it should remove properties which are duplicated and also should insert explicit default values for not repeated properties. Fix the problem by making the getDefaultSPRM() aware of the context (which style type it deals with), and then by making sure that only default properties relevant for the given style type are inserted. Change-Id: I35b6599cc47fa51b8754fd921c61a3b31a283547 Reviewed-on: https://gerrit.libreoffice.org/60946 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'writerfilter/source/rtftok/rtfdocumentimpl.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b5a96b401e89..f45e9b484cfd 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -487,12 +487,10 @@ RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms const& rSprms, Id
RTFSprms aStyleSprms;
RTFSprms aStyleAttributes;
// Ensure the paragraph style is a flat list.
- if (!nStyleType || nStyleType == NS_ooxml::LN_Value_ST_StyleType_paragraph)
- {
- RTFReferenceProperties& rProps
- = *static_cast<RTFReferenceProperties*>(it->second.get());
- lcl_copyFlatten(rProps, aStyleAttributes, aStyleSprms);
- }
+ // Take paragraph style into account for character properties as well,
+ // as paragraph style may contain character properties.
+ RTFReferenceProperties& rProps = *static_cast<RTFReferenceProperties*>(it->second.get());
+ lcl_copyFlatten(rProps, aStyleAttributes, aStyleSprms);
if (itChar != m_aStyleTableEntries.end())
{
@@ -506,8 +504,8 @@ RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms const& rSprms, Id
}
// Get rid of direct formatting what is already in the style.
- RTFSprms const sprms(aSprms.cloneAndDeduplicate(aStyleSprms));
- RTFSprms const attributes(rAttributes.cloneAndDeduplicate(aStyleAttributes));
+ RTFSprms const sprms(aSprms.cloneAndDeduplicate(aStyleSprms, nStyleType));
+ RTFSprms const attributes(rAttributes.cloneAndDeduplicate(aStyleAttributes, nStyleType));
return new RTFReferenceProperties(attributes, sprms);
}