diff options
author | Justin Luth <justin_luth@sil.org> | 2018-03-30 21:36:42 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2018-04-28 06:14:58 +0200 |
commit | a3783c0af4bd21eb9c001aadc60c660c06a47779 (patch) | |
tree | 0ed0a5b17ac2d3207113f1d9c73b843b0fa76e18 | |
parent | a6a38c6de9c18fd1269fc8cfc0e070ef429c8e2f (diff) |
tdf#106062 ww8import: skip fake tab only on hanging indent
Export has changed, so that it only exports a tab when the
footnote paragraph has a hanging indent. Adjusting the import
code to match that change.
Please test with MSO before flagging this patch as a regression.
Certainly there will be some documents previously saved by LO
which will now, in LO, show an extra tab character after the footnote.
Any previously saved document without a hanging indent will display
this extra tab. However, MSO has always seen that extra tab, so
these patches are enhancing compatibility.
Change-Id: Id074ca0f3246eaee9807b907757cbeb6f1bbe7b4
Reviewed-on: https://gerrit.libreoffice.org/52173
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt | bin | 0 -> 14255 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 14 |
3 files changed, 21 insertions, 2 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt b/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt Binary files differnew file mode 100644 index 000000000000..af5e225ea08c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index bca0d6b745fb..bc9a104740bb 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -209,6 +209,15 @@ DECLARE_WW8EXPORT_TEST(testTdf108448_endNote, "tdf108448_endNote.odt") CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in Endnote i", 1, getParagraphs(xEndnote) ); } +DECLARE_WW8EXPORT_TEST(testTdf106062_nonHangingFootnote, "tdf106062_nonHangingFootnote.odt") +{ + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); + // This failed, tab between the footnote number and the footnote content was lost on import. + CPPUNIT_ASSERT_MESSAGE( "Footnote starts with a tab", xTextRange->getString().startsWith("\t") ); +} + DECLARE_WW8EXPORT_TEST(testTdf116570_exportFootnote, "tdf116570_exportFootnote.odt") { uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 56c45f4d5ba5..cb68c03c438d 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -245,10 +245,20 @@ sal_uInt16 SwWW8ImplReader::End_Footnote() const OUString &rText = pTNd->GetText(); if (rText[0] == sChar[0]) { + // Allow MSO to emulate LO footnote text starting at left margin - only meaningful with hanging indent + sal_Int32 nFirstLineIndent=0; + SfxItemSet aSet( m_rDoc.GetAttrPool(), svl::Items<RES_LR_SPACE, RES_LR_SPACE>{} ); + if ( pTNd->GetAttr(aSet) ) + { + const SvxLRSpaceItem* pLRSpace = aSet.GetItem<SvxLRSpaceItem>(RES_LR_SPACE); + if ( pLRSpace ) + nFirstLineIndent = pLRSpace->GetTextFirstLineOfst(); + } + m_pPaM->GetPoint()->nContent.Assign( pTNd, 0 ); m_pPaM->SetMark(); - // Strip out tabs we may have inserted on export #i24762# - if (rText.getLength() > 1 && rText[1] == 0x09) + // Strip out aesthetic tabs we may have inserted on export #i24762# + if (nFirstLineIndent < 0 && rText.getLength() > 1 && rText[1] == 0x09) ++m_pPaM->GetMark()->nContent; ++m_pPaM->GetMark()->nContent; m_xReffingStck->Delete(*m_pPaM); |