summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-03-23 12:40:14 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-03-28 15:07:59 +0200
commit7e92a996d1588bdf2ff1e2df10220a0f57686cfb (patch)
tree65fc42fff23ae9aebda0015170fd4b83f5c7a7f1
parent21827d1776b3c47ecab76561cf3e95bbf79f4a6e (diff)
tdf#116570 ww8 export: skip sectionbreak for footnotes
An extra CR was added at the start of each footnote. I'm guessing these documents started life as "end of document" footnotes in Word. SectionBreaksAndFrames is only used by .doc, so this will not affect .docx and .rtf (which are both fine anyway). I forgot that I recently fixed the same problem for endnotes in tdf#108448. Nice to have found example footnote documents also. Change-Id: Ib496e02d9ff46dbc2337a6d3dfe164a625b09a83 Reviewed-on: https://gerrit.libreoffice.org/51771 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/inc/swmodeltestbase.hxx18
-rw-r--r--sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odtbin0 -> 16416 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx20
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx2
4 files changed, 25 insertions, 15 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index b4b39aad7f27..de9db84162f5 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -498,13 +498,14 @@ protected:
return aValue;
}
- /// Get number of paragraphs of the document.
- int getParagraphs()
+ int getParagraphs( uno::Reference<text::XText> const & xText )
{
- uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
int nRet = 0;
+ if ( ! xText.is() )
+ return nRet;
+
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xText->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
while (xParaEnum->hasMoreElements())
{
xParaEnum->nextElement();
@@ -513,6 +514,13 @@ protected:
return nRet;
}
+ /// Get number of paragraphs of the document.
+ int getParagraphs()
+ {
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ return getParagraphs( xTextDocument->getText() );
+ }
+
uno::Reference<text::XTextContent> getParagraphOrTable(int number, uno::Reference<text::XText> const & xText = uno::Reference<text::XText>()) const
{
assert(number != 0); // this thing is 1-based
diff --git a/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt b/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt
new file mode 100644
index 000000000000..c1598eb71c9f
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index ab640d848931..bca0d6b745fb 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -206,15 +206,17 @@ DECLARE_WW8EXPORT_TEST(testTdf108448_endNote, "tdf108448_endNote.odt")
uno::Reference<text::XText> xEndnote;
xEndnotes->getByIndex(0) >>= xEndnote;
- uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xEndnote->getText(), uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
- int nRet = 0;
- while (xParaEnum->hasMoreElements())
- {
- xParaEnum->nextElement();
- nRet++;
- }
- CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in Endnote i", 1, nRet );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in Endnote i", 1, getParagraphs(xEndnote) );
+}
+
+DECLARE_WW8EXPORT_TEST(testTdf116570_exportFootnote, "tdf116570_exportFootnote.odt")
+{
+ uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
+ uno::Reference<text::XText> xFootnoteText;
+ xFootnotes->getByIndex(0) >>= xFootnoteText;
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in first footnote", 2, getParagraphs(xFootnoteText) );
}
DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJustification.doc")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index e4553b6217f3..ce893b951085 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2706,7 +2706,7 @@ void MSWordExportBase::WriteText()
SwNode& rNd = m_pCurPam->GetNode();
// no section breaks exported for Endnotes
- if ( rNd.IsTextNode() && m_nTextTyp != TXT_EDN )
+ if ( rNd.IsTextNode() && m_nTextTyp != TXT_EDN && m_nTextTyp != TXT_FTN )
{
SwSoftPageBreakList breakList;
// if paragraph need to be split than handle section break somewhere