[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0-29' - sw/qa sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Mon May 18 08:32:14 UTC 2020


 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |   15 +++++++++++++++
 sw/source/filter/ww8/wrtw8nds.cxx         |    3 ++-
 sw/source/filter/ww8/wrtww8.cxx           |    3 +++
 sw/source/filter/ww8/wrtww8.hxx           |    1 +
 4 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 195f4f6840d105ae6cb9c16bd499924fa3d99f1e
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Wed Mar 21 21:57:54 2018 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon May 18 10:31:41 2020 +0200

    tdf93121 MS export: only one fake tab per footnote
    
    Every paragraph was getting the fake tab added.
    
    The fake tab is only inserted by LO in order to emulate the
    spacing between the footnote character and the
    footnote paragraph, so it is not desirable to insert it
    before additional paragraphs.
    The fake tab is also only removed once per
    footnote during the import process, so this fake tab
    was altering the document during the first round-trip.
    
    (cherry picked from commit add7a962bc33b3c1f2252a9920bebf324df688de)
    
    Conflicts:
            sw/source/filter/ww8/wrtww8.cxx
    
    Change-Id: Ia54cea1b04c747a021032f46f22b673fe6658995
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94324
    Tested-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 52f632cdbb3b..88e15f302270 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -18,6 +18,7 @@
 #include <com/sun/star/style/TabStop.hpp>
 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
 #include <com/sun/star/text/XTextFrame.hpp>
 #include <com/sun/star/text/XTextTable.hpp>
 #include <com/sun/star/text/XTextFramesSupplier.hpp>
@@ -527,6 +528,20 @@ DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
     if (!pXmlEndNotes)
         return;
     assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14");
+
+    //tdf#93121 don't add fake tabs in front of extra footnote paragraphs
+    uno::Reference<text::XFootnotesSupplier> xFootnoteSupp(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xFootnoteIdxAcc(xFootnoteSupp->getFootnotes(), uno::UNO_QUERY);
+    uno::Reference<text::XFootnote> xFootnote(xFootnoteIdxAcc->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<text::XText> xFootnoteText(xFootnote, uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess>xParaEnumAccess(xFootnoteText->getText(), uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration>xParaEnum = xParaEnumAccess->createEnumeration();
+
+    uno::Reference<text::XTextRange> xTextRange;
+    xParaEnum->nextElement();
+    xParaEnum->nextElement() >>= xTextRange;
+    OUString sFootnotePara = xTextRange->getString();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Paragraph starts with W(87), not tab(9)", u'W', sFootnotePara[0] );
 }
 
 DECLARE_OOXMLEXPORT_TEST(testfdo79668,"fdo79668.docx")
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 9361943a7636..93bf00b75482 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2509,8 +2509,9 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
                 if ( ( m_nTextTyp == TXT_EDN || m_nTextTyp == TXT_FTN ) && nAktPos == 0 && nLen > 0 )
                 {
                     // Insert tab for aesthetic purposes #i24762#
-                    if ( aSnippet[0] != 0x09 )
+                    if ( m_bAddFootnoteTab && aSnippet[0] != 0x09 )
                         aSnippet = "\x09" + aSnippet;
+                    m_bAddFootnoteTab = false;
                 }
 
                 if ( bPostponeWritingText && ( FLY_POSTPONED != nStateOfFlyFrame ) )
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 64bf90dfdac5..18b21ff63bef 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1826,6 +1826,8 @@ void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_u
     bool bOldPageDescs = m_bOutPageDescs;
     m_bOutPageDescs = false;
                                     // bOutKF was set / stored in WriteKF1
+    if ( nTTyp == TXT_FTN || nTTyp == TXT_EDN )
+        m_bAddFootnoteTab = true;   // enable one aesthetic tab for this footnote
     SetCurPam(nStart, nEnd);
 
     // clear linked textboxes since old ones can't be linked to frames in this section
@@ -3638,6 +3640,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM
     , m_bHideTabLeaderAndPageNumbers(false)
     , m_bExportModeRTF(false)
     , m_bFontSizeWritten(false)
+    , m_bAddFootnoteTab(false)
     , m_pDoc(pDocument)
     , m_nCurStart(pCurrentPam->GetPoint()->nNode.GetIndex())
     , m_nCurEnd(pCurrentPam->GetMark()->nNode.GetIndex())
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index c95323f6edfc..ab01bcdb576f 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -558,6 +558,7 @@ public:
     bool m_bExportModeRTF;
     /// Is font size written already as part of the current character properties?
     bool m_bFontSizeWritten;
+    bool m_bAddFootnoteTab;     // only one aesthetic spacing tab per footnote
 
     SwDoc *m_pDoc;
     sal_uLong m_nCurStart, m_nCurEnd;


More information about the Libreoffice-commits mailing list