summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-03-05 22:00:54 +0200
committerTor Lillqvist <tml@collabora.com>2018-05-31 21:39:02 +0300
commit01ebbba2bbd2333c9bade8bf5b41e61ab9a3ec65 (patch)
treec457cec228e0ceaddd68fca27dd1844a4bad9a01 /vbahelper
parent737ea470d16f6b323811029c33abd2945decc087 (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> (cherry picked from commit d7f69b1cb4dbdd39970d56d0c340d7abb92fbdc1)
Diffstat (limited to 'vbahelper')
-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 61cb7d3d0e74..b09de686dd31 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>
@@ -441,6 +444,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: */