From fe84ced08668ef0030fbd37bea52424fd86c8e7a Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 9 Feb 2024 13:40:10 -0500 Subject: tdf#126533 rtf import: page background fill I worked on this mainly to see what the impact of the docx changes would be on RTF. It seemed to be OK. This patch shows that RTF can now import gradient page backgrounds. It does NOT import image backgrounds (at least no the ones I tested) because they were specified as XML_sn: fillBlip XML_sv: which is an unknown property in RTFSdrImport::resolve. The only fill type that RTFSdrImport::resolve knows about is XML_gradient. The only existing unit test I noted was page-background.rtf Change-Id: Ie40b91468d21b29a102472c859cd1eecfcb2a5f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163199 Tested-by: Jenkins Reviewed-by: Justin Luth --- writerfilter/source/rtftok/rtfsdrimport.cxx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 031f24117d00..9c673e871835 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -1136,18 +1136,6 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap return; } - if (m_rImport.isInBackground()) - { - RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_Background_color, - new RTFValue(xPropertySet->getPropertyValue("FillColor").get())); - m_rImport.Mapper().props(new RTFReferenceProperties(std::move(aAttributes))); - - uno::Reference xComponent(xShape, uno::UNO_QUERY); - xComponent->dispose(); - return; - } - // Send it to dmapper if (xShape.is()) { @@ -1158,6 +1146,13 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap } } + if (m_rImport.isInBackground()) + { + RTFSprms aSprms; + aSprms.set(NS_ooxml::LN_background_background, new RTFValue()); // action="end" + m_rImport.Mapper().props(new RTFReferenceProperties(RTFSprms(), std::move(aSprms))); + } + // If the shape has an inner shape, the inner object's properties should not be influenced by // the outer one. rShape.getProperties().clear(); -- cgit v1.2.3