diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-23 10:07:43 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-23 10:28:41 +0100 |
commit | 732c0f929fc0229b6da37d4ec4b6de8994fcea46 (patch) | |
tree | c5670154e8eaae95a6c3278dc782f4e12ee36438 /svtools | |
parent | c04f3c0f794e8c608fade8c6142db13c32e6f4e7 (diff) |
svt: Use constructor feature for GraphicProvider.
Change-Id: I0cb66814c3dcbe38a92ada0dfcc0374313784a2b
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/graphic/descriptor.hxx | 4 | ||||
-rw-r--r-- | svtools/source/graphic/graphic.cxx | 4 | ||||
-rw-r--r-- | svtools/source/graphic/graphic.hxx | 6 | ||||
-rw-r--r-- | svtools/source/graphic/provider.cxx | 53 | ||||
-rw-r--r-- | svtools/source/inc/provider.hxx | 9 | ||||
-rw-r--r-- | svtools/source/uno/miscservices.cxx | 12 | ||||
-rw-r--r-- | svtools/util/svt.component | 3 |
7 files changed, 23 insertions, 68 deletions
diff --git a/svtools/source/graphic/descriptor.hxx b/svtools/source/graphic/descriptor.hxx index 906c4aae074e..5d4e7b92471e 100644 --- a/svtools/source/graphic/descriptor.hxx +++ b/svtools/source/graphic/descriptor.hxx @@ -60,10 +60,6 @@ class Graphic; namespace unographic { -// ------------------- -// - GraphicProvider - -// ------------------- - class GraphicDescriptor : public ::cppu::OWeakAggObject, public ::com::sun::star::lang::XServiceInfo, public ::com::sun::star::lang::XTypeProvider, diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx index da0a9deaca39..f81a019cd928 100644 --- a/svtools/source/graphic/graphic.cxx +++ b/svtools/source/graphic/graphic.cxx @@ -31,10 +31,6 @@ using namespace com::sun::star; namespace unographic { -// ------------------- -// - GraphicProvider - -// ------------------- - Graphic::Graphic() : mpGraphic( NULL ) { diff --git a/svtools/source/graphic/graphic.hxx b/svtools/source/graphic/graphic.hxx index 645269c0c2c2..9ab6fc08ae68 100644 --- a/svtools/source/graphic/graphic.hxx +++ b/svtools/source/graphic/graphic.hxx @@ -28,14 +28,8 @@ #include "descriptor.hxx" #include "transformer.hxx" -class Graphic; - namespace unographic { -// ------------------- -// - GraphicProvider - -// ------------------- - class Graphic : public ::com::sun::star::graphic::XGraphic, public ::com::sun::star::awt::XBitmap, public ::com::sun::star::lang::XUnoTunnel, diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index cf5113b5c93f..2bc31a62e573 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -43,19 +43,10 @@ using namespace com::sun::star; -namespace unographic { +namespace { #define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" -// ------------------- -// - GraphicProvider - -// ------------------- - -uno::Reference< uno::XInterface > SAL_CALL GraphicProvider_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) -{ - return (static_cast< ::cppu::OWeakObject* >(new GraphicProvider )); -} - GraphicProvider::GraphicProvider() { } @@ -68,30 +59,10 @@ GraphicProvider::~GraphicProvider() // ------------------------------------------------------------------------------ -OUString GraphicProvider::getImplementationName_Static() - throw() -{ - return OUString( "com.sun.star.comp.graphic.GraphicProvider" ); -} - -// ------------------------------------------------------------------------------ - -uno::Sequence< OUString > GraphicProvider::getSupportedServiceNames_Static() - throw() -{ - uno::Sequence< OUString > aSeq( 1 ); - - aSeq.getArray()[ 0 ] = "com.sun.star.graphic.GraphicProvider"; - - return aSeq; -} - -// ------------------------------------------------------------------------------ - OUString SAL_CALL GraphicProvider::getImplementationName() throw( uno::RuntimeException ) { - return getImplementationName_Static(); + return OUString( "com.sun.star.comp.graphic.GraphicProvider" ); } // ------------------------------------------------------------------------------ @@ -114,7 +85,9 @@ sal_Bool SAL_CALL GraphicProvider::supportsService( const OUString& ServiceName uno::Sequence< OUString > SAL_CALL GraphicProvider::getSupportedServiceNames() throw( uno::RuntimeException ) { - return getSupportedServiceNames_Static(); + uno::Sequence< OUString > aSeq( 1 ); + aSeq.getArray()[ 0 ] = "com.sun.star.graphic.GraphicProvider"; + return aSeq; } // ------------------------------------------------------------------------------ @@ -384,7 +357,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc if( xIStm.is() ) { - GraphicDescriptor* pDescriptor = new GraphicDescriptor; + unographic::GraphicDescriptor* pDescriptor = new unographic::GraphicDescriptor; pDescriptor->init( xIStm, aURL ); xRet = pDescriptor; } @@ -408,7 +381,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc } else { - GraphicDescriptor* pDescriptor = new GraphicDescriptor; + unographic::GraphicDescriptor* pDescriptor = new unographic::GraphicDescriptor; pDescriptor->init( aURL ); xRet = pDescriptor; } @@ -898,4 +871,16 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_graphic_GraphicProvider_get_implementation( + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + uno_Sequence * arguments) +{ + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new GraphicProvider)); + x->acquire(); + return x.get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/provider.hxx b/svtools/source/inc/provider.hxx index ba69554d1f6d..9b200508e90d 100644 --- a/svtools/source/inc/provider.hxx +++ b/svtools/source/inc/provider.hxx @@ -25,11 +25,7 @@ #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/awt/XBitmap.hpp> -namespace unographic { - -// ------------------- -// - GraphicProvider - -// ------------------- +namespace { class GraphicProvider : public ::cppu::WeakImplHelper1< ::com::sun::star::graphic::XGraphicProvider > { @@ -38,9 +34,6 @@ public: GraphicProvider(); ~GraphicProvider(); - static OUString getImplementationName_Static() throw(); - static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(); - protected: // XServiceInfo diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 62f60cbccc50..4a7ec7396cbd 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -28,7 +28,6 @@ #include <uno/mapping.hxx> #include "documentcloser.hxx" #include "hatchwindow.hxx" -#include "provider.hxx" #include "unowizard.hxx" #include "comphelper/servicedecl.hxx" @@ -39,7 +38,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::registry; using namespace ::com::sun::star::lang; -using namespace unographic; namespace sdecl = comphelper::service_decl; @@ -74,7 +72,6 @@ namespace DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) -DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicProvider ) extern "C" { @@ -112,13 +109,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( SvFilterOptionsDialog_CreateInstance, aServiceNames); } - else if( GraphicProvider::getImplementationName_Static().equalsAscii( pImplementationName ) ) - { - xFactory = ::cppu::createOneInstanceFactory(xSMgr, - GraphicProvider::getImplementationName_Static(), - GraphicProvider_CreateInstance, - GraphicProvider::getSupportedServiceNames_Static() ); - } else if (rtl_str_compare (pImplementationName, "com.sun.star.comp.embed.DocumentCloser") == 0) { xFactory = ::cppu::createOneInstanceFactory(xSMgr, @@ -132,7 +122,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( pImplementationName, static_cast<css::lang::XMultiServiceFactory *>(_pServiceManager), static_cast<css::registry::XRegistryKey *>(pRegistryKey), - serviceDecl ); + unographic::serviceDecl ); if ( !pResult ) pResult = cppu::component_getFactoryHelper(pImplementationName, _pServiceManager, diff --git a/svtools/util/svt.component b/svtools/util/svt.component index dbba9e74d708..bd359afc0b60 100644 --- a/svtools/util/svt.component +++ b/svtools/util/svt.component @@ -19,7 +19,8 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" prefix="svt" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.graphic.GraphicProvider"> + <implementation name="com.sun.star.comp.graphic.GraphicProvider" + constructor="com_sun_star_comp_graphic_GraphicProvider_get_implementation"> <service name="com.sun.star.graphic.GraphicProvider"/> </implementation> <implementation name="com.sun.star.comp.graphic.GraphicRendererVCL" |