[Libreoffice-commits] core.git: 3 commits - sd/CppunitTest_sd_import_tests.mk sd/CppunitTest_sd_misc_tests.mk sd/inc sd/qa sd/source

Michael Stahl mstahl at redhat.com
Mon Jul 25 10:17:16 UTC 2016


 sd/CppunitTest_sd_import_tests.mk  |    5 ++++-
 sd/CppunitTest_sd_misc_tests.mk    |    5 ++++-
 sd/inc/EffectMigration.hxx         |    2 ++
 sd/qa/unit/data/sxi/ooo41061-1.sxi |binary
 sd/qa/unit/export-tests-ooxml1.cxx |    6 +-----
 sd/qa/unit/export-tests-ooxml2.cxx |   21 +--------------------
 sd/qa/unit/export-tests.cxx        |   33 ++++++++++++++++++++++++++++-----
 sd/qa/unit/sdmodeltestbase.hxx     |   33 ++++++++++++++++++++++++++++++++-
 sd/source/core/EffectMigration.cxx |   25 +++++++++++++++++++++++++
 sd/source/ui/docshell/docshel4.cxx |    3 +++
 10 files changed, 100 insertions(+), 33 deletions(-)

New commits:
commit 2f758cdd01a998292a93091f951ad96668139a5b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 25 11:47:25 2016 +0200

    move parseExport to SdExportTest base class
    
    Change-Id: I20cc59e21aa1b99d8cee5a9f60c0703e9c457187

diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk
index a2a2956..0440e3d 100644
--- a/sd/CppunitTest_sd_import_tests.mk
+++ b/sd/CppunitTest_sd_import_tests.mk
@@ -11,7 +11,10 @@
 
 $(eval $(call gb_CppunitTest_CppunitTest,sd_import_tests))
 
-$(eval $(call gb_CppunitTest_use_external,sd_import_tests,boost_headers))
+$(eval $(call gb_CppunitTest_use_externals,sd_import_tests,\
+	boost_headers \
+	libxml2 \
+))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sd_import_tests, \
     sd/qa/unit/import-tests \
diff --git a/sd/CppunitTest_sd_misc_tests.mk b/sd/CppunitTest_sd_misc_tests.mk
index 8c9cfa6..fd6250b 100644
--- a/sd/CppunitTest_sd_misc_tests.mk
+++ b/sd/CppunitTest_sd_misc_tests.mk
@@ -11,7 +11,10 @@
 
 $(eval $(call gb_CppunitTest_CppunitTest,sd_misc_tests))
 
-$(eval $(call gb_CppunitTest_use_external,sd_misc_tests,boost_headers))
+$(eval $(call gb_CppunitTest_use_externals,sd_misc_tests,\
+	boost_headers \
+	libxml2 \
+))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sd_misc_tests, \
     sd/qa/unit/misc-tests \
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 14d29d9..402f03b 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -9,8 +9,6 @@
 #include <officecfg/Office/Common.hxx>
 #include "sdmodeltestbase.hxx"
 #include "Outliner.hxx"
-#include <test/xmltesttools.hxx>
-#include <comphelper/processfactory.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <svl/stritem.hxx>
 #include <editeng/editobj.hxx>
@@ -40,7 +38,6 @@
 #include <svx/xflclit.hxx>
 #include <animations/animationnodehelper.hxx>
 #include <unotools/mediadescriptor.hxx>
-#include <unotools/ucbstreamhelper.hxx>
 #include <rtl/ustring.hxx>
 
 #include <vcl/opengl/OpenGLWrapper.hxx>
@@ -67,7 +64,6 @@
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
@@ -81,7 +77,7 @@
 using namespace css;
 using namespace css::animations;
 
