summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-03-21 21:57:54 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-05-18 10:31:41 +0200
commit195f4f6840d105ae6cb9c16bd499924fa3d99f1e (patch)
tree29478b201eba15cfbaafbb5ddbcebe634f34804f /sw
parent0e6f32b3fa4883cca7d413d494ad03e4a7d903f3 (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. (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@collabora.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-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 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;