summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-03-21 21:57:54 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-03-26 10:31:46 +0200
commitadd7a962bc33b3c1f2252a9920bebf324df688de (patch)
tree182bd70c034d78446ddc4952d86e9ac75817009e
parentd5903802e2c40d6fccbc322c49b5f9a311551b9b (diff)
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@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx15
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx3
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx3
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1
4 files changed, 21 insertions, 1 deletions
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;