diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-16 10:16:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-16 11:37:14 +0200 |
commit | e2e66c4a37350155a4dbb6ec5e2811b9f87a6883 (patch) | |
tree | 77db9b49934db9f85409ddb724d7d6f6a8ba455b /extensions | |
parent | f510f6a0b339522b0146d26630b139e0421a3657 (diff) |
extensions/bib: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I022d29f4c39f79ed8e0fafe0687e95088279e046
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98875
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/bibliography/bib.component | 5 | ||||
-rw-r--r-- | extensions/source/bibliography/bibload.cxx | 56 |
2 files changed, 9 insertions, 52 deletions
diff --git a/extensions/source/bibliography/bib.component b/extensions/source/bibliography/bib.component index 37963bb90497..19841cc9e970 100644 --- a/extensions/source/bibliography/bib.component +++ b/extensions/source/bibliography/bib.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="bib" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.extensions.Bibliography"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.extensions.Bibliography" + constructor="extensions_BibliographyLoader_get_implementation"> <service name="com.sun.star.frame.Bibliography"/> <service name="com.sun.star.frame.FrameLoader"/> </implementation> diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 10067f17b23c..b8a7dafa7a3e 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -66,8 +66,6 @@ using namespace ::com::sun::star::form; using namespace ::com::sun::star::container; using namespace ::com::sun::star::frame; -static Reference< XInterface > BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ); - namespace { class BibliographyLoader : public cppu::WeakImplHelper @@ -94,15 +92,8 @@ public: // XServiceInfo OUString SAL_CALL getImplementationName() override; - sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - static OUString getImplementationName_Static() throw( ) - - { - //! - return "com.sun.star.extensions.Bibliography"; - //! - } //XNameAccess virtual Any SAL_CALL getByName(const OUString& aName) override; @@ -122,11 +113,6 @@ public: virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) override; virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) override; - static Sequence<OUString> getSupportedServiceNames_Static() throw( ); - - /// @throws Exception - friend Reference< XInterface > (::BibliographyLoader_CreateInstance)( const Reference< XMultiServiceFactory > & rSMgr ); - // XLoader virtual void SAL_CALL load(const Reference< XFrame > & aFrame, const OUString& aURL, const Sequence< PropertyValue >& aArgs, @@ -151,17 +137,10 @@ BibliographyLoader::~BibliographyLoader() } -Reference< XInterface > BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & /*rSMgr*/ ) -{ - return *(new BibliographyLoader); -} - - // XServiceInfo OUString BibliographyLoader::getImplementationName() - { - return getImplementationName_Static(); + return "com.sun.star.extensions.Bibliography"; } // XServiceInfo @@ -173,37 +152,14 @@ sal_Bool BibliographyLoader::supportsService(const OUString& ServiceName) // XServiceInfo Sequence< OUString > BibliographyLoader::getSupportedServiceNames() { - return getSupportedServiceNames_Static(); -} - -// ORegistryServiceManager_Static -Sequence< OUString > BibliographyLoader::getSupportedServiceNames_Static() throw( ) -{ return { "com.sun.star.frame.FrameLoader", "com.sun.star.frame.Bibliography" }; } -extern "C" +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_BibliographyLoader_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - SAL_DLLPUBLIC_EXPORT void * bib_component_getFactory( - const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) - { - void * pRet = nullptr; - if (BibliographyLoader::getImplementationName_Static().equalsAscii( pImplName ) ) - { - // create the factory - Reference< XSingleServiceFactory > xFactory = - cppu::createSingleFactory( - static_cast<css::lang::XMultiServiceFactory *>(pServiceManager), - BibliographyLoader::getImplementationName_Static(), - BibliographyLoader_CreateInstance, - BibliographyLoader::getSupportedServiceNames_Static() ); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; - } - + return cppu::acquire(new BibliographyLoader()); } void BibliographyLoader::cancel() |