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

Miklos Vajna vmiklos at collabora.co.uk
Thu Aug 28 02:02:43 PDT 2014


 oox/source/ppt/pptimport.cxx |    2 ++
 sd/qa/unit/import-tests.cxx  |   16 ++++++++++++++++
 2 files changed, 18 insertions(+)

New commits:
commit ef2668bad976f1fbb70759887cafd35ea7833655
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Aug 28 10:08:02 2014 +0200

    PPTX import: fix missing document metadata
    
    Without this, the creation / modification date is lost on import.
    
    Change-Id: I0b74ac91aee7b8b3e0bc763247086a3a39816bc1

diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index de5ee83..c3d733a 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -82,6 +82,8 @@ bool PowerPointImport::importDocument()
         file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
     OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
 
+    importDocumentProperties();
+
     OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "officeDocument" );
     FragmentHandlerRef xPresentationFragmentHandler( new PresentationFragmentHandler( *this, aFragmentPath ) );
     maTableStyleListPath = xPresentationFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "tableStyles" );
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 288ac79..3131937 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -32,7 +32,9 @@
 #include <svx/svdotable.hxx>
 #include <svx/xflclit.hxx>
 #include <animations/animationnodehelper.hxx>
+#include <sax/tools/converter.hxx>
 
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
@@ -71,6 +73,7 @@ public:
     void testN862510_4();
     void testBnc870237();
     void testBnc887225();
+    void testCreationDate();
 
     CPPUNIT_TEST_SUITE(SdFiltersTest);
     CPPUNIT_TEST(testDocumentLayout);
@@ -90,6 +93,7 @@ public:
     CPPUNIT_TEST(testN862510_4);
     CPPUNIT_TEST(testBnc870237);
     CPPUNIT_TEST(testBnc887225);
+    CPPUNIT_TEST(testCreationDate);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -553,6 +557,18 @@ void SdFiltersTest::testBnc870237()
     xDocShRef->DoClose();
 }
 
+void SdFiltersTest::testCreationDate()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71434.pptx"), PPTX);
+    uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY);
+    uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
+    util::DateTime aDate = xDocumentProperties->getCreationDate();
+    OUStringBuffer aBuffer;
+    sax::Converter::convertDateTime(aBuffer, aDate, 0);
+    // Metadata wasn't imported, this was 0000-00-00.
+    CPPUNIT_ASSERT_EQUAL(OUString("2013-11-09T10:37:56"), aBuffer.makeStringAndClear());
+}
+
 void SdFiltersTest::testBnc887225()
 {
     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bnc887225.pptx"), PPTX );


More information about the Libreoffice-commits mailing list