-class SdOOXMLExportTest1 : public SdModelTestBase, public XmlTestTools
+class SdOOXMLExportTest1 : public SdModelTestBaseXML
 {
 public:
     void testFdo90607();
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 83eecaa..7805017 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -9,8 +9,6 @@
 #include <officecfg/Office/Common.hxx>
 #include "sdmodeltestbase.hxx"
 #include "Outliner.hxx"
-#include <test/xmltesttools.hxx>
-#include <comphelper/processfactory.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <svl/stritem.hxx>
 #include <editeng/editobj.hxx>
@@ -40,7 +38,6 @@
 #include <svx/xflclit.hxx>
 #include <animations/animationnodehelper.hxx>
 #include <unotools/mediadescriptor.hxx>
-#include <unotools/ucbstreamhelper.hxx>
 #include <rtl/ustring.hxx>
 
 #include <vcl/opengl/OpenGLWrapper.hxx>
@@ -67,7 +64,6 @@
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
@@ -81,7 +77,7 @@
 using namespace css;
 using namespace css::animations;
 
-class SdOOXMLExportTest2 : public SdModelTestBase, public XmlTestTools
+class SdOOXMLExportTest2 : public SdModelTestBaseXML
 {
 public:
     void testTdf93883();
@@ -158,21 +154,6 @@ public:
         }
     }
 
-    xmlDocPtr parseExport(utl::TempFile & rTempFile, OUString const& rStreamName)
-    {
-        OUString const url(rTempFile.GetURL());
-        uno::Reference<packages::zip::XZipFileAccess2> const xZipNames(
-            packages::zip::ZipFileAccess::createWithURL(
-                comphelper::getComponentContext(m_xSFactory), url));
-        uno::Reference<io::XInputStream> const xInputStream(
-            xZipNames->getByName(rStreamName), uno::UNO_QUERY);
-        std::unique_ptr<SvStream> const pStream(
-            utl::UcbStreamHelper::CreateStream(xInputStream, true));
-        xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get());
-        pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup(
-            reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr())));
-        return pXmlDoc;
-    }
 };
 
 void SdOOXMLExportTest2::testTdf93883()
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index d24daa7..5ecb651 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -9,8 +9,6 @@
 #include <officecfg/Office/Common.hxx>
 #include "sdmodeltestbase.hxx"
 #include "Outliner.hxx"
-#include <test/xmltesttools.hxx>
-#include <comphelper/processfactory.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <svl/stritem.hxx>
 #include <editeng/editobj.hxx>
@@ -40,7 +38,6 @@
 #include <svx/xflclit.hxx>
 #include <animations/animationnodehelper.hxx>
 #include <unotools/mediadescriptor.hxx>
-#include <unotools/ucbstreamhelper.hxx>
 #include <rtl/ustring.hxx>
 
 #include <vcl/opengl/OpenGLWrapper.hxx>
@@ -67,7 +64,6 @@
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
@@ -82,7 +78,7 @@
 using namespace css;
 using namespace css::animations;
 
-class SdExportTest : public SdModelTestBase, public XmlTestTools
+class SdExportTest : public SdModelTestBaseXML
 {
 public:
     void testN821567();
@@ -138,21 +134,6 @@ public:
         }
     }
 
-    xmlDocPtr parseExport(utl::TempFile & rTempFile, OUString const& rStreamName)
-    {
-        OUString const url(rTempFile.GetURL());
-        uno::Reference<packages::zip::XZipFileAccess2> const xZipNames(
-            packages::zip::ZipFileAccess::createWithURL(
-                comphelper::getComponentContext(m_xSFactory), url));
-        uno::Reference<io::XInputStream> const xInputStream(
-            xZipNames->getByName(rStreamName), uno::UNO_QUERY);
-        std::unique_ptr<SvStream> const pStream(
-            utl::UcbStreamHelper::CreateStream(xInputStream, true));
-        xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get());
-        pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup(
-            reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr())));
-        return pXmlDoc;
-    }
 };
 
 void SdExportTest::testN821567()
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index c4dcc80..33b63eb 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -12,14 +12,17 @@
 
 #include <test/bootstrapfixture.hxx>
 #include <test/xmldiff.hxx>
