[Libreoffice-commits] core.git: extensions/Library_abp.mk extensions/source

Matúš Kukan matus.kukan at gmail.com
Sun Jan 3 02:32:30 PST 2016


 extensions/Library_abp.mk                  |    1 
 extensions/source/abpilot/abp.component    |    5 +-
 extensions/source/abpilot/abpservices.cxx  |   59 -----------------------------
 extensions/source/abpilot/unodialogabp.cxx |   54 ++++++--------------------
 extensions/source/abpilot/unodialogabp.hxx |   23 ++---------
 5 files changed, 23 insertions(+), 119 deletions(-)

New commits:
commit d4bbf358eb19a8c96720595b9aa3fdf47d9e02f9
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Dec 31 16:08:44 2015 +0100

    tdf#74608: Ctor function for abp::OABSPilotUno
    
    Change-Id: I15f64797340ae366e02c2b503767cd3d22a66eeb

diff --git a/extensions/Library_abp.mk b/extensions/Library_abp.mk
index 559b8d82..e12bd26 100644
--- a/extensions/Library_abp.mk
+++ b/extensions/Library_abp.mk
@@ -30,7 +30,6 @@ $(eval $(call gb_Library_use_sdk_api,abp))
 
 $(eval $(call gb_Library_add_exception_objects,abp,\
 	extensions/source/abpilot/abpfinalpage \
-	extensions/source/abpilot/abpservices \
 	extensions/source/abpilot/abspage \
 	extensions/source/abpilot/abspilot \
 	extensions/source/abpilot/admininvokationimpl \
diff --git a/extensions/source/abpilot/abp.component b/extensions/source/abpilot/abp.component
index 6c1580a..91b9638 100644
--- a/extensions/source/abpilot/abp.component
+++ b/extensions/source/abpilot/abp.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="abp" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="org.openoffice.comp.abp.OAddressBookSourcePilot">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="org.openoffice.comp.abp.OAddressBookSourcePilot"
+      constructor="org_openoffice_comp_abp_OAddressBookSourcePilot">
     <service name="com.sun.star.ui.dialogs.AddressBookSourcePilot"/>
   </implementation>
 </component>
diff --git a/extensions/source/abpilot/abpservices.cxx b/extensions/source/abpilot/abpservices.cxx
deleted file mode 100644
index 16be0a0..0000000
--- a/extensions/source/abpilot/abpservices.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "componentmodule.hxx"
-#include "unodialogabp.hxx"
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-
-extern "C" void SAL_CALL abp_initializeModule()
-{
-    static bool s_bInit = false;
-    if (!s_bInit)
-    {
-        createRegistryInfo_OABSPilotUno();
-        ::abp::OModule::setResourceFilePrefix("abp");
-        s_bInit = true;
-    }
-}
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL abp_component_getFactory(
-                    const sal_Char* pImplementationName,
-                    void* pServiceManager,
-                    void* /*pRegistryKey*/)
-{
-    abp_initializeModule();
-
-    Reference< XInterface > xRet;
-    if (pServiceManager && pImplementationName)
-    {
-        xRet = ::abp::OModule::getComponentFactory(
-            OUString::createFromAscii(pImplementationName),
-            static_cast< XMultiServiceFactory* >(pServiceManager));
-    }
-
-    if (xRet.is())
-        xRet->acquire();
-    return xRet.get();
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx
index 3f01533..af54ed9 100644
--- a/extensions/source/abpilot/unodialogabp.cxx
+++ b/extensions/source/abpilot/unodialogabp.cxx
@@ -24,17 +24,10 @@
 #include <comphelper/sequence.hxx>
 #include <vcl/msgbox.hxx>
 
-void SAL_CALL createRegistryInfo_OABSPilotUno()
-{
-    static ::abp::OMultiInstanceAutoRegistration< ::abp::OABSPilotUno > aAutoRegistration;
-}
-
 #define PROPERTY_ID_DATASOURCENAME  3
 
 namespace abp
 {
-
-
     using namespace ::com::sun::star;
     using namespace ::com::sun::star::uno;
     using namespace ::com::sun::star::lang;
@@ -48,72 +41,45 @@ namespace abp
             &m_sDataSourceName, cppu::UnoType<decltype(m_sDataSourceName)>::get() );
     }
 
-
     Any SAL_CALL OABSPilotUno::queryInterface( const Type& aType ) throw (RuntimeException, std::exception)
     {
-        Any aReturn = OABSPilotUno_DBase::queryInterface( aType );
+        Any aReturn = svt::OGenericUnoDialog::queryInterface( aType );
         return aReturn.hasValue() ? aReturn : OABSPilotUno_JBase::queryInterface( aType );
     }
 
-
     void SAL_CALL OABSPilotUno::acquire(  ) throw ()
     {
-        OABSPilotUno_DBase::acquire();
+        svt::OGenericUnoDialog::acquire();
     }
 
-
     void SAL_CALL OABSPilotUno::release(  ) throw ()
     {
-        OABSPilotUno_DBase::release();
+        svt::OGenericUnoDialog::release();
     }
 
-
     Sequence< Type > SAL_CALL OABSPilotUno::getTypes(  ) throw (RuntimeException, std::exception)
     {
         return ::comphelper::concatSequences(
-            OABSPilotUno_DBase::getTypes(),
+            svt::OGenericUnoDialog::getTypes(),
             OABSPilotUno_JBase::getTypes()
         );
     }
 
-
     Sequence<sal_Int8> SAL_CALL OABSPilotUno::getImplementationId(  ) throw(RuntimeException, std::exception)
     {
         return css::uno::Sequence<sal_Int8>();
     }
 
-
-    Reference< XInterface > SAL_CALL OABSPilotUno::Create(const Reference< XMultiServiceFactory >& _rxFactory)
-    {
-        return *(new OABSPilotUno( comphelper::getComponentContext(_rxFactory) ));
-    }
-
-
     OUString SAL_CALL OABSPilotUno::getImplementationName() throw(RuntimeException, std::exception)
     {
-        return getImplementationName_Static();
-    }
-
-
-    OUString OABSPilotUno::getImplementationName_Static() throw(RuntimeException)
-    {
         return OUString("org.openoffice.comp.abp.OAddressBookSourcePilot");
     }
 
-
     css::uno::Sequence<OUString> SAL_CALL OABSPilotUno::getSupportedServiceNames() throw(RuntimeException, std::exception)
     {
-        return getSupportedServiceNames_Static();
-    }
-
-
-    css::uno::Sequence<OUString> OABSPilotUno::getSupportedServiceNames_Static() throw(RuntimeException)
-    {
-        css::uno::Sequence<OUString> aSupported { "com.sun.star.ui.dialogs.AddressBookSourcePilot" };
-        return aSupported;
+        return { "com.sun.star.ui.dialogs.AddressBookSourcePilot" };
     }
 
-
     Reference<XPropertySetInfo>  SAL_CALL OABSPilotUno::getPropertySetInfo() throw(RuntimeException, std::exception)
     {
         Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
@@ -146,7 +112,6 @@ namespace abp
         }
     }
 
-
     VclPtr<Dialog> OABSPilotUno::createDialog(vcl::Window* _pParent)
     {
         return VclPtr<OAddessBookSourcePilot>::Create(_pParent, m_aContext );
@@ -180,5 +145,14 @@ namespace abp
 
 }   // namespace abp
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+org_openoffice_comp_abp_OAddressBookSourcePilot(
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
+{
+    abp::OModule::setResourceFilePrefix("abp");
+
+    return cppu::acquire(new abp::OABSPilotUno(context));
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/abpilot/unodialogabp.hxx b/extensions/source/abpilot/unodialogabp.hxx
index 234eda1..a5145e1 100644
--- a/extensions/source/abpilot/unodialogabp.hxx
+++ b/extensions/source/abpilot/unodialogabp.hxx
@@ -26,25 +26,24 @@
 #include <com/sun/star/task/XJob.hpp>
 #include <cppuhelper/implbase1.hxx>
 
-
 namespace abp
 {
-
     class OABSPilotUno;
-    typedef ::svt::OGenericUnoDialog                                OABSPilotUno_DBase;
     typedef ::cppu::ImplHelper1< css::task::XJob >     OABSPilotUno_JBase;
     typedef ::comphelper::OPropertyArrayUsageHelper< OABSPilotUno > OABSPilotUno_PBase;
     /// the UNO wrapper for the address book source pilot
     class OABSPilotUno
             :public OModuleResourceClient
-            ,public OABSPilotUno_DBase
+            ,public svt::OGenericUnoDialog
             ,public OABSPilotUno_JBase
             ,public OABSPilotUno_PBase
     {
         OUString m_sDataSourceName;
-        OABSPilotUno(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
 
     public:
+        OABSPilotUno(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
+
+    private:
         // XInterface (disambiguation)
         virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw (css::uno::RuntimeException, std::exception) override;
         virtual void SAL_CALL acquire(  ) throw () override;
@@ -58,12 +57,6 @@ namespace abp
         virtual OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException, std::exception) override;
         virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
 
-        // XServiceInfo - static methods
-        static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw( css::uno::RuntimeException );
-        static OUString getImplementationName_Static() throw( css::uno::RuntimeException );
-        static css::uno::Reference< css::uno::XInterface >
-                SAL_CALL Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
-
         // XPropertySet
         virtual css::uno::Reference< css::beans::XPropertySetInfo>  SAL_CALL getPropertySetInfo() throw(css::uno::RuntimeException, std::exception) override;
         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
@@ -77,18 +70,14 @@ namespace abp
         // XInitialisation
         virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException, std::exception) override;
 
-        using OABSPilotUno_DBase::execute;
-    protected:
-    // OGenericUnoDialog overridables
+        using svt::OGenericUnoDialog::execute;
+        // OGenericUnoDialog overridables
         virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override;
         virtual void executedDialog(sal_Int16 _nExecutionResult) override;
     };
 
-
 }   // namespace abp
 
-extern "C" void SAL_CALL createRegistryInfo_OABSPilotUno();
-
 #endif // INCLUDED_EXTENSIONS_SOURCE_ABPILOT_UNODIALOGABP_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list