diff options
-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); |