[Libreoffice-commits] core.git: solenv/bin starmath/Library_smd.mk starmath/source starmath/util

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Dec 20 07:57:08 UTC 2018


 solenv/bin/native-code.py    |    2 +
 starmath/Library_smd.mk      |    1 
 starmath/source/detreg.cxx   |   69 -------------------------------------------
 starmath/source/smdetect.cxx |   24 ++++----------
 starmath/source/smdetect.hxx |   14 --------
 starmath/util/smd.component  |    5 +--
 6 files changed, 13 insertions(+), 102 deletions(-)

New commits:
commit ae270343e29084ca94e82d85d5c76e1ec05184dc
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Dec 19 21:55:12 2018 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Dec 20 08:56:44 2018 +0100

    starmath: create SmFilterDetect instances with an uno constructor
    
    Change-Id: I11ffe5153bc9ea263cde63093544584f01a344d2
    Reviewed-on: https://gerrit.libreoffice.org/65464
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 0ba747e6ffea..76e8e66b977c 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -299,6 +299,8 @@ edit_constructor_list = [
     "Math_XMLImporter_get_implementation",
     "Math_XMLOasisMetaImporter_get_implementation",
     "Math_XMLOasisSettingsImporter_get_implementation",
+# starmath/util/smd.component
+    "math_FormatDetector_get_implementation",
 # sw/util/sw.component
     "com_sun_star_comp_Writer_XMLOasisContentExporter_get_implementation",
     "com_sun_star_comp_Writer_XMLOasisMetaExporter_get_implementation",
diff --git a/starmath/Library_smd.mk b/starmath/Library_smd.mk
index 481069dd716a..565f7e9c04a4 100644
--- a/starmath/Library_smd.mk
+++ b/starmath/Library_smd.mk
@@ -32,7 +32,6 @@ $(eval $(call gb_Library_use_libraries,smd,\
 ))
 
 $(eval $(call gb_Library_add_exception_objects,smd,\
-	starmath/source/detreg \
 	starmath/source/smdetect \
 	starmath/source/eqnolefilehdr \
 ))
diff --git a/starmath/source/detreg.cxx b/starmath/source/detreg.cxx
deleted file mode 100644
index 74d25aa3d762..000000000000
--- a/starmath/source/detreg.cxx
+++ /dev/null
@@ -1,69 +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/factory.hxx>
-#include <rtl/ustring.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include "smdetect.hxx"
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-
-extern "C" {
-
-SAL_DLLPUBLIC_EXPORT void* smd_component_getFactory( const sal_Char* pImplementationName,
-                                     void* pServiceManager,
-                                     void* /*pRegistryKey*/ )
-{
-    // Set default return value for this operation - if it failed.
-    void* pReturn = nullptr ;
-
-    if  (
-            ( pImplementationName   !=  nullptr ) &&
-            ( pServiceManager       !=  nullptr )
-        )
-    {
-        // Define variables which are used in following macros.
-        Reference< XSingleServiceFactory >   xFactory                                                                                                ;
-        Reference< XMultiServiceFactory >    xServiceManager( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
-
-        if( SmFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
-        {
-            xFactory = ::cppu::createSingleFactory( xServiceManager,
-            SmFilterDetect::impl_getStaticImplementationName(),
-            SmFilterDetect::impl_createInstance,
-            SmFilterDetect::impl_getStaticSupportedServiceNames() );
-        }
-
-        // Factory is valid - service was found.
-        if ( xFactory.is() )
-        {
-            xFactory->acquire();
-            pReturn = xFactory.get();
-        }
-    }
-
-    // Return with result of this operation.
-    return pReturn ;
-}
-} // extern "C"
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index 8cff53e43e95..ad5dacfb8821 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -21,6 +21,7 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/ucb/ContentCreationException.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <sfx2/docfile.hxx>
 #include <unotools/mediadescriptor.hxx>
 #include <sal/log.hxx>
@@ -35,7 +36,7 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::lang;
 using utl::MediaDescriptor;
 
-SmFilterDetect::SmFilterDetect( const Reference < XMultiServiceFactory >& /*xFactory*/ )
+SmFilterDetect::SmFilterDetect()
 {
 }
 
@@ -121,7 +122,7 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
 /* XServiceInfo */
 OUString SAL_CALL SmFilterDetect::getImplementationName()
 {
-    return impl_getStaticImplementationName();
+    return OUString("com.sun.star.comp.math.FormatDetector");
 }
 
 /* XServiceInfo */
@@ -133,25 +134,14 @@ sal_Bool SAL_CALL SmFilterDetect::supportsService( const OUString& sServiceName
 /* XServiceInfo */
 Sequence< OUString > SAL_CALL SmFilterDetect::getSupportedServiceNames()
 {
-    return impl_getStaticSupportedServiceNames();
-}
-
-/* Helper for XServiceInfo */
-Sequence< OUString > SmFilterDetect::impl_getStaticSupportedServiceNames()
-{
     return Sequence< OUString >{ "com.sun.star.frame.ExtendedTypeDetection" };
 }
 
-/* Helper for XServiceInfo */
-OUString SmFilterDetect::impl_getStaticImplementationName()
-{
-    return OUString("com.sun.star.comp.math.FormatDetector");
-}
-
-/* Helper for registry */
-Reference< XInterface > SmFilterDetect::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager )
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+math_FormatDetector_get_implementation(uno::XComponentContext* /*pCtx*/,
+                                       uno::Sequence<uno::Any> const& /*rSeq*/)
 {
-    return Reference< XInterface >( *new SmFilterDetect( xServiceManager ) );
+    return cppu::acquire(new SmFilterDetect);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/source/smdetect.hxx b/starmath/source/smdetect.hxx
index 3386365e2759..fa616773bca1 100644
--- a/starmath/source/smdetect.hxx
+++ b/starmath/source/smdetect.hxx
@@ -34,10 +34,6 @@ namespace com
     {
         namespace star
         {
-            namespace lang
-            {
-                class XMultiServiceFactory;
-            }
             namespace beans
             {
                 struct PropertyValue;
@@ -49,7 +45,7 @@ namespace com
 class SmFilterDetect : public ::cppu::WeakImplHelper< css::document::XExtendedFilterDetection, css::lang::XServiceInfo >
 {
 public:
-    explicit SmFilterDetect( const css::uno::Reference < css::lang::XMultiServiceFactory >& xFactory );
+    explicit SmFilterDetect();
     virtual                 ~SmFilterDetect() override;
 
     /* XServiceInfo */
@@ -57,14 +53,6 @@ public:
     virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
-    /* Helper for XServiceInfo */
-    static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
-    static OUString impl_getStaticImplementationName();
-
-    /* Helper for registry */
-    /// @throws css::uno::Exception
-    static css::uno::Reference< css::uno::XInterface > impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
-
     // XExtendedFilterDetect
     virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) override;
 };
diff --git a/starmath/util/smd.component b/starmath/util/smd.component
index da5fd934b402..4230e807be64 100644
--- a/starmath/util/smd.component
+++ b/starmath/util/smd.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="smd" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.math.FormatDetector">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.math.FormatDetector"
+    constructor="math_FormatDetector_get_implementation">
     <service name="com.sun.star.frame.ExtendedTypeDetection"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list