oovbaapi/ooo/vba/word/XGlobals.idl | 1 + sw/source/ui/vba/vbaglobals.cxx | 9 +++++++++ sw/source/ui/vba/vbaglobals.hxx | 1 + 3 files changed, 11 insertions(+)
New commits: commit fbcde15089977ca8354c981fc8794a026fceea1e Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Oct 10 20:40:30 2022 -0400 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Oct 20 15:29:10 2022 +0200 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 <jl...@mail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141355 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl b/oovbaapi/ooo/vba/word/XGlobals.idl index b76ef8f62d82..13dda8d384e1 100644 --- a/oovbaapi/ooo/vba/word/XGlobals.idl +++ b/oovbaapi/ooo/vba/word/XGlobals.idl @@ -35,6 +35,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 0e5db3802895..457cefb56462 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> @@ -124,6 +125,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 1d8c0b4f8a2a..ad39de12f765 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;