tdf#143039 tdf#143106 sw: DOCX export: don't export duplicate flys

The problem is that at the end of the paragraph a second call to
OutFlys() is made in line 2730 and that causes the duplication; for
this call the value FLY_POSTPONED must be returned, not FLY_NONE.

(regression from 3eced2d524)

Also revert commit deb892628a because its
test fails now as 0 comments are exported; it was apparently another
problem introduced by the above commit, and apparently this fix helps
for duplication of comments too.

Change-Id: Ib9706e4c24db38c15a0170ba2e8f08fba5327f98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128386
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
This commit is contained in:
Michael Stahl
2022-01-13 14:14:44 +01:00
parent bb830461f0
commit f261fae4af
2 changed files with 5 additions and 11 deletions

View File

@@ -394,7 +394,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
return nMinPos;
}
void SwWW8AttrIter::OutAttr(sal_Int32 nSwPos, bool bWriteCombChars, bool bPostponeSingleUse)
void SwWW8AttrIter::OutAttr(sal_Int32 nSwPos, bool bWriteCombChars)
{
m_rExport.AttrOutput().RTLAndCJKState( mbCharIsRTL, GetScript() );
@@ -458,13 +458,6 @@ void SwWW8AttrIter::OutAttr(sal_Int32 nSwPos, bool bWriteCombChars, bool bPostpo
nWhichId = aIter.NextWhich();
}
}
else if (bPostponeSingleUse &&
(nWhich == RES_TXTATR_FTN || nWhich == RES_TXTATR_ANNOTATION || nWhich == RES_TXTATR_FIELD))
{
// Do not duplicate these multiple times when the character run is split.
// Skip this time - it will be attempted later.
// ?? also RES_TXTATR_REFMARK: RES_TXTATR_TOXMARK: RES_TXTATR_META: RES_TXTATR_METAFIELD: ??
}
else
aRangeItems[nWhich] = (&(pHt->GetAttr()));
}
@@ -717,7 +710,8 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
if (maFlyIter == maFlyFrames.end())
{
return FLY_NONE;
// tdf#143039 postponed prevents fly duplication at end of paragraph
return m_rExport.AttrOutput().IsFlyProcessingPostponed() ? FLY_POSTPONED : FLY_NONE;
}
/*
@@ -2655,7 +2649,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
// Output the character attributes
// #i51277# do this before writing flys at end of paragraph
AttrOutput().StartRunProperties();
aAttrIter.OutAttr(nCurrentPos, false, bPostponeWritingText);
aAttrIter.OutAttr(nCurrentPos, false);
AttrOutput().EndRunProperties( pRedlineData );
}

View File

@@ -1542,7 +1542,7 @@ public:
void NextPos() { if ( nCurrentSwPos < SAL_MAX_INT32 ) nCurrentSwPos = SearchNext( nCurrentSwPos + 1 ); }
void OutAttr(sal_Int32 nSwPos, bool bWriteCombinedChars, bool bPostponeSingleUse = false);
void OutAttr(sal_Int32 nSwPos, bool bWriteCombinedChars);
virtual const SfxPoolItem* HasTextItem( sal_uInt16 nWhich ) const override;
virtual const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const override;
int OutAttrWithRange(const SwTextNode& rNode, sal_Int32 nPos);