[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth justin_luth at sil.org
Wed Jan 18 04:44:16 UTC 2017


 sw/qa/extras/ooxmlexport/data/tdf92470_footnoteRestart.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx                   |    9 +++++++
 sw/source/filter/ww8/docxattributeoutput.cxx                |   14 ++++++++++++
 3 files changed, 23 insertions(+)

New commits:
commit 34d32031ed2ab1969377abbc91981a056fe375b7
Author: Justin Luth <justin_luth at sil.org>
Date:   Mon Jan 16 22:04:32 2017 +0300

    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 at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

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 0000000..b874696
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf92470_footnoteRestart.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index f93ace6..e5e4880 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 8ac45b2..17a592d 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 );


More information about the Libreoffice-commits mailing list