summaryrefslogtreecommitdiff
path: root/filter/source/config
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-12 21:57:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-13 12:42:43 +0200
commiteae2ac9de5c81d946c220e5f1f4c9a96dd66a2b6 (patch)
treeb037f1b319e95124ad5803d81233e169f1d007ae /filter/source/config
parent92e816e08a983334d78ebb4bd49a39a782e8a053 (diff)
filter/config: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I4de7d1b5822422bd7f85f09114c1e6ceb98551d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98611 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter/source/config')
-rw-r--r--filter/source/config/cache/contenthandlerfactory.cxx25
-rw-r--r--filter/source/config/cache/contenthandlerfactory.hxx40
-rw-r--r--filter/source/config/cache/filterconfig1.component12
-rw-r--r--filter/source/config/cache/filterfactory.cxx26
-rw-r--r--filter/source/config/cache/filterfactory.hxx41
-rw-r--r--filter/source/config/cache/frameloaderfactory.cxx24
-rw-r--r--filter/source/config/cache/frameloaderfactory.hxx39
-rw-r--r--filter/source/config/cache/registration.cxx24
-rw-r--r--filter/source/config/cache/typedetection.cxx26
-rw-r--r--filter/source/config/cache/typedetection.hxx41
10 files changed, 36 insertions, 262 deletions
diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx
index 0a17930e7828..0f04e4f000d2 100644
--- a/filter/source/config/cache/contenthandlerfactory.cxx
+++ b/filter/source/config/cache/contenthandlerfactory.cxx
@@ -31,8 +31,8 @@ ContentHandlerFactory::ContentHandlerFactory(const css::uno::Reference< css::uno
: m_xContext(rxContext)
{
BaseContainer::init(rxContext ,
- ContentHandlerFactory::impl_getImplementationName() ,
- ContentHandlerFactory::impl_getSupportedServiceNames(),
+ "com.sun.star.comp.filter.config.ContentHandlerFactory" ,
+ { "com.sun.star.frame.ContentHandlerFactory" },
FilterCache::E_CONTENTHANDLER );
}
@@ -92,25 +92,14 @@ css::uno::Sequence< OUString > SAL_CALL ContentHandlerFactory::getAvailableServi
return BaseContainer::getElementNames();
}
+} // namespace filter::config
-OUString ContentHandlerFactory::impl_getImplementationName()
-{
- return "com.sun.star.comp.filter.config.ContentHandlerFactory";
-}
-
-
-css::uno::Sequence< OUString > ContentHandlerFactory::impl_getSupportedServiceNames()
-{
- return { "com.sun.star.frame.ContentHandlerFactory" };
-}
-
-
-css::uno::Reference< css::uno::XInterface > ContentHandlerFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_ContentHandlerFactory_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
- ContentHandlerFactory* pNew = new ContentHandlerFactory( comphelper::getComponentContext(xSMGR) );
- return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY);
+ return cppu::acquire(new filter::config::ContentHandlerFactory(context));
}
-} // namespace filter::config
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/config/cache/contenthandlerfactory.hxx b/filter/source/config/cache/contenthandlerfactory.hxx
index bcb2dcfca9f1..9836ad003f6b 100644
--- a/filter/source/config/cache/contenthandlerfactory.hxx
+++ b/filter/source/config/cache/contenthandlerfactory.hxx
@@ -73,48 +73,8 @@ class ContentHandlerFactory : public ::cppu::ImplInheritanceHelper< BaseContaine
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override;
- // static uno helper!
-
public:
-
- /** @short return the uno implementation name of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- it's implemented as a static function!
-
- @return The fix uno implementation name of this class.
- */
- static OUString impl_getImplementationName();
-
-
- /** @short return the list of supported uno services of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- it's implemented as a static function!
-
- @return The fix list of uno services supported by this class.
- */
- static css::uno::Sequence< OUString > impl_getSupportedServiceNames();
-
-
- /** @short return a new intsnace of this class.
-
- @descr This method is used by the uno service manager, to create
- a new instance of this service if needed.
-
- @param xSMGR
- reference to the uno service manager, which require
- this new instance. It should be passed to the new object
- so it can be used internally to create own needed uno resources.
-
- @return The new instance of this service as a uno reference.
- */
- static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
-
-
// Overrides to resolve ambiguity
virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override
{ return BaseContainer::getByName(aName); }
diff --git a/filter/source/config/cache/filterconfig1.component b/filter/source/config/cache/filterconfig1.component
index 6674639c91f2..da841a112962 100644
--- a/filter/source/config/cache/filterconfig1.component
+++ b/filter/source/config/cache/filterconfig1.component
@@ -22,16 +22,20 @@
<implementation name="com.sun.star.comp.filter.config.ConfigFlush">
<service name="com.sun.star.document.FilterConfigRefresh"/>
</implementation>
- <implementation name="com.sun.star.comp.filter.config.ContentHandlerFactory">
+ <implementation name="com.sun.star.comp.filter.config.ContentHandlerFactory"
+ constructor="filter_ContentHandlerFactory_get_implementation">
<service name="com.sun.star.frame.ContentHandlerFactory"/>
</implementation>
- <implementation name="com.sun.star.comp.filter.config.FilterFactory">
+ <implementation name="com.sun.star.comp.filter.config.FilterFactory"
+ constructor="filter_FilterFactory_get_implementation">
<service name="com.sun.star.document.FilterFactory"/>
</implementation>
- <implementation name="com.sun.star.comp.filter.config.FrameLoaderFactory">
+ <implementation name="com.sun.star.comp.filter.config.FrameLoaderFactory"
+ constructor="filter_FrameLoaderFactory_get_implementation">
<service name="com.sun.star.frame.FrameLoaderFactory"/>
</implementation>
- <implementation name="com.sun.star.comp.filter.config.TypeDetection">
+ <implementation name="com.sun.star.comp.filter.config.TypeDetection"
+ constructor="filter_TypeDetection_get_implementation">
<service name="com.sun.star.document.TypeDetection"/>
</implementation>
</component>
diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx
index 80ec0225a94a..d379857c7310 100644
--- a/filter/source/config/cache/filterfactory.cxx
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -51,8 +51,8 @@ FilterFactory::FilterFactory(const css::uno::Reference< css::uno::XComponentCont
: m_xContext(rxContext)
{
BaseContainer::init(rxContext ,
- FilterFactory::impl_getImplementationName() ,
- FilterFactory::impl_getSupportedServiceNames(),
+ "com.sun.star.comp.filter.config.FilterFactory" ,
+ { "com.sun.star.document.FilterFactory" },
FilterCache::E_FILTER );
}
@@ -498,25 +498,13 @@ std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const O
return std::vector<OUString>();
}
+} // namespace filter
-OUString FilterFactory::impl_getImplementationName()
-{
- return "com.sun.star.comp.filter.config.FilterFactory";
-}
-
-
-css::uno::Sequence< OUString > FilterFactory::impl_getSupportedServiceNames()
-{
- return { "com.sun.star.document.FilterFactory" };
-}
-
-
-css::uno::Reference< css::uno::XInterface > FilterFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_FilterFactory_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
- FilterFactory* pNew = new FilterFactory( comphelper::getComponentContext(xSMGR) );
- return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY);
+ return cppu::acquire(new filter::config::FilterFactory(context));
}
-} // namespace filter
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/config/cache/filterfactory.hxx b/filter/source/config/cache/filterfactory.hxx
index 5cc06919e576..93588762797e 100644
--- a/filter/source/config/cache/filterfactory.hxx
+++ b/filter/source/config/cache/filterfactory.hxx
@@ -130,47 +130,6 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper< BaseContainer
*/
std::vector<OUString> impl_readSortedFilterListFromConfig(const OUString& sModule) const;
-
- // static uno helper!
-
- public:
-
-
- /** @short return the uno implementation name of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- it's implemented as a static function!
-
- @return The fix uno implementation name of this class.
- */
- static OUString impl_getImplementationName();
-
-
- /** @short return the list of supported uno services of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- it's implemented as a static function!
-
- @return The fix list of uno services supported by this class.
- */
- static css::uno::Sequence< OUString > impl_getSupportedServiceNames();
-
-
- /** @short return a new intsnace of this class.
-
- @descr This method is used by the uno service manager, to create
- a new instance of this service if needed.
-
- @param xSMGR
- reference to the uno service manager, which require
- this new instance. It should be passed to the new object
- so it can be used internally to create own needed uno resources.
-
- @return The new instance of this service as a uno reference.
- */
- static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
};
} // namespace config
diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx
index 00924aa22638..220fa252982f 100644
--- a/filter/source/config/cache/frameloaderfactory.cxx
+++ b/filter/source/config/cache/frameloaderfactory.cxx
@@ -31,8 +31,8 @@ FrameLoaderFactory::FrameLoaderFactory(const css::uno::Reference< css::uno::XCom
: m_xContext(rxContext)
{
BaseContainer::init(rxContext ,
- FrameLoaderFactory::impl_getImplementationName() ,
- FrameLoaderFactory::impl_getSupportedServiceNames(),
+ "com.sun.star.comp.filter.config.FrameLoaderFactory" ,
+ { "com.sun.star.frame.FrameLoaderFactory" },
FilterCache::E_FRAMELOADER );
}
@@ -90,25 +90,15 @@ css::uno::Sequence< OUString > SAL_CALL FrameLoaderFactory::getAvailableServiceN
return BaseContainer::getElementNames();
}
-
-OUString FrameLoaderFactory::impl_getImplementationName()
-{
- return "com.sun.star.comp.filter.config.FrameLoaderFactory";
-}
-
-
-css::uno::Sequence< OUString > FrameLoaderFactory::impl_getSupportedServiceNames()
-{
- return { "com.sun.star.frame.FrameLoaderFactory" };
-}
+} // namespace filter::config
-css::uno::Reference< css::uno::XInterface > FrameLoaderFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_FrameLoaderFactory_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
- FrameLoaderFactory* pNew = new FrameLoaderFactory( comphelper::getComponentContext(xSMGR) );
- return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY);
+ return cppu::acquire(new filter::config::FrameLoaderFactory(context));
}
-} // namespace filter::config
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/config/cache/frameloaderfactory.hxx b/filter/source/config/cache/frameloaderfactory.hxx
index 7a0b744d2152..1c2d9cc2822e 100644
--- a/filter/source/config/cache/frameloaderfactory.hxx
+++ b/filter/source/config/cache/frameloaderfactory.hxx
@@ -73,47 +73,8 @@ class FrameLoaderFactory : public ::cppu::ImplInheritanceHelper< BaseContainer
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override;
- // static uno helper!
-
public:
-
- /** @short return the uno implementation name of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- it's implemented as a static function!
-
- @return The fix uno implementation name of this class.
- */
- static OUString impl_getImplementationName();
-
-
- /** @short return the list of supported uno services of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- it's implemented as a static function!
-
- @return The fix list of uno services supported by this class.
- */
- static css::uno::Sequence< OUString > impl_getSupportedServiceNames();
-
-
- /** @short return a new intsnace of this class.
-
- @descr This method is used by the uno service manager, to create
- a new instance of this service if needed.
-
- @param xSMGR
- reference to the uno service manager, which require
- this new instance. It should be passed to the new object
- so it can be used internally to create own needed uno resources.
-
- @return The new instance of this service as a uno reference.
- */
- static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
-
// Overrides to resolve ambiguity
virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override
{ return BaseContainer::getByName(aName); }
diff --git a/filter/source/config/cache/registration.cxx b/filter/source/config/cache/registration.cxx
index cd5c1ccad8a6..76e7775913c3 100644
--- a/filter/source/config/cache/registration.cxx
+++ b/filter/source/config/cache/registration.cxx
@@ -45,30 +45,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void*
css::uno::Reference< css::lang::XSingleServiceFactory > xFactory;
OUString sImplName = OUString::createFromAscii(pImplementationName);
- if (TypeDetection::impl_getImplementationName() == sImplName)
- xFactory = cppu::createSingleFactory( xSMGR,
- TypeDetection::impl_getImplementationName(),
- TypeDetection::impl_createInstance,
- TypeDetection::impl_getSupportedServiceNames() );
-
- if (FilterFactory::impl_getImplementationName() == sImplName)
- xFactory = cppu::createSingleFactory( xSMGR,
- FilterFactory::impl_getImplementationName(),
- FilterFactory::impl_createInstance,
- FilterFactory::impl_getSupportedServiceNames() );
-
- if (ContentHandlerFactory::impl_getImplementationName() == sImplName)
- xFactory = cppu::createSingleFactory( xSMGR,
- ContentHandlerFactory::impl_getImplementationName(),
- ContentHandlerFactory::impl_createInstance,
- ContentHandlerFactory::impl_getSupportedServiceNames() );
-
- if (FrameLoaderFactory::impl_getImplementationName() == sImplName)
- xFactory = cppu::createSingleFactory( xSMGR,
- FrameLoaderFactory::impl_getImplementationName(),
- FrameLoaderFactory::impl_createInstance,
- FrameLoaderFactory::impl_getSupportedServiceNames() );
-
if (ConfigFlush::impl_getImplementationName() == sImplName)
xFactory = cppu::createOneInstanceFactory( xSMGR,
ConfigFlush::impl_getImplementationName(),
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 1b80a01dd2e8..ef164df45c26 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -56,8 +56,8 @@ TypeDetection::TypeDetection(const css::uno::Reference< css::uno::XComponentCont
{
css::frame::Desktop::create(m_xContext)->addTerminateListener(m_xTerminateListener.get());
BaseContainer::init(rxContext ,
- TypeDetection::impl_getImplementationName() ,
- TypeDetection::impl_getSupportedServiceNames(),
+ "com.sun.star.comp.filter.config.TypeDetection" ,
+ { "com.sun.star.document.TypeDetection" },
FilterCache::E_TYPE );
}
@@ -1197,25 +1197,13 @@ bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescri
return false;
}
+} // namespace filter
-OUString TypeDetection::impl_getImplementationName()
-{
- return "com.sun.star.comp.filter.config.TypeDetection";
-}
-
-
-css::uno::Sequence< OUString > TypeDetection::impl_getSupportedServiceNames()
-{
- return { "com.sun.star.document.TypeDetection" };
-}
-
-
-css::uno::Reference< css::uno::XInterface > TypeDetection::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_TypeDetection_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
- TypeDetection* pNew = new TypeDetection( comphelper::getComponentContext(xSMGR) );
- return css::uno::Reference< css::uno::XInterface >(static_cast< css::document::XTypeDetection* >(pNew), css::uno::UNO_QUERY);
+ return cppu::acquire(new filter::config::TypeDetection(context));
}
-} // namespace filter
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx
index e8ce727cfe12..93c2d32b1da5 100644
--- a/filter/source/config/cache/typedetection.hxx
+++ b/filter/source/config/cache/typedetection.hxx
@@ -327,47 +327,6 @@ public:
virtual OUString SAL_CALL queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor,
sal_Bool bAllowDeep ) override;
-
-// static uno helper!
-
-public:
-
-
- /** @short return the uno implementation name of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- it's implemented as a static function!
-
- @return The fix uno implementation name of this class.
- */
- static OUString impl_getImplementationName();
-
-
- /** @short return the list of supported uno services of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- it's implemented as a static function!
-
- @return The fix list of uno services supported by this class.
- */
- static css::uno::Sequence< OUString > impl_getSupportedServiceNames();
-
-
- /** @short return a new intsnace of this class.
-
- @descr This method is used by the uno service manager, to create
- a new instance of this service if needed.
-
- @param xSMGR
- reference to the uno service manager, which require
- this new instance. It should be passed to the new object
- so it can be used internally to create own needed uno resources.
-
- @return The new instance of this service as a uno reference.
- */
- static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
};
class TerminateDetection : public cppu::WeakComponentImplHelper<css::frame::XTerminateListener>