[Libreoffice-commits] .: Branch 'integration/dev300_m98' - 2 commits - sd/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Tue Mar 8 07:19:17 PST 2011


 sd/source/filter/eppt/epptooxml.hxx      |    4 +
 sd/source/filter/eppt/pptx-epptooxml.cxx |   74 +++++++++++--------------------
 2 files changed, 30 insertions(+), 48 deletions(-)

New commits:
commit c1be0f313f88bb0da5860e46a0c4743c9b842712
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Tue Mar 8 16:01:52 2011 +0100

    Add implCreateVbaProject() to PPTX export
    
    Just mimicking the import here, hopefully correct

diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
index a453a46..8e933ad 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -105,6 +105,8 @@ protected:
     virtual sal_Bool ImplCreateDocument();
     virtual sal_Bool ImplCreateMainNotes();
 
+    virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+
     sal_Bool WriteNotesMaster();
 
     void WriteAnimateTo( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any aValue, const ::rtl::OUString& rAttributeName );
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 7312a56..1c277d2 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <oox/drawingml/chart/chartconverter.hxx>
 #include <oox/token/tokens.hxx>
+#include <oox/ole/vbaproject.hxx>
 #include <epptooxml.hxx>
 #include <epptdef.hxx>
 #include <oox/export/shapes.hxx>
@@ -369,6 +370,11 @@ bool PowerPointExport::exportDocument() throw()
     return true;
 }
 
+::oox::ole::VbaProject* PowerPointExport::implCreateVbaProject() const
+{
+    return new ::oox::ole::VbaProject( getComponentContext(), getModel(), CREATE_OUSTRING( "Impress" ) );
+}
+
 void PowerPointExport::ImplWriteBackground( FSHelperPtr pFS, Reference< XPropertySet > rXPropSet )
 {
     FillStyle aFillStyle( FillStyle_NONE );
commit acfd5133f1a3d01596364daf776fd4460f7eb4ba
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Tue Mar 8 16:01:26 2011 +0100

    Adapt pptx export filter to use ComponentContext

diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
index fd93a3e..a453a46 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -73,7 +73,7 @@ class PowerPointExport : public XmlFilterBase, public PPTWriterBase
     friend class PowerPointShapeExport;
 public:
 
-    PowerPointExport( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr  );
+    PowerPointExport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rSMgr  );
     ~PowerPointExport();
 
     // from FilterBase
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 114c9ff..7312a56 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -34,6 +34,7 @@
 #include <epptdef.hxx>
 #include <oox/export/shapes.hxx>
 
+#include <cppuhelper/implementationentry.hxx>
 #include <cppuhelper/factory.hxx>
 #include <sax/fshelper.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -307,8 +308,8 @@ ShapeExport& PowerPointShapeExport::WriteUnknownShape( Reference< XShape > xShap
     return *this;
 }
 
-PowerPointExport::PowerPointExport( const Reference< XMultiServiceFactory > & rSMgr  )
-    : XmlFilterBase( rSMgr ),
+PowerPointExport::PowerPointExport( const Reference< XComponentContext > & rxCtxt  )
+    : XmlFilterBase( rxCtxt ),
       PPTWriterBase(),
       mnLayoutFileIdMax( 1 ),
       mnSlideIdMax( 1 << 8 ),
@@ -2053,9 +2054,9 @@ uno::Sequence< OUString > SAL_CALL PowerPointExport_getSupportedServiceNames() t
     return aSeq;
 }
 
-uno::Reference< uno::XInterface > SAL_CALL PowerPointExport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
+uno::Reference< uno::XInterface > SAL_CALL PowerPointExport_createInstance(const uno::Reference< XComponentContext > & rxCtxt ) throw( uno::Exception )
 {
-    return (cppu::OWeakObject*)new PowerPointExport( rSMgr );
+    return (cppu::OWeakObject*)new PowerPointExport( rxCtxt );
 }
 
 OUString PowerPointExport::implGetImplementationName() const
@@ -2070,6 +2071,18 @@ OUString PowerPointExport::implGetImplementationName() const
 // - component_getImplementationEnvironment -
 // ------------------------------------------
 
+static struct cppu::ImplementationEntry g_entries[] =
+{
+    {
+        oox::core::PowerPointExport_createInstance,
+        oox::core::PowerPointExport_getImplementationName,
+        oox::core::PowerPointExport_getSupportedServiceNames,
+        cppu::createSingleComponentFactory,
+        0 , 0
+    },
+    { 0, 0, 0, 0, 0, 0 }
+};
+
 #ifdef __cplusplus
 extern "C"
 {
@@ -2084,57 +2097,18 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const
 // - component_writeInfo -
 // -----------------------
 
-SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
 {
-    sal_Bool bRet = sal_False;
-
-    if( pRegistryKey )
-    {
-        try
-        {
-            uno::Reference< registry::XRegistryKey > xNewKey1(
-                static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
-                ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME "/UNO/SERVICES/" )) ) );
-            xNewKey1->createKey( oox::core::PowerPointExport_getSupportedServiceNames().getConstArray()[0] );
-
-            bRet = sal_True;
-        }
-        catch( registry::InvalidRegistryException& )
-        {
-            OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
-        }
-    }
-
-    return bRet;
+    return cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
 }
 
 // ------------------------
 // - component_getFactory -
 // ------------------------
 
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
 {
-    uno::Reference< lang::XSingleServiceFactory > xFactory;
-    void*                                   pRet = 0;
-
-    if( rtl_str_compare( pImplName, IMPL_NAME ) == 0 )
-    {
-        const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME ) );
-
-        xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
-                        reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
-                        oox::core::PowerPointExport_getImplementationName(),
-                        oox::core::PowerPointExport_createInstance,
-                        oox::core::PowerPointExport_getSupportedServiceNames() ) );
-    }
-
-    if( xFactory.is() )
-    {
-        xFactory->acquire();
-        pRet = xFactory.get();
-    }
-
-    return pRet;
+    return cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
 }
 
 #ifdef __cplusplus


More information about the Libreoffice-commits mailing list