filter/Library_msfilter.mk                |    1 
 filter/source/msfilter/msfilter.component |    5 ++-
 filter/source/msfilter/msvbahelper.cxx    |   27 ++++++------------
 filter/source/msfilter/services.cxx       |   43 ------------------------------
 include/filter/msfilter/msvbahelper.hxx   |    9 ------
 5 files changed, 13 insertions(+), 72 deletions(-)

New commits:
commit cea25cb5eda6bcef6c74c735a2c38dea57191a1b
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Jul 12 20:12:15 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jul 13 08:47:58 2020 +0200

    filter/msfilter: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: I7bc7e89699173966406272138301a4ca2422281d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98609
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/filter/Library_msfilter.mk b/filter/Library_msfilter.mk
index b15e548f522a..22c765f20d78 100644
--- a/filter/Library_msfilter.mk
+++ b/filter/Library_msfilter.mk
@@ -63,7 +63,6 @@ $(eval $(call gb_Library_add_exception_objects,msfilter,\
        filter/source/msfilter/msoleexp \
        filter/source/msfilter/mstoolbar \
        filter/source/msfilter/msvbahelper \
-       filter/source/msfilter/services \
        filter/source/msfilter/svdfppt \
        filter/source/msfilter/svxmsbas2 \
        filter/source/msfilter/rtfutil \
diff --git a/filter/source/msfilter/msfilter.component 
b/filter/source/msfilter/msfilter.component
index 11691436550e..0e1a35ee4a83 100644
--- a/filter/source/msfilter/msfilter.component
+++ b/filter/source/msfilter/msfilter.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="msfilter" xmlns="http://openoffice.org/2010/uno-components";>
-  <implementation name="com.sun.star.comp.vba.VBAMacroResolver">
+    xmlns="http://openoffice.org/2010/uno-components";>
+  <implementation name="com.sun.star.comp.vba.VBAMacroResolver"
+    constructor="filter_VBAMacroResolver_get_implementation">
     <service name="com.sun.star.script.vba.VBAMacroResolver"/>
   </implementation>
 </component>
diff --git a/filter/source/msfilter/msvbahelper.cxx 
b/filter/source/msfilter/msvbahelper.cxx
index 8c44140397b1..0a3b27204299 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -501,21 +501,6 @@ bool executeMacro( SfxObjectShell* pShell, const OUString& 
sMacroName, uno::Sequ
 }
 
 
-uno::Sequence< OUString > VBAMacroResolver_getSupportedServiceNames()
-{
-    return { "com.sun.star.script.vba.VBAMacroResolver" };
-}
-
-OUString VBAMacroResolver_getImplementationName()
-{
-    return "com.sun.star.comp.vba.VBAMacroResolver";
-}
-
-uno::Reference< uno::XInterface > VBAMacroResolver_createInstance( const 
uno::Reference< uno::XComponentContext >& )
-{
-    return static_cast< ::cppu::OWeakObject* >( new VBAMacroResolver );
-}
-
 
 VBAMacroResolver::VBAMacroResolver() :
     mpObjShell( nullptr )
@@ -530,7 +515,7 @@ VBAMacroResolver::~VBAMacroResolver()
 
 OUString SAL_CALL VBAMacroResolver::getImplementationName()
 {
-    return VBAMacroResolver_getImplementationName();
+    return "com.sun.star.comp.vba.VBAMacroResolver";
 }
 
 sal_Bool SAL_CALL VBAMacroResolver::supportsService( const OUString& rService )
@@ -540,7 +525,7 @@ sal_Bool SAL_CALL VBAMacroResolver::supportsService( const 
OUString& rService )
 
 uno::Sequence< OUString > SAL_CALL VBAMacroResolver::getSupportedServiceNames()
 {
-    return VBAMacroResolver_getSupportedServiceNames();
+    return { "com.sun.star.script.vba.VBAMacroResolver" };
 }
 
 // com.sun.star.lang.XInitialization interface --------------------------------
@@ -775,5 +760,13 @@ void applyShortCutKeyBinding ( const uno::Reference< 
frame::XModel >& rxModel, c
 
 
 } // namespace ooo
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_VBAMacroResolver_get_implementation(
+    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
+{
+    return cppu::acquire(new ooo::vba::VBAMacroResolver());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 
diff --git a/filter/source/msfilter/services.cxx 
b/filter/source/msfilter/services.cxx
deleted file mode 100644
index 086a394d2b87..000000000000
--- a/filter/source/msfilter/services.cxx
+++ /dev/null
@@ -1,43 +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 <filter/msfilter/msvbahelper.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::ooo::vba;
-
-namespace {
-
-::cppu::ImplementationEntry const spServices[] =
-{
-    { VBAMacroResolver_createInstance, VBAMacroResolver_getImplementationName,
-      VBAMacroResolver_getSupportedServiceNames,
-      ::cppu::createSingleComponentFactory, nullptr, 0 },
-    { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
-
-} // namespace
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* msfilter_component_getFactory( const 
char* pImplName, void* pServiceManager, void* pRegistryKey )
-{
-    return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, 
pRegistryKey, spServices );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msvbahelper.hxx 
b/include/filter/msfilter/msvbahelper.hxx
index 673476caa9b6..0693e71a265f 100644
--- a/include/filter/msfilter/msvbahelper.hxx
+++ b/include/filter/msfilter/msvbahelper.hxx
@@ -105,15 +105,6 @@ private:
     OUString            maProjectName;
 };
 
-OUString VBAMacroResolver_getImplementationName();
-
-css::uno::Sequence<OUString>
-VBAMacroResolver_getSupportedServiceNames();
-
-/// @throws css::uno::Exception
-css::uno::Reference<css::uno::XInterface>
-VBAMacroResolver_createInstance(
-    css::uno::Reference<css::uno::XComponentContext > const & rxContext);
 
 } // namespace vba
 } // namespace ooo
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to