+#include <test/xmltesttools.hxx>
 
 #include <unotest/filters-test.hxx>
 #include <unotest/macros_test.hxx>
 
 #include "drawdoc.hxx"
 #include "../source/ui/inc/DrawDocShell.hxx"
-#include "unotools/tempfile.hxx"
+#include <unotools/tempfile.hxx>
+#include <unotools/ucbstreamhelper.hxx>
 #include <tools/color.hxx>
+#include <comphelper/processfactory.hxx>
 
 #include <rtl/strbuf.hxx>
 #include <sfx2/docfile.hxx>
@@ -27,6 +30,7 @@
 #include <svl/itemset.hxx>
 
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
 #include <drawinglayer/XShapeDumper.hxx>
 #include <com/sun/star/text/XTextField.hpp>
 
@@ -358,6 +362,30 @@ protected:
         xPropSet->getPropertyValue("TextField") >>= xField;
         return xField;
     }
+
+};
+
+class SdModelTestBaseXML
+    : public SdModelTestBase, public XmlTestTools
+{
+
+public:
+    xmlDocPtr parseExport(utl::TempFile & rTempFile, OUString const& rStreamName)
+    {
+        OUString const url(rTempFile.GetURL());
+        uno::Reference<packages::zip::XZipFileAccess2> const xZipNames(
+            packages::zip::ZipFileAccess::createWithURL(
+                comphelper::getComponentContext(m_xSFactory), url));
+        uno::Reference<io::XInputStream> const xInputStream(
+            xZipNames->getByName(rStreamName), uno::UNO_QUERY);
+        std::unique_ptr<SvStream> const pStream(
+            utl::UcbStreamHelper::CreateStream(xInputStream, true));
+        xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get());
+        pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup(
+            reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr())));
+        return pXmlDoc;
+    }
+
 };
 
 CPPUNIT_NS_BEGIN
commit 5206929f3a125a739adb860709586a0f50cb9611
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Jul 24 00:02:23 2016 +0200

    sd: OOoXML import: fix loss of animations
    
    There are 2 different animation formats, legacy one used in OOoXML
    format, based on presentation:animations element, and SMIL based one
    used in ODF format, based on a node hierarchy with
    <anim:par presentation:node-type="timing-root"> at the top.
    
    The problem is that when the legacy animations are imported, they are
    not immediately set on the draw-page in the same way as the new
    animations are imported.
    
    "soffice --convert-to odp ooo28334-1.sxi" loses all of the animations,
    whereas loading the file in the UI and storing it all animations are
    converted, and if you use API load/store methods some are converted and
    some not depending on timing.
    
    The problem is that there is a necessary conversion step
    MainSequence::implRebuild() that needs to happen after all the
    EffectMigration calls for a particular SdPage are finished, which
    is only triggered by a timer MainSequence::onTimerHdl().
    
    Fix it by forcing a call to implRebuild() from DrawDocShell::Load().
    
    Note: SdDrawDocument::NewOrLoadCompleted() is a horribly misleading
    function name as it is actually called *before* loading the document.
    
    Change-Id: I9881cb9bf2ae6ccc5fcf06602343f2d0e0704699

diff --git a/sd/inc/EffectMigration.hxx b/sd/inc/EffectMigration.hxx
index 033e4ed..f1702b1 100644
--- a/sd/inc/EffectMigration.hxx
+++ b/sd/inc/EffectMigration.hxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/presentation/AnimationSpeed.hpp>
 #include <com/sun/star/presentation/FadeEffect.hpp>
 
+class SdDrawDocument;
 class SdPage;
 class SvxShape;
 class SdAnimationInfo;
@@ -68,6 +69,7 @@ public:
 
     static void SetAnimationPath( SvxShape* pShape, SdrPathObj* pPathObj );
     static void CreateAnimatedGroup(SdrObjGroup& rGroupObj, SdPage& rPage);
+    static void DocumentLoaded(SdDrawDocument & rDoc);
 };
 
 } // end of namespace sd
