summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-26 14:25:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-26 17:10:17 +0200
commit31b8db1d143b25400e307030f9672a556e69573a (patch)
treeea35dbdb48a2749f1ab336f8f07a302f3fef2e53 /sc
parent38bccb6928aaf4ed7eb2e146579fc0cf2446dc17 (diff)
sc/vba: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I6f8d7c3c0075cf5c1843b8bc79d93f467c4aec7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99456 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_vbaobj.mk1
-rw-r--r--sc/source/ui/vba/service.cxx42
-rw-r--r--sc/source/ui/vba/service.hxx43
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx14
-rw-r--r--sc/source/ui/vba/vbahyperlink.cxx13
-rw-r--r--sc/source/ui/vba/vbarange.cxx20
-rw-r--r--sc/source/ui/vba/vbarange.hxx5
-rw-r--r--sc/source/ui/vba/vbawindow.cxx13
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx13
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx12
-rw-r--r--sc/util/vbaobj.component14
11 files changed, 42 insertions, 148 deletions
diff --git a/sc/Library_vbaobj.mk b/sc/Library_vbaobj.mk
index 9fa0628d3d92..1f62462d67bd 100644
--- a/sc/Library_vbaobj.mk
+++ b/sc/Library_vbaobj.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Library_use_libraries,vbaobj,\
$(eval $(call gb_Library_add_exception_objects,vbaobj,\
sc/source/ui/vba/excelvbahelper \
- sc/source/ui/vba/service \
sc/source/ui/vba/vbaapplication \
sc/source/ui/vba/vbaassistant \
sc/source/ui/vba/vbaaxes \
diff --git a/sc/source/ui/vba/service.cxx b/sc/source/ui/vba/service.cxx
deleted file mode 100644
index dab8e9d4db62..000000000000
--- a/sc/source/ui/vba/service.cxx
+++ /dev/null
@@ -1,42 +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 <comphelper/servicedecl.hxx>
-
-#include "service.hxx"
-
-// component exports
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-namespace sdecl = comphelper::service_decl;
-
-extern "C"
-{
- SAL_DLLPUBLIC_EXPORT void * vbaobj_component_getFactory(
- const char * pImplName, void *, void *)
- {
- void* pRet = sdecl::component_getFactoryHelper(
- pImplName, {&range::serviceDecl, &workbook::serviceDecl, &worksheet::serviceDecl, &window::serviceDecl, &hyperlink::serviceDecl, &application::serviceDecl} );
- return pRet;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/service.hxx b/sc/source/ui/vba/service.hxx
deleted file mode 100644
index 06b8e68ba0f1..000000000000
--- a/sc/source/ui/vba/service.hxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * 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/.
- */
-
-#ifndef INCLUDED_SC_SOURCE_UI_VBA_SERVICE_HXX
-#define INCLUDED_SC_SOURCE_UI_VBA_SERVICE_HXX
-
-#include <sal/config.h>
-
-namespace comphelper::service_decl { class ServiceDecl; }
-
-namespace application {
-extern comphelper::service_decl::ServiceDecl const serviceDecl;
-}
-
-namespace hyperlink {
-extern comphelper::service_decl::ServiceDecl const serviceDecl;
-}
-
-namespace range {
-extern comphelper::service_decl::ServiceDecl const serviceDecl;
-}
-
-namespace window {
-extern comphelper::service_decl::ServiceDecl const serviceDecl;
-}
-
-namespace workbook {
-extern comphelper::service_decl::ServiceDecl const serviceDecl;
-}
-
-namespace worksheet {
-extern comphelper::service_decl::ServiceDecl const serviceDecl;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 93b32a408d5b..bb59a92c0ebb 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -35,7 +35,6 @@
#include <ooo/vba/office/MsoShapeType.hpp>
#include <ooo/vba/office/MsoAutoShapeType.hpp>
-#include "service.hxx"
#include "vbaapplication.hxx"
#include "vbaworkbooks.hxx"
#include "vbaworkbook.hxx"
@@ -1480,16 +1479,15 @@ ScVbaApplication::getServiceNames()
return aServiceNames;
}
-namespace application
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_ScVbaApplication_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaApplication, sdecl::with_args<false> > const serviceImpl;
-sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaApplication",
- "ooo.vba.excel.Application" );
+ return cppu::acquire(new ScVbaApplication(context));
}
+
// ScVbaApplicationOutgoingConnectionPoint
ScVbaApplicationOutgoingConnectionPoint::ScVbaApplicationOutgoingConnectionPoint( ScVbaApplication* pApp ) :
diff --git a/sc/source/ui/vba/vbahyperlink.cxx b/sc/source/ui/vba/vbahyperlink.cxx
index 9dc88cdd06cb..74a512bb6bda 100644
--- a/sc/source/ui/vba/vbahyperlink.cxx
+++ b/sc/source/ui/vba/vbahyperlink.cxx
@@ -19,7 +19,6 @@
#include <sal/config.h>
-#include "service.hxx"
#include "vbahyperlink.hxx"
#include <vbahelper/helperdecl.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -227,14 +226,12 @@ void ScVbaHyperlink::setUrlComponents( const UrlComponents& rUrlComp )
mxTextField->setPropertyValue("URL", uno::Any( aUrl.makeStringAndClear() ) );
}
-namespace hyperlink
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_ScVbaHyperlink_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaHyperlink, sdecl::with_args<true> > const serviceImpl;
-sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaHyperlink",
- "ooo.vba.excel.Hyperlink" );
+ return cppu::acquire(new ScVbaHyperlink(args, context));
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 6f5c5a5d892a..1ea6f81d4055 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -123,7 +123,6 @@
#include <unonames.hxx>
#include "excelvbahelper.hxx"
-#include "service.hxx"
#include "vbaapplication.hxx"
#include "vbafont.hxx"
#include "vbacomment.hxx"
@@ -5618,11 +5617,7 @@ ScVbaRange::getServiceImplName()
uno::Sequence< OUString >
ScVbaRange::getServiceNames()
{
- static uno::Sequence< OUString > const aServiceNames
- {
- "ooo.vba.excel.Range"
- };
- return aServiceNames;
+ return { "ooo.vba.excel.Range" };
}
sal_Bool SAL_CALL
@@ -5641,14 +5636,13 @@ ScVbaRange::hasError()
return dResult > 0.0;
}
-namespace range
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_ScVbaRange_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaRange, sdecl::with_args<true> > const serviceImpl;
-sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "SvVbaRange",
- "ooo.vba.excel.Range" );
+ return cppu::acquire(new ScVbaRange(args, context));
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index 54b699a3b25e..5c28acf6f245 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -34,6 +34,7 @@ namespace com::sun::star::sheet { class XSheetCellRangeContainer; }
namespace com::sun::star::table { class XCell; }
namespace com::sun::star::table { class XCellRange; }
namespace com::sun::star::table { struct CellRangeAddress; }
+namespace com::sun::star::lang { class XServiceInfo; }
namespace ooo::vba { class XCollection; }
namespace ooo::vba::excel { class XComment; }
namespace ooo::vba::excel { class XFont; }
@@ -45,8 +46,6 @@ class ScDocShell;
class ScDocument;
class ScRangeList;
-typedef ScVbaFormat< ov::excel::XRange > ScVbaRange_BASE;
-
class ArrayVisitor
{
public:
@@ -69,6 +68,8 @@ public:
virtual const css::uno::Any& getValue() const = 0;
};
+typedef ScVbaFormat< ov::excel::XRange > ScVbaRange_BASE;
+
class ScVbaRange : public ScVbaRange_BASE
{
css::uno::Reference< ov::XCollection > m_Areas;
diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index d7dda7c89f0d..6f9d5291db61 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -18,7 +18,6 @@
*/
#include <vbahelper/helperdecl.hxx>
#include "excelvbahelper.hxx"
-#include "service.hxx"
#include "vbawindow.hxx"
#include "vbaworksheets.hxx"
#include "vbaworksheet.hxx"
@@ -889,14 +888,12 @@ ScVbaWindow::getServiceNames()
};
return aServiceNames;
}
-namespace window
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_ScVbaWindow_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaWindow, sdecl::with_args<true> > const serviceImpl;
-sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaWindow",
- "ooo.vba.excel.Window" );
+ return cppu::acquire(new ScVbaWindow(args, context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 7665a226ef9b..b41a7ed72b01 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -29,7 +29,6 @@
#include <ooo/vba/excel/XlFileFormat.hpp>
#include <ooo/vba/excel/XApplication.hpp>
-#include "service.hxx"
#include "vbaworksheet.hxx"
#include "vbaworksheets.hxx"
#include "vbaworkbook.hxx"
@@ -417,14 +416,12 @@ ScVbaWorkbook::getSomething(const uno::Sequence<sal_Int8 >& rId )
return 0;
}
-namespace workbook
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_ScVbaWorkbook_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaWorkbook, sdecl::with_args<true> > const serviceImpl;
-sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaWorkbook",
- "ooo.vba.excel.Workbook" );
+ return cppu::acquire(new ScVbaWorkbook(args, context));
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index e39c36412bf9..afb977df2152 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -61,7 +61,6 @@
#include <tabprotection.hxx>
#include "excelvbahelper.hxx"
-#include "service.hxx"
#include "vbaoutline.hxx"
#include "vbarange.hxx"
#include "vbacomments.hxx"
@@ -1050,14 +1049,11 @@ ScVbaWorksheet::getSomething(const uno::Sequence<sal_Int8 > & rId)
return 0;
}
-namespace worksheet
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+Calc_ScVbaWorksheet_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaWorksheet, sdecl::with_args<true> > const serviceImpl;
-sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaWorksheet",
- "ooo.vba.excel.Worksheet" );
+ return cppu::acquire(new ScVbaWorksheet(args, context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/util/vbaobj.component b/sc/util/vbaobj.component
index 4e250aafe41f..5ce466babe0c 100644
--- a/sc/util/vbaobj.component
+++ b/sc/util/vbaobj.component
@@ -18,8 +18,8 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="vbaobj" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="ScVbaApplication">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="ScVbaApplication" constructor="Calc_ScVbaApplication_get_implementation">
<service name="ooo.vba.excel.Application"/>
</implementation>
<implementation name="ScVbaEventsHelper"
@@ -30,23 +30,23 @@
constructor="ScVbaGlobals_get_implementation">
<service name="ooo.vba.excel.Globals"/>
</implementation>
- <implementation name="ScVbaHyperlink">
+ <implementation name="ScVbaHyperlink" constructor="Calc_ScVbaHyperlink_get_implementation">
<service name="ooo.vba.excel.Hyperlink"/>
</implementation>
<implementation name="ScVbaTextFrame"
constructor="ScVbaTextFrame_get_implementation">
<service name="ooo.vba.excel.TextFrame"/>
</implementation>
- <implementation name="ScVbaWindow">
+ <implementation name="ScVbaWindow" constructor="Calc_ScVbaWindow_get_implementation">
<service name="ooo.vba.excel.Window"/>
</implementation>
- <implementation name="ScVbaWorkbook">
+ <implementation name="ScVbaWorkbook" constructor="Calc_ScVbaWorkbook_get_implementation">
<service name="ooo.vba.excel.Workbook"/>
</implementation>
- <implementation name="ScVbaWorksheet">
+ <implementation name="ScVbaWorksheet" constructor="Calc_ScVbaWorksheet_get_implementation">
<service name="ooo.vba.excel.Worksheet"/>
</implementation>
- <implementation name="SvVbaRange">
+ <implementation name="SvVbaRange" constructor="Calc_ScVbaRange_get_implementation">
<service name="ooo.vba.excel.Range"/>
</implementation>
</component>