sw/source/filter/ww8/docxexport.cxx |    5 +++++
 sw/source/filter/ww8/docxexport.hxx |    2 ++
 sw/source/filter/ww8/rtfexport.hxx  |    2 ++
 sw/source/filter/ww8/wrtw8sty.cxx   |    1 +
 sw/source/filter/ww8/wrtww8.hxx     |    4 ++++
 5 files changed, 14 insertions(+)

New commits:
commit db233078ea597912e0a8caceaf75d0b6d9825f2e
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Jan 14 11:07:21 2026 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Thu Jan 15 15:49:01 2026 +0100

    officeotron: fillcolor is not valid for framePr
    
    because of some generic code adding attributes to the flyAttrList, we end 
with:
    
    <w:pPr>
        ...
        <w:framePr fillcolor="#FF00FF"/>
    
    inside word/header1.xml, which is not valid.
    
    Unfortunately, the code structure here does not allow an elegant solution,
    we need a new virtual method to be able to get at the flyAttrList and clear 
it,
    to prevent attributes leaking into elements they are not meant for.
    
    Change-Id: I2bfd6b1afd78e722a29d79cf853a4678b7d0dea4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197248
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit f748949b6ffe6e8ef2a7fd27c70669efe8ac3818)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197285
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 74959a4a1437..0711544ab60e 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -739,6 +739,11 @@ void DocxExport::PrepareNewPageDesc( const SfxItemSet* 
pSet,
 
 }
 
+void DocxExport::ClearFlyAttrList()
+{
+    SdrExporter().getFlyAttrList().clear();
+}
+
 void DocxExport::InitStyles()
 {
     m_pStyles.reset(new MSWordStyles( *this, /*bListStyles =*/ true ));
diff --git a/sw/source/filter/ww8/docxexport.hxx 
b/sw/source/filter/ww8/docxexport.hxx
index 0e20b9f30e58..e3d80eb13d0d 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -245,6 +245,8 @@ protected:
                                      const SwPageDesc* pNewPgDesc,
                                      bool bExtraPageBreak = false) override;
 
+    virtual void ClearFlyAttrList() override;
+
 private:
     /// Setup pStyles and write styles.xml
     void InitStyles();
diff --git a/sw/source/filter/ww8/rtfexport.hxx 
b/sw/source/filter/ww8/rtfexport.hxx
index 71d242ef8647..cab87086c40c 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -151,6 +151,8 @@ protected:
     void AppendSection(const SwPageDesc* pPageDesc, const SwSectionFormat* 
pFormat,
                        sal_uLong nLnNum) override;
 
+    void ClearFlyAttrList() override {}
+
 public:
     /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class.
     RtfExport(RtfExportFilter* pFilter, SwDoc& rDocument, 
std::shared_ptr<SwUnoCursor>& pCurrentPam,
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index d8d277768724..95b77175b38f 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1867,6 +1867,7 @@ void MSWordExportBase::SectionProperties( const 
WW8_SepInfo& rSepInfo, WW8_PdAtt
             }
 
             AttrOutput().OutputStyleItemSet( pPdFormat->GetAttrSet(), false );
+            ClearFlyAttrList(); // so they do not leak into other elements
 
             if (titlePage)
             {
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 4cba24900374..de4787723bf8 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -936,6 +936,8 @@ protected:
 
     virtual bool IsDummyFloattableAnchor(SwNode& /*rNode*/) const { return 
false; }
 
+    virtual void ClearFlyAttrList() = 0;
+
 public:
     MSWordExportBase(SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & 
pCurrentPam, SwPaM* pOriginalPam);
     virtual ~MSWordExportBase();
@@ -1235,6 +1237,8 @@ protected:
 
     virtual void AppendSection( const SwPageDesc *pPageDesc, const 
SwSectionFormat* pFormat, sal_uLong nLnNum ) override;
 
+    virtual void ClearFlyAttrList() override {}
+
 private:
     WW8Export(const WW8Export&) = delete;
     WW8Export& operator=(const WW8Export&) = delete;

Reply via email to