svx: Use constructor feature for SvxShapeCollection.

Change-Id: If717b1d526e5d3e67adae4a224018b6da4bf09aa
This commit is contained in:
Matúš Kukan
2013-12-30 12:37:34 +01:00
parent e11a80d0be
commit 2978ddf60d
4 changed files with 13 additions and 25 deletions

View File

@@ -81,11 +81,8 @@ public:
virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
static com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static();
static OUString getImplementationName_Static();
};
::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxShapeCollection_createInstance( const com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
#endif

View File

@@ -25,7 +25,6 @@
#include "../customshapes/EnhancedCustomShapeEngine.hxx"
#include <svx/xtable.hxx>
#include "svx/unoshcol.hxx"
using namespace ::com::sun::star;
using namespace ::rtl;
@@ -249,13 +248,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory (
create_EnhancedCustomShapeEngine,
EnhancedCustomShapeEngine_getSupportedServiceNames() );
}
else if( rtl_str_compare( pImplName, "com.sun.star.drawing.SvxShapeCollection" ) == 0 )
{
xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
SvxShapeCollection::getImplementationName_Static(),
SvxShapeCollection_createInstance,
SvxShapeCollection::getSupportedServiceNames_Static() );
}
if( xFactory.is())
{

View File

@@ -18,9 +18,10 @@
*/
#include <com/sun/star/document/EventObject.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include "svx/unoshcol.hxx"
#include <svx/unoprov.hxx>
#include <svx/unoshcol.hxx>
#include <cppuhelper/supportsservice.hxx>
using namespace ::cppu;
@@ -209,11 +210,6 @@ sal_Bool SAL_CALL SvxShapeCollection::hasElements() throw( uno::RuntimeException
// XServiceInfo
OUString SAL_CALL SvxShapeCollection::getImplementationName()
throw( uno::RuntimeException )
{
return getImplementationName_Static();
}
OUString SvxShapeCollection::getImplementationName_Static()
{
return OUString("com.sun.star.drawing.SvxShapeCollection");
}
@@ -225,11 +221,6 @@ sal_Bool SAL_CALL SvxShapeCollection::supportsService( const OUString& ServiceNa
}
uno::Sequence< OUString > SAL_CALL SvxShapeCollection::getSupportedServiceNames() throw( uno::RuntimeException )
{
return getSupportedServiceNames_Static();
}
uno::Sequence< OUString > SvxShapeCollection::getSupportedServiceNames_Static()
{
uno::Sequence< OUString > aSeq(2);
aSeq.getArray()[0] = "com.sun.star.drawing.Shapes";
@@ -237,9 +228,16 @@ uno::Sequence< OUString > SvxShapeCollection::getSupportedServiceNames_Static()
return aSeq;
}
Reference< XInterface > SAL_CALL SvxShapeCollection_createInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_drawing_SvxShapeCollection_implementation_getFactory(
SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
uno_Sequence * arguments)
{
return *( new SvxShapeCollection() );
assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
css::uno::Reference<css::uno::XInterface> x(
static_cast<cppu::OWeakObject *>(new SvxShapeCollection));
x->acquire();
return x.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -35,7 +35,8 @@
<implementation name="com.sun.star.drawing.EnhancedCustomShapeEngine">
<service name="com.sun.star.drawing.CustomShapeEngine"/>
</implementation>
<implementation name="com.sun.star.drawing.SvxShapeCollection">
<implementation name="com.sun.star.drawing.SvxShapeCollection"
constructor="com_sun_star_drawing_SvxShapeCollection_implementation_getFactory">
<service name="com.sun.star.drawing.ShapeCollection"/>
</implementation>
<implementation name="com.sun.star.drawing.SvxUnoColorTable">