svt: use constructor feature for HatchWindowFactory.
Change-Id: I0881c0994342816b8f0ac0281d884ce618d5e285
This commit is contained in:
@@ -17,34 +17,33 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hatchwindowfactory.hxx"
|
#include <com/sun/star/embed/XHatchWindowFactory.hpp>
|
||||||
#include "hatchwindow.hxx"
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||||
#include "cppuhelper/factory.hxx"
|
#include <cppuhelper/implbase2.hxx>
|
||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
|
|
||||||
#include "documentcloser.hxx"
|
#include <hatchwindow.hxx>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::impl_staticGetSupportedServiceNames()
|
namespace {
|
||||||
{
|
|
||||||
uno::Sequence< OUString > aRet(2);
|
|
||||||
aRet[0] = "com.sun.star.embed.HatchWindowFactory";
|
|
||||||
aRet[1] = "com.sun.star.comp.embed.HatchWindowFactory";
|
|
||||||
return aRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
OUString SAL_CALL OHatchWindowFactory::impl_staticGetImplementationName()
|
class OHatchWindowFactory : public ::cppu::WeakImplHelper2<
|
||||||
|
embed::XHatchWindowFactory,
|
||||||
|
lang::XServiceInfo >
|
||||||
{
|
{
|
||||||
return OUString( "com.sun.star.comp.embed.HatchWindowFactory" );
|
public:
|
||||||
}
|
OHatchWindowFactory() {}
|
||||||
|
|
||||||
uno::Reference< uno::XInterface > SAL_CALL OHatchWindowFactory::impl_staticCreateSelfInstance(
|
// XHatchWindowFactory
|
||||||
const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
|
virtual uno::Reference< embed::XHatchWindow > SAL_CALL createHatchWindowInstance( const uno::Reference< awt::XWindowPeer >& xParent, const awt::Rectangle& aBounds, const awt::Size& aSize ) throw (uno::RuntimeException);
|
||||||
{
|
|
||||||
return uno::Reference< uno::XInterface >( *new OHatchWindowFactory( xServiceManager ) );
|
// XServiceInfo
|
||||||
}
|
virtual OUString SAL_CALL getImplementationName() throw (uno::RuntimeException);
|
||||||
|
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (uno::RuntimeException);
|
||||||
|
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (uno::RuntimeException);
|
||||||
|
};
|
||||||
|
|
||||||
uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchWindowInstance(
|
uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchWindowInstance(
|
||||||
const uno::Reference< awt::XWindowPeer >& xParent,
|
const uno::Reference< awt::XWindowPeer >& xParent,
|
||||||
@@ -64,7 +63,7 @@ uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchW
|
|||||||
OUString SAL_CALL OHatchWindowFactory::getImplementationName()
|
OUString SAL_CALL OHatchWindowFactory::getImplementationName()
|
||||||
throw ( uno::RuntimeException )
|
throw ( uno::RuntimeException )
|
||||||
{
|
{
|
||||||
return impl_staticGetImplementationName();
|
return OUString( "com.sun.star.comp.embed.HatchWindowFactory" );
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName )
|
sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName )
|
||||||
@@ -76,7 +75,24 @@ sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceN
|
|||||||
uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames()
|
uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames()
|
||||||
throw ( uno::RuntimeException )
|
throw ( uno::RuntimeException )
|
||||||
{
|
{
|
||||||
return impl_staticGetSupportedServiceNames();
|
uno::Sequence< OUString > aRet(2);
|
||||||
|
aRet[0] = "com.sun.star.embed.HatchWindowFactory";
|
||||||
|
aRet[1] = "com.sun.star.comp.embed.HatchWindowFactory";
|
||||||
|
return aRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
|
||||||
|
com_sun_star_comp_embed_HatchWindowFactory_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 OHatchWindowFactory));
|
||||||
|
x->acquire();
|
||||||
|
return x.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -20,45 +20,6 @@
|
|||||||
#ifndef INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_HATCHWINDOWFACTORY_HXX
|
#ifndef INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_HATCHWINDOWFACTORY_HXX
|
||||||
#define INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_HATCHWINDOWFACTORY_HXX
|
#define INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_HATCHWINDOWFACTORY_HXX
|
||||||
|
|
||||||
#include <com/sun/star/embed/XHatchWindowFactory.hpp>
|
|
||||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
#include <cppuhelper/implbase2.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
class OHatchWindowFactory : public ::cppu::WeakImplHelper2<
|
|
||||||
::com::sun::star::embed::XHatchWindowFactory,
|
|
||||||
::com::sun::star::lang::XServiceInfo >
|
|
||||||
{
|
|
||||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
|
|
||||||
|
|
||||||
public:
|
|
||||||
OHatchWindowFactory(
|
|
||||||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
|
|
||||||
: m_xFactory( xFactory )
|
|
||||||
{
|
|
||||||
OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
static ::com::sun::star::uno::Sequence< OUString > SAL_CALL impl_staticGetSupportedServiceNames();
|
|
||||||
|
|
||||||
static OUString SAL_CALL impl_staticGetImplementationName();
|
|
||||||
|
|
||||||
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
|
|
||||||
impl_staticCreateSelfInstance(
|
|
||||||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
|
|
||||||
|
|
||||||
|
|
||||||
// XHatchWindowFactory
|
|
||||||
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XHatchWindow > SAL_CALL createHatchWindowInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent, const ::com::sun::star::awt::Rectangle& aBounds, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException);
|
|
||||||
|
|
||||||
// XServiceInfo
|
|
||||||
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);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
#include <osl/diagnose.h>
|
#include <osl/diagnose.h>
|
||||||
#include <uno/mapping.hxx>
|
#include <uno/mapping.hxx>
|
||||||
#include "documentcloser.hxx"
|
#include "documentcloser.hxx"
|
||||||
#include "hatchwindowfactory.hxx"
|
|
||||||
#include "hatchwindow.hxx"
|
#include "hatchwindow.hxx"
|
||||||
#include "provider.hxx"
|
#include "provider.hxx"
|
||||||
#include "unowizard.hxx"
|
#include "unowizard.hxx"
|
||||||
@@ -127,13 +126,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory (
|
|||||||
ODocumentCloser::impl_staticCreateSelfInstance,
|
ODocumentCloser::impl_staticCreateSelfInstance,
|
||||||
ODocumentCloser::impl_staticGetSupportedServiceNames());
|
ODocumentCloser::impl_staticGetSupportedServiceNames());
|
||||||
}
|
}
|
||||||
else if (rtl_str_compare (pImplementationName, "com.sun.star.comp.embed.HatchWindowFactory") == 0)
|
|
||||||
{
|
|
||||||
xFactory = ::cppu::createOneInstanceFactory(xSMgr,
|
|
||||||
OHatchWindowFactory::impl_staticGetImplementationName(),
|
|
||||||
OHatchWindowFactory::impl_staticCreateSelfInstance,
|
|
||||||
OHatchWindowFactory::impl_staticGetSupportedServiceNames());
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pResult = comphelper::service_decl::component_getFactoryHelper(
|
pResult = comphelper::service_decl::component_getFactoryHelper(
|
||||||
|
@@ -49,7 +49,8 @@
|
|||||||
<implementation name="com.sun.star.comp.embed.DocumentCloser">
|
<implementation name="com.sun.star.comp.embed.DocumentCloser">
|
||||||
<service name="com.sun.star.embed.DocumentCloser"/>
|
<service name="com.sun.star.embed.DocumentCloser"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
<implementation name="com.sun.star.comp.embed.HatchWindowFactory">
|
<implementation name="com.sun.star.comp.embed.HatchWindowFactory"
|
||||||
|
constructor="com_sun_star_comp_embed_HatchWindowFactory_get_implementation">
|
||||||
<service name="com.sun.star.comp.embed.HatchWindowFactory"/>
|
<service name="com.sun.star.comp.embed.HatchWindowFactory"/>
|
||||||
<service name="com.sun.star.embed.HatchWindowFactory"/>
|
<service name="com.sun.star.embed.HatchWindowFactory"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
|
Reference in New Issue
Block a user