sw/qa/extras/ooxmlexport/ooxmlexport15.cxx   |    6 ------
 sw/source/filter/ww8/docxattributeoutput.cxx |    2 +-
 sw/source/filter/ww8/wrtw8sty.cxx            |    5 ++++-
 sw/source/filter/ww8/wrtww8.cxx              |    1 +
 sw/source/filter/ww8/wrtww8.hxx              |    1 +
 5 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit a971b4c2ac8197e27ee30a21c02893fecb6fb989
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jan 15 11:21:32 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sun Jan 18 20:01:00 2026 +0100

    officeotron: duplicate <w:bidi/> elements
    
    we end up with:
    
    <w:document
       ..
            <w:bidi/>
            <w:bidi/>
            <w:docGrid w:type="default" w:linePitch="360" w:charSpace="0"/>
        </w:sectPr>
      </w:body>
    </w:document>
    
    Change-Id: Ie3a8cc5f02c40b5f4df7cb2efd43b057210fd4ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197423
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index aa92610d3f92..b25b420ab83f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -657,9 +657,6 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c14v2, "tdf135343_colu
 
 DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c12v3, 
"tdf135343_columnSectionBreak_c12v3.docx")
 {
-    //FIXME: validation error in OOXML export: Errors: 1
-    skipValidation();
-
     // In this Word 20-3 v3, section one and two have different number of 
columns. It acts like a page break.
     uno::Reference<beans::XPropertySet> xTextSection = 
getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(1, u"Four 
columns,"_ustr), u"TextSection"_ustr);
     uno::Reference<text::XTextColumns> xTextColumns = 
getProperty<uno::Reference<text::XTextColumns>>(xTextSection, 
u"TextColumns"_ustr);
@@ -673,9 +670,6 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c12v3, "tdf135343_colu
 
 DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c15, 
"tdf135343_columnSectionBreak_c15.docx")
 {
-    //FIXME: validation error in OOXML export: Errors: 1
-    skipValidation();
-
     // Word 2013+ version - nextColumn breaks inside column sections are 
always handled like nextPage breaks.
     uno::Reference<beans::XPropertySet> xTextSection = 
getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(12, u"RTL 
2"_ustr), u"TextSection"_ustr);
     uno::Reference<text::XTextColumns> xTextColumns = 
getProperty<uno::Reference<text::XTextColumns>>(xTextSection, 
u"TextColumns"_ustr);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7b823f80e2e9..df844f72b6a7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -10436,7 +10436,7 @@ void DocxAttributeOutput::FormatFrameDirection( const 
SvxFrameDirectionItem& rDi
     if ( m_rExport.m_bOutPageDescs )
     {
         m_pSerializer->singleElementNS(XML_w, XML_textDirection, FSNS(XML_w, 
XML_val), sTextFlow);
-        if ( bBiDi )
+        if ( bBiDi && !m_rExport.m_bSuppressBidi )
             m_pSerializer->singleElementNS(XML_w, XML_bidi);
     }
     else if ( !m_rExport.m_bOutFlyFrameAttrs )
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 2986f84f432f..bb3b9cc51059 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1763,14 +1763,17 @@ void MSWordExportBase::SectionProperties( const 
WW8_SepInfo& rSepInfo, WW8_PdAtt
             const SfxItemSet* pOldI = m_pISet;
             m_pISet = &aSet;
 
+            const bool bBiDi = SvxFrameDirection::Horizontal_RL_TB == 
TrueFrameDirection( *rSepInfo.pSectionFormat );
+            m_bSuppressBidi = bBiDi; // prevent duplicate <w:bidi/> elements
             // Switch off test on default item values, if page description
             // set (value of <bOutPgDscSet>) isn't written.
             AttrOutput().OutputStyleItemSet( aSet, bOutPgDscSet );
             bOutputStyleItemSet = true;
+            m_bSuppressBidi = false;
 
             //Cannot export as normal page framedir, as continuous sections
             //cannot contain any grid settings like proper sections
-            AttrOutput().SectionBiDi( SvxFrameDirection::Horizontal_RL_TB == 
TrueFrameDirection( *rSepInfo.pSectionFormat ) );
+            AttrOutput().SectionBiDi( bBiDi );
 
             m_pISet = pOldI;
         }
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 766f53434c1e..b960f625aa4f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3980,6 +3980,7 @@ MSWordExportBase::MSWordExportBase( SwDoc& rDocument, 
std::shared_ptr<SwUnoCurso
     , m_bHasFtr(false)
     , m_bSubstituteBullets(true)
     , m_bTabInTOC(false)
+    , m_bSuppressBidi(false)
     , m_bHideTabLeaderAndPageNumbers(false)
     , m_bExportModeRTF(false)
     , m_bFontSizeWritten(false)
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 9296e9719227..08906ab7fb73 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -560,6 +560,7 @@ public:
     bool m_bHasFtr : 1;
     bool m_bSubstituteBullets : 1; // true: SubstituteBullet() gets called
     bool m_bTabInTOC : 1; //true for TOC field flag 'w'
+    bool m_bSuppressBidi : 1; // prevent duplicate bidi elements
 
     bool m_bHideTabLeaderAndPageNumbers : 1 ; // true: the 'z' field of TOC is 
set.
     bool m_bExportModeRTF;

Reply via email to