diff --git a/sd/qa/unit/data/sxi/ooo41061-1.sxi b/sd/qa/unit/data/sxi/ooo41061-1.sxi
new file mode 100644
index 0000000..4c2482a
Binary files /dev/null and b/sd/qa/unit/data/sxi/ooo41061-1.sxi differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 7d1cb39..d24daa7 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -89,6 +89,7 @@ public:
     void testMediaEmbedding();
     void testFdo84043();
     void testSwappedOutImageExport();
+    void testOOoXMLAnimations();
     void testTdf80020();
     void testLinkedGraphicRT();
     void testImageWithSpecialID();
@@ -102,6 +103,7 @@ public:
     CPPUNIT_TEST(testMediaEmbedding);
     CPPUNIT_TEST(testFdo84043);
     CPPUNIT_TEST(testSwappedOutImageExport);
+    CPPUNIT_TEST(testOOoXMLAnimations);
     CPPUNIT_TEST(testTdf80020);
     CPPUNIT_TEST(testLinkedGraphicRT);
     CPPUNIT_TEST(testImageWithSpecialID);
@@ -116,10 +118,12 @@ public:
         struct { char const * pPrefix; char const * pURI; } namespaces[] =
         {
             // ODF
+            { "anim", "urn:oasis:names:tc:opendocument:xmlns:animation:1.0" },
             { "draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" },
             { "fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" },
             { "number", "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" },
             { "office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" },
+            { "presentation", "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" },
             { "style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" },
             { "svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" },
             { "table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0" },
@@ -340,6 +344,28 @@ void SdExportTest::testSwappedOutImageExport()
     }
 }
 
