From d6f3715190494b55e2ecc105cbd6e5ddeff47f0c Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 24 Feb 2023 12:45:35 -0500 Subject: word vba: Add activeWindow to XDocument This allows ActiveDocument.ActiveWindow.* It already works as a global, and as Aplication.ActiveWindow Unit test will follow when some of the * items are added. Change-Id: I7fb18df9f6259ec4b9d60516b2da704098831dfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147665 Tested-by: Jenkins Reviewed-by: Justin Luth --- sw/source/ui/vba/vbadocument.cxx | 8 ++++++++ sw/source/ui/vba/vbadocument.hxx | 1 + 2 files changed, 9 insertions(+) (limited to 'sw/source/ui') diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index 52907477dcff..caf520c3433a 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -30,6 +30,7 @@ #include "vbabookmarks.hxx" #include "vbamailmerge.hxx" #include "vbavariables.hxx" +#include "vbawindow.hxx" #include #include #include @@ -245,6 +246,13 @@ uno::Any SAL_CALL SwVbaDocument::SelectContentControlsByTitle(const uno::Any& in new SwVbaContentControls(this, mxContext, mxTextDocument, "", sTitle))); } +uno::Reference SwVbaDocument::getActiveWindow() +{ + // copied from vbaappliction which has a #FIXME so far can't determine Parent + return new SwVbaWindow(uno::Reference< XHelperInterface >(), mxContext, mxModel, + mxModel->getCurrentController()); +} + uno::Any SAL_CALL SwVbaDocument::Variables( const uno::Any& rIndex ) { diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx index 31ca3751686a..069215513cc5 100644 --- a/sw/source/ui/vba/vbadocument.hxx +++ b/sw/source/ui/vba/vbadocument.hxx @@ -58,6 +58,7 @@ public: css::uno::Any SAL_CALL ContentControls(const css::uno::Any& index) override; css::uno::Any SAL_CALL SelectContentControlsByTag(const css::uno::Any& index) override; css::uno::Any SAL_CALL SelectContentControlsByTitle(const css::uno::Any& index) override; + css::uno::Reference SAL_CALL getActiveWindow() override; virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) override; virtual css::uno::Any SAL_CALL getAttachedTemplate() override; virtual void SAL_CALL setAttachedTemplate( const css::uno::Any& _attachedtemplate ) override; -- cgit