diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-04-09 16:35:45 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-05-31 14:02:16 +0300 |
commit | 48ba5b970b8c0f100dbc79274f5b17113e5b7fd2 (patch) | |
tree | 6819aa759cb173fa529bad38d0cca6f658b9f7a2 | |
parent | b01c131e5776c104e86da2966d5ac93aa4601d24 (diff) |
Fire the DocumentBeforeClose event (call the callback)
Change-Id: I9c7a17aa9bdbbba29cd12a0e3d09c9047e9b5678
-rw-r--r-- | sw/source/ui/vba/vbadocument.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index b2413cb178e2..9a1fcf39ae9a 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -88,6 +88,7 @@ SwVbaDocument::~SwVbaDocument() void SwVbaDocument::Initialize() { mxTextDocument.set( getModel(), uno::UNO_QUERY_THROW ); + word::getDocShell( mxModel )->RegisterAutomationDocumentObject( this ); } sal_uInt32 diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index d369e459d9e8..22696b2af35f 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -335,13 +335,25 @@ bool SwDocShell::PrepareClose( bool bUI ) if (m_xDoc && IsInPrepareClose()) { + uno::Any aDocument; + aDocument <<= mxAutomationDocumentObject; + + uno::Sequence< uno::Any > aArgs(2); + aArgs[0] = aDocument; + // FIXME: This should be an out argument, hmm? + aArgs[1] <<= false; + + SW_MOD()->CallAutomationApplicationEventSinks( "DocumentBeforeClose", aArgs ); + + // FIXME: Do something based on what value the callback set the second argument to + uno::Reference< script::vba::XVBAEventProcessor > const xVbaEvents = m_xDoc->GetVbaEventProcessor(); if( xVbaEvents.is() ) { using namespace com::sun::star::script::vba::VBAEventId; - uno::Sequence< uno::Any > aArgs; - xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aArgs ); + uno::Sequence< uno::Any > aNoArgs; + xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aNoArgs ); } } return bRet; |