svt: Use constructor feature for GraphicProvider.

Change-Id: I0cb66814c3dcbe38a92ada0dfcc0374313784a2b
This commit is contained in:
Matúš Kukan
2013-12-23 10:07:43 +01:00
parent c04f3c0f79
commit 732c0f929f
7 changed files with 23 additions and 68 deletions

View File

@@ -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,

View File

@@ -31,10 +31,6 @@ using namespace com::sun::star;
namespace unographic {
// -------------------
// - GraphicProvider -
// -------------------
Graphic::Graphic() :
mpGraphic( NULL )
{

View File

@@ -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,

View File

@@ -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: */

View File

@@ -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

View File

@@ -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,

View File

@@ -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"