[Libreoffice-commits] core.git: 2 commits - scripting/Library_vbaevents.mk scripting/source

Stephan Bergmann sbergman at redhat.com
Thu Mar 12 02:48:26 PDT 2015


 scripting/Library_vbaevents.mk                 |    1 
 scripting/source/vbaevents/eventhelper.cxx     |   98 +++++++++++++------------
 scripting/source/vbaevents/service.cxx         |   59 ---------------
 scripting/source/vbaevents/service.hxx         |   55 --------------
 scripting/source/vbaevents/vbaevents.component |    8 +-
 5 files changed, 59 insertions(+), 162 deletions(-)

New commits:
commit 2358dfc60274fdc928ec614a893344608b8f3c52
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 12 10:47:43 2015 +0100

    Clean up previous commit
    
    ...and add missing XServiceInfo implementations
    
    Change-Id: I719cd10b6202d94e751805e1b838eb3f193e24d1

diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index babe1cb..fe942f4 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -70,16 +70,12 @@
 #include <comphelper/anytostring.hxx>
 
 #include <com/sun/star/script/XScriptListener.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase.hxx>
 #include <comphelper/evtmethodhelper.hxx>
 
 #include <list>
 #include <unordered_map>
 
-#include <service.hxx>
-
 #define ASYNC 0
 
 // primitive support for asynchronous handling of
@@ -461,7 +457,7 @@ ScriptEventHelper::createEvents( const OUString& sCodeName )
 }
 
 
-typedef ::cppu::WeakImplHelper1< container::XNameContainer > NameContainer_BASE;
+typedef ::cppu::WeakImplHelper< container::XNameContainer > NameContainer_BASE;
 
 class ReadOnlyEventsNameContainer : public NameContainer_BASE
 {
@@ -549,7 +545,7 @@ ReadOnlyEventsNameContainer::hasByName( const OUString& aName ) throw (RuntimeEx
     return sal_True;
 }
 
-typedef ::cppu::WeakImplHelper1< XScriptEventsSupplier > EventsSupplier_BASE;
+typedef ::cppu::WeakImplHelper< XScriptEventsSupplier > EventsSupplier_BASE;
 
 class ReadOnlyEventsSupplier : public EventsSupplier_BASE
 {
@@ -563,7 +559,7 @@ private:
     Reference< container::XNameContainer > m_xNameContainer;
 };
 
-typedef ::cppu::WeakImplHelper3< XScriptListener, util::XCloseListener, lang::XInitialization > EventListener_BASE;
+typedef ::cppu::WeakImplHelper< XScriptListener, util::XCloseListener, lang::XInitialization, css::lang::XServiceInfo > EventListener_BASE;
 
 #define EVENTLSTNR_PROPERTY_ID_MODEL         1
 #define EVENTLSTNR_PROPERTY_MODEL            OUString( "Model"  )
@@ -622,6 +618,25 @@ public:
             setShellFromModel();
     }
 
+    OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
+    {
+        return OUString( "ooo.vba.EventListener"  );
+    }
+
+    sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
+    {
+        return cppu::supportsService(this, ServiceName);
+    }
+
+    css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
+    {
+        const OUString strName( getImplementationName() );
+        return Sequence< OUString >( &strName, 1 );
+    }
+
 protected:
     // OPropertySetHelper
     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(  ) SAL_OVERRIDE;
@@ -1017,7 +1032,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
     }
 }
 
-typedef ::cppu::WeakImplHelper1< XVBAToOOEventDescGen > VBAToOOEventDescGen_BASE;
+typedef ::cppu::WeakImplHelper< XVBAToOOEventDescGen, css::lang::XServiceInfo > VBAToOOEventDescGen_BASE;
 
 
 class VBAToOOEventDescGen : public VBAToOOEventDescGen_BASE
