|author||Justin Luth <email@example.com>||2019-12-26 11:17:21 +0300|
|committer||Miklos Vajna <firstname.lastname@example.org>||2020-01-02 10:28:37 +0100|
tdf#129605 rtfimport: deduplicating borders loses information
Because at least ONE direct attribute still existes, that SPRM overrides the style SPRM, and therefore the style contents are ignored. But deduplicating has removed the matching parts from the paragraph, so any children properties that match the style revert to default values. In this unit test, only the green border-color was kept, and so a default none-border was created. The UI in writer also directly applies all border properties during a color change, so further style changes in the border-style or thickness no longer have any effect. So there is no reason to try to deduplicate border stuff. UNRESOLVED PROBLEM NOTE: If deduplication is going to happen, then there needs to be a merging of character style child attributes and the directly applied properties - which in practice is the same as not deduplicating at all. (The problem will still come when the paragraph ONLY redefines the border color - then there is nothing to deduplicate and still the style contents are ignored.) This patch affects paragraph-style borders (in a good way), since it fixes tdf#129631 as well. Probably every SPRM that expects children should just avoid deduplication... UNRESOLVED PROBLEM NOTE: Another problem is that the direct properties themselves do not seem to be deduplicated. In addition, deduplication happens against the FIRST instance of the property, not on the LAST instance (which ultimately is the winner). Change-Id: I97333fba66db5cfb5238de426821fe458def329b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85868 Tested-by: Jenkins Reviewed-by: Justin Luth <email@example.com> Reviewed-by: Miklos Vajna <firstname.lastname@example.org>
Diffstat (limited to 'writerfilter')
1 files changed, 13 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx
index 76838e3aa620..c7ae29effe2e 100644
@@ -211,6 +211,19 @@ static bool isSPRMDeduplicateBlacklist(Id nId)
// correct, keep these.
+ // \chbrdr requires *all* of the border settings to be present,
+ // otherwise a default (NONE) border is created from the removed
+ // attributes which then overrides the style-defined border.
+ // See BorderHandler.cxx and NS_ooxml::LN_EG_RPrBase_bdr in DomainMapper.
+ // This also is needed for NS_ooxml::LN_CT_PBdr_top etc.
+ case NS_ooxml::LN_CT_Border_sz:
+ case NS_ooxml::LN_CT_Border_val:
+ case NS_ooxml::LN_CT_Border_color:
+ case NS_ooxml::LN_CT_Border_space:
+ case NS_ooxml::LN_CT_Border_shadow:
+ case NS_ooxml::LN_CT_Border_frame:
+ case NS_ooxml::LN_CT_Border_themeTint:
+ case NS_ooxml::LN_CT_Border_themeColor: