[Libreoffice-commits] core.git: 3 commits - embeddedobj/source include/oox oox/source sd/CppunitTest_sd_export_tests.mk sd/qa

Zolnai Tamás tamas.zolnai at collabora.com
Mon Dec 22 07:37:46 PST 2014


 embeddedobj/source/msole/oleembed.cxx                   |   11 +
 include/oox/export/shapes.hxx                           |    2 
 oox/source/drawingml/shape.cxx                          |   13 +
 oox/source/drawingml/textparagraphproperties.cxx        |   12 +
 oox/source/drawingml/textparagraphpropertiescontext.cxx |    5 
 oox/source/export/shapes.cxx                            |  108 ++++++++++++----
 sd/CppunitTest_sd_export_tests.mk                       |   41 ------
 sd/qa/unit/data/odp/bnc822341.odp                       |binary
 sd/qa/unit/data/pptx/bnc862510_6.pptx                   |binary
 sd/qa/unit/data/pptx/bnc862510_7.pptx                   |binary
 sd/qa/unit/export-tests.cxx                             |   37 +++++
 sd/qa/unit/import-tests.cxx                             |   75 +++++++++++
 12 files changed, 230 insertions(+), 74 deletions(-)

New commits:
commit 7a64988dbc7a1542aa38f0e8f9a8a47941fbc67d
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Dec 22 16:36:27 2014 +0100

    bnc#862510: PPTX import: Wrong text vertical adjustment inside shape.
    
    When alignment is not specified, it should be set to the
    default "left" value just on time, when properties are
    pushed to the property set, otherwise uninitialized value
    is better.
    
    Change-Id: Ic294c5d7cc477f7515aea1c071ad9b67275c012d

diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index 22bab14..a4797f3 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/style/TabStop.hpp>
 #include <com/sun/star/text/PositionAndSpaceMode.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
 
 #include <osl/diagnose.h>
 
@@ -381,6 +382,8 @@ void TextParagraphProperties::apply( const TextParagraphProperties& rSourceProps
         moFirstLineIndentation = rSourceProps.moFirstLineIndentation;
     if( rSourceProps.mnLevel )
         mnLevel = rSourceProps.mnLevel;
+    if( rSourceProps.moParaAdjust )
+        moParaAdjust = rSourceProps.moParaAdjust;
 }
 
 void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
@@ -478,6 +481,15 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
             aPropSet.setProperty( PROP_ParaTabStops, aSeq );
         }
     }
+
+    if ( moParaAdjust )
+    {
+        aPropSet.setProperty( PROP_ParaAdjust, moParaAdjust.get());
+    }
+    else
+    {
+        aPropSet.setProperty( PROP_ParaAdjust, com::sun::star::style::ParagraphAdjust_LEFT);
+    }
 }
 
 float TextParagraphProperties::getCharHeightPoints( float fDefault ) const
diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx
index 6d51ee5..06c6625 100644
--- a/oox/source/drawingml/textparagraphpropertiescontext.cxx
+++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx
@@ -54,7 +54,10 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler2H
     PropertyMap& rPropertyMap( mrTextParagraphProperties.getTextParagraphPropertyMap() );
 
     // ST_TextAlignType
-    rPropertyMap.setProperty( PROP_ParaAdjust, GetParaAdjust( rAttribs.getToken( XML_algn, XML_l ) ));
+    if ( rAttribs.hasAttribute( XML_algn ) )
+    {
+        mrTextParagraphProperties.getParaAdjust() = GetParaAdjust( rAttribs.getToken( XML_algn, XML_l ) );
+    }
     // TODO see to do the same with RubyAdjust
 
     // ST_Coordinate32
diff --git a/sd/qa/unit/data/pptx/bnc862510_7.pptx b/sd/qa/unit/data/pptx/bnc862510_7.pptx
new file mode 100644
index 0000000..0eb3bbe
Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc862510_7.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 771746b..c33176f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -53,6 +53,7 @@
 #include <com/sun/star/chart2/data/XDataSequence.hpp>
 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
 
 #include <stlpool.hxx>
 
@@ -90,6 +91,7 @@ public:
     void testBnc904423();
     void testShapeLineStyle();
     void testBnc862510_6();
+    void testBnc862510_7();
 
     CPPUNIT_TEST_SUITE(SdImportTest);
     CPPUNIT_TEST(testDocumentLayout);
@@ -120,6 +122,7 @@ public:
     CPPUNIT_TEST(testBnc904423);
     CPPUNIT_TEST(testShapeLineStyle);
     CPPUNIT_TEST(testBnc862510_6);
+    CPPUNIT_TEST(testBnc862510_7);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -1033,6 +1036,38 @@ void SdImportTest::testBnc862510_6()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testBnc862510_7()
+{
+    // Title shape's text was aligned to left instead of center.
+    ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_7.pptx"), PPTX);
+
+    uno::Reference< drawing::XDrawPagesSupplier > xDoc(
+        xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
+
+    uno::Reference< drawing::XDrawPage > xPage(
+        xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+
+    uno::Reference< beans::XPropertySet > xShape(
+        xPage->getByIndex(0), uno::UNO_QUERY );
+    CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
+
+    // Get first paragraph
+    uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
+    CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
+    uno::Reference<container::XEnumerationAccess> paraEnumAccess;
+    paraEnumAccess.set(xText, uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
+    uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
+                uno::UNO_QUERY_THROW);
+    uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
+
+    sal_Int16 nParaAdjust = 0;
+    xPropSet->getPropertyValue( "ParaAdjust" ) >>= nParaAdjust;
+    CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(nParaAdjust));
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 89206c472ecf18bfde6824cea8004921cd404365
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Dec 21 15:39:36 2014 +0100

    bnc#862510: PPTX import: Wrong text color inside shape
    
    When theme index is 0, it means it's unset so we should not
    apply that.
    
    Change-Id: I62a9cd2a9b4c19f5acffc334d5e8263fe24fc8fd

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 9cffa09..7fdfefd 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1042,11 +1042,14 @@ Reference< XShape > Shape::createAndInsert(
                 TextCharacterProperties aCharStyleProperties;
                 if( const ShapeStyleRef* pFontRef = getShapeStyleRef( XML_fontRef ) )
                 {
-                    if( pTheme )
-                        if( const TextCharacterProperties* pCharProps = pTheme->getFontStyle( pFontRef->mnThemedIdx ) )
-                            aCharStyleProperties.assignUsed( *pCharProps );
-                    SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "use font color");
-                    aCharStyleProperties.maCharColor.assignIfUsed( pFontRef->maPhClr );
+                    if( pFontRef->mnThemedIdx != 0 )
+                    {
+                        if( pTheme )
+                            if( const TextCharacterProperties* pCharProps = pTheme->getFontStyle( pFontRef->mnThemedIdx ) )
+                                aCharStyleProperties.assignUsed( *pCharProps );
+                        SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "use font color");
+                        aCharStyleProperties.maCharColor.assignIfUsed( pFontRef->maPhClr );
+                    }
                 }
 
                 Reference < XTextCursor > xAt = xText->createTextCursor();
diff --git a/sd/qa/unit/data/pptx/bnc862510_6.pptx b/sd/qa/unit/data/pptx/bnc862510_6.pptx
new file mode 100644
index 0000000..fc5f008
Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc862510_6.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 1ee45bf..771746b 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -89,6 +89,7 @@ public:
     void testBnc584721_4();
     void testBnc904423();
     void testShapeLineStyle();
+    void testBnc862510_6();
 
     CPPUNIT_TEST_SUITE(SdImportTest);
     CPPUNIT_TEST(testDocumentLayout);
@@ -118,6 +119,7 @@ public:
     CPPUNIT_TEST(testBnc584721_4);
     CPPUNIT_TEST(testBnc904423);
     CPPUNIT_TEST(testShapeLineStyle);
+    CPPUNIT_TEST(testBnc862510_6);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -993,6 +995,44 @@ void SdImportTest::testShapeLineStyle()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testBnc862510_6()
+{
+    // Black text was imported instead of gray
+    ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_6.pptx"), PPTX);
+
+    uno::Reference< drawing::XDrawPagesSupplier > xDoc(
+        xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
+
+    uno::Reference< drawing::XDrawPage > xPage(
+        xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+
+    uno::Reference< beans::XPropertySet > xShape(
+        xPage->getByIndex(0), uno::UNO_QUERY );
+    CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
+
+    // Get first paragraph of the text
+    uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
+    CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
+    uno::Reference<container::XEnumerationAccess> paraEnumAccess;
+    paraEnumAccess.set(xText, uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
+    uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
+                uno::UNO_QUERY_THROW);
+
+    // Get first run of the paragraph
+    uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+    uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
+    uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
+    sal_Int32 nCharColor;
+    xPropSet->getPropertyValue( "CharColor" ) >>= nCharColor;
+
+    // Color should be black
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(0x8B8B8B), nCharColor );
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 0c3d5fb0ad35ff7fc18917fc86fa58d9312fe3ae
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Dec 21 15:38:10 2014 +0100

    bnc#822341: PPTX export of embedded text documents
    
    -Make embedded text documents exported by analogy with spreadsheet
    embedded documents.
    -Convert MS ole objects to LO sepcific objecst to allow
    exporting those ole objects too.
    
    Plus use gb_CppunitTest_use_rdb instead of wasting time on
    finding out which missing components cause test failing.
    Especcially when we have platform dependent components
    (e.g. related to embedded object)
    
    Change-Id: Ic76d659b51274777a1669c215344a1169ebcba81

diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 7bce91d..ca8b731 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -587,6 +587,17 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState )
         }
     }
     else
+#else
+    // if it is possible, the object will be converted to OOo format
+    if ( !m_bTriedConversion )
+    {
+        m_bTriedConversion = true;
+        if ( TryToConvertToOOo() )
+        {
+            changeState( nNewState );
+            return;
+        }
+    }
 #endif
     {
         throw embed::UnreachableStateException();
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index f0dcdcc..6403aec 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -43,7 +43,7 @@ namespace oox { namespace drawingml {
 class OOX_DLLPUBLIC ShapeExport : public DrawingML {
 
 private:
-    static int mnSpreadsheetCounter;
+    static int mnEmbeddeDocumentCounter;
     struct ShapeCheck
     {
         bool operator()( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s1, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s2 ) const
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 8d394fe..8fa575b 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -52,6 +52,7 @@
 #include <com/sun/star/text/XSimpleText.hpp>
 #include <com/sun/star/text/XText.hpp>
 #include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/text/XTextField.hpp>
 #include <com/sun/star/text/XTextRange.hpp>
 #include <com/sun/star/table/XTable.hpp>
@@ -111,7 +112,7 @@ namespace oox { namespace drawingml {
         mAny >>= variable;
 
 // not thread safe
-int ShapeExport::mnSpreadsheetCounter = 1;
+int ShapeExport::mnEmbeddeDocumentCounter = 1;
 
 ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ShapeHashMap* pShapeMap, XmlFilterBase* pFB, DocumentType eDocumentType, DMLTextExport* pTextExport )
     : DrawingML( pFS, pFB, eDocumentType, pTextExport )
@@ -988,47 +989,90 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
             }
             else
             {
-                // this part now supports only embedded spreadsheets, it can be extended to support remaining ooxml documents
-                // only exporter, counter and object filename are specific to spreadsheet
-                Reference< XSpreadsheetDocument > xSheetDoc( mAny, UNO_QUERY );
-                if( xSheetDoc.is() && mpFB)
+                const bool bSpreadSheet = Reference< XSpreadsheetDocument >( mAny, UNO_QUERY ).is();
+                const bool bTextDocument = Reference< css::text::XTextDocument >( mAny, UNO_QUERY ).is();
+                if( ( bSpreadSheet || bTextDocument ) && mpFB)
                 {
                     Reference< XComponent > xDocument( mAny, UNO_QUERY );
                     if( xDocument.is() )
                     {
-                        Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( OUStringBuffer()
-                                                                                          .appendAscii( GetComponentDir() )
-                                                                                          .appendAscii( "/embeddings/spreadsheet" )
-                                                                                          .append( (sal_Int32) mnSpreadsheetCounter )
-                                                                                          .appendAscii( ".xlsx" )
-                                                                                          .makeStringAndClear(),
-                                                                                          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" );
+                        Reference< XOutputStream > xOutStream;
+                        if( bSpreadSheet )
+                        {
+                            xOutStream = mpFB->openFragmentStream( OUStringBuffer()
+                                                                   .appendAscii( GetComponentDir() )
+                                                                   .appendAscii( "/embeddings/spreadsheet" )
+                                                                   .append( static_cast<sal_Int32>(mnEmbeddeDocumentCounter) )
+                                                                   .appendAscii( ".xlsx" )
+                                                                   .makeStringAndClear(),
+                                                                   "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" );
+                        }
+                        else
+                        {
+                            xOutStream = mpFB->openFragmentStream( OUStringBuffer()
+                                                                   .appendAscii( GetComponentDir() )
+                                                                   .appendAscii( "/embeddings/textdocument" )
+                                                                   .append( static_cast<sal_Int32>(mnEmbeddeDocumentCounter) )
+                                                                   .appendAscii( ".docx" )
+                                                                   .makeStringAndClear(),
+                                                                   "application/vnd.openxmlformats-officedocument.wordprocessingml.document" );
+                        }
+
                         // export the embedded document
                         Sequence< PropertyValue > rMedia(1);
 
                         rMedia[0].Name = utl::MediaDescriptor::PROP_STREAMFOROUTPUT();
                         rMedia[0].Value <<= xOutStream;
 
-                        Reference< XExporter > xExporter(
-                            mpFB->getComponentContext()->getServiceManager()->
-                                createInstanceWithContext(
-                                    "com.sun.star.comp.oox.xls.ExcelFilter",
-                                    mpFB->getComponentContext() ),
-                            UNO_QUERY_THROW );
+                        Reference< XExporter > xExporter;
+                        if( bSpreadSheet )
+                        {
+                            xExporter.set(
+                                mpFB->getComponentContext()->getServiceManager()->
+                                    createInstanceWithContext(
+                                        "com.sun.star.comp.oox.xls.ExcelFilter",
+                                        mpFB->getComponentContext() ),
+                                UNO_QUERY_THROW );
+                        }
+                        else
+                        {
+                            xExporter.set(
+                                mpFB->getComponentContext()->getServiceManager()->
+                                    createInstanceWithContext(
+                                        "com.sun.star.comp.Writer.WriterFilter",
+                                        mpFB->getComponentContext() ),
+                                UNO_QUERY_THROW );
+
+                        }
                         xExporter->setSourceDocument( xDocument );
                         Reference< XFilter >( xExporter, UNO_QUERY_THROW )->
                             filter( rMedia );
 
                         xOutStream->closeOutput();
 
-                        OUString sRelId = mpFB->addRelation( mpFS->getOutputStream(),
-                                                             "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package",
-                                                             OUStringBuffer()
-                                                             .appendAscii( GetRelationCompPrefix() )
-                                                             .appendAscii( "embeddings/spreadsheet" )
-                                                             .append( (sal_Int32) mnSpreadsheetCounter ++ )
-                                                             .appendAscii( ".xlsx" )
-                                                             .makeStringAndClear() );
+                        OUString sRelId;
+                        if( bSpreadSheet )
+                        {
+                            sRelId = mpFB->addRelation( mpFS->getOutputStream(),
+                                                        "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package",
+                                                        OUStringBuffer()
+                                                        .appendAscii( GetRelationCompPrefix() )
+                                                        .appendAscii( "embeddings/spreadsheet" )
+                                                        .append( static_cast<sal_Int32>(mnEmbeddeDocumentCounter++) )
+                                                        .appendAscii( ".xlsx" )
+                                                        .makeStringAndClear() );
+                        }
+                        else
+                        {
+                            sRelId = mpFB->addRelation( mpFS->getOutputStream(),
+                                                        "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package",
+                                                        OUStringBuffer()
+                                                        .appendAscii( GetRelationCompPrefix() )
+                                                        .appendAscii( "embeddings/textdocument" )
+                                                        .append( static_cast<sal_Int32>(mnEmbeddeDocumentCounter++) )
+                                                        .appendAscii( ".docx" )
+                                                        .makeStringAndClear() );
+                        }
 
                         mpFS->startElementNS( mnXmlNamespace, XML_graphicFrame, FSEND );
 
@@ -1053,10 +1097,20 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
                         mpFS->startElementNS( XML_a, XML_graphicData,
                                               XML_uri, "http://schemas.openxmlformats.org/presentationml/2006/ole",
                                               FSEND );
-                        mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
+                        if( bSpreadSheet )
+                        {
+                            mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
                                               XML_name, "Spreadsheet",
                                               FSNS(XML_r, XML_id), USS( sRelId ),
                                               FSEND );
+                        }
+                        else
+                        {
+                            mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
+                                              XML_name, "Document",
+                                              FSNS(XML_r, XML_id), USS( sRelId ),
+                                              FSEND );
+                        }
 
                         mpFS->singleElementNS( mnXmlNamespace, XML_embed, FSEND );
 
diff --git a/sd/CppunitTest_sd_export_tests.mk b/sd/CppunitTest_sd_export_tests.mk
index a8f3dbf..1c54b95 100644
--- a/sd/CppunitTest_sd_export_tests.mk
+++ b/sd/CppunitTest_sd_export_tests.mk
@@ -65,46 +65,7 @@ $(eval $(call gb_CppunitTest_use_api,sd_export_tests,\
 $(eval $(call gb_CppunitTest_use_ure,sd_export_tests))
 $(eval $(call gb_CppunitTest_use_vcl,sd_export_tests))
 
-$(eval $(call gb_CppunitTest_use_components,sd_export_tests,\
-    animations/source/animcore/animcore \
-    basic/util/sb \
-    chart2/source/chartcore \
-    chart2/source/controller/chartcontroller \
-    comphelper/util/comphelp \
-    configmgr/source/configmgr \
-    dbaccess/util/dba \
-    desktop/source/deployment/deployment \
-    embeddedobj/util/embobj \
-    filter/source/config/cache/filterconfig1 \
-    filter/source/svg/svgfilter \
-    forms/util/frm \
-    framework/util/fwk \
-    i18npool/util/i18npool \
-    linguistic/source/lng \
-    oox/util/oox \
-    package/source/xstor/xstor \
-    package/util/package2 \
-    sax/source/expatwrap/expwrap \
-    sd/util/sd \
-    sd/util/sdfilt \
-    sd/util/sdd \
-    sfx2/util/sfx \
-    sot/util/sot \
-    svl/source/fsstor/fsstorage \
-    svtools/util/svt \
-    toolkit/util/tk \
-    ucb/source/core/ucb1 \
-    ucb/source/ucp/expand/ucpexpand1 \
-    ucb/source/ucp/file/ucpfile1 \
-    ucb/source/ucp/package/ucppkg1 \
-    ucb/source/ucp/tdoc/ucptdoc1 \
-    unotools/util/utl \
-    unoxml/source/rdf/unordf \
-    unoxml/source/service/unoxml \
-    xmloff/util/xo \
-    xmlsecurity/util/xsec_fw \
-    xmlsecurity/util/xmlsecurity \
-))
+$(eval $(call gb_CppunitTest_use_rdb,sd_export_tests,services))
 
 $(eval $(call gb_CppunitTest_use_custom_headers,sd_export_tests,\
 	officecfg/registry \
diff --git a/sd/qa/unit/data/odp/bnc822341.odp b/sd/qa/unit/data/odp/bnc822341.odp
new file mode 100644
index 0000000..28fe2f4
Binary files /dev/null and b/sd/qa/unit/data/odp/bnc822341.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 037f8e5..b425323 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -81,6 +81,7 @@ public:
     void testSwappedOutImageExport();
     void testLinkedGraphicRT();
     void testImageWithSpecialID();
+    void testBnc822341();
 
     CPPUNIT_TEST_SUITE(SdExportTest);
     CPPUNIT_TEST(testN821567);
@@ -100,6 +101,7 @@ public:
     CPPUNIT_TEST(testSwappedOutImageExport);
     CPPUNIT_TEST(testLinkedGraphicRT);
     CPPUNIT_TEST(testImageWithSpecialID);
+    CPPUNIT_TEST(testBnc822341);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -720,6 +722,41 @@ void SdExportTest::testImageWithSpecialID()
     }
 }
 
+void SdExportTest::testBnc822341()
+{
+    // Check import / export of embedded text document
+    ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP);
+    xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+    // Export an LO specific ole object (exported from an ODP document)
+    {
+        SdDrawDocument *pDoc = xDocShRef->GetDoc();
+        CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+        const SdrPage *pPage = pDoc->GetPage(1);
+        CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+        const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
+        CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
+        CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
+    }
+
+    xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+    // Export an MS specific ole object (exported from a PPTX document)
+    {
+        SdDrawDocument *pDoc = xDocShRef->GetDoc();
+        CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+        const SdrPage *pPage = pDoc->GetPage(1);
+        CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+        const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
+        CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
+        CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
+    }
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list