diff options
author | Justin Luth <justin_luth@sil.org> | 2017-01-16 22:04:32 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2017-01-18 04:43:38 +0000 |
commit | 34d32031ed2ab1969377abbc91981a056fe375b7 (patch) | |
tree | 63d365268058da83e600f4ef5ecfc1e679da85b6 | |
parent | fa2eb4b43fc872c171129d477cfabe9fa29d78ce (diff) |
tdf#92470 docxexport: add support for XML_numRestart
Although import handled whether footnote numbering restarted
every page, chapter(section) or document, that information
was not being exported in docx.
Change-Id: If9e0a1d53c8610b18b949fd918c5dd7d7bd94682
Reviewed-on: https://gerrit.libreoffice.org/33183
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
-rwxr-xr-x | sw/qa/extras/ooxmlexport/data/tdf92470_footnoteRestart.docx | bin | 0 -> 5154 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 14 |
3 files changed, 23 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf92470_footnoteRestart.docx b/sw/qa/extras/ooxmlexport/data/tdf92470_footnoteRestart.docx Binary files differnew file mode 100755 index 000000000000..b8746968b44a --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf92470_footnoteRestart.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index f93ace6ad4c3..e5e4880556c4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/Hatch.hpp> +#include <ftninfo.hxx> #include <string> @@ -110,6 +111,14 @@ DECLARE_OOXMLEXPORT_TEST(testFdo68787, "fdo68787.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPageStyle, "FootnoteLineRelativeWidth")); } +DECLARE_OOXMLEXPORT_TEST(testTdf92470_footnoteRestart, "tdf92470_footnoteRestart.docx") +{ + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT( pDoc ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote doesn't restart every Page", FTNNUM_PAGE, pDoc->GetFootnoteInfo().eNum ); +} + DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt") { uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 8ac45b248cf4..17a592db61db 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6989,6 +6989,20 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr if( info.nFootnoteOffset != 0 ) fs->singleElementNS( XML_w, XML_numStart, FSNS( XML_w, XML_val ), OString::number( info.nFootnoteOffset + 1).getStr(), FSEND ); + + const SwFootnoteInfo* pFootnoteInfo = dynamic_cast<const SwFootnoteInfo*>(&info); + if( pFootnoteInfo ) + { + switch( pFootnoteInfo->eNum ) + { + case FTNNUM_PAGE: fmt = "eachPage"; break; + case FTNNUM_CHAPTER: fmt = "eachSect"; break; + default: fmt = nullptr; break; + } + if( fmt != nullptr ) + fs->singleElementNS( XML_w, XML_numRestart, FSNS( XML_w, XML_val ), fmt, FSEND ); + } + if( listtag != 0 ) // we are writing to settings.xml, write also special footnote/endnote list { // there are currently only two hardcoded ones ( see FootnotesEndnotes()) fs->singleElementNS( XML_w, listtag, FSNS( XML_w, XML_id ), "0", FSEND ); |