[Libreoffice-commits] core.git: 2 commits - svl/Library_svl.mk svl/source svl/util

Stephan Bergmann sbergman at redhat.com
Wed Mar 11 15:19:33 PDT 2015


 svl/Library_svl.mk                  |    1 
 svl/source/inc/registerservices.hxx |   46 -----------------
 svl/source/numbers/numfmuno.cxx     |   17 +++---
 svl/source/numbers/supservs.cxx     |   16 ++++--
 svl/source/numbers/supservs.hxx     |   11 ----
 svl/source/uno/pathservice.cxx      |   14 ++---
 svl/source/uno/registerservices.cxx |   94 ------------------------------------
 svl/util/svl.component              |   11 ++--
 8 files changed, 37 insertions(+), 173 deletions(-)

New commits:
commit 888c28dd07ad97454231e0ff7e976f311b39e40c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 11 22:47:53 2015 +0100

    Clean up previous commit
    
    Change-Id: I6ecc801d19c54ff93559bff627b99c656e71a6e4

diff --git a/svl/source/numbers/supservs.hxx b/svl/source/numbers/supservs.hxx
index e49f399..da04e95 100644
--- a/svl/source/numbers/supservs.hxx
+++ b/svl/source/numbers/supservs.hxx
@@ -25,11 +25,6 @@
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
-extern "C" ::com::sun::star::uno::XInterface *
-    SAL_CALL com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation(
-        ::com::sun::star::uno::XComponentContext* context,
-        ::com::sun::star::uno::Sequence<css::uno::Any> const &);
-
 /**
  * SvNumberFormatsSupplierServiceObject - a number formats supplier which
  * - can be instantiated as an service
@@ -38,16 +33,10 @@ extern "C" ::com::sun::star::uno::XInterface *
  * with a specific language (i.e. ::com::sun::star::lang::Locale)
  */
 class SvNumberFormatsSupplierServiceObject
-            :protected SvNumberFormatsSupplierObj
+            :public SvNumberFormatsSupplierObj
             ,public ::com::sun::star::lang::XInitialization
             ,public ::com::sun::star::lang::XServiceInfo
-{   // don't want the Set-/GetNumberFormatter to be accessible from outside
-
-    friend ::com::sun::star::uno::XInterface *
-        SAL_CALL com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation(
-                ::com::sun::star::uno::XComponentContext* context,
-                ::com::sun::star::uno::Sequence<css::uno::Any> const &);
-
+{
 protected:
     SvNumberFormatter*  m_pOwnFormatter;
     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
diff --git a/svl/source/uno/pathservice.cxx b/svl/source/uno/pathservice.cxx
index 8e02fd8..00e81d8 100644
--- a/svl/source/uno/pathservice.cxx
+++ b/svl/source/uno/pathservice.cxx
@@ -26,7 +26,10 @@
 #include <com/sun/star/frame/XConfigManager.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace com { namespace sun { namespace star { namespace uno {
+    class XComponentContext;
+} } } }
 
 class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo >
 {
diff --git a/svl/util/svl.component b/svl/util/svl.component
index e50f918..eabd64d 100644
--- a/svl/util/svl.component
+++ b/svl/util/svl.component
@@ -18,7 +18,7 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="svl" xmlns="http://openoffice.org/2010/uno-components">
+    xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="com.sun.star.comp.svl.PathService"
       constructor="com_sun_star_comp_svl_PathService_get_implementation">
     <service name="com.sun.star.config.SpecialConfigManager"/>
commit 0214898aa695bc17a40007e82dad3542d855ea70
Author: Chris Sherlock <chris.sherlock at collabora.com>
Date:   Mon Mar 2 16:25:59 2015 +1100

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

diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk
index 0754157..db08af5 100644
--- a/svl/Library_svl.mk
+++ b/svl/Library_svl.mk
@@ -139,7 +139,6 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
     svl/source/svsql/converter \
     svl/source/undo/undo \
     svl/source/uno/pathservice \
-    svl/source/uno/registerservices \
 ))
 
 ifeq ($(OS),WNT)
