summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-02-09 17:26:52 -0500
committerMiklos Vajna <vmiklos@collabora.com>2024-02-21 08:45:08 +0100
commitd7cd7dff0e8f71b3d83b4c91b574f39248a25e2f (patch)
tree2b8c30f33ffdc6e3b42ccda52a1f89cc7b68fcfa
parented91971c9312e4b8a33c03c28d339bff6c5accc7 (diff)
tdf#126533 docx export: page background vml fill: tiles/patterns
This patch only benefits LO. MSO ignores "frame" and always treats page background as it if were tiled, but that is a trait we do NOT want to mimic. Textures are the primary fill type that needs to be tiled (instead of scaled/stretched). LO export also treats patterns as tiled bitmaps, and the end result of exporting as a tile looks the same as the original pattern. It just loses HOW the page background (i.e. as a pattern) but that is very low value. It is rather difficult to export as a true pattern and just not worth the effort of identifying the correct fore/background colors, converting to b&w image, and inverting the B&W image if the first pixel is white instead of black. [Hatching seems similar to patterns, but rarely (and only coincidentally) would it tile well. I think hatching is a new DML-only thing. Hatching is not in the page background UI of MS Word. LO just exports any hatching as a solid color.] Change-Id: I5cd3f1c6e380edb5e5b21900bad289fa298574e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163206 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
-rw-r--r--sw/source/filter/ww8/docxexport.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index fcb55e19c314..466fe652d5dd 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -55,6 +55,7 @@
#include <oox/ole/olehelper.hxx>
#include <svx/svdpage.hxx>
+#include <svx/xflbmtit.hxx>
#include <map>
#include <algorithm>
@@ -1914,6 +1915,7 @@ void DocxExport::WriteMainText()
m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, XML_color),
msfilter::util::ConvertColor(oBrush->GetColor()));
+ const SwAttrSet& rPageStyleAttrSet = m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet();
const GraphicObject* pGraphicObj = oBrush->GetGraphicObject();
if (pGraphicObj) // image/pattern/texture
{
@@ -1922,8 +1924,12 @@ void DocxExport::WriteMainText()
{
m_pDocumentFS->startElementNS(XML_v, XML_background);
+ // Although MSO treats everything as tile, it is better for LO to not always tile
+ OString sType = "frame"_ostr; // single image
+ if (rPageStyleAttrSet.Get(XATTR_FILLBMP_TILE).GetValue())
+ sType = "tile"_ostr; // primarily for patterns / textures
m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, XML_id), aRelId,
- XML_type, "frame");
+ XML_type, sType);
m_pDocumentFS->endElementNS(XML_v, XML_background);
}