sw/source/filter/ww8/docxexport.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 57244c2096782dbedfd55cea5629ae08433e204a
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Feb 9 17:26:52 2024 -0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Feb 26 08:43:38 2024 +0100

    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 <jl...@mail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163863
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 46e66a4a42a0..a4c06ab5ac5b 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);
             }

Reply via email to