[Libreoffice-commits] core.git: extensions/Library_oleautobridge.mk extensions/source

2019-06-11 Thread Tor Lillqvist (via logerrit)
 extensions/Library_oleautobridge.mk |1 
 extensions/source/ole/unoobjw.cxx   |   59 
 2 files changed, 60 insertions(+)

New commits:
commit 89f883bd90a50587868a57397b6350ed9559a20f
Author: Tor Lillqvist 
AuthorDate: Mon Jun 10 15:41:28 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Tue Jun 11 08:18:12 2019 +0200

Veto process exit while an OLE client is connected

Change-Id: Iad9fc1742ae371a8a162edbc16998e9cb6895919
Reviewed-on: https://gerrit.libreoffice.org/73763
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/extensions/Library_oleautobridge.mk 
b/extensions/Library_oleautobridge.mk
index ec59f715c504..6aafe250 100644
--- a/extensions/Library_oleautobridge.mk
+++ b/extensions/Library_oleautobridge.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_Library_use_libraries,oleautobridge,\
cppuhelper \
cppu \
sal \
+   tl \
 ))
 
 $(eval $(call gb_Library_use_system_win32_libs,oleautobridge,\
diff --git a/extensions/source/ole/unoobjw.cxx 
b/extensions/source/ole/unoobjw.cxx
index 669fe9af36c3..3c8313e4c83e 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -56,9 +56,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -110,6 +114,58 @@ static bool writeBackOutParameter(VARIANTARG* pDest, 
VARIANT* pSource);
 static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource);
 static HRESULT mapCannotConvertException(const CannotConvertException , 
unsigned int * puArgErr);
 
+class TerminationVetoer : public WeakImplHelper
+{
+public:
+int mnCount;
+
+private:
+TerminationVetoer()
+: mnCount(0)
+{
+try
+{
+Reference< css::frame::XDesktop > xDesktop =
+css::frame::Desktop::create( 
comphelper::getProcessComponentContext() );
+xDesktop->addTerminateListener( this );
+}
+catch ( const Exception& )
+{
+DBG_UNHANDLED_EXCEPTION("extensions.ole");
+}
+}
+
+public:
+static Reference< TerminationVetoer > get()
+{
+static TerminationVetoer* pInstance = new TerminationVetoer;
+static Reference< TerminationVetoer > aInstance( pInstance );
+
+return aInstance;
+}
+
+// XTerminateListener
+void SAL_CALL queryTermination( const EventObject& ) override
+{
+// Always veto termination while an OLE object is active
+if (mnCount > 0)
+{
+throw css::frame::TerminationVetoException();
+}
+}
+
+void SAL_CALL notifyTermination( const EventObject& ) override
+{
+// ???
+}
+
+// XEventListener
+void SAL_CALL disposing( const css::lang::EventObject& ) override
+{
+// ???
+}
+};
+
 /* Does not throw any exceptions.
Param pInfo can be NULL.
  */
@@ -128,6 +184,7 @@ InterfaceOleWrapper::InterfaceOleWrapper( 
Reference const
 UnoConversionUtilities( xFactory, 
unoWrapperClass, comWrapperClass),
 m_defaultValueType( 0)
 {
+TerminationVetoer::get()->mnCount++;
 }
 
 InterfaceOleWrapper::~InterfaceOleWrapper()
@@ -137,6 +194,8 @@ InterfaceOleWrapper::~InterfaceOleWrapper()
 auto it = UnoObjToWrapperMap.find( 
reinterpret_cast(m_xOrigin.get()));
 if(it != UnoObjToWrapperMap.end())
 UnoObjToWrapperMap.erase(it);
+
+TerminationVetoer::get()->mnCount--;
 }
 
 STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, void ** ppv)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: extensions/Library_oleautobridge.mk extensions/source

2018-05-29 Thread Tor Lillqvist
 extensions/Library_oleautobridge.mk |6 +-
 extensions/source/ole/servprov.cxx  |   36 +---
 extensions/source/ole/servprov.hxx  |8 +---
 3 files changed, 39 insertions(+), 11 deletions(-)

New commits:
commit 0667df70dc749ae50ce29713308f14d624f2a683
Author: Tor Lillqvist 
Date:   Tue Feb 13 18:41:24 2018 +0200

Provide also an ooo.vba.word.XApplication object

Create the objects on offer to Automation clients lazily

It would be silly to create the ooo.vba.word.XApplication in every
LibreOffice instance, even if no Writer functionality was going to be
used at all in that process.

I did not have to do what the old FIXME said, "make Application a
proper service", whatever that means.

Change-Id: I02a0ceb6290012b4bb6afacadc03871feaf57406
Reviewed-on: https://gerrit.libreoffice.org/55005
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/extensions/Library_oleautobridge.mk 
b/extensions/Library_oleautobridge.mk
index 70b518c50d41..ec59f715c504 100644
--- a/extensions/Library_oleautobridge.mk
+++ b/extensions/Library_oleautobridge.mk
@@ -13,7 +13,11 @@ $(eval $(call gb_Library_Library,oleautobridge))
 
 $(eval $(call 
gb_Library_set_componentfile,oleautobridge,extensions/source/ole/oleautobridge))
 
-$(eval $(call gb_Library_use_sdk_api,oleautobridge))
+$(eval $(call gb_Library_use_api,oleautobridge,\
+offapi \
+oovbaapi \
+udkapi \
+))
 
 $(eval $(call gb_Library_set_include,oleautobridge,\
$(foreach inc,$(ATL_INCLUDE),-I$(inc)) \
diff --git a/extensions/source/ole/servprov.cxx 
b/extensions/source/ole/servprov.cxx
index 72e5944fb5ba..220ced0bc2fd 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace cppu;
 using namespace osl;
@@ -43,10 +44,14 @@ using namespace com::sun::star::bridge::ModelDependent;
 // {82154420-0FBF-11d4-8313-005004526AB4}
 DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 
0x50, 0x4, 0x52, 0x6a, 0xb4);
 
+// FIXME: This GUID is just the above with the initial part bumped by one. Is 
that good enough?
+// {82154421-0FBF-11d4-8313-005004526AB4}
+DEFINE_GUID(OID_LibreOfficeWriterApplication, 0x82154421, 0xfbf, 0x11d4, 0x83, 
0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
+
 OneInstanceOleWrapper::OneInstanceOleWrapper(  const 
Reference& smgr,
-   const Reference& 
xInst )
+   std::function()> xInstFunction )
 : m_refCount(0)
-, m_xInst(xInst)
+, m_xInstFunction(xInstFunction)
 , m_factoryHandle(0)
 , m_smgr(smgr)
 {
@@ -127,9 +132,10 @@ STDMETHODIMP 
OneInstanceOleWrapper::CreateInstance(IUnknown FAR* punkOuter,
 HRESULT ret = ResultFromScode(E_UNEXPECTED);
 punkOuter = nullptr;
 
-if (m_xInst.is())
+const Reference& xInst = m_xInstFunction();
+if (xInst.is())
 {
-Any usrAny(_xInst, cppu::UnoType::get());
+Any usrAny(, cppu::UnoType::get());
 sal_uInt8 arId[16];
 rtl_getGlobalProcessId( arId);
 Any oleAny = m_bridgeSupplier->createBridge(usrAny,
@@ -456,7 +462,23 @@ OleServer::OleServer( const 
Reference& smgr):
 a >>= m_bridgeSupplier;
 }
 
-(void) provideInstance( m_smgr, _ServiceManager );
+(void) provideInstance( [&]
+{
+return m_smgr;
+},
+_ServiceManager );
+
+(void) provideInstance( [&]
+{
+const Reference xWordGlobals = 
m_smgr->createInstance("ooo.vba.word.Globals");
+xWordGlobals->acquire();
+const Reference 
xHelperInterface(xWordGlobals, UNO_QUERY);
+Any aApplication = 
xHelperInterface->Application();
+Reference xApplication;
+aApplication >>= xApplication;
+return xApplication;
+},
+_LibreOfficeWriterApplication );
 }
 
 OleServer::~OleServer()
@@ -486,9 +508,9 @@ css::uno::Sequence 
OleServer::getSupportedServiceNames()
 "com.sun.star.bridge.oleautomation.ApplicationRegistration"};
 }
 
-bool OleServer::provideInstance(const Reference& xInst, GUID const 
* guid)
+bool OleServer::provideInstance(std::function()> 
xInstFunction, GUID const * guid)
 {
-OneInstanceOleWrapper* pWrapper = new OneInstanceOleWrapper( m_smgr, xInst 
);
+OneInstanceOleWrapper* pWrapper = new OneInstanceOleWrapper( m_smgr, 
xInstFunction );
 
 pWrapper->AddRef();
 m_wrapperList.push_back(pWrapper);
diff --git a/extensions/source/ole/servprov.hxx 
b/extensions/source/ole/servprov.hxx
index 

[Libreoffice-commits] core.git: extensions/Library_oleautobridge.mk extensions/source

2016-12-19 Thread Takeshi Abe
 extensions/Library_oleautobridge.mk |1 -
 extensions/source/ole/windata.cxx   |   30 --
 2 files changed, 31 deletions(-)

New commits:
commit 2e9c02feca732f6dd012ccbe5d7c6853c64075a5
Author: Takeshi Abe 
Date:   Sun Dec 18 07:18:39 2016 +0900

extensions: Drop empty file

Change-Id: I4962d739af889595f026c250b8f10a917b1dfb17
Reviewed-on: https://gerrit.libreoffice.org/32130
Reviewed-by: Takeshi Abe 
Tested-by: Takeshi Abe 

diff --git a/extensions/Library_oleautobridge.mk 
b/extensions/Library_oleautobridge.mk
index 5dde7cc..70b518c 100644
--- a/extensions/Library_oleautobridge.mk
+++ b/extensions/Library_oleautobridge.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Library_add_exception_objects,oleautobridge,\
extensions/source/ole/servreg \
extensions/source/ole/unoobjw \
extensions/source/ole/unotypewrapper \
-   extensions/source/ole/windata \
 ))
 
 # vim:set noet sw=4 ts=4:
diff --git a/extensions/source/ole/windata.cxx 
b/extensions/source/ole/windata.cxx
deleted file mode 100644
index 98afa2b..000
--- a/extensions/source/ole/windata.cxx
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "windata.hxx"
-
-
-namespace ole_adapter
-{
-
-
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits