summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2022-10-11 12:14:34 -0400
committerJustin Luth <jluth@mail.com>2022-10-12 01:12:17 +0200
commit73911ed8d35294a9e15771d8aaa1e9121ef10309 (patch)
tree440bebcb650b937b048bababf9cd7c0975377e99 /sw/source
parentf518928c322d45cdec4163c0182b0008da0da729 (diff)
tdf#148806 doc vba: highest priority is ThisDocument AutoOpen V2
A review by Stephan Bergmann made me re-think adding a separate event for this. It really is only one event and not two (or three as I initially imagined). In the end, I like this better because it highlights the difference between Excel and Word by keeping all the differentiating logic in one place. The inability to properly document the purpose of these new events was the impetus to redesign this. Thanks Stephan for the prompt. Change-Id: Ic2d461c13c4a52e279224cb485d2b6c4a3c57b54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141233 Tested-by: Justin Luth <jluth@mail.com> Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/ui/vba/vbaeventshelper.cxx23
-rw-r--r--sw/source/uibase/app/docsh2.cxx6
2 files changed, 5 insertions, 24 deletions
diff --git a/sw/source/ui/vba/vbaeventshelper.cxx b/sw/source/ui/vba/vbaeventshelper.cxx
index d083940106b5..d928eaba16f2 100644
--- a/sw/source/ui/vba/vbaeventshelper.cxx
+++ b/sw/source/ui/vba/vbaeventshelper.cxx
@@ -32,13 +32,10 @@ SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArg
{
using namespace ::com::sun::star::script::ModuleType;
registerEventHandler( DOCUMENT_NEW, DOCUMENT, "Document_New" );
- registerEventHandler(DOCUMENT_AUTO_NEW, DOCUMENT, "AutoNew");
registerEventHandler( AUTO_NEW, NORMAL, "AutoNew" );
registerEventHandler( DOCUMENT_OPEN, DOCUMENT, "Document_Open" );
- registerEventHandler(DOCUMENT_AUTO_OPEN, DOCUMENT, "AutoOpen");
registerEventHandler( AUTO_OPEN, NORMAL, "AutoOpen" );
registerEventHandler( DOCUMENT_CLOSE, DOCUMENT, "Document_Close" );
- registerEventHandler(DOCUMENT_AUTO_CLOSE, DOCUMENT, "AutoClose");
registerEventHandler( AUTO_CLOSE, NORMAL, "AutoClose" );
}
@@ -46,25 +43,9 @@ SwVbaEventsHelper::~SwVbaEventsHelper()
{
}
-bool SwVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue,
- const EventHandlerInfo& rInfo, const uno::Sequence< uno::Any >& rArgs)
+bool SwVbaEventsHelper::implPrepareEvent(EventQueue& /*rEventQueue*/,
+ const EventHandlerInfo& /*rInfo*/, const uno::Sequence<uno::Any>& /*rArgs*/)
{
- switch( rInfo.mnEventId )
- {
- case DOCUMENT_AUTO_NEW:
- // Only one "AutoNew" subroutine can run. ThisDocument is highest priority.
- if (!hasVbaEventHandler(rInfo.mnEventId, rArgs))
- rEventQueue.emplace_back(AUTO_NEW);
- break;
- case DOCUMENT_AUTO_OPEN:
- if (!hasVbaEventHandler(rInfo.mnEventId, rArgs))
- rEventQueue.emplace_back(AUTO_OPEN);
- break;
- case DOCUMENT_AUTO_CLOSE:
- if (!hasVbaEventHandler(rInfo.mnEventId, rArgs))
- rEventQueue.emplace_back(AUTO_CLOSE);
- break;
- }
return true;
}
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 51082a682c2d..a5e79881e342 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -221,11 +221,11 @@ static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVB
switch( pSfxEventHint->GetEventId() )
{
case SfxEventHintId::CreateDoc:
- xVbaEvents->processVbaEvent(DOCUMENT_AUTO_NEW, aArgs);
+ xVbaEvents->processVbaEvent(AUTO_NEW, aArgs);
xVbaEvents->processVbaEvent(DOCUMENT_NEW, aArgs);
break;
case SfxEventHintId::OpenDoc:
- xVbaEvents->processVbaEvent(DOCUMENT_AUTO_OPEN, aArgs);
+ xVbaEvents->processVbaEvent(AUTO_OPEN, aArgs);
xVbaEvents->processVbaEvent(DOCUMENT_OPEN, aArgs);
break;
default: break;
@@ -387,7 +387,7 @@ bool SwDocShell::PrepareClose( bool bUI )
{
using namespace com::sun::star::script::vba::VBAEventId;
uno::Sequence< uno::Any > aNoArgs;
- xVbaEvents->processVbaEvent(DOCUMENT_AUTO_CLOSE, aNoArgs);
+ xVbaEvents->processVbaEvent(AUTO_CLOSE, aNoArgs);
xVbaEvents->processVbaEvent(DOCUMENT_CLOSE, aNoArgs);
}
}