[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - oox/source sd/qa

Miklos Vajna vmiklos at collabora.co.uk
Thu Aug 28 04:28:42 PDT 2014


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

New commits:
commit c46620ffd96638377018e6da0d31c46c4b4d3016
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.
    
    (cherry picked from commit ef2668bad976f1fbb70759887cafd35ea7833655)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>
    
    Conflicts:
    	sd/qa/unit/import-tests.cxx
    
    Change-Id: I0b74ac91aee7b8b3e0bc763247086a3a39816bc1

diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index d294b79..259e716 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -77,6 +77,8 @@ bool PowerPointImport::importDocument() throw()
         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 f4f4f08..7920e0e 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -27,7 +27,9 @@
 #include <svx/svdoole2.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>
@@ -63,6 +65,7 @@ public:
     void testBnc870233_2();
     void testBnc880763();
     void testBnc862510_5();
+    void testCreationDate();
 
     CPPUNIT_TEST_SUITE(SdFiltersTest);
     CPPUNIT_TEST(testDocumentLayout);
@@ -79,6 +82,7 @@ public:
     CPPUNIT_TEST(testBnc870233_2);
     CPPUNIT_TEST(testBnc880763);
     CPPUNIT_TEST(testBnc862510_5);
+    CPPUNIT_TEST(testCreationDate);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -434,6 +438,18 @@ void SdFiltersTest::testBnc870237()
     xDocShRef->DoClose();
 }
 
+void SdFiltersTest::testCreationDate()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/n593612.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("2008-12-10T19:12:35"), aBuffer.makeStringAndClear());
+}
+
 void SdFiltersTest::testBnc870233_1()
 {
     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"));


More information about the Libreoffice-commits mailing list