diff --git a/svl/source/inc/registerservices.hxx b/svl/source/inc/registerservices.hxx
deleted file mode 100644
index a6af007..0000000
--- a/svl/source/inc/registerservices.hxx
+++ /dev/null
@@ -1,46 +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_SVL_SOURCE_INC_REGISTERSERVICES_HXX
-#define INCLUDED_SVL_SOURCE_INC_REGISTERSERVICES_HXX
-
-#include <sal/config.h>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <sal/types.h>
-
-namespace com { namespace sun { namespace star {
-    namespace lang { class XMultiServiceFactory; }
-    namespace uno { class XInterface; }
-} } }
-
-css::uno::Reference<css::uno::XInterface> SAL_CALL PathService_CreateInstance(
-    css::uno::Reference<css::lang::XMultiServiceFactory> const &);
-
-css::uno::Reference<css::uno::XInterface> SAL_CALL
-SvNumberFormatsSupplierServiceObject_CreateInstance(
-    css::uno::Reference<css::lang::XMultiServiceFactory> const &);
-
-css::uno::Reference<css::uno::XInterface> SAL_CALL
-SvNumberFormatterServiceObj_CreateInstance(
-    css::uno::Reference<css::lang::XMultiServiceFactory> const &);
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 15e10a7..f486ed7 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -33,8 +33,6 @@
 #include <svl/zformat.hxx>
 #include <svl/itemprop.hxx>
 
-#include <registerservices.hxx>
-
 using namespace com::sun::star;
 
 #define PROPERTYNAME_FMTSTR     "FormatString"
@@ -115,11 +113,6 @@ SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj()
 {
 }
 
-com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvNumberFormatterServiceObj_CreateInstance( SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
-{
-    return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new SvNumberFormatterServiceObj );
-}
-
 // XNumberFormatter
 
 void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier( const uno::Reference<util::XNumberFormatsSupplier>& _xSupplier )
@@ -1099,4 +1092,14 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatSettingsObj::getSupportedServiceN
     return aRet;
 }
 
+
+extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
+com_sun_star_uno_util_numbers_SvNumberFormatterServiceObject_get_implementation(::com::sun::star::uno::XComponentContext*,
+                                                                                ::com::sun::star::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new SvNumberFormatterServiceObj());
+}
+
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx
index a2f6099..416ddef 100644
--- a/svl/source/numbers/supservs.cxx
+++ b/svl/source/numbers/supservs.cxx
@@ -22,6 +22,7 @@
 #include <comphelper/sharedmutex.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/weak.hxx>
 #include <i18nlangtag/mslangid.hxx>
 #include <tools/debug.hxx>
 #include <osl/mutex.hxx>
@@ -29,7 +30,6 @@
 #include <tools/stream.hxx>
 #include <svl/instrm.hxx>
 
-#include <registerservices.hxx>
 #include <strmadpt.hxx>
 
 using namespace ::com::sun::star::uno;
@@ -39,10 +39,6 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::util;
 using namespace ::utl;
 
-Reference< XInterface > SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory)
-{
-    return static_cast< ::cppu::OWeakObject* >(new SvNumberFormatsSupplierServiceObject( comphelper::getComponentContext(_rxFactory) ));
-}
 
 SvNumberFormatsSupplierServiceObject::SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB)
     :m_pOwnFormatter(NULL)
@@ -169,4 +165,14 @@ void SvNumberFormatsSupplierServiceObject::implEnsureFormatter()
     }
 }
 
