summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2022-10-13 17:22:52 -0400
committerMiklos Vajna <vmiklos@collabora.com>2022-10-17 14:14:53 +0200
commit55628d6b258f77eac8a34a1a8f6bbcbf09fd97cc (patch)
tree2d714107e7afadf9faf22c1f2df01bf1cb9bb8ed /vbahelper
parentdaa85533cf377a8ec2585f5d45e4d0127f74cdf8 (diff)
sw vba: add WordBasic.MsgBox
The unit test just consists of adding a "WordBasic.MsgBox()" to the vba code in testVBA.docm. make CppunitTest_sw_macros_test or just open the file manually for an easy-to-run experience. Change-Id: I38edfee42649fcc85f0f535a2c9861c45038fa0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141347 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 4e71cb582565..2722f627e9ba 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -746,6 +746,27 @@ void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, con
pProp[ nLength ].Value = aValue;
}
+bool executeRunTimeLibrary(const std::u16string_view& rSbRtl_command, SbxArray* pParameters)
+{
+ StarBASIC* pBasic = dynamic_cast< StarBASIC* >(StarBASIC::GetActiveModule()->GetParent());
+ if (!pBasic)
+ return false;
+
+ SbxObject* pRunTimeLibrary = pBasic->GetRtl();
+ if (!pRunTimeLibrary)
+ return false;
+
+ SbxVariable* pFound = pRunTimeLibrary->Find(OUString(rSbRtl_command), SbxClassType::Method);
+ SbxMethod* pMethod = dynamic_cast<SbxMethod*>(pFound);
+ if (!pMethod)
+ return false;
+
+ pMethod->SetParameters(pParameters);
+ // Believe it or not, this actually runs the command
+ pMethod->Broadcast(SfxHintId::BasicDataWanted);
+ return true;
+}
+
// ====UserFormGeomentryHelper====
UserFormGeometryHelper::UserFormGeometryHelper(