sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 6 --- sw/qa/extras/uiwriter/data/tdf168157.docx |binary sw/qa/extras/uiwriter/uiwriter8.cxx | 27 ++++++++++++++++ sw/source/core/doc/DocumentContentOperationsManager.cxx | 3 - 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 8 files changed, 35 insertions(+), 10 deletions(-)
New commits: commit af2f05eb5f0b0d492b935829368e121f4c84ed63 Author: Noel Grandin <[email protected]> AuthorDate: Thu Jan 15 11:21:32 2026 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Jan 22 19:54:48 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 (cherry picked from commit a971b4c2ac8197e27ee30a21c02893fecb6fb989) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197553 Reviewed-by: Xisco Fauli <[email protected]> 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 73d23da6d7a9..0673a2601423 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -10447,7 +10447,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 5aa6c208235b..a9991dfc6dda 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; commit 52d9973d835758d44de583b3b13862b5ed557f18 Author: Xisco Fauli <[email protected]> AuthorDate: Tue Jan 13 13:02:51 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Jan 22 19:54:38 2026 +0100 tdf#168157: sw_uiwriter8: Add test Change-Id: Ib8e85cdfa32175c94df296a1f5c5b9e701faf102 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197193 Reviewed-by: Xisco Fauli <[email protected]> Tested-by: Jenkins Reviewed-by: Dan Williams <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197551 diff --git a/sw/qa/extras/uiwriter/data/tdf168157.docx b/sw/qa/extras/uiwriter/data/tdf168157.docx new file mode 100644 index 000000000000..e737fb68bb00 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf168157.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index f91a0db7e1b1..aebb38aa28b0 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -3067,6 +3067,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf153636) } } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf168157_crash_after_pasting_and_undoing) +{ + createSwDoc("tdf168157.docx"); + + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + + dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); + + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); + + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); + + CPPUNIT_ASSERT_EQUAL(2, getShapes()); + + dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); + + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); + + CPPUNIT_ASSERT_EQUAL(1, getShapes()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf157129) { // Unit test for tdf#157129 commit 4e333ad9294a5a57d719284ec1a7ed65d0fa4d85 Author: Xisco Fauli <[email protected]> AuthorDate: Tue Jan 13 12:52:36 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Jan 22 19:54:33 2026 +0100 tdf#168157: Revert "writer: when pasting Copy paragraph style when dest node is " "" This reverts commit 251798c9b4f2ebad447953c3a4b1048e48cd30e3. The reverted commit doesn't point to any ticket in Bugzilla/Github, besides it doesn't have any test covering the fix, so it's very hard to tell what it tries to fix. There has not been any response from the author in https://gerrit.libreoffice.org/c/core/+/189900 or tdf#168157 either, so reverting it for now before the release of LibreOffice 26.2. Change-Id: I6ef5b81f33ab38cc180c457f04a238289d4d1513 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197192 Tested-by: Jenkins Reviewed-by: Dan Williams <[email protected]> Reviewed-by: Xisco Fauli <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197550 diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 61b9297ca4ef..0472afa6e1eb 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -5195,9 +5195,8 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo SwTextNode* pSttTextNd = pStart->GetNode().GetTextNode(); SwTextNode* pEndTextNd = pEnd->GetNode().GetTextNode(); SwTextNode* pDestTextNd = aInsPos.GetNode().GetTextNode(); - bool bDestTextNdEmpty = pDestTextNd && (pDestTextNd->GetText().isEmpty() || pDestTextNd->GetText() == " "); bool bCopyCollFormat = !rDoc.IsInsOnlyTextGlossary() && - ( bDestTextNdEmpty || + ( (pDestTextNd && !pDestTextNd->GetText().getLength()) || ( !bOneNode && !rPos.GetContentIndex() ) ); bool bCopyBookmarks = true; bool bCopyPageSource = false;
