summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-25 11:01:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-25 17:39:26 +0200
commitb68c10a0d0e6f83b6b037da72210033cacb1677b (patch)
tree503cd9a374d04b5c6db947b0f32f97eb95018cd9 /filter
parent97200ca0822a22163d3f091241b9f1dfe24b7f86 (diff)
filter/xsltdialog: create instances with uno constructors
See tdf#74608 for motivation. I have changed this from single-instance to multi-instance to avoid loplugin:staticvar and because I can't see a good reason for a dialog to be single-instance Change-Id: Ic7c917fd4923dce11466069e9531bf44989a1ae9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99421 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/xsltdialog/xmlfilterdialogcomponent.cxx59
-rw-r--r--filter/source/xsltdialog/xsltdlg.component5
2 files changed, 12 insertions, 52 deletions
diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
index 6aad2f1f7323..f49f44af6d7a 100644
--- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
+++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
@@ -64,13 +64,13 @@ class XMLFilterDialogComponent : public XMLFilterDialogComponentBase,
public:
explicit XMLFilterDialogComponent( const Reference< XComponentContext >& rxContext );
-protected:
// XInterface
virtual Any SAL_CALL queryInterface( const Type& aType ) override;
virtual Any SAL_CALL queryAggregation( Type const & rType ) override;
virtual void SAL_CALL acquire() throw () override;
virtual void SAL_CALL release() throw () override;
+protected:
// XTypeProvider
virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
virtual Sequence< Type > SAL_CALL getTypes() override;
@@ -158,28 +158,10 @@ void SAL_CALL XMLFilterDialogComponent::release() throw ()
OComponentHelper::release();
}
-/// @throws RuntimeException
-static OUString XMLFilterDialogComponent_getImplementationName()
-{
- return "com.sun.star.comp.ui.XSLTFilterDialog";
-}
-
-/// @throws RuntimeException
-static Sequence< OUString > XMLFilterDialogComponent_getSupportedServiceNames()
-{
- Sequence< OUString > aSupported { "com.sun.star.ui.dialogs.XSLTFilterDialog" };
- return aSupported;
-}
-
-/// @throws Exception
-static Reference< XInterface > XMLFilterDialogComponent_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
-{
- return static_cast<OWeakObject*>(new XMLFilterDialogComponent( comphelper::getComponentContext(rSMgr) ));
-}
OUString SAL_CALL XMLFilterDialogComponent::getImplementationName()
{
- return XMLFilterDialogComponent_getImplementationName();
+ return "com.sun.star.comp.ui.XSLTFilterDialog";
}
namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
@@ -222,7 +204,7 @@ Sequence< Type > XMLFilterDialogComponent::getTypes()
Sequence< OUString > SAL_CALL XMLFilterDialogComponent::getSupportedServiceNames()
{
- return XMLFilterDialogComponent_getSupportedServiceNames();
+ return { "com.sun.star.ui.dialogs.XSLTFilterDialog" };
}
sal_Bool SAL_CALL XMLFilterDialogComponent::supportsService(const OUString& ServiceName)
@@ -313,36 +295,13 @@ void SAL_CALL XMLFilterDialogComponent::initialize( const Sequence< Any >& aArgu
}
}
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void * xsltdlg_component_getFactory(
- const char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
-{
- void * pRet = nullptr;
- if( pServiceManager )
- {
- Reference< XSingleServiceFactory > xFactory;
-
- OUString implName = OUString::createFromAscii( pImplName );
- if ( implName == XMLFilterDialogComponent_getImplementationName() )
- {
- xFactory = createOneInstanceFactory(
- static_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- XMLFilterDialogComponent_createInstance, XMLFilterDialogComponent_getSupportedServiceNames() );
-
- }
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
-}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_XSLTFilterDialog_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(static_cast<cppu::OWeakObject*>(new XMLFilterDialogComponent(context)));
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xsltdialog/xsltdlg.component b/filter/source/xsltdialog/xsltdlg.component
index 7059cc66cd76..6d4a693f387a 100644
--- a/filter/source/xsltdialog/xsltdlg.component
+++ b/filter/source/xsltdialog/xsltdlg.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="xsltdlg" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.ui.XSLTFilterDialog">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.ui.XSLTFilterDialog"
+ constructor="filter_XSLTFilterDialog_get_implementation">
<service name="com.sun.star.ui.dialogs.XSLTFilterDialog"/>
</implementation>
</component>