[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth
justin_luth at sil.org
Mon Mar 26 08:32:17 UTC 2018
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 add7a962bc33b3c1f2252a9920bebf324df688de
Author: Justin Luth <justin_luth at sil.org>
Date: Wed Mar 21 21:57:54 2018 +0300
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.
Change-Id: Ia54cea1b04c747a021032f46f22b673fe6658995
Reviewed-on: https://gerrit.libreoffice.org/51755
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 11401fe20323..12483de3a041 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 7d6819593646..143dd510ab2e 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2434,8 +2434,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 99558ecc13cf..e4553b6217f3 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1831,6 +1831,8 @@ void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_u
SwPaM* pOldEnd = m_pOrigPam;
bool bOldPageDescs = m_bOutPageDescs;
m_bOutPageDescs = false;
+ if ( nTTyp == TXT_FTN || nTTyp == TXT_EDN )
+ m_bAddFootnoteTab = true; // enable one aesthetic tab for this footnote
SetCurPam(nStart, nEnd);
@@ -3614,6 +3616,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 c678921485d2..f56c81ce3d8d 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -563,6 +563,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