diff options
author | Justin Luth <justin.luth@collabora.com> | 2024-02-09 13:40:10 -0500 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2024-02-24 13:14:03 +0100 |
commit | fe84ced08668ef0030fbd37bea52424fd86c8e7a (patch) | |
tree | e2275dd6f14655bee05c3a42583bd21c145a7a79 | |
parent | dd5710a8dd4e05059ac248243d950e28d830905d (diff) |
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: <shape_as_text_string>
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 <jluth@mail.com>
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 19 |
1 files 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<sal_Int32>())); - m_rImport.Mapper().props(new RTFReferenceProperties(std::move(aAttributes))); - - uno::Reference<lang::XComponent> 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(); |