diff options
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/inc/comphelper_module.hxx | 50 | ||||
-rw-r--r-- | comphelper/source/misc/comphelper_module.cxx | 19 | ||||
-rw-r--r-- | comphelper/source/misc/comphelper_services.cxx | 7 | ||||
-rw-r--r-- | comphelper/source/misc/storagehelper.cxx | 17 |
4 files changed, 73 insertions, 20 deletions
diff --git a/comphelper/source/inc/comphelper_module.hxx b/comphelper/source/inc/comphelper_module.hxx index 9f8e32656715..dfa364df1983 100644 --- a/comphelper/source/inc/comphelper_module.hxx +++ b/comphelper/source/inc/comphelper_module.hxx @@ -35,7 +35,55 @@ namespace comphelper { namespace module { //........................................................................ - DECLARE_COMPONENT_MODULE( ComphelperModule, ComphelperModuleClient ) + class ComphelperModule : public ::comphelper::OModule + { + friend struct ComphelperModuleCreator; + typedef ::comphelper::OModule BaseClass; + + public: + static ComphelperModule& getInstance(); + + private: + ComphelperModule(); + }; + + /* -------------------------------------------------------------------- */ + class ComphelperModuleClient : public ::comphelper::OModuleClient + { + private: + typedef ::comphelper::OModuleClient BaseClass; + + public: + ComphelperModuleClient() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; + + /* -------------------------------------------------------------------- */ + template < class TYPE > + class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > + { + private: + typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; + + public: + OAutoRegistration() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; + + /* -------------------------------------------------------------------- */ + template < class TYPE > + class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > + { + private: + typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; + + public: + OSingletonRegistration() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; //........................................................................ } } // namespace comphelper::module diff --git a/comphelper/source/misc/comphelper_module.cxx b/comphelper/source/misc/comphelper_module.cxx index 8b9ee4221dfc..b2bdad6665cb 100644 --- a/comphelper/source/misc/comphelper_module.cxx +++ b/comphelper/source/misc/comphelper_module.cxx @@ -35,7 +35,24 @@ namespace comphelper { namespace module { //........................................................................ - IMPLEMENT_COMPONENT_MODULE( ComphelperModule ); + struct ComphelperModuleCreator + { + ComphelperModule m_aComphelperModule; + }; + namespace + { + class theComphelperModuleInstance : public rtl::Static<ComphelperModuleCreator, theComphelperModuleInstance> {}; + } + + ComphelperModule::ComphelperModule() + :BaseClass() + { + } + + ComphelperModule& ComphelperModule::getInstance() + { + return theComphelperModuleInstance::get().m_aComphelperModule; + } //........................................................................ } } // namespace comphelper::module diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx index 32d1c53aff93..ad5558fb8ee7 100644 --- a/comphelper/source/misc/comphelper_services.cxx +++ b/comphelper/source/misc/comphelper_services.cxx @@ -85,6 +85,11 @@ namespace comphelper { namespace module } } // namespace comphelper::module //........................................................................ -IMPLEMENT_COMPONENT_LIBRARY_API( ::comphelper::module::ComphelperModule, ::comphelper::module::initializeModule ) +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) +{ + ::comphelper::module::initializeModule(); + return ::comphelper::module::ComphelperModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 3441e0a1736f..70b7852b579a 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -314,23 +314,6 @@ sal_Int32 OStorageHelper::GetXStorageFormat( } // ---------------------------------------------------------------------- -uno::Reference< embed::XStorage > OStorageHelper::GetTemporaryStorageOfFormat( - const ::rtl::OUString& aFormat, - const uno::Reference< lang::XMultiServiceFactory >& xFactory ) - throw ( uno::Exception ) -{ - uno::Reference< lang::XMultiServiceFactory > xFactoryToUse = xFactory.is() ? xFactory : ::comphelper::getProcessServiceFactory(); - if ( !xFactoryToUse.is() ) - throw uno::RuntimeException(); - - uno::Reference< io::XStream > xTmpStream( - xFactoryToUse->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ), - uno::UNO_QUERY_THROW ); - - return GetStorageOfFormatFromStream( aFormat, xTmpStream, embed::ElementModes::READWRITE, xFactoryToUse ); -} - -// ---------------------------------------------------------------------- uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL( const ::rtl::OUString& aFormat, const ::rtl::OUString& aURL, |