sw/qa/extras/ooxmlexport/data/tdf170516_drawingBeforePlainText.docx |binary sw/source/filter/ww8/wrtw8nds.cxx | 10 ++++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
New commits: commit 09c6ea865ea8c86d9359bd92684d61bf23c237a7 Author: Justin Luth <[email protected]> AuthorDate: Mon Feb 23 17:45:18 2026 -0500 Commit: Miklos Vajna <[email protected]> CommitDate: Tue Feb 24 14:23:15 2026 +0100 tdf#170516 docx export: return proper StateOfFlyProcessing In forum-mso-en-13717.docx there are two flies anchored before the plainText SDT and one fly anchored afterwards. After processing two flies, OutFlys was returning the value FLY_NOT_PROCESSED because there was still one more fly left on the paragraph - that it wasn't supposed to process yet. Well, the usage of OutFlys was wondering whether anything had been written inside a w:r, so returning FLY_PROCESSED is more appropriate. AFAICS, FLY_POSTPONED is based on the time it is called (i.e. within RunProperties instead of inside a run) so I would NOT expect one fly to be PROCESSED and another fly to be POSTPONED. In any case, that seems super fragile anwyay, so I tried to just do something sane here. Ideally the whole POSTPONED thing would go away... make CppunitTest_sw_ooxmlexport25 \ CPPUNIT_TEST_NAME=testTdf170516_drawingBeforePlainText Change-Id: I7fcfc084f525b9eb64cb5cf285321fb458b069f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200132 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> (cherry picked from commit 49dee0dd73be06af22cb7198ab80c3a7c377e352) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200134 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/data/tdf170516_drawingBeforePlainText.docx b/sw/qa/extras/ooxmlexport/data/tdf170516_drawingBeforePlainText.docx index fa054c0c9ac3..e7879e0b9b3b 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf170516_drawingBeforePlainText.docx and b/sw/qa/extras/ooxmlexport/data/tdf170516_drawingBeforePlainText.docx differ diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index a391c341fcf4..4bbf24378247 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -812,6 +812,7 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos) May have an anchored graphic to be placed, loop through sorted array and output all at this position */ + FlyProcessingState nRet = FLY_NOT_PROCESSED; while ( maFlyIter != maFlyFrames.end() ) { const SwPosition &rAnchor = maFlyIter->GetPosition(); @@ -819,7 +820,7 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos) assert(nPos >= nSwPos && "a fly must get flagged as a nextAttr/CurrentPos"); if ( nPos != nSwPos ) - return FLY_NOT_PROCESSED ; // We haven't processed the fly + return nRet; const SdrObject* pSdrObj = maFlyIter->GetFrameFormat().FindRealSdrObject(); @@ -854,8 +855,13 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos) m_rExport.AttrOutput().OutputFlyFrame( *maFlyIter ); } ++maFlyIter; + + if (nRet != FLY_PROCESSED && m_rExport.AttrOutput().IsFlyProcessingPostponed()) + nRet = FLY_POSTPONED; + else + nRet = FLY_PROCESSED; // at least one fly was processed } - return ( m_rExport.AttrOutput().IsFlyProcessingPostponed() ? FLY_POSTPONED : FLY_PROCESSED ) ; + return nRet; } bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos ) const