@@ -1028,6 +1043,26 @@ public:
     // XVBAToOOEventDescGen
     virtual Sequence< ScriptEventDescriptor > SAL_CALL getEventDescriptions( const OUString& sCtrlServiceName, const OUString& sCodeName ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     virtual Reference< XScriptEventsSupplier > SAL_CALL getEventSupplier( const Reference< XInterface >& xControl,  const OUString& sCodeName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
+    {
+        return OUString( "ooo.vba.VBAToOOEventDesc"  );
+    }
+
+    sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
+    {
+        return cppu::supportsService(this, ServiceName);
+    }
+
+    css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
+    {
+        const OUString strName( getImplementationName() );
+        return Sequence< OUString >( &strName, 1 );
+    }
+
 private:
     Reference< XComponentContext > m_xContext;
 
@@ -1052,42 +1087,6 @@ VBAToOOEventDescGen::getEventSupplier( const Reference< XInterface >& xControl,
     return xSupplier;
 }
 
-// Component related
-
-namespace evtlstner
-{
-    OUString SAL_CALL getImplementationName()
-    {
-        return OUString( "ooo.vba.EventListener"  );
-    }
-
-    uno::Reference< XInterface > SAL_CALL create(
-    Reference< XComponentContext > const & xContext )
-    {
-        return static_cast< lang::XTypeProvider * >( new EventListener( xContext ) );
-    }
-
-    Sequence< OUString > SAL_CALL getSupportedServiceNames()
-    {
-        const OUString strName( ::evtlstner::getImplementationName() );
-        return Sequence< OUString >( &strName, 1 );
-    }
-}
-namespace ooevtdescgen
-{
-    OUString SAL_CALL getImplementationName()
-    {
-        return OUString( "ooo.vba.VBAToOOEventDesc"  );
-    }
-
-    Sequence< OUString > SAL_CALL getSupportedServiceNames()
-    {
-        const OUString strName( ::ooevtdescgen::getImplementationName() );
-        return Sequence< OUString >( &strName, 1 );
-    }
-}
-
-
 extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
 ooo_vba_EventListener_get_implementation(::com::sun::star::uno::XComponentContext* context,
                                          ::com::sun::star::uno::Sequence<css::uno::Any> const &)
diff --git a/scripting/source/vbaevents/service.hxx b/scripting/source/vbaevents/service.hxx
deleted file mode 100644
index cff03cb..0000000
--- a/scripting/source/vbaevents/service.hxx
+++ /dev/null
@@ -1,49 +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 .
- */
-
-#ifndef INCLUDED_SCRIPTING_SOURCE_VBAEVENTS_SERVICE_HXX
-#define INCLUDED_SCRIPTING_SOURCE_VBAEVENTS_SERVICE_HXX
-
-#include <sal/config.h>
-
-namespace evtlstner
-{
-
-    // component operations
-
-    OUString SAL_CALL getImplementationName();
-
-    css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames();
-
-} // end evtlstner
-
-namespace ooevtdescgen
-{
-
-    // component operations
-
-    OUString SAL_CALL getImplementationName();
-
-    css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames();
-
-} // end ooevtdescgen
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/vbaevents/vbaevents.component b/scripting/source/vbaevents/vbaevents.component
index cf39be0..75fcf02 100644
--- a/scripting/source/vbaevents/vbaevents.component
+++ b/scripting/source/vbaevents/vbaevents.component
@@ -18,7 +18,7 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="vbaevents" xmlns="http://openoffice.org/2010/uno-components">
+    xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="ooo.vba.EventListener"
       constructor="ooo_vba_EventListener_get_implementation">
     <service name="ooo.vba.EventListener"/>
commit 6f7b0a1fad61e14ac82d14fad2280344169c51ad
Author: Chris Sherlock <chris.sherlock at collabora.com>
Date:   Thu Mar 5 20:20:46 2015 +1100

    scripting: use constructor syntax in vbaevents.component
    
    Change-Id: Ie27ec9ca92137e9f8666d2080fd1bc028417e337
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/scripting/Library_vbaevents.mk b/scripting/Library_vbaevents.mk
index acf7af5..482ffbb 100644
--- a/scripting/Library_vbaevents.mk
+++ b/scripting/Library_vbaevents.mk
@@ -38,7 +38,6 @@ $(eval $(call gb_Library_use_libraries,vbaevents,\
 
 $(eval $(call gb_Library_add_exception_objects,vbaevents,\
 	scripting/source/vbaevents/eventhelper \
-	scripting/source/vbaevents/service \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index a9e970d..babe1cb 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -1080,12 +1080,6 @@ namespace ooevtdescgen
         return OUString( "ooo.vba.VBAToOOEventDesc"  );
     }
 
-    uno::Reference< XInterface > SAL_CALL create(
-        Reference< XComponentContext > const & xContext )
-    {
-        return static_cast< lang::XTypeProvider * >( new VBAToOOEventDescGen( xContext ) );
-    }
-
     Sequence< OUString > SAL_CALL getSupportedServiceNames()
     {
         const OUString strName( ::ooevtdescgen::getImplementationName() );
@@ -1093,4 +1087,21 @@ namespace ooevtdescgen
     }
 }
 
+
+extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
+ooo_vba_EventListener_get_implementation(::com::sun::star::uno::XComponentContext* context,
+                                         ::com::sun::star::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new EventListener(context));
+}
+
+
+extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
+ooo_vba_VBAToOOEventDesc_get_implementation(::com::sun::star::uno::XComponentContext* context,
+                                            ::com::sun::star::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new VBAToOOEventDescGen(context));
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/vbaevents/service.cxx b/scripting/source/vbaevents/service.cxx
deleted file mode 100644
index d6f21e2..0000000
--- a/scripting/source/vbaevents/service.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 "cppuhelper/implementationentry.hxx"
-#include <osl/diagnose.h>
-
-#include <service.hxx>
-
-// component exports
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-    const ::cppu::ImplementationEntry s_component_entries [] =
-    {
-        {
-            ::evtlstner::create, ::evtlstner::getImplementationName,
-            ::evtlstner::getSupportedServiceNames,
-            ::cppu::createSingleComponentFactory,
-            0, 0
-        },
-        {
-            ::ooevtdescgen::create, ::ooevtdescgen::getImplementationName,
-            ::ooevtdescgen::getSupportedServiceNames,
-            ::cppu::createSingleComponentFactory,
-            0, 0
-        },
-        { 0, 0, 0, 0, 0, 0 }
-    };
-
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT  void * SAL_CALL vbaevents_component_getFactory(
-        const sal_Char * pImplName, void * pServiceManager,
-        void * pRegistryKey )
-    {
-        OSL_TRACE("In component_getFactory");
-        return ::cppu::component_getFactoryHelper(
-            pImplName, pServiceManager, pRegistryKey, s_component_entries );
-    }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/vbaevents/service.hxx b/scripting/source/vbaevents/service.hxx
index 4c8357c..cff03cb 100644
--- a/scripting/source/vbaevents/service.hxx
+++ b/scripting/source/vbaevents/service.hxx
@@ -27,9 +27,6 @@ namespace evtlstner
 
     // component operations
 
-    css::uno::Reference< css::uno::XInterface > SAL_CALL create(
-        css::uno::Reference< css::uno::XComponentContext > const & xContext );
-
     OUString SAL_CALL getImplementationName();
 
     css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames();
@@ -41,9 +38,6 @@ namespace ooevtdescgen
 
     // component operations
 
-    css::uno::Reference< css::uno::XInterface > SAL_CALL create(
-        css::uno::Reference< css::uno::XComponentContext > const & xContext );
-
     OUString SAL_CALL getImplementationName();
 
     css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames();
diff --git a/scripting/source/vbaevents/vbaevents.component b/scripting/source/vbaevents/vbaevents.component
index 15b3eb6..cf39be0 100644
--- a/scripting/source/vbaevents/vbaevents.component
+++ b/scripting/source/vbaevents/vbaevents.component
@@ -19,10 +19,12 @@
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     prefix="vbaevents" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="ooo.vba.EventListener">
+  <implementation name="ooo.vba.EventListener"
+      constructor="ooo_vba_EventListener_get_implementation">
     <service name="ooo.vba.EventListener"/>
   </implementation>
-  <implementation name="ooo.vba.VBAToOOEventDesc">
+  <implementation name="ooo.vba.VBAToOOEventDesc"
+      constructor="ooo_vba_VBAToOOEventDesc_get_implementation">
     <service name="ooo.vba.VBAToOOEventDesc"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list