summaryrefslogtreecommitdiff
path: root/vbahelper/source
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-03-05 22:00:54 +0200
committerTor Lillqvist <tml@collabora.com>2018-05-30 13:42:55 +0200
commitd7f69b1cb4dbdd39970d56d0c340d7abb92fbdc1 (patch)
tree2122fc9ccff5de716676e5f209e39e3874ec5636 /vbahelper/source
parent1eda8cbe464ff33e4babf30327612836963c6956 (diff)
Add code to VbaApplicationBase::Quit() for the Automation client case
Change-Id: I4354adf5353bdfb0b080b24a5c49e3d22539eb23 Reviewed-on: https://gerrit.libreoffice.org/55051 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'vbahelper/source')
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 198c71fb6c45..a0268237efe6 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -37,6 +37,7 @@
#include <rtl/ref.hxx>
#include <tools/datetime.hxx>
#include <vcl/timer.hxx>
+#include <vcl/svapp.hxx>
#include <basic/sbx.hxx>
#include <basic/sbstar.hxx>
@@ -45,6 +46,8 @@
#include <basic/sbmod.hxx>
#include <basic/vbahelper.hxx>
+#include <comphelper/asyncquithandler.hxx>
+
#include "vbacommandbars.hxx"
#include <unordered_map>
@@ -440,6 +443,15 @@ void VbaApplicationBase::Quit()
pBasic->QuitAndExitApplication();
}
}
+ else
+ {
+ // This is the case of a call from an (OLE) Automation client.
+
+ // TODO: Probably we should just close any document windows open by the "application"
+ // (Writer or Calc) the call being handled is for. And only then, if no document windows
+ // are left open, quit the actual LibreOffice application.
+ Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ) );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */