From 6f42a2c8631bace1caa4fac0b3ea554942f1fca3 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 12 Aug 2022 14:10:31 +0200 Subject: tdf#150382 writerfilter,sw: RTF import of paragraph border override The style (default unnamed \s0, applied via \pard) defines green borders, which are overridden at the 2nd paragraph and cleared. Of course there isn't a single border control word to be found on the 2nd paragraph, the override happens by omitting the borders of the implicitly applied style. Hence handle LN_CT_PrBase_pBdr in getDefaultSPRM(). The export of the override relies on changes from commit 967a03eb8760fb498c5ea6c32d03d1eea486bbe2. Change-Id: I081eb2908d76123e7828cab6c31ceb7b11760183 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138193 Tested-by: Jenkins Reviewed-by: Michael Stahl --- writerfilter/source/rtftok/rtfsprm.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'writerfilter') diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index 2edfec829edf..90bc97001d27 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -199,6 +199,22 @@ static RTFValue::Pointer_t getDefaultSPRM(Id const id, Id nStyleType) // presumably this means 100%, cf. static const int nSingleLineSpacing = 240; return new RTFValue(240); + case NS_ooxml::LN_CT_PrBase_pBdr: + { // tdf#150382 default all paragraph borders to none + RTFSprms attributes; + RTFSprms sprms; + for (int i = 0; i < 4; ++i) + { + auto const nBorder = getParagraphBorder(i); + RTFSprms aAttributes; + RTFSprms aSprms; + aAttributes.set(NS_ooxml::LN_CT_Border_val, + new RTFValue(NS_ooxml::LN_Value_ST_Border_none)); + sprms.set(nBorder, new RTFValue(aAttributes, aSprms)); + } + return new RTFValue(attributes, sprms); + } + default: break; } -- cgit