Kaydet (Commit) 29298475 authored tarafından Matúš Kukan's avatar Matúš Kukan

svx: Use constructor feature for GalleryThemeProvider.

Change-Id: Ifb92256b1516098d292a3ad960cb5982121998da
üst 32b64a0f
......@@ -25,23 +25,9 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/gallery/XGalleryThemeProvider.hpp>
#include <svx/svxdllapi.h>
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
......
......@@ -223,7 +223,6 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con
//
#include "UnoGraphicExporter.hxx"
#include "unogalthemeprovider.hxx"
#include <com/sun/star/registry/XRegistryKey.hpp>
#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())
{
......
......@@ -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<css::uno::XInterface> x(
static_cast<cppu::OWeakObject *>(new GalleryThemeProvider));
x->acquire();
css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
if (xx.is())
{
css::uno::Sequence<css::uno::Any> aArgs(
reinterpret_cast<css::uno::Any *>(arguments->elements),
arguments->nElements);
xx->initialize(aArgs);
}
return x.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -22,7 +22,8 @@
<implementation name="com.sun.star.comp.Draw.GraphicExporter">
<service name="com.sun.star.drawing.GraphicExportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.gallery.GalleryThemeProvider">
<implementation name="com.sun.star.comp.gallery.GalleryThemeProvider"
constructor="com_sun_star_comp_gallery_GalleryThemeProvider_implementation_getFactory">
<service name="com.sun.star.gallery.GalleryThemeProvider"/>
</implementation>
<implementation name="com.sun.star.comp.svx.Impl.FindbarDispatcher">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment