sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |    3 +++
 sw/source/filter/ww8/wrtw8nds.cxx         |   11 +++++++++--
 sw/source/filter/ww8/wrtww8.hxx           |    2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 4c4fb36222f6c624cfdea82ce266bf9d99073558
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jan 14 11:55:55 2022 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jan 14 14:44:17 2022 +0100

    Restore tdf#134951 docxexport: stop duplicating stuff in postponed text
    
    Partially revert commit f261fae4af72b1328bc3e93fc52a9a24ce0975b3
    to restore deb892628a1501527c8c41b85a65282df95b81b1 because as reported
    by jluth the test case testfdo79008 that failed was apparently somewhat
    misleading and the test case testTdf134951_duplicates that should test
    comments erroneously failed to fail because it is doing a loadAndSave()
    instead of a loadAndReload().
    
    Change-Id: I7e788287da3b1742f65697ec350997d175db9e69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128410
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index ef128fb59eef..327e7e88569e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -136,9 +136,12 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo79008)
      */
     parseExport("word/document.xml");
 
+#if 0
+    // TODO: jluth says this test case needs more work
     // tdf#134951: there is only one comment
     xmlDocUniquePtr pXmlSettings = parseExport("word/comments.xml");
     assertXPath(pXmlSettings, "/w:comments/w:comment", 1);
+#endif
 
     // Read-only is set, but it is not enforced, so it should be off...
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument 
*>(mxComponent.get());
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 2cd392279f01..f092b8f6f1d0 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -394,7 +394,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
     return nMinPos;
 }
 
-void SwWW8AttrIter::OutAttr(sal_Int32 nSwPos, bool bWriteCombChars)
+void SwWW8AttrIter::OutAttr(sal_Int32 nSwPos, bool bWriteCombChars, bool 
bPostponeSingleUse)
 {
     m_rExport.AttrOutput().RTLAndCJKState( mbCharIsRTL, GetScript() );
 
@@ -458,6 +458,13 @@ void SwWW8AttrIter::OutAttr(sal_Int32 nSwPos, bool 
bWriteCombChars)
                         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()));
             }
@@ -2649,7 +2656,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);
+                aAttrIter.OutAttr(nCurrentPos, false, bPostponeWritingText);
                 AttrOutput().EndRunProperties( pRedlineData );
             }
 
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 4df6d5c24fe8..bd960da05d7a 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1542,7 +1542,7 @@ public:
 
     void NextPos() { if ( nCurrentSwPos < SAL_MAX_INT32 ) nCurrentSwPos = 
SearchNext( nCurrentSwPos + 1 ); }
 
-    void OutAttr(sal_Int32 nSwPos, bool bWriteCombinedChars);
+    void OutAttr(sal_Int32 nSwPos, bool bWriteCombinedChars, bool 
bPostponeSingleUse = false);
     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);

Reply via email to