summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-01-16 22:04:32 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-01-19 08:36:14 +0000
commitad08abd824e28f2f166a231635db9f4ac1a68eae (patch)
treead66374ca4eabb16bd554e1679a1202c25b7de64
parent99c4b9effe38917eb2063d15aed0d879508c110e (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> (cherry picked from commit 34d32031ed2ab1969377abbc91981a056fe375b7) Reviewed-on: https://gerrit.libreoffice.org/33243 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/tdf92470_footnoteRestart.docxbin0 -> 5154 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport3.cxx9
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx14
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
new file mode 100755
index 000000000000..b8746968b44a
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf92470_footnoteRestart.docx
Binary files differ
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 7830a3260126..1673f7403f2e 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 );