summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/docxexport.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-02-09 15:43:32 -0500
committerMiklos Vajna <vmiklos@collabora.com>2024-02-21 08:42:31 +0100
commited91971c9312e4b8a33c03c28d339bff6c5accc7 (patch)
treef64b93b80b0bdab001969808d007a20020ee4988 /sw/source/filter/ww8/docxexport.cxx
parentbbb0663813d0476b9a654207b7006315cb417c2e (diff)
tdf#126533 docx export: page background vml fill: basic image
This is the absolute minimal possible combination to export an image to page background. However, none of the other properties that I see strike me as particularly important or connected to our image properties. Plus MSO ignores things like "frame" and tiles anyway. Import is also pretty basic, so any improvement to imports can also add the corresponding export component. For example: it seems like MSO tiles all images based on somewhat magical sizing (they do always export o:targetscreensize="999<w>,999<h>" which we ignore). But note that MSO does pixel display and not logical display for page background - something we do NOT want to emulate, so any importing of properties needs to be done intelligently. But MSO's UI only allows for basic image insertion, so very few files will have complex settings. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageBitmap Change-Id: Ib410594d1e3377aefb8ee94f209a1a1155154b17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163203 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source/filter/ww8/docxexport.cxx')
-rw-r--r--sw/source/filter/ww8/docxexport.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 869862909678..fcb55e19c314 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1911,11 +1911,25 @@ void DocxExport::WriteMainText()
// Write background page color
if (std::unique_ptr<SvxBrushItem> oBrush = getBackground(); oBrush)
{
- Color backgroundColor = oBrush->GetColor();
- OString aBackgroundColorStr = msfilter::util::ConvertColor(backgroundColor);
+ m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, XML_color),
+ msfilter::util::ConvertColor(oBrush->GetColor()));
- m_pDocumentFS->singleElementNS(XML_w, XML_background, FSNS(XML_w, XML_color),
- aBackgroundColorStr);
+ const GraphicObject* pGraphicObj = oBrush->GetGraphicObject();
+ if (pGraphicObj) // image/pattern/texture
+ {
+ const OUString aRelId = m_pDrawingML->writeGraphicToStorage(pGraphicObj->GetGraphic());
+ if (!aRelId.isEmpty())
+ {
+ m_pDocumentFS->startElementNS(XML_v, XML_background);
+
+ m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, XML_id), aRelId,
+ XML_type, "frame");
+
+ m_pDocumentFS->endElementNS(XML_v, XML_background);
+ }
+ }
+
+ m_pDocumentFS->endElementNS(XML_w, XML_background);
}
// body