tdf#148806 sw vba: fix GetVbaEventProcessor
commitacc71c3e502f23daaf2489d102dda3b00a45960a
authorJustin Luth <justin.luth@collabora.com>
Fri, 30 Sep 2022 14:33:00 +0000 (30 10:33 -0400)
committerMiklos Vajna <vmiklos@collabora.com>
Sat, 1 Oct 2022 06:56:13 +0000 (1 08:56 +0200)
treec7196a69e9b101270cb2211294b3b240dcf839c9
parentdc3a6485b67ca0996803e3799faa76a11cddb46a
tdf#148806 sw vba: fix GetVbaEventProcessor

I've decided this is not an API change because there exists
offapi/com/sun/star/script/vba/VBATextEventProcessor.idl

This patch allows New, Open, and Close events to be
sent to VBA macro event handlers.

I tested with DOCUMENT_OPEN.

Amazing - all this stuff is here in place,
but isn't properly wired up. How can so much
ground-work be done without it ever being functional?

I don't think this has ever worked,
and the same problem/code is seen in OpenOffice.

The service names were already mismatched in the initial patch:
commit fc135411fa926f4d89e98378d113f597af79e2a2
Author: Daniel Rentz on Tue Jul 6 19:34:53 2010 +0200
    mib17: #i112634# add VBA sheet event handling,
           based on a patch from Noel Power

https://bz.apache.org/ooo/show_bug.cgi?id=112634
says "Additionally I added the hooks for vba for word
( but they are compiled out for now )"

Enabling this will open up the doors to a lot of
untested code I think.
I had to move initialization of mxVbaEvents
because it was being set without a VBA project,
but it didn't work to put it in VbaGlobals like Calc does.

Change-Id: I08cc0e33444dc7dfaac82cf6cebb1a89dbb69faa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140801
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
sw/inc/doc.hxx
sw/source/core/doc/doc.cxx
sw/source/ui/vba/vbadocument.cxx
sw/source/ui/vba/vbaeventshelper.cxx
sw/source/ui/vba/vbaglobals.cxx
sw/util/vbaswobj.component