summaryrefslogtreecommitdiff
path: root/extensions/source/propctrlr/propertyhandler.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-22 09:27:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-22 14:40:58 +0200
commit5c2b301f031ff8374fcf0e4c2ed8f9bd4300815e (patch)
tree5a7091c2939a2244dc84548c411f9095b83305bf /extensions/source/propctrlr/propertyhandler.hxx
parent690b9b08373dc7cc08517c4273c777154e893bd7 (diff)
extensions/prop: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I89d2c8d0b2bf960b3de1853c69fa64ff41b484ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99185 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions/source/propctrlr/propertyhandler.hxx')
-rw-r--r--extensions/source/propctrlr/propertyhandler.hxx80
1 files changed, 1 insertions, 79 deletions
diff --git a/extensions/source/propctrlr/propertyhandler.hxx b/extensions/source/propctrlr/propertyhandler.hxx
index f09e8bf523b9..b547e9600f9b 100644
--- a/extensions/source/propctrlr/propertyhandler.hxx
+++ b/extensions/source/propctrlr/propertyhandler.hxx
@@ -361,89 +361,11 @@ namespace pcr
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override = 0;
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) final override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override = 0;
};
- //= HandlerComponentBase
-
- /** a PropertyHandlerComponent implementation which routes XServiceInfo::getImplementationName and
- XServiceInfo::getSupportedServiceNames to static versions of those methods, which are part of
- the derived class.
-
- Additionally, a method <member>Create</member> is provided which takes a component context, and returns a new
- instance of the derived class. This <member>Create</member> is used to register the implementation
- of the derived class at the <type>PcrModule</type>.
-
- Well, every time we're talking about derived class, we in fact mean the template argument of
- <type>HandlerComponentBase</type>. But usually this equals your derived class:
- <pre>
- class MyHandler;
- typedef HandlerComponentBase< MyHandler > MyHandler_Base;
- class MyHandler : MyHandler_Base
- {
- ...
- public:
- static OUString SAL_CALL getImplementationName_static( ) throw (css::uno::RuntimeException);
- static css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_static( ) throw (css::uno::RuntimeException);
- };
- </pre>
- */
- template < class HANDLER >
- class HandlerComponentBase : public PropertyHandlerComponent
- {
- protected:
- explicit HandlerComponentBase( const css::uno::Reference< css::uno::XComponentContext >& _rxContext )
- :PropertyHandlerComponent( _rxContext )
- {
- }
-
- protected:
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
- static css::uno::Reference< css::uno::XInterface > SAL_CALL Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
-
- public:
- /** registers the implementation of HANDLER at the <type>PcrModule</type>
- */
- static void registerImplementation();
- };
-
-
- template < class HANDLER >
- OUString SAL_CALL HandlerComponentBase< HANDLER >::getImplementationName( )
- {
- return HANDLER::getImplementationName_static();
- }
-
-
- template < class HANDLER >
- css::uno::Sequence< OUString > SAL_CALL HandlerComponentBase< HANDLER >::getSupportedServiceNames( )
- {
- return HANDLER::getSupportedServiceNames_static();
- }
-
-
- template < class HANDLER >
- void HandlerComponentBase< HANDLER >::registerImplementation()
- {
- PcrModule::getInstance().registerImplementation(
- HANDLER::getImplementationName_static(),
- HANDLER::getSupportedServiceNames_static(),
- HANDLER::Create
- );
- }
-
-
- template < class HANDLER >
- css::uno::Reference< css::uno::XInterface > SAL_CALL HandlerComponentBase< HANDLER >::Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext )
- {
- return *( new HANDLER( _rxContext ) );
- }
-
-
} // namespace pcr