summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-02-24 12:45:35 -0500
committerJustin Luth <jluth@mail.com>2023-02-24 21:55:40 +0000
commitd6f3715190494b55e2ecc105cbd6e5ddeff47f0c (patch)
treec556055bbe33bb0fd6f126ca8681af88f7092c37
parentBaseMutex->std::mutex in SdStyleSheet (diff)
downloadcore-d6f3715190494b55e2ecc105cbd6e5ddeff47f0c.tar.gz
core-d6f3715190494b55e2ecc105cbd6e5ddeff47f0c.zip
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 <jluth@mail.com>
-rw-r--r--oovbaapi/ooo/vba/word/XDocument.idl1
-rw-r--r--sw/source/ui/vba/vbadocument.cxx8
-rw-r--r--sw/source/ui/vba/vbadocument.hxx1
3 files changed, 10 insertions, 0 deletions
diff --git a/oovbaapi/ooo/vba/word/XDocument.idl b/oovbaapi/ooo/vba/word/XDocument.idl
index 354cac11b2ed..99bdd5249a6a 100644
--- a/oovbaapi/ooo/vba/word/XDocument.idl
+++ b/oovbaapi/ooo/vba/word/XDocument.idl
@@ -25,6 +25,7 @@ interface XDocument
interface XConnectable;
[attribute, readonly] XRange Content;
+ [attribute, readonly] XWindow ActiveWindow;
[attribute] any AttachedTemplate;
[attribute] long ProtectionType;
[attribute] boolean UpdateStylesOnOpen;
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 <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
#include <cppu/unotype.hxx>
@@ -245,6 +246,13 @@ uno::Any SAL_CALL SwVbaDocument::SelectContentControlsByTitle(const uno::Any& in
new SwVbaContentControls(this, mxContext, mxTextDocument, "", sTitle)));
}
+uno::Reference<word::XWindow> 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<ov::word::XWindow> 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;