summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2022-10-10 20:40:30 -0400
committerMiklos Vajna <vmiklos@collabora.com>2022-10-13 09:03:27 +0200
commit3aebb45d18116926dc8edb268c205c6f4ff06f05 (patch)
tree58aa6856ce0b9862cff21b7531e6c820e13a3d87
parent8ac97a8cb4f5657b7601f30fc9ca6b0cecc1e429 (diff)
sw vba: tie WordBasic to VBAGlobals
This allows WordBasic to also be run directly, instead of only working with Application.WordBasic.*. Change-Id: I60c3beaa1fce9a8bf25786cc0b2ed6ef6deda2f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141200 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--oovbaapi/ooo/vba/word/XGlobals.idl1
-rw-r--r--sw/source/ui/vba/vbaglobals.cxx9
-rw-r--r--sw/source/ui/vba/vbaglobals.hxx1
3 files changed, 11 insertions, 0 deletions
diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl b/oovbaapi/ooo/vba/word/XGlobals.idl
index 8d2ee3900fcc..0e16bcb08d4e 100644
--- a/oovbaapi/ooo/vba/word/XGlobals.idl
+++ b/oovbaapi/ooo/vba/word/XGlobals.idl
@@ -31,6 +31,7 @@ interface XGlobals : com::sun::star::uno::XInterface
[attribute, readonly] ooo::vba::word::XSystem System;
[attribute, readonly] ooo::vba::word::XOptions Options;
[attribute, readonly] ooo::vba::word::XSelection Selection;
+ [attribute, readonly] ooo::vba::word::XWordBasic WordBasic;
any CommandBars( [in] any Index );
any Documents( [in] any Index );
any Addins( [in] any Index );
diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx
index f1c948c6cb5f..a319a4aea13d 100644
--- a/sw/source/ui/vba/vbaglobals.cxx
+++ b/sw/source/ui/vba/vbaglobals.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "vbaglobals.hxx"
+#include "vbawordbasic.hxx"
#include <sal/log.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -126,6 +127,14 @@ SwVbaGlobals::getSelection()
return getApplication()->getSelection();
}
+uno::Reference<word::XWordBasic> SAL_CALL SwVbaGlobals::getWordBasic()
+{
+ assert(dynamic_cast<SwVbaApplication*>(getApplication().get()));
+ SwVbaApplication* pVbaApp = static_cast<SwVbaApplication*>(getApplication().get());
+ uno::Reference<word::XWordBasic> xWB(new SwWordBasic(pVbaApp));
+ return xWB;
+}
+
float SAL_CALL SwVbaGlobals::CentimetersToPoints( float Centimeters )
{
return getApplication()->CentimetersToPoints( Centimeters );
diff --git a/sw/source/ui/vba/vbaglobals.hxx b/sw/source/ui/vba/vbaglobals.hxx
index af26f1b6256d..72f4ca07829c 100644
--- a/sw/source/ui/vba/vbaglobals.hxx
+++ b/sw/source/ui/vba/vbaglobals.hxx
@@ -50,6 +50,7 @@ public:
virtual css::uno::Reference<ov::word::XWindow> SAL_CALL getActiveWindow() override;
virtual css::uno::Reference<ooo::vba::word::XOptions> SAL_CALL getOptions() override;
virtual css::uno::Reference<ooo::vba::word::XSelection> SAL_CALL getSelection() override;
+ virtual css::uno::Reference<ooo::vba::word::XWordBasic> SAL_CALL getWordBasic() override;
virtual css::uno::Any SAL_CALL CommandBars(const css::uno::Any& aIndex) override;
virtual css::uno::Any SAL_CALL Documents(const css::uno::Any& aIndex) override;
virtual css::uno::Any SAL_CALL Addins(const css::uno::Any& aIndex) override;