summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-04-09 16:35:45 +0300
committerTor Lillqvist <tml@collabora.com>2018-05-31 14:02:16 +0300
commit48ba5b970b8c0f100dbc79274f5b17113e5b7fd2 (patch)
tree6819aa759cb173fa529bad38d0cca6f658b9f7a2 /sw
parentb01c131e5776c104e86da2966d5ac93aa4601d24 (diff)
Fire the DocumentBeforeClose event (call the callback)
Change-Id: I9c7a17aa9bdbbba29cd12a0e3d09c9047e9b5678
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/vba/vbadocument.cxx1
-rw-r--r--sw/source/uibase/app/docsh2.cxx16
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;