From 2929847516a597bc20e696fdd1a260d750560584 Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Mon, 30 Dec 2013 10:38:29 +0100 Subject: svx: Use constructor feature for GalleryThemeProvider. Change-Id: Ifb92256b1516098d292a3ad960cb5982121998da --- svx/source/inc/unogalthemeprovider.hxx | 19 +------ svx/source/unodraw/unoctabl.cxx | 8 --- svx/source/unogallery/unogalthemeprovider.cxx | 79 +++++++++------------------ svx/util/svx.component | 3 +- 4 files changed, 28 insertions(+), 81 deletions(-) diff --git a/svx/source/inc/unogalthemeprovider.hxx b/svx/source/inc/unogalthemeprovider.hxx index 8d1cd680c08f..84980ab408c7 100644 --- a/svx/source/inc/unogalthemeprovider.hxx +++ b/svx/source/inc/unogalthemeprovider.hxx @@ -25,23 +25,9 @@ #include #include -#include - class Gallery; -namespace unogallery { - -// ------------------------- -// - some helper functions - -// ------------------------- - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GalleryThemeProvider_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception ); - ::com::sun::star::uno::Sequence< OUString > SAL_CALL GalleryThemeProvider_getSupportedServiceNames() throw(); -OUString SAL_CALL GalleryThemeProvider_getImplementationName() throw(); - -// ----------------- -// - GalleryThemes - -// ----------------- +namespace { class GalleryThemeProvider : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XInitialization, ::com::sun::star::gallery::XGalleryThemeProvider > @@ -51,9 +37,6 @@ public: GalleryThemeProvider(); ~GalleryThemeProvider(); - SVX_DLLPUBLIC static OUString getImplementationName_Static() throw(); - SVX_DLLPUBLIC static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(); - protected: // XServiceInfo diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 56aee061476e..8f990b7c9268 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -223,7 +223,6 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con // #include "UnoGraphicExporter.hxx" -#include "unogalthemeprovider.hxx" #include #include "sal/types.h" #include "osl/diagnose.h" @@ -331,13 +330,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory ( svx::FindbarDispatcher_createInstance, svx::FindbarDispatcher::getSupportedServiceNames_Static() ); } - else if( ::unogallery::GalleryThemeProvider_getImplementationName().equalsAscii( pImplName ) ) - { - xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), - ::unogallery::GalleryThemeProvider_getImplementationName(), - ::unogallery::GalleryThemeProvider_createInstance, - ::unogallery::GalleryThemeProvider_getSupportedServiceNames() ); - } if( xFactory.is()) { diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx index e5ad2d89002a..71b0736f6491 100644 --- a/svx/source/unogallery/unogalthemeprovider.cxx +++ b/svx/source/unogallery/unogalthemeprovider.cxx @@ -30,38 +30,7 @@ using namespace ::com::sun::star; -namespace unogallery { - -// -------------------- -// - Helper functions - -// -------------------- - -uno::Reference< uno::XInterface > SAL_CALL GalleryThemeProvider_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & ) - throw( uno::Exception ) -{ - return *( new GalleryThemeProvider() ); -} - -// ----------------------------------------------------------------------------- - -uno::Sequence< OUString > SAL_CALL GalleryThemeProvider_getSupportedServiceNames() - throw() -{ - return GalleryThemeProvider::getSupportedServiceNames_Static(); -} - -// ----------------------------------------------------------------------------- - -OUString SAL_CALL GalleryThemeProvider_getImplementationName() - throw() -{ - return GalleryThemeProvider::getImplementationName_Static(); -} - -// ----------------- -// - GalleryThemeProvider - -// ----------------- +namespace { GalleryThemeProvider::GalleryThemeProvider() : mbHiddenThemes( sal_False ) @@ -77,30 +46,10 @@ GalleryThemeProvider::~GalleryThemeProvider() // ------------------------------------------------------------------------------ -SVX_DLLPUBLIC OUString GalleryThemeProvider::getImplementationName_Static() - throw() -{ - return OUString( "com.sun.star.comp.gallery.GalleryThemeProvider" ); -} - -// ------------------------------------------------------------------------------ - -SVX_DLLPUBLIC uno::Sequence< OUString > GalleryThemeProvider::getSupportedServiceNames_Static() - throw() -{ - uno::Sequence< OUString > aSeq( 1 ); - - aSeq.getArray()[ 0 ] = "com.sun.star.gallery.GalleryThemeProvider"; - - return aSeq; -} - -// ------------------------------------------------------------------------------ - OUString SAL_CALL GalleryThemeProvider::getImplementationName() throw( uno::RuntimeException ) { - return getImplementationName_Static(); + return OUString( "com.sun.star.comp.gallery.GalleryThemeProvider" ); } // ------------------------------------------------------------------------------ @@ -123,7 +72,9 @@ sal_Bool SAL_CALL GalleryThemeProvider::supportsService( const OUString& Service uno::Sequence< OUString > SAL_CALL GalleryThemeProvider::getSupportedServiceNames() throw( uno::RuntimeException ) { - return getSupportedServiceNames_Static(); + uno::Sequence< OUString > aSeq( 1 ); + aSeq.getArray()[ 0 ] = "com.sun.star.gallery.GalleryThemeProvider"; + return aSeq; } // ------------------------------------------------------------------------------ @@ -297,4 +248,24 @@ void SAL_CALL GalleryThemeProvider::removeByName( const OUString& rName ) } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_gallery_GalleryThemeProvider_implementation_getFactory( + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + uno_Sequence * arguments) +{ + assert(arguments != 0); + css::uno::Reference x( + static_cast(new GalleryThemeProvider)); + x->acquire(); + css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY); + if (xx.is()) + { + css::uno::Sequence aArgs( + reinterpret_cast(arguments->elements), + arguments->nElements); + xx->initialize(aArgs); + } + return x.get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/util/svx.component b/svx/util/svx.component index 0e985a7c5f63..fbc4eed0df6f 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -22,7 +22,8 @@ - + -- cgit