+void SdExportTest::testOOoXMLAnimations()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/sxi/ooo41061-1.sxi"), SXI);
+
+    uno::Reference<lang::XComponent> xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
+    uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
+    utl::MediaDescriptor aMediaDescriptor;
+    aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8);
+    utl::TempFile aTempFile;
+    aTempFile.EnableKillingFile();
+    xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+
+    xDocShRef->DoClose();
+
+    // the problem was that legacy OOoXML animations were lost if store
+    // immediately follows load because they were "converted" async by a timer
+    xmlDocPtr pXmlDoc = parseExport(aTempFile, "content.xml");
+    assertXPath(pXmlDoc, "//anim:par[@presentation:node-type='timing-root']", 26);
+    // currently getting 52 of these without the fix (depends on timing)
+    assertXPath(pXmlDoc, "//anim:par", 223);
+}
+
 void SdExportTest::testTdf80020()
 {
     ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80020.odp"), ODP);
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 9df7837..c4dcc80 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -52,6 +52,7 @@ struct FileFormat
 #define PDF_FORMAT_TYPE  ( SfxFilterFlags::STARONEFILTER | SfxFilterFlags::ALIEN | SfxFilterFlags::IMPORT | SfxFilterFlags::PREFERED )
 #define FODG_FORMAT_TYPE  (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT)
 #define FODP_FORMAT_TYPE  (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT)
+#define SXI_FORMAT_TYPE  (SfxFilterFlags::IMPORT | SfxFilterFlags::TEMPLATE | SfxFilterFlags::OWN | SfxFilterFlags::ALIEN | SfxFilterFlags::PREFERED | SfxFilterFlags::ENCRYPTION)
 
 /** List of file formats we support in Impress unit tests.
 
@@ -70,6 +71,7 @@ FileFormat aFileFormats[] =
     { "pdf",  "draw_pdf_import", "pdf_Portable_Document_Format", "", PDF_FORMAT_TYPE },
     { "fodg",  "OpenDocument Drawing Flat XML", "Flat XML ODF Drawing", "", FODG_FORMAT_TYPE },
     { "fodp",  "OpenDocument Presentation Flat XML", "Flat XML ODF Presentation", "", FODP_FORMAT_TYPE },
+    { "sxi",  "StarOffice XML (Impress)", "OpenOffice.org 1.0 Presentation", "", SXI_FORMAT_TYPE },
     { nullptr, nullptr, nullptr, nullptr, SfxFilterFlags::NONE }
 };
 
@@ -80,6 +82,7 @@ FileFormat aFileFormats[] =
 #define PDF  4
 #define FODG 5
 #define FODP 6
+#define SXI 7
 
 /// Base class for filter tests loading or roundtriping a document, and asserting the document model.
 class SdModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest
diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx
index 83ca865..ab2a461 100644
--- a/sd/source/core/EffectMigration.cxx
+++ b/sd/source/core/EffectMigration.cxx
@@ -1427,4 +1427,29 @@ void EffectMigration::CreateAnimatedGroup(SdrObjGroup& rGroupObj, SdPage& rPage)
     }
 }
 
+void EffectMigration::DocumentLoaded(SdDrawDocument & rDoc)
+{
+    if (DOCUMENT_TYPE_DRAW == rDoc.GetDocumentType())
+        return; // no animations in Draw
+    for (sal_uInt16 n = 0; n < rDoc.GetSdPageCount(PK_STANDARD); ++n)
+    {
+        SdPage *const pPage = rDoc.GetSdPage(n, PK_STANDARD);
+        if (pPage->hasAnimationNode())
+        {
+            // this will force the equivalent of the MainSequence::onTimerHdl
+            // so that the animations are present in export-able representation
+            // *before* the import is finished
+            pPage->getMainSequence()->getRootNode();
+        }
+    }
+    for (sal_uInt16 n = 0; n < rDoc.GetMasterSdPageCount(PK_STANDARD); ++n)
+    {
+        SdPage *const pPage = rDoc.GetMasterSdPage(n, PK_STANDARD);
+        if (pPage->hasAnimationNode())
+        {
+            pPage->getMainSequence()->getRootNode();
+        }
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 5fa1204..0b9e6a2 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -62,6 +62,7 @@
 #include "ViewShell.hxx"
 #include "sdmod.hxx"
 #include "View.hxx"
+#include "EffectMigration.hxx"
 #include "CustomAnimationEffect.hxx"
 #include "sdpage.hxx"
 #include "sdresid.hxx"
@@ -300,6 +301,8 @@ bool DrawDocShell::Load( SfxMedium& rMedium )
 
     if( bRet )
     {
+        // for legacy markup in OOoXML filter, convert the animations now
+        EffectMigration::DocumentLoaded(*GetDoc());
         UpdateTablePointers();
 
         // If we're an embedded OLE object, use tight bounds
commit e32a795eee3d6b2c4c4be112674d37b39d3e315f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 25 12:04:19 2016 +0200

    Revert "loplugin:unreffun"
    
    This reverts commit eeb852ea1ecb77c2980d44075429b06e7d420c3a.
    
    Only the function in export-tests.cxx which is now used.
    
    Change-Id: I0751a4fd2d651676cfee42dd077b1d438a98fc92

diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 4598014..7d1cb39 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -133,6 +133,22 @@ public:
                 reinterpret_cast<xmlChar const *>(namespaces[i].pURI));
         }
     }
+
+    xmlDocPtr parseExport(utl::TempFile & rTempFile, OUString const& rStreamName)
+    {
+        OUString const url(rTempFile.GetURL());
+        uno::Reference<packages::zip::XZipFileAccess2> const xZipNames(
+            packages::zip::ZipFileAccess::createWithURL(
+                comphelper::getComponentContext(m_xSFactory), url));
+        uno::Reference<io::XInputStream> const xInputStream(
+            xZipNames->getByName(rStreamName), uno::UNO_QUERY);
+        std::unique_ptr<SvStream> const pStream(
+            utl::UcbStreamHelper::CreateStream(xInputStream, true));
+        xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get());
+        pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup(
+            reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr())));
+        return pXmlDoc;
+    }
 };
 
 void SdExportTest::testN821567()


More information about the Libreoffice-commits mailing list