[Libreoffice-commits] .: basic/source

Matus Kukan mkukan at kemper.freedesktop.org
Thu Jul 21 04:31:07 PDT 2011


 basic/source/uno/sbmodule.cxx   |   19 ++++++++++++++-
 basic/source/uno/sbmodule.hxx   |   50 +++++++++++++++++++++++++++++++++++++++-
 basic/source/uno/sbservices.cxx |    7 ++++-
 3 files changed, 73 insertions(+), 3 deletions(-)

New commits:
commit 628d9181189802fd8a729087ae7a960f94c68ac0
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Jul 21 13:29:42 2011 +0200

    Do not use macros from comphelper's componentmodule.hxx

diff --git a/basic/source/uno/sbmodule.cxx b/basic/source/uno/sbmodule.cxx
index f054225..e2a7b20 100644
--- a/basic/source/uno/sbmodule.cxx
+++ b/basic/source/uno/sbmodule.cxx
@@ -36,7 +36,24 @@ namespace basic
 {
 //........................................................................
 
-    IMPLEMENT_COMPONENT_MODULE( BasicModule );
+    struct BasicModuleCreator
+    {
+        BasicModule m_aBasicModule;
+    };
+    namespace
+    {
+        class theBasicModuleInstance : public rtl::Static<BasicModuleCreator, theBasicModuleInstance> {};
+    }
+
+    BasicModule::BasicModule()
+        :BaseClass()
+    {
+    }
+
+    BasicModule& BasicModule::getInstance()
+    {
+        return theBasicModuleInstance::get().m_aBasicModule;
+    }
 
 //........................................................................
 } // namespace basic
diff --git a/basic/source/uno/sbmodule.hxx b/basic/source/uno/sbmodule.hxx
index 64e9f16..06429a1 100644
--- a/basic/source/uno/sbmodule.hxx
+++ b/basic/source/uno/sbmodule.hxx
@@ -36,7 +36,55 @@ namespace basic
 {
 //........................................................................
 
-    DECLARE_COMPONENT_MODULE( BasicModule, BasicModuleClient )
+    class BasicModule : public ::comphelper::OModule
+    {
+        friend struct BasicModuleCreator;
+        typedef ::comphelper::OModule BaseClass;
+
+    public:
+        static BasicModule& getInstance();
+
+    private:
+        BasicModule();
+    };
+
+    /* -------------------------------------------------------------------- */
+    class BasicModuleClient : public ::comphelper::OModuleClient
+    {
+    private:
+        typedef ::comphelper::OModuleClient BaseClass;
+
+    public:
+        BasicModuleClient() : BaseClass( BasicModule::getInstance() )
+        {
+        }
+    };
+
+    /* -------------------------------------------------------------------- */
+    template < class TYPE >
+    class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE >
+    {
+    private:
+        typedef ::comphelper::OAutoRegistration< TYPE > BaseClass;
+
+    public:
+        OAutoRegistration() : BaseClass( BasicModule::getInstance() )
+        {
+        }
+    };
+
+    /* -------------------------------------------------------------------- */
+    template < class TYPE >
+    class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE >
+    {
+    private:
+        typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass;
+
+    public:
+        OSingletonRegistration() : BaseClass( BasicModule::getInstance() )
+        {
+        }
+    };
 
 //........................................................................
 } // namespace basic
diff --git a/basic/source/uno/sbservices.cxx b/basic/source/uno/sbservices.cxx
index 77361ef..4b295de 100644
--- a/basic/source/uno/sbservices.cxx
+++ b/basic/source/uno/sbservices.cxx
@@ -60,6 +60,11 @@ namespace basic
 } // namespace basic
 //........................................................................
 
-IMPLEMENT_COMPONENT_LIBRARY_API( ::basic::BasicModule, ::basic::initializeModule )
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+    const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey )
+{
+    ::basic::initializeModule();
+    return ::basic::BasicModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey );
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list