+
+extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
+com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation(::com::sun::star::uno::XComponentContext* context,
+                                                                    ::com::sun::star::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new SvNumberFormatsSupplierServiceObject(context));
+}
+
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/numbers/supservs.hxx b/svl/source/numbers/supservs.hxx
index b2bed8e..e49f399 100644
--- a/svl/source/numbers/supservs.hxx
+++ b/svl/source/numbers/supservs.hxx
@@ -25,7 +25,10 @@
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
-#include <registerservices.hxx>
+extern "C" ::com::sun::star::uno::XInterface *
+    SAL_CALL com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation(
+        ::com::sun::star::uno::XComponentContext* context,
+        ::com::sun::star::uno::Sequence<css::uno::Any> const &);
 
 /**
  * SvNumberFormatsSupplierServiceObject - a number formats supplier which
@@ -40,9 +43,10 @@ class SvNumberFormatsSupplierServiceObject
             ,public ::com::sun::star::lang::XServiceInfo
 {   // don't want the Set-/GetNumberFormatter to be accessible from outside
 
-    friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-        SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+    friend ::com::sun::star::uno::XInterface *
+        SAL_CALL com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation(
+                ::com::sun::star::uno::XComponentContext* context,
+                ::com::sun::star::uno::Sequence<css::uno::Any> const &);
 
 protected:
     SvNumberFormatter*  m_pOwnFormatter;
diff --git a/svl/source/uno/pathservice.cxx b/svl/source/uno/pathservice.cxx
index 91a640d..8e02fd8 100644
--- a/svl/source/uno/pathservice.cxx
+++ b/svl/source/uno/pathservice.cxx
@@ -26,8 +26,7 @@
 #include <com/sun/star/frame/XConfigManager.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
-
-#include <registerservices.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo >
 {
@@ -81,13 +80,11 @@ public:
 };
 
 
-
-css::uno::Reference< css::uno::XInterface > PathService_CreateInstance (
-    SAL_UNUSED_PARAMETER const css::uno::Reference<
-        css::lang::XMultiServiceFactory > &)
+extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
+com_sun_star_comp_svl_PathService_get_implementation(::com::sun::star::uno::XComponentContext*,
+                                                     ::com::sun::star::uno::Sequence<css::uno::Any> const &)
 {
-    return css::uno::Reference< css::uno::XInterface >(
-        static_cast< cppu::OWeakObject* >(new PathService()));
+    return cppu::acquire(new PathService());
 }
 
 
diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx
deleted file mode 100644
index cd28b25..0000000
--- a/svl/source/uno/registerservices.cxx
+++ /dev/null
@@ -1,94 +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 <sal/types.h>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <svl/svldllapi.h>
-
-#include <registerservices.hxx>
-
-using css::uno::Reference;
-using css::uno::Sequence;
-
-extern "C"
-{
-
-SVL_DLLPUBLIC void* SAL_CALL svl_component_getFactory (
-    const sal_Char * pImplementationName, void * _pServiceManager,
-    SAL_UNUSED_PARAMETER void * /* _pRegistryKey*/)
-{
-    void * pResult = 0;
-    if ( _pServiceManager )
-    {
-        Reference< css::lang::XSingleServiceFactory > xFactory;
-        if (rtl_str_compare(
-                pImplementationName,
-                "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0)
-        {
-            Sequence< OUString > aServiceNames(1);
-            aServiceNames.getArray()[0] =
-                "com.sun.star.util.NumberFormatsSupplier";
-
-            xFactory = ::cppu::createSingleFactory(
-                reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
-                OUString::createFromAscii( pImplementationName ),
-                SvNumberFormatsSupplierServiceObject_CreateInstance,
-                aServiceNames);
-        }
-        else if (rtl_str_compare(
-                     pImplementationName,
-                     "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0)
-        {
-            Sequence< OUString > aServiceNames(1);
-            aServiceNames.getArray()[0] = "com.sun.star.util.NumberFormatter";
-
-            xFactory = ::cppu::createSingleFactory(
-                reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
-                OUString::createFromAscii( pImplementationName ),
-                SvNumberFormatterServiceObj_CreateInstance,
-                aServiceNames);
-        }
-        else if (rtl_str_compare (
-                     pImplementationName, "com.sun.star.comp.svl.PathService") == 0)
-        {
-            Sequence< OUString > aServiceNames(1);
-            aServiceNames.getArray()[0] =
-                "com.sun.star.config.SpecialConfigManager";
-            xFactory = ::cppu::createSingleFactory (
-                reinterpret_cast< css::lang::XMultiServiceFactory* >( _pServiceManager ),
-                OUString::createFromAscii( pImplementationName ),
-                PathService_CreateInstance,
-                aServiceNames);
-        }
-        if ( xFactory.is() )
-        {
-            xFactory->acquire();
-            pResult = xFactory.get();
-        }
-    }
-    return pResult;
-}
-
-}   // "C"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/util/svl.component b/svl/util/svl.component
index 64c0cd4..e50f918 100644
--- a/svl/util/svl.component
+++ b/svl/util/svl.component
@@ -19,13 +19,16 @@
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     prefix="svl" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.svl.PathService">
+  <implementation name="com.sun.star.comp.svl.PathService"
+      constructor="com_sun_star_comp_svl_PathService_get_implementation">
     <service name="com.sun.star.config.SpecialConfigManager"/>
   </implementation>
-  <implementation name="com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject">
+  <implementation name="com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject"
+      constructor="com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation">
     <service name="com.sun.star.util.NumberFormatsSupplier"/>
   </implementation>
-  <implementation name="com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject">
+  <implementation name="com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject"
+      constructor="com_sun_star_uno_util_numbers_SvNumberFormatterServiceObject_get_implementation">
     <service name="com.sun.star.util.NumberFormatter"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list