[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 56 commits - comphelper/Library_comphelper.mk comphelper/source extensions/source external/python3 include/comphelper include/vbahelper oovbaapi/ooo oovbaapi/UnoApi_oovbaapi.mk sc/CppunitTest_sc_addin_functions_test.mk sc/CppunitTest_sc_anchor_test.mk sc/CppunitTest_sc_array_functions_test.mk sc/CppunitTest_sc_bugfix_test.mk sc/CppunitTest_sc_cond_format_merge.mk sc/CppunitTest_sc_copypaste.mk sc/CppunitTest_sc_database_functions_test.mk sc/CppunitTest_sc_dataprovider.mk sc/CppunitTest_sc_datatransformation.mk sc/CppunitTest_sc_datetime_functions_test.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_financial_functions_test.mk sc/CppunitTest_sc_functions_test_old.mk sc/CppunitTest_sc_html_export_test.mk sc/CppunitTest_sc_information_functions_test.mk sc/CppunitTest_sc_logical_functions_test.mk sc/CppunitTest_sc_mathematical_functions_test.mk sc/CppunitTest_sc_opencl_test.mk sc/CppunitTest_sc_parallelism.mk sc/CppunitTest_sc_ pivottable_filters_test.mk sc/CppunitTest_sc_spreadsheet_functions_test.mk sc/CppunitTest_sc_statistical_functions_test.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/CppunitTest_sc_text_functions_test.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_scd.mk sc/Library_scfilt.mk sc/Library_sc.mk sc/Library_scqahelper.mk sc/Library_scui.mk scp2/source sc/source stoc/source svtools/CppunitTest_svtools_graphic.mk sw/CppunitTest_sw_docbookexport.mk sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_fodfexport.mk sw/CppunitTest_sw_globalfilter.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_htmlimport.mk sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_mailmerge.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_ooxmlencryption.mk sw/CppunitTest_sw_ooxmlexport8.mk sw/CppunitTest_sw_ooxmlfieldexport.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_ooxmllinks.mk sw/CppunitTest_sw_ooxmlw14export.mk s w/CppunitTest_sw_rtfexport2.mk sw/CppunitTest_sw_rtfexport3.mk sw/CppunitTest_sw_rtfexport.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_tiledrendering.mk sw/CppunitTest_sw_txtexport.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_uwriter.mk sw/CppunitTest_sw_ww8export2.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk sw/inc sw/Library_msword.mk sw/Library_sw.mk sw/Library_swui.mk sw/ooxmlexport_setup.mk sw/source vbahelper/source

Stephan Bergmann sbergman at redhat.com
Thu May 31 19:31:13 UTC 2018


 comphelper/Library_comphelper.mk                  |    1 
 comphelper/source/misc/automationinvokedzone.cxx  |   36 
 extensions/source/ole/servprov.cxx                |   37 
 extensions/source/ole/unoobjw.cxx                 | 1653 +++++++++++++++++++---
 extensions/source/ole/unoobjw.hxx                 |   26 
 external/python3/ExternalPackage_python3.mk       |    1 
 include/comphelper/automationinvokedzone.hxx      |   39 
 include/comphelper/windowsdebugoutput.hxx         |    5 
 include/vbahelper/vbaapplicationbase.hxx          |    7 
 oovbaapi/UnoApi_oovbaapi.mk                       |    9 
 oovbaapi/ooo/vba/TypeAndIID.idl                   |   30 
 oovbaapi/ooo/vba/XApplicationBase.idl             |    1 
 oovbaapi/ooo/vba/XConnectable.idl                 |   38 
 oovbaapi/ooo/vba/XConnectionPoint.idl             |   34 
 oovbaapi/ooo/vba/XInterfaceWithIID.idl            |   34 
 oovbaapi/ooo/vba/XSink.idl                        |   36 
 oovbaapi/ooo/vba/XSinkCaller.idl                  |   29 
 oovbaapi/ooo/vba/excel/XApplication.idl           |   13 
 oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl   |   37 
 oovbaapi/ooo/vba/excel/XWorkbook.idl              |   11 
 oovbaapi/ooo/vba/word/XApplication.idl            |   21 
 oovbaapi/ooo/vba/word/XApplicationOutgoing.idl    |   39 
 oovbaapi/ooo/vba/word/XDocument.idl               |    5 
 oovbaapi/ooo/vba/word/XDocumentOutgoing.idl       |   35 
 oovbaapi/ooo/vba/word/XDocuments.idl              |    8 
 sc/CppunitTest_sc_addin_functions_test.mk         |    1 
 sc/CppunitTest_sc_anchor_test.mk                  |    6 
 sc/CppunitTest_sc_array_functions_test.mk         |    1 
 sc/CppunitTest_sc_bugfix_test.mk                  |    6 
 sc/CppunitTest_sc_cond_format_merge.mk            |    6 
 sc/CppunitTest_sc_copypaste.mk                    |    6 
 sc/CppunitTest_sc_database_functions_test.mk      |    1 
 sc/CppunitTest_sc_dataprovider.mk                 |    6 
 sc/CppunitTest_sc_datatransformation.mk           |    6 
 sc/CppunitTest_sc_datetime_functions_test.mk      |    1 
 sc/CppunitTest_sc_filters_test.mk                 |    6 
 sc/CppunitTest_sc_financial_functions_test.mk     |    1 
 sc/CppunitTest_sc_functions_test_old.mk           |    1 
 sc/CppunitTest_sc_html_export_test.mk             |    6 
 sc/CppunitTest_sc_information_functions_test.mk   |    1 
 sc/CppunitTest_sc_logical_functions_test.mk       |    1 
 sc/CppunitTest_sc_mathematical_functions_test.mk  |    1 
 sc/CppunitTest_sc_opencl_test.mk                  |    6 
 sc/CppunitTest_sc_parallelism.mk                  |    6 
 sc/CppunitTest_sc_pivottable_filters_test.mk      |    6 
 sc/CppunitTest_sc_spreadsheet_functions_test.mk   |    1 
 sc/CppunitTest_sc_statistical_functions_test.mk   |    1 
 sc/CppunitTest_sc_subsequent_export_test.mk       |    6 
 sc/CppunitTest_sc_subsequent_filters_test.mk      |    6 
 sc/CppunitTest_sc_text_functions_test.mk          |    1 
 sc/CppunitTest_sc_ucalc.mk                        |    6 
 sc/Library_sc.mk                                  |    6 
 sc/Library_scd.mk                                 |    6 
 sc/Library_scfilt.mk                              |    6 
 sc/Library_scqahelper.mk                          |    6 
 sc/Library_scui.mk                                |    6 
 sc/inc/scmod.hxx                                  |    7 
 sc/source/ui/app/scmod.cxx                        |   11 
 sc/source/ui/docshell/docsh.cxx                   |   32 
 sc/source/ui/inc/docsh.hxx                        |    6 
 sc/source/ui/vba/vbaapplication.cxx               |  102 +
 sc/source/ui/vba/vbaapplication.hxx               |   23 
 sc/source/ui/vba/vbaworkbook.cxx                  |   21 
 sc/source/ui/vba/vbaworkbook.hxx                  |    2 
 scp2/source/calc/registryitem_calc.scp            |   15 
 scp2/source/writer/registryitem_writer.scp        |   15 
 stoc/source/invocation/invocation.cxx             |  130 -
 svtools/CppunitTest_svtools_graphic.mk            |    6 
 sw/CppunitTest_sw_docbookexport.mk                |    6 
 sw/CppunitTest_sw_filters_test.mk                 |    6 
 sw/CppunitTest_sw_fodfexport.mk                   |    6 
 sw/CppunitTest_sw_globalfilter.mk                 |    6 
 sw/CppunitTest_sw_htmlexport.mk                   |    6 
 sw/CppunitTest_sw_htmlimport.mk                   |    6 
 sw/CppunitTest_sw_layoutwriter.mk                 |    6 
 sw/CppunitTest_sw_mailmerge.mk                    |    6 
 sw/CppunitTest_sw_odfexport.mk                    |    6 
 sw/CppunitTest_sw_odfimport.mk                    |    6 
 sw/CppunitTest_sw_ooxmlencryption.mk              |    7 
 sw/CppunitTest_sw_ooxmlexport8.mk                 |    6 
 sw/CppunitTest_sw_ooxmlfieldexport.mk             |    6 
 sw/CppunitTest_sw_ooxmlimport.mk                  |    6 
 sw/CppunitTest_sw_ooxmllinks.mk                   |    6 
 sw/CppunitTest_sw_ooxmlw14export.mk               |    6 
 sw/CppunitTest_sw_rtfexport.mk                    |    6 
 sw/CppunitTest_sw_rtfexport2.mk                   |    6 
 sw/CppunitTest_sw_rtfexport3.mk                   |    6 
 sw/CppunitTest_sw_rtfimport.mk                    |    6 
 sw/CppunitTest_sw_tiledrendering.mk               |    6 
 sw/CppunitTest_sw_txtexport.mk                    |    6 
 sw/CppunitTest_sw_uiwriter.mk                     |    6 
 sw/CppunitTest_sw_uwriter.mk                      |    6 
 sw/CppunitTest_sw_ww8export.mk                    |    6 
 sw/CppunitTest_sw_ww8export2.mk                   |    6 
 sw/CppunitTest_sw_ww8import.mk                    |    6 
 sw/Library_msword.mk                              |    6 
 sw/Library_sw.mk                                  |    6 
 sw/Library_swui.mk                                |    6 
 sw/inc/docsh.hxx                                  |    9 
 sw/inc/swmodule.hxx                               |    6 
 sw/ooxmlexport_setup.mk                           |    6 
 sw/source/ui/vba/vbaapplication.cxx               |  223 ++
 sw/source/ui/vba/vbaapplication.hxx               |   50 
 sw/source/ui/vba/vbadocument.cxx                  |   99 +
 sw/source/ui/vba/vbadocument.hxx                  |   20 
 sw/source/ui/vba/vbadocuments.cxx                 |    6 
 sw/source/ui/vba/vbadocuments.hxx                 |    1 
 sw/source/uibase/app/docsh.cxx                    |   16 
 sw/source/uibase/app/docsh2.cxx                   |   69 
 sw/source/uibase/app/swmodule.cxx                 |   13 
 sw/source/uibase/uno/unotxdoc.cxx                 |    5 
 vbahelper/source/vbahelper/vbaapplicationbase.cxx |   34 
 vbahelper/source/vbahelper/vbahelper.cxx          |   17 
 113 files changed, 3058 insertions(+), 378 deletions(-)

New commits:
commit c778b78cc0433f9ab767f2db9fad3b89da355227
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Apr 7 12:19:43 2018 +0200

    external/python3: Drop nis.cpython-*m.so
    
    At least Fedora 28 glibc-2.27-8.fc28 no longer provides the nis development
    headers and libraries.  (It only still contains some binaries for backwards
    compatibility, in the libnsl sub-package: "This package provides the legacy
    version of libnsl library, for accessing NIS services.")
    
    There is probably no real need to have nis.cpython-*m.so contained in
    external/python3/ExternalPackage_python3.mk (it probably just happened to build
    fine when that list was originally created, so was included).
    
    Change-Id: Ic6128fd872432005c0ded76640c5b56781ca69a1
    Reviewed-on: https://gerrit.libreoffice.org/52535
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 93e6a823bd8543d30621769c7b34d6261ea5cb01)

diff --git a/external/python3/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk
index 8617e0efb34f..dc3d739c295b 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -83,7 +83,6 @@ $(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
 	LO_lib/mmap.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_multibytecodec.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_multiprocessing.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
-	LO_lib/nis.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/_opcode.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/ossaudiodev.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
 	LO_lib/parser.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)m.so \
commit 8690db361a14aaf7de199d2a41aaead885dd3fd5
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu May 31 19:04:25 2018 +0300

    Log the call to CoRegisterClassObject()
    
    Change-Id: Idfca38ec2c931572b6978440862c7bfca8d536e6
    (cherry picked from commit 9d2e7c3c07b471a89e7fc375eb9094510a3cacd7)

diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 687b2f58465a..f90cb56c9803 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/script/CannotConvertException.hpp>
 #include <comphelper/automationinvokedzone.hxx>
 #include <comphelper/windowsdebugoutput.hxx>
+#include <comphelper/windowserrorstring.hxx>
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <o3tl/any.hxx>
@@ -92,6 +93,8 @@ bool OneInstanceOleWrapper::registerClass(GUID const * pGuid)
             REGCLS_MULTIPLEUSE,
             &m_factoryHandle);
 
+    SAL_INFO("extensions.olebridge", "CoRegisterClassObject(" << *pGuid << "): " << WindowsErrorStringFromHRESULT(hresult));
+
     return (hresult == NOERROR);
 }
 
commit 6cdecbd9581754f47b5dd9f46ec8df0f699fb950
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed May 2 14:57:48 2018 +0300

    Implement NewWorkbook and WorkbookOpen Automation callbacks in Calc
    
    Change-Id: I1ff31d692100695a706bf128c18c4e3ae8b55ce3

diff --git a/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl b/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl
index 9e601c5331d6..6ca5b4581d75 100644
--- a/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl
+++ b/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl
@@ -25,6 +25,7 @@ module ooo {  module vba {  module excel {
 
 interface XApplicationOutgoing : XInterfaceWithIID
 {
+    void NewWorkbook([in] any Wb);
     void WorkbookOpen([in] any Wb);
     void WorkbookBeforeClose([in] any Wb, [out] any Cancel);
 };
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 865e7c4ad2b1..6993c59a485d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -991,6 +991,33 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
         //  RegisterNewTargetNames doesn't exist any longer
         SfxGetpApp()->Broadcast(SfxHint( SfxHintId::ScDocNameChanged )); // Navigator
     }
+
+    if ( const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint) )
+    {
+        switch( pSfxEventHint->GetEventId() )
+        {
+           case SfxEventHintId::CreateDoc:
+                {
+                    uno::Any aWorkbook;
+                    aWorkbook <<= mxAutomationWorkbookObject;
+                    uno::Sequence< uno::Any > aArgs(1);
+                    aArgs[0] = aWorkbook;
+                    SC_MOD()->CallAutomationApplicationEventSinks( "NewWorkbook", aArgs );
+                }
+                break;
+            case SfxEventHintId::OpenDoc:
+                {
+                    uno::Any aWorkbook;
+                    aWorkbook <<= mxAutomationWorkbookObject;
+                    uno::Sequence< uno::Any > aArgs(1);
+                    aArgs[0] = aWorkbook;
+                    SC_MOD()->CallAutomationApplicationEventSinks( "WorkbookOpen", aArgs );
+                }
+                break;
+            default:
+                break;
+        }
+    }
 }
 
 // Load contents for organizer
@@ -3245,6 +3272,11 @@ void ScDocShell::SetIsInUcalc()
     mbUcalcTest = true;
 }
 
+void ScDocShell::RegisterAutomationWorkbookObject(css::uno::Reference< ooo::vba::excel::XWorkbook > const& xWorkbook)
+{
+    mxAutomationWorkbookObject = xWorkbook;
+}
+
 extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportSLK(SvStream &rStream)
 {
     ScDLL::Init();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index d457bb8ab04d..ebd07bb18279 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -20,8 +20,8 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_DOCSH_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_DOCSH_HXX
 
+#include <ooo/vba/excel/XWorkbook.hpp>
 #include <sfx2/objsh.hxx>
-
 #include <sfx2/docfac.hxx>
 #include <sfx2/sfxmodelfactory.hxx>
 #include <sfx2/viewsh.hxx>
@@ -110,6 +110,8 @@ class SC_DLLPUBLIC ScDocShell final: public SfxObjectShell, public SfxListener
 
     ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading)
 
+    css::uno::Reference< ooo::vba::excel::XWorkbook> mxAutomationWorkbookObject;
+
     SAL_DLLPRIVATE void          InitItems();
     SAL_DLLPRIVATE void          DoEnterHandler();
     SAL_DLLPRIVATE void          InitOptions(bool bForLoading);
@@ -411,6 +413,8 @@ public:
     void SnapVisArea( tools::Rectangle& rRect ) const;
 
     void SetIsInUcalc();
+
+    void RegisterAutomationWorkbookObject(css::uno::Reference< ooo::vba::excel::XWorkbook > const& xWorkbook);
 };
 
 void UpdateAcceptChangesDialog();
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 2ec7f38da5da..85b4217eac61 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -201,6 +201,9 @@ ScVbaWorkbook::init()
 {
     if ( !ColorData.getLength() )
         ResetColors();
+    uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY );
+    if ( xModel.is() )
+        excel::getDocShell( xModel )->RegisterAutomationWorkbookObject( this );
 }
 
 ScVbaWorkbook::ScVbaWorkbook(   const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::frame::XModel > const & xModel ) : ScVbaWorkbook_BASE( xParent, xContext, xModel )
commit 45fe2979e86828ec7ad13445e2a521c247772a49
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed May 2 14:48:22 2018 +0300

    Add a SAL_INFO
    
    Change-Id: Ic197a9573968fb252cb52cc5089f9140d5375d3a
    (cherry picked from commit ad57e6d3369b10c181cb644729466512428cc52d)

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 190623f56e76..ac6873be9300 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -2272,6 +2272,8 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments )
             // have done "compile-time binding" and where the sink would actually be an object with
             // a vtbl corresponding to the outgoing interface. Late binding clients that work like
             // VBScript is all we support.
+            SAL_INFO("extensions.olebridge", "Sink::Call(" << Method << "): Calling Invoke(" << nMemId << ")");
+
             nResult = pDispatch->Invoke(nMemId, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &aDispParams, &aVarResult, NULL, &uArgErr);
             SAL_WARN_IF(!SUCCEEDED(nResult), "extensions.olebridge", "Call to " << Method << " failed: " << WindowsErrorStringFromHRESULT(nResult));
 
commit db1e3cb11657009fc476116bb403351bf6fc0013
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 25 19:29:53 2018 +0300

    Must catch Exception here, not the more specific UnknownPropertyException
    
    Change-Id: I4b0b119af356f38f359f2ba5afa6081533790443
    (cherry picked from commit 0cae8eeaae08c9dc4ace44ee026af6f2b335c9c6)

diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index b1f2a4d3e8da..e70017baa0da 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -499,7 +499,7 @@ Any Invocation_Impl::getValue( const OUString& PropertyName )
         if (_xDirect.is())
             return _xDirect->getValue( PropertyName );
     }
-    catch (UnknownPropertyException &)
+    catch (Exception &)
     {
         if (!mbFromOLE)
             throw;
@@ -543,7 +543,7 @@ void Invocation_Impl::setValue( const OUString& PropertyName, const Any& Value )
             return;
         }
     }
-    catch (UnknownPropertyException &)
+    catch (Exception &)
     {
         if (!mbFromOLE)
             throw;
commit 80efd3852aedec00c3b94a8bf4c923f35cb22314
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 25 19:07:12 2018 +0300

    Need to enter the AutomationInvokedZone here, too
    
    Change-Id: I2723146f2c549c630dfa0e5da330af228cb305a0
    (cherry picked from commit bfedeb79937aa5e8bdf01ecf6be25e2bbe8a6db5)

diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index ad31b1025ad6..687b2f58465a 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -29,6 +29,7 @@
 #include "oleobjw.hxx"
 
 #include <com/sun/star/script/CannotConvertException.hpp>
+#include <comphelper/automationinvokedzone.hxx>
 #include <comphelper/windowsdebugoutput.hxx>
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -139,6 +140,8 @@ STDMETHODIMP OneInstanceOleWrapper::CreateInstance(IUnknown FAR* punkOuter,
                                                    REFIID riid,
                                                    void FAR* FAR* ppv)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", "OneInstanceOleWrapper::CreateInstance(" << riid << ")");
 
     HRESULT ret = ResultFromScode(E_UNEXPECTED);
commit e049fb311ad408ccd08f0ca5d45a9f1fba25cb7c
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 25 17:04:49 2018 +0300

    Add Author property to ooo::vba::excel::XWorkbook and implement it
    
    Corresponds to the Author attribute of
    css::document::XDocumentProperties. I.e. the initial creator of the
    document.
    
    Change-Id: I07d3ce9dfb87900948d2bb7af14109b17546fb4c
    (cherry picked from commit 034e8bfafadf3dfe930447696b7a686345aa6632)

diff --git a/oovbaapi/ooo/vba/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl
index 2c9b5871fdb6..fe310e2adc1a 100644
--- a/oovbaapi/ooo/vba/excel/XWorkbook.idl
+++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl
@@ -32,6 +32,7 @@ interface XWorkbook
     [attribute, readonly] string  CodeName;
     [attribute, readonly] long FileFormat;
     [attribute] boolean  PrecisionAsDisplayed;
+    [attribute] string Author;
 
     any  Worksheets( [in] any Index );
     any  Styles( [in] any Index ) raises (com::sun::star::script::BasicErrorException);
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 978915ef71d6..2ec7f38da5da 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -292,6 +292,24 @@ void SAL_CALL ScVbaWorkbook::setPrecisionAsDisplayed( sal_Bool _precisionAsDispl
     rDoc.SetDocOptions( aOpt );
 }
 
+OUString SAL_CALL ScVbaWorkbook::getAuthor()
+{
+    uno::Reference<document::XDocumentPropertiesSupplier> xDPS( getModel(), uno::UNO_QUERY );
+    if (!xDPS.is())
+        return OUString("?");
+    uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
+    return xDocProps->getAuthor();
+}
+
+void SAL_CALL ScVbaWorkbook::setAuthor( const OUString& _author )
+{
+    uno::Reference<document::XDocumentPropertiesSupplier> xDPS( getModel(), uno::UNO_QUERY );
+    if (!xDPS.is())
+        return;
+    uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
+    xDocProps->setAuthor( _author );
+}
+
 void
 ScVbaWorkbook::SaveCopyAs( const OUString& sFileName )
 {
diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx
index 25c4b188017c..6efaa938cfa8 100644
--- a/sc/source/ui/vba/vbaworkbook.hxx
+++ b/sc/source/ui/vba/vbaworkbook.hxx
@@ -44,6 +44,8 @@ public:
     virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() override;
     virtual sal_Bool SAL_CALL getPrecisionAsDisplayed() override;
     virtual void SAL_CALL setPrecisionAsDisplayed( sal_Bool _precisionAsDisplayed ) override;
+    virtual OUString SAL_CALL getAuthor() override;
+    virtual void SAL_CALL setAuthor( const OUString& _author ) override;
 
     // Methods
     virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) override;
commit d237c57129d5f73b6b89c88703b6f04bcf5a0d19
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 25 17:03:50 2018 +0300

    Can simplify, our IDL compiler is more clever nowadays
    
    Change-Id: Ie62c47a0b60df5b7a7237cce981e850cbbe5aee9
    (cherry picked from commit b11329eed924483a24f2c05d97c573b9a95b26e8)

diff --git a/oovbaapi/ooo/vba/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl
index 9efbf6ce354c..2c9b5871fdb6 100644
--- a/oovbaapi/ooo/vba/excel/XWorkbook.idl
+++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl
@@ -20,21 +20,11 @@
 #define __ooo_vba_excel_XWorkbook_idl__
 
 #include <com/sun/star/lang/XUnoTunnel.idl>
-#include <ooo/vba/XHelperInterface.idl>
-
-
 
 module ooo {  module vba {  module excel {
 
-
-
-interface XWorksheet;
-interface XWorksheets;
-interface XStyles;
-
 interface XWorkbook
 {
-
     interface ::com::sun::star::lang::XUnoTunnel;
 
     [attribute, readonly] boolean ProtectStructure;
commit 3a1d0b7bb59bbdd96642f2e8d56f6b288d35fc6a
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 25 16:44:01 2018 +0300

    Avoid a SolarMutex assertion failure in some use cases from Automation
    
    For instance when opening a Calc Document through ooo::vba::excel::
    XWorkbooks::Open(). Instead just let the function return null. It does
    seem that callers are prepared for that.
    
    Change-Id: I7136133155f95a696b5ed3e661a9adb98396c9c5
    (cherry picked from commit 1b55ed02a4c5b7f6d1ff39220af6e7624995f9d3)

diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index d6be56bd8bd9..f53a5fd2e540 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.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.
  *
@@ -39,6 +39,7 @@
 
 #include <ooo/vba/msforms/XShape.hpp>
 
+#include <comphelper/automationinvokedzone.hxx>
 #include <comphelper/processfactory.hxx>
 
 #include <sfx2/objsh.hxx>
@@ -1121,6 +1122,12 @@ uno::Reference< XHelperInterface > getUnoDocModule( const OUString& aModName, Sf
     if ( pShell )
     {
         OUString sProj( "Standard" );
+        // GetBasicManager() causes a SolarMutex assertion failure in some use cases from
+        // Automation, at least when opening a Calc Document through ooo::vba::excel::
+        // XWorkbooks::Open(). Let's see if this check is a good way around that. It does seem that
+        // callers are prepared for this to return null?
+        if (comphelper::Automation::AutomationInvokedZone::isActive())
+            return xIf;
         BasicManager* pBasMgr = pShell->GetBasicManager();
         if ( pBasMgr && !pBasMgr->GetName().isEmpty() )
             sProj = pBasMgr->GetName();
commit 554ee410e4ade6b09ade12943a5ae34fb29575cf
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 25 16:41:50 2018 +0300

    Enter AutomationInvokedZone appropriately
    
    Change-Id: Ic76fc43fc521a6fd6642e22b71c311370788d4aa
    (cherry picked from commit 469b8334ad858723b83be1c285cde1d991df86c6)

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index b4c34f6be881..190623f56e76 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -61,6 +61,7 @@
 #include <ooo/vba/msforms/XCheckBox.hpp>
 #include <osl/interlck.h>
 #include <com/sun/star/uno/genfunc.h>
+#include <comphelper/automationinvokedzone.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/profilezone.hxx>
 #include <comphelper/windowsdebugoutput.hxx>
@@ -188,6 +189,8 @@ InterfaceOleWrapper::~InterfaceOleWrapper()
 
 STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, LPVOID FAR * ppv)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::QueryInterface(" << riid << ")");
 
     HRESULT ret= S_OK;
@@ -264,6 +267,8 @@ STDMETHODIMP InterfaceOleWrapper::getOriginalUnoObject( Reference<XInterface>* p
 }
 STDMETHODIMP  InterfaceOleWrapper::getOriginalUnoStruct( Any * pStruct)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     HRESULT ret= E_FAIL;
     if( !m_xOrigin.is())
     {
@@ -425,6 +430,8 @@ public:
     virtual HRESULT STDMETHODCALLTYPE GetTypeInfoOfGuid(REFGUID guid,
                                                         ITypeInfo **ppTInfo) override
     {
+        comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
         SAL_INFO("extensions.olebridge", this << "@CXTypeLib::GetTypeInfoOfGuid(" << guid << ")");
         if (!ppTInfo)
             return E_POINTER;
@@ -596,6 +603,8 @@ void CXTypeInfo::InitForOutgoing(Reference<XInterface> xOrigin,
 
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetTypeAttr(TYPEATTR **ppTypeAttr)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetTypeAttr");
 
     if (!ppTypeAttr)
@@ -684,6 +693,8 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetTypeComp(ITypeComp **ppTComp)
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetFuncDesc(UINT index,
                                                   FUNCDESC **ppFuncDesc)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     if (!ppFuncDesc)
         return E_POINTER;
 
@@ -795,6 +806,8 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetNames(MEMBERID memid,
                                                UINT cMaxNames,
                                                UINT *pcNames)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetNames(" << memid << ")");
     assert(meKind != Kind::COCLASS);
 
@@ -855,6 +868,8 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetRefTypeOfImplType(UINT index,
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetImplTypeFlags(UINT index,
                                                        INT *pImplTypeFlags)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetImplTypeFlags(" << index << ")");
 
     if (!pImplTypeFlags)
@@ -907,7 +922,10 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetDocumentation(MEMBERID memid,
                                                        DWORD *pdwHelpContext,
                                                        BSTR *pBstrHelpFile)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetDocumentation(" << memid << ")");
+
     if (pBstrName)
     {
         if (memid == MEMBERID_NIL)
@@ -952,6 +970,8 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetDllEntry(MEMBERID memid,
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetRefTypeInfo(HREFTYPE hRefType,
                                                      ITypeInfo **ppTInfo)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetRefTypeInfo(" << hRefType << ")");
 
     if (!ppTInfo)
@@ -1024,6 +1044,8 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetMops(MEMBERID memid,
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetContainingTypeLib(ITypeLib **ppTLib,
                                                            UINT *pIndex)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetContainingTypeLib");
 
     if (!ppTLib || !pIndex)
@@ -1068,6 +1090,8 @@ void STDMETHODCALLTYPE CXTypeInfo::ReleaseVarDesc(VARDESC *pVarDesc)
 
 STDMETHODIMP InterfaceOleWrapper::GetTypeInfo(unsigned int iTInfo, LCID, ITypeInfo ** ppTInfo)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::GetTypeInfo(" << iTInfo << ")");
 
     if (!ppTInfo)
@@ -1108,6 +1132,8 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
                                                 LCID /*lcid*/,
                                                 DISPID * rgdispid )
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::GetIDsOfNames("
              << OUString(o3tl::toU(rgszNames[0]))
              << (cNames > 1 ? "...!" : "") << "," << cNames << ")");
@@ -1776,6 +1802,8 @@ STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMember,
                                          EXCEPINFO * pexcepinfo,
                                          unsigned int * puArgErr )
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::Invoke(" << dispidMember << ")");
 
     comphelper::ProfileZone aZone("COM Bridge");
@@ -2063,6 +2091,8 @@ public:
                                            VARIANT *rgVar,
                                            ULONG *pCeltFetched) override
     {
+        comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
         if (pCeltFetched)
             *pCeltFetched = 0;
 
@@ -2097,6 +2127,8 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE STDMETHODCALLTYPE Skip(ULONG celt) override
     {
+        comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
         while (celt > 0)
         {
             if (!mxEnumeration->hasMoreElements())
@@ -2339,6 +2371,8 @@ public:
                                            LPCONNECTDATA rgcd,
                                            ULONG *pcFetched) override
     {
+        comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
         if (!rgcd)
         {
             SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Next(" << cConnections << "): E_POINTER");
@@ -2453,6 +2487,8 @@ public:
     virtual HRESULT STDMETHODCALLTYPE Advise(IUnknown *pUnkSink,
                                              DWORD *pdwCookie) override
     {
+        comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
         SAL_INFO("extensions.olebridge", this << "@CXConnectionPoint::Advise(" << pUnkSink << ")");
 
         if (!pdwCookie)
@@ -2474,6 +2510,8 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE Unadvise(DWORD dwCookie) override
     {
+        comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
         SAL_INFO("extensions.olebridge", this << "@CXConnectionPoint::Unadvise(" << dwCookie << ")");
 
         if (dwCookie == 0 || dwCookie > mvISinks.size())
@@ -2490,6 +2528,8 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE EnumConnections(IEnumConnections **ppEnum) override
     {
+        comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
         HRESULT nResult;
 
         SAL_INFO("extensions.olebridge", this << "@CXConnectionPoint::EnumConnections...");
@@ -2751,6 +2791,8 @@ STDMETHODIMP InterfaceOleWrapper::GetNameSpaceParent(
 HRESULT STDMETHODCALLTYPE InterfaceOleWrapper::GetClassInfo (
     /* [out] */ ITypeInfo **ppTI)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::GetClassInfo");
 
     if (!ppTI)
@@ -2795,6 +2837,8 @@ HRESULT STDMETHODCALLTYPE InterfaceOleWrapper::FindConnectionPoint(
     /* [in] */ REFIID riid,
     /* [out] */ IConnectionPoint **ppCP)
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::FindConnectionPoint(" << riid << ")");
 
     if (!ppCP)
@@ -2909,6 +2953,8 @@ STDMETHODIMP  UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /*
                          DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
                          unsigned int * puArgErr )
 {
+    comphelper::Automation::AutomationInvokedZone aAutomationActive;
+
     HRESULT ret = S_OK;
     try
     {
commit 7f4150bc2d2ed28fbe050e851313ac86184b736b
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 25 16:09:59 2018 +0300

    Introduce comphelper::Automation::AutomationInvokedZone
    
    Enables finding out anywhere whether the thread is processing a call
    from an Automation client. Not sure how I have managed without this
    until now.
    
    Presumably the Invocation_Impl::mbFromOLE variable in stoc can be
    replaced by a call of comphelper::Automation::AutomationInvokedZone::
    isActive().
    
    Change-Id: Ib79ec5f6dff17af25c8539d2907c7cd5d7b9a62c
    (cherry picked from commit 08259ed73142e8644f8e254644d2e18487a66855)

diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 4a24d65da15c..388e036d64c8 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
     comphelper/source/misc/accimplaccess \
     comphelper/source/misc/anytostring \
     comphelper/source/misc/asyncnotification \
+    comphelper/source/misc/automationinvokedzone \
     comphelper/source/misc/backupfilehelper \
     comphelper/source/misc/base64 \
     comphelper/source/misc/comphelper_module \
diff --git a/comphelper/source/misc/automationinvokedzone.cxx b/comphelper/source/misc/automationinvokedzone.cxx
new file mode 100644
index 000000000000..2134217a1eaa
--- /dev/null
+++ b/comphelper/source/misc/automationinvokedzone.cxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#include <cassert>
+
+#include <comphelper/automationinvokedzone.hxx>
+
+namespace comphelper
+{
+namespace Automation
+{
+thread_local static int nActiveount = 0;
+
+bool AutomationInvokedZone::isActive() { return nActiveount > 0; }
+
+AutomationInvokedZone::AutomationInvokedZone()
+{
+    assert(nActiveount < 1000);
+    nActiveount++;
+}
+
+AutomationInvokedZone::~AutomationInvokedZone()
+{
+    assert(nActiveount > 0);
+    nActiveount--;
+}
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/automationinvokedzone.hxx b/include/comphelper/automationinvokedzone.hxx
new file mode 100644
index 000000000000..13b674efa7e1
--- /dev/null
+++ b/include/comphelper/automationinvokedzone.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_AUTOMATIONINVOKEDZONE_HXX
+#define INCLUDED_COMPHELPER_AUTOMATIONINVOKEDZONE_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+// Helpers for use when calling into LO from an Automation (OLE
+// Automation) client.
+
+namespace comphelper
+{
+namespace Automation
+{
+// Create an object of this class at the start of a function directly invoked from an Automation
+// client.
+
+class COMPHELPER_DLLPUBLIC AutomationInvokedZone
+{
+public:
+    AutomationInvokedZone();
+
+    ~AutomationInvokedZone();
+
+    static bool isActive();
+};
+}
+}
+
+#endif // INCLUDED_COMPHELPER_AUTOMATIONINVOKEDZONE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f8addac6dd8ece33ea62c56ca199dcbdc4d3bdb7
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Apr 24 22:36:40 2018 +0300

    Do same trick in setValue() as earlier in getValue() for Automation clients
    
    Also, it is UnknownPropertyException that we need to catch, not
    RuntimeException. Did I not actually exercise my change to getValue()
    back in February?
    
    Change-Id: If13eaa9bbecd15f5330a4102ae932f2ec0c7ecd4

diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index bf003165b2a9..b1f2a4d3e8da 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -499,7 +499,7 @@ Any Invocation_Impl::getValue( const OUString& PropertyName )
         if (_xDirect.is())
             return _xDirect->getValue( PropertyName );
     }
-    catch (RuntimeException &)
+    catch (UnknownPropertyException &)
     {
         if (!mbFromOLE)
             throw;
@@ -535,74 +535,82 @@ Any Invocation_Impl::getValue( const OUString& PropertyName )
 
 void Invocation_Impl::setValue( const OUString& PropertyName, const Any& Value )
 {
-    if (_xDirect.is())
-        _xDirect->setValue( PropertyName, Value );
-    else
+    try
     {
-        try
-        {
-            // Properties
-            if( _xIntrospectionAccess.is() && _xPropertySet.is()
-                && _xIntrospectionAccess->hasProperty(
-                    PropertyName, PropertyConcept::ALL ^ PropertyConcept::DANGEROUS ) )
-            {
-                Property aProp = _xIntrospectionAccess->getProperty(
-                    PropertyName, PropertyConcept::ALL ^ PropertyConcept::DANGEROUS );
-                Reference < XIdlClass > r = TypeToIdlClass( aProp.Type, xCoreReflection );
-                if( r->isAssignableFrom( TypeToIdlClass( Value.getValueType(), xCoreReflection ) ) )
-                    _xPropertySet->setPropertyValue( PropertyName, Value );
-                else if( xTypeConverter.is() )
-                    _xPropertySet->setPropertyValue(
-                        PropertyName, xTypeConverter->convertTo( Value, aProp.Type ) );
-                else
-                    throw RuntimeException( "no type converter service!" );
-            }
-            // NameContainer
-            else if( _xNameContainer.is() )
-            {
-                // Note: This misfeature deliberately not adapted to apply to objects which
-                // have XNameReplace but not XNameContainer
-                Any aConv;
-                Reference < XIdlClass > r =
-                    TypeToIdlClass( _xNameContainer->getElementType(), xCoreReflection );
-                if( r->isAssignableFrom(TypeToIdlClass( Value.getValueType(), xCoreReflection ) ) )
-                    aConv = Value;
-                else if( xTypeConverter.is() )
-                    aConv = xTypeConverter->convertTo( Value, _xNameContainer->getElementType() );
-                else
-                    throw RuntimeException( "no type converter service!" );
-
-                // Replace if present, otherwise insert
-                if (_xNameContainer->hasByName( PropertyName ))
-                    _xNameContainer->replaceByName( PropertyName, aConv );
-                else
-                    _xNameContainer->insertByName( PropertyName, aConv );
-            }
-            else
-                throw UnknownPropertyException( "no introspection nor name container!" );
-        }
-        catch (UnknownPropertyException &)
-        {
-            throw;
-        }
-        catch (CannotConvertException &)
+        if (_xDirect.is())
         {
-            throw;
+            _xDirect->setValue( PropertyName, Value );
+            return;
         }
-        catch (InvocationTargetException &)
-        {
+    }
+    catch (UnknownPropertyException &)
+    {
+        if (!mbFromOLE)
             throw;
-        }
-        catch (RuntimeException &)
+    }
+    try
+    {
+        // Properties
+        if( _xIntrospectionAccess.is() && _xPropertySet.is()
+            && _xIntrospectionAccess->hasProperty(
+                PropertyName, PropertyConcept::ALL ^ PropertyConcept::DANGEROUS ) )
         {
-            throw;
+            Property aProp = _xIntrospectionAccess->getProperty(
+                PropertyName, PropertyConcept::ALL ^ PropertyConcept::DANGEROUS );
+            Reference < XIdlClass > r = TypeToIdlClass( aProp.Type, xCoreReflection );
+            if( r->isAssignableFrom( TypeToIdlClass( Value.getValueType(), xCoreReflection ) ) )
+                _xPropertySet->setPropertyValue( PropertyName, Value );
+            else if( xTypeConverter.is() )
+                _xPropertySet->setPropertyValue(
+                    PropertyName, xTypeConverter->convertTo( Value, aProp.Type ) );
+            else
+                throw RuntimeException( "no type converter service!" );
         }
-        catch (const Exception & exc)
+        // NameContainer
+        else if( _xNameContainer.is() )
         {
-            throw InvocationTargetException(
-                "exception occurred in setValue(): " + exc.Message,
-                Reference< XInterface >(), makeAny( exc /* though sliced */ ) );
+            // Note: This misfeature deliberately not adapted to apply to objects which
+            // have XNameReplace but not XNameContainer
+            Any aConv;
+            Reference < XIdlClass > r =
+                TypeToIdlClass( _xNameContainer->getElementType(), xCoreReflection );
+            if( r->isAssignableFrom(TypeToIdlClass( Value.getValueType(), xCoreReflection ) ) )
+                aConv = Value;
+            else if( xTypeConverter.is() )
+                aConv = xTypeConverter->convertTo( Value, _xNameContainer->getElementType() );
+            else
+                throw RuntimeException( "no type converter service!" );
+
+            // Replace if present, otherwise insert
+            if (_xNameContainer->hasByName( PropertyName ))
+                _xNameContainer->replaceByName( PropertyName, aConv );
+            else
+                _xNameContainer->insertByName( PropertyName, aConv );
         }
+        else
+            throw UnknownPropertyException( "no introspection nor name container!" );
+    }
+    catch (UnknownPropertyException &)
+    {
+        throw;
+    }
+    catch (CannotConvertException &)
+    {
+        throw;
+    }
+    catch (InvocationTargetException &)
+    {
+        throw;
+    }
+    catch (RuntimeException &)
+    {
+        throw;
+    }
+    catch (const Exception & exc)
+    {
+        throw InvocationTargetException(
+            "exception occurred in setValue(): " + exc.Message,
+            Reference< XInterface >(), makeAny( exc /* though sliced */ ) );
     }
 }
 
commit 378921f0f69539fe500214b467059451e0d77830
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Apr 24 21:58:59 2018 +0300

    Decrease fragility in odd use cases with no current document (yet)
    
    Especially, this happens when an Automation client wants to open a
    Calc document. Equivalent to the code for the same situation in
    getCurrentWordDoc().
    
    Change-Id: I209a72dcae49f18cd265e0c6c2790618e1ebb4a1
    (cherry picked from commit 5cc28c5e9455a7923153f82dcf18e76570e36717)

diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 0b07f2a57ba1..d6be56bd8bd9 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -262,7 +262,13 @@ getCurrentExcelDoc( const uno::Reference< uno::XComponentContext >& xContext )
     }
     catch (const uno::Exception&)
     {
-        xModel = getThisExcelDoc( xContext );
+        try
+        {
+            xModel = getThisExcelDoc( xContext );
+        }
+        catch (const uno::Exception&)
+        {
+        }
     }
     return xModel;
 }
commit 2bd57f0c8a1941708527827655a07a33da9e3e55
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Apr 24 19:56:17 2018 +0300

    Make convertDispparamsArgs() handle mismatch in number of parameters sanely
    
    Parameters come in in reverse order in pdispparams. There might be
    less parameters than expected. In that case, assume the missing ones
    are "optional" (but can't be marked as such in UNO IDL), and fill in
    the rest with empty Anys. There might also be more parameters than
    expected. In that case, assume the oovbaapi UNO IDL hasn't kept up
    with added optional parameters in MSO, and just ignore the extra ones,
    as long as they are empty.
    
    An example: incoming parameters: <12, 13, "foo/bar.tem">
    
    Expected paramters: (string filename, int something, int
    somethingElse, Any whatever, Any whateverElse)
    
    Here the existing incoming parameters are placed in reverse order in
    the first three outgoing parameters, and the rest of the outgoing
    paramters are passed as empty Anys.
    
    Another example: incoming parameters: <EMPTY, TRUE>
    
    Expected parameters: (bool flag)
    
    Here the TRUE is passed as the sole outgoing parameter, and the
    incoming EMPTY is ignored.
    
    Still an example: incoming parameters: <"foo.doc", TRUE>
    
    Expected parameters: (bool flag)
    
    This throws an error as the incoming non-empty extra parameter
    presumably indicates something important, but there is no
    corresponding outgoing parameter to pass it in.
    
    Change-Id: Ib04f9701099ecb899e792d99ff86588022b3bbf6
    (cherry picked from commit e4a99a3c502c0285b6fb542d84a9bffde045e526)

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 5f8f305c61fb..b4c34f6be881 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -1253,8 +1253,35 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
 void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
     unsigned short /*wFlags*/, DISPPARAMS* pdispparams, Sequence<Any>& rSeq)
 {
+    // Parameters come in in reverse order in pdispparams. There might be less parameters than
+    // expected. In that case, assume they are "optional" (but can't be marked as such in UNO IDL),
+    // and fill in the rest with empty Anys. There might also be more than expected. In that case,
+    // assume the oovbaapi UNO IDL hasn't kept up with added optional parameters in MSO, and just
+    // ignore the extra ones, as long as they are empty.
+
+    // An example: incoming parameters: <12, 13, "foo/bar.tem">
+    //
+    // Expected paramters: (string filename, int something, int somethingElse, Any whatever, Any
+    // whateverElse)
+    //
+    // Here the existing incoming parameters are placed in reverse order in the first three outgoing
+    // parameters, and the rest of the outgoing paramters are kept as empty Anys.
+    //
+    // Another example: incoming parameters: <EMPTY, TRUE>
+    //
+    // Expected parameters: (bool flag)
+    //
+    // Here the TRUE is passed as the sole outgoing parameter, and the incoming EMPTY is ignored.
+    //
+    // Still an example: incoming parameters: <"foo.doc", TRUE>
+    //
+    // Expected parameters: (bool flag)
+    //
+    // This throws an error as the incoming string parameter presumably should do something important,
+    // but there is no corresponding outgoing parameter.
+
     HRESULT hr = S_OK;
-    const int countArgs = pdispparams->cArgs;
+    const int countIncomingArgs = pdispparams->cArgs;
 
     //Get type information for the current call
     InvocationInfo info;
@@ -1263,33 +1290,39 @@ void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
                   "[automation bridge]InterfaceOleWrapper::convertDispparamsArgs \n"
                   "Could not obtain type information for current call.");
 
-    // We accept less or even more parameters (on certain conditions) than expected. So size rSeq
-    // according to the number of expected parameters.
-    const int expectedArgs = info.aParamTypes.getLength();
+    // Size rSeq according to the number of expected parameters.
+    const int expectedArgs = info.aParamTypes.getLength() + (info.eMemberType == MemberType_PROPERTY ? 1 : 0);
     rSeq.realloc( expectedArgs );
     Any* pParams = rSeq.getArray();
 
     Any anyParam;
 
-    for (int i = 0; i < std::max(countArgs, expectedArgs); i++)
+    int outgoingArgIndex = 0;
+
+    // Go through incoming parameters in reverse order, i.e. in the order as declared in IDL
+    for (int i = std::max(countIncomingArgs, expectedArgs) - 1; i >= 0; i--)
     {
         // Ignore too many parameters if they are VT_EMPTY anyway
-        if ( i < countArgs && i >= expectedArgs && pdispparams->rgvarg[i].vt == VT_EMPTY )
+        if ( outgoingArgIndex >= expectedArgs && pdispparams->rgvarg[i].vt == VT_EMPTY )
             continue;
 
         // But otherwise too many parameters is an error
-        if ( i < countArgs && i >= expectedArgs )
+        if ( outgoingArgIndex >= expectedArgs )
             throw BridgeRuntimeError( "[automation bridge] Too many parameters" );
 
         if (info.eMemberType == MemberType_METHOD &&
-            info.aParamModes[ expectedArgs - i - 1 ] == ParamMode_OUT)
+            info.aParamModes[ outgoingArgIndex ] == ParamMode_OUT)
+        {
+            outgoingArgIndex++;
             continue;
+        }
 
-        if (i < countArgs)
+        if (i < countIncomingArgs)
         {
             if(convertValueObject( & pdispparams->rgvarg[i], anyParam))
             { //a param is a ValueObject and could be converted
-                pParams[ expectedArgs - i - 1 ] = anyParam;
+                pParams[ outgoingArgIndex ] = anyParam;
+                outgoingArgIndex++;
                 continue;
             }
         }
@@ -1297,6 +1330,7 @@ void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
         {
             // A missing arg. Let's hope it is de facto optional (there is no way in UNO IDL to mark
             // a parameter as optional). The corresponding slot in pParams is already a void Any.
+            // Here we don't increase outgoingArgIndex!
             continue;
         }
 
@@ -1309,9 +1343,13 @@ void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
 
         // Check for JScript out and in/out paramsobjects (VT_DISPATCH).
         // To find them out we use typeinformation of the function being called.
+
+        // No idea how this stuff, originally written for JScript, works for other Automation
+        // clients.
+
         if( pdispparams->rgvarg[i].vt == VT_DISPATCH )
         {
-            if( info.eMemberType == MemberType_METHOD && info.aParamModes[ expectedArgs - i - 1 ] == ParamMode_INOUT)
+            if( info.eMemberType == MemberType_METHOD && info.aParamModes[ outgoingArgIndex ] == ParamMode_INOUT)
             {
                 // INOUT-param
                 // Index ( property) "0" contains the actual IN-param. The object is a JScript
@@ -1340,13 +1378,15 @@ void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
 
         if(info.eMemberType == MemberType_METHOD)
             variantToAny( & varParam, anyParam,
-                           info.aParamTypes[ expectedArgs - i - 1 ]);
+                           info.aParamTypes[ outgoingArgIndex ]);
         else if(info.eMemberType == MemberType_PROPERTY)
             variantToAny( & varParam, anyParam, info.aType);
         else
             OSL_ASSERT(false);
 
-        pParams[ expectedArgs - i - 1 ]= anyParam;
+        if (outgoingArgIndex < expectedArgs)
+            pParams[ outgoingArgIndex ]= anyParam;
+        outgoingArgIndex++;
     }// end for / iterating over all parameters
 }
 
commit 363df7b4462d484c41cb25d96346e2b89cad208a
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Apr 24 01:29:58 2018 +0300

    Implement EnumConnections, and fix handling of mismatched parameter number
    
    If we have too few parameters, fill with empty ones, as before. If we
    have more paramters than the called method expects, but the extra ones
    are empty anyway, ignore them. Do all of this in
    convertDispparamsArgs(). This improves interoperability with typical
    Automation clients.
    
    Change-Id: I47376993dc10b401e4c349e19b2bbe4be9f8f444

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 9d5110e05c15..5f8f305c61fb 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -1253,15 +1253,8 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
 void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
     unsigned short /*wFlags*/, DISPPARAMS* pdispparams, Sequence<Any>& rSeq)
 {
-    HRESULT hr= S_OK;
-    sal_Int32 countArgs= pdispparams->cArgs;
-    if( countArgs == 0)
-        return;
-
-    rSeq.realloc( countArgs);
-    Any*    pParams = rSeq.getArray();
-
-    Any anyParam;
+    HRESULT hr = S_OK;
+    const int countArgs = pdispparams->cArgs;
 
     //Get type information for the current call
     InvocationInfo info;
@@ -1270,17 +1263,42 @@ void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
                   "[automation bridge]InterfaceOleWrapper::convertDispparamsArgs \n"
                   "Could not obtain type information for current call.");
 
-    for (int i = 0; i < countArgs; i++)
+    // We accept less or even more parameters (on certain conditions) than expected. So size rSeq
+    // according to the number of expected parameters.
+    const int expectedArgs = info.aParamTypes.getLength();
+    rSeq.realloc( expectedArgs );
+    Any* pParams = rSeq.getArray();
+
+    Any anyParam;
+
+    for (int i = 0; i < std::max(countArgs, expectedArgs); i++)
     {
+        // Ignore too many parameters if they are VT_EMPTY anyway
+        if ( i < countArgs && i >= expectedArgs && pdispparams->rgvarg[i].vt == VT_EMPTY )
+            continue;
+
+        // But otherwise too many parameters is an error
+        if ( i < countArgs && i >= expectedArgs )
+            throw BridgeRuntimeError( "[automation bridge] Too many parameters" );
+
         if (info.eMemberType == MemberType_METHOD &&
-            info.aParamModes[ countArgs - i -1 ]  == ParamMode_OUT)
+            info.aParamModes[ expectedArgs - i - 1 ] == ParamMode_OUT)
             continue;
 
-         if(convertValueObject( & pdispparams->rgvarg[i], anyParam))
-         { //a param is a ValueObject and could be converted
-            pParams[countArgs - (i + 1)] = anyParam;
-             continue;
-         }
+        if (i < countArgs)
+        {
+            if(convertValueObject( & pdispparams->rgvarg[i], anyParam))
+            { //a param is a ValueObject and could be converted
+                pParams[ expectedArgs - i - 1 ] = anyParam;
+                continue;
+            }
+        }
+        else
+        {
+            // A missing arg. Let's hope it is de facto optional (there is no way in UNO IDL to mark
+            // a parameter as optional). The corresponding slot in pParams is already a void Any.
+            continue;
+        }
 
         // If the param is an out, in/out parameter in
         // JScript (Array object, with value at index 0) then we
@@ -1293,7 +1311,7 @@ void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
         // To find them out we use typeinformation of the function being called.
         if( pdispparams->rgvarg[i].vt == VT_DISPATCH )
         {
-            if( info.eMemberType == MemberType_METHOD && info.aParamModes[ countArgs - i -1 ]  == ParamMode_INOUT)
+            if( info.eMemberType == MemberType_METHOD && info.aParamModes[ expectedArgs - i - 1 ] == ParamMode_INOUT)
             {
                 // INOUT-param
                 // Index ( property) "0" contains the actual IN-param. The object is a JScript
@@ -1318,17 +1336,17 @@ void InterfaceOleWrapper::convertDispparamsArgs(DISPID id,
         }
 
         if( varParam.vt == VT_EMPTY) // then it was no in/out parameter
-                 varParam= pdispparams->rgvarg[i];
+            varParam= pdispparams->rgvarg[i];
 
         if(info.eMemberType == MemberType_METHOD)
             variantToAny( & varParam, anyParam,
-                           info.aParamTypes[ countArgs - i - 1]);
+                           info.aParamTypes[ expectedArgs - i - 1 ]);
         else if(info.eMemberType == MemberType_PROPERTY)
             variantToAny( & varParam, anyParam, info.aType);
         else
             OSL_ASSERT(false);
 
-        pParams[countArgs - (i + 1)]= anyParam;
+        pParams[ expectedArgs - i - 1 ]= anyParam;
     }// end for / iterating over all parameters
 }
 
@@ -1748,17 +1766,6 @@ STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMember,
 
                         convertDispparamsArgs(dispidMember, wFlags, pdispparams , params );
 
-                        // Pass missing (hopefully optional) parameters as Any().
-                        InvocationInfo aInvocationInfo;
-                        getInvocationInfoForCall(dispidMember, aInvocationInfo);
-                        if (pdispparams->cArgs < (UINT)aInvocationInfo.aParamTypes.getLength())
-                        {
-                            params.realloc(aInvocationInfo.aParamTypes.getLength());
-                            Any* pParams = params.getArray();
-                            for (int i = pdispparams->cArgs; i < aInvocationInfo.aParamTypes.getLength(); ++i)
-                                pParams[i] = Any();
-                        }
-
                         ret= doInvoke(pdispparams, pvarResult,
                                       pexcepinfo, puArgErr, d.name, params);
                     }
@@ -2261,6 +2268,99 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments )
     SAL_WARN("extensions.olebridge", "Sink::Call: Uknown method '" << Method << "'");
 }
 
+class CXEnumConnections : public IEnumConnections,
+                          public CComObjectRoot
+{
+public:
+    CXEnumConnections()
+    {
+    }
+
+    ~CXEnumConnections()
+    {
+    }
+
+    BEGIN_COM_MAP(CXEnumConnections)
+        COM_INTERFACE_ENTRY(IEnumConnections)
+    END_COM_MAP()
+
+    DECLARE_NOT_AGGREGATABLE(CXEnumConnections)
+
+    void Init(std::vector<IUnknown*>& rUnknowns, std::vector<DWORD>& rCookies)
+    {
+        SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Init");
+        SAL_WARN_IF(rUnknowns.size() != rCookies.size(), "extensions.olebridge", "Vectors of different size");
+        mvUnknowns = rUnknowns;
+        mvCookies = rCookies;
+        mnIndex = 0;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE Next(ULONG cConnections,
+                                           LPCONNECTDATA rgcd,
+                                           ULONG *pcFetched) override
+    {
+        if (!rgcd)
+        {
+            SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Next(" << cConnections << "): E_POINTER");
+            return E_POINTER;
+        }
+
+        if (pcFetched && cConnections != 1)
+        {
+            SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Next(" << cConnections << "): E_INVALIDARG");
+            return E_POINTER;
+        }
+
+        ULONG nFetched = 0;
+        while (nFetched < cConnections && mnIndex < mvUnknowns.size())
+        {
+            rgcd[nFetched].pUnk = mvUnknowns[mnIndex];
+            rgcd[nFetched].pUnk->AddRef();
+            rgcd[nFetched].dwCookie = mvCookies[mnIndex];
+            ++nFetched;
+            ++mnIndex;
+        }
+        if (nFetched != cConnections)
+        {
+            SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Next(" << cConnections << "): S_FALSE");
+            if (pcFetched)
+                *pcFetched = nFetched;
+            return S_FALSE;
+        }
+        SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Next(" << cConnections << "): S_OK");
+        if (pcFetched)
+            *pcFetched = nFetched;
+
+        return S_OK;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE Skip(ULONG cConnections) override
+    {
+        SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Skip(" << cConnections << "): E_NOTIMPL");
+
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE Reset() override
+    {
+        SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Reset: E_NOTIMPL");
+
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE Clone(IEnumConnections** /* ppEnum */) override
+    {
+        SAL_INFO("extensions.olebridge", this << "@CXEnumConnections::Clone: E_NOTIMPL");
+
+        return E_NOTIMPL;
+    }
+
+private:
+    std::vector<IUnknown*> mvUnknowns;
+    std::vector<DWORD> mvCookies;
+    ULONG mnIndex;
+};
+
 class CXConnectionPoint : public IConnectionPoint,
                           public CComObjectRoot
 {
@@ -2350,16 +2450,39 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE EnumConnections(IEnumConnections **ppEnum) override
     {
-        (void) ppEnum;
-        SAL_WARN("extensions.olebridge", this << "@CXConnectionPoint::EnumConnections: E_NOTIMPL");
-        return E_NOTIMPL;
+        HRESULT nResult;
+
+        SAL_INFO("extensions.olebridge", this << "@CXConnectionPoint::EnumConnections...");
+
+        if (!ppEnum)
+        {
+            SAL_INFO("extensions.olebridge", "..." << this << "@CXConnectionPoint::EnumConnections: E_POINTER");
+            return E_POINTER;
+        }
+
+        CComObject<CXEnumConnections>* pEnumConnections;
+
+        nResult = CComObject<CXEnumConnections>::CreateInstance(&pEnumConnections);
+        if (FAILED(nResult))
+        {
+            SAL_INFO("extensions.olebridge", "..." << this << "@CXConnectionPoint::EnumConnections: " << WindowsErrorStringFromHRESULT(nResult));
+            return nResult;
+        }
+
+        pEnumConnections->AddRef();
+
+        pEnumConnections->Init(mvISinks, mvCookies);
+        *ppEnum = pEnumConnections;
+
+        SAL_INFO("extensions.olebridge", "..." << this << "@CXConnectionPoint::EnumConnections: S_OK");
+
+        return S_OK;
     }
 
-private:
     InterfaceOleWrapper* mpInterfaceOleWrapper;
     std::vector<IUnknown*> mvISinks;
     std::vector<Reference<ooo::vba::XSink>> mvXSinks;
-    std::vector<sal_uInt32> mvCookies;
+    std::vector<DWORD> mvCookies;
     Reference<XMultiServiceFactory> mxMSF;
     Reference<ooo::vba::XConnectionPoint> mxCP;
     ooo::vba::TypeAndIID maTypeAndIID;
commit 088ef840c0002d109298d767eb3ccb1bd40526fb
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Apr 23 22:20:52 2018 +0300

    Make SAL_INFO logging style more useful
    
    Make it easier to search for a specific class and function in the
    output by outputting the 'this' pointer first, not between the class
    and function name.
    
    Change-Id: Ia6e087e3a4be9e701c418aedb9b6af5fd4f6e828
    (cherry picked from commit c86c08ea00e284ce4381b26609cd83fab17e4991)

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 48c6dee1aeb1..9d5110e05c15 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -188,7 +188,7 @@ InterfaceOleWrapper::~InterfaceOleWrapper()
 
 STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, LPVOID FAR * ppv)
 {
-    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::QueryInterface " << riid);
+    SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::QueryInterface(" << riid << ")");
 
     HRESULT ret= S_OK;
 
@@ -283,7 +283,7 @@ STDMETHODIMP  InterfaceOleWrapper::getOriginalUnoStruct( Any * pStruct)
 
 STDMETHODIMP InterfaceOleWrapper::GetTypeInfoCount( unsigned int *pctinfo )
 {
-    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::GetTypeInfoCount()");
+    SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::GetTypeInfoCount");
 
     if (!pctinfo)
         return E_POINTER;
@@ -392,7 +392,7 @@ public:
               const OUString& sImplementationName,
               Reference<XMultiServiceFactory> xMSF)
     {
-        SAL_INFO("extensions.olebridge", "CXTypeLib::Init() this=" << this << " for " << sImplementationName);
+        SAL_INFO("extensions.olebridge", this << "@CXTypeLib::Init for " << sImplementationName);
         mxOrigin = xOrigin;
         msImplementationName = sImplementationName;
         mxMSF = xMSF;
@@ -400,7 +400,7 @@ public:
 
     virtual UINT STDMETHODCALLTYPE GetTypeInfoCount() override
     {
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::GetTypeInfoCount()");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib::GetTypeInfoCount");
         return 1;
     }
 
@@ -409,7 +409,7 @@ public:
     {
         (void) index;
         (void) ppTInfo;
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::GetTypeInfo: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib::GetTypeInfo: E_NOTIMPL");
         return E_NOTIMPL;
     }
 
@@ -418,14 +418,14 @@ public:
     {
         (void) index;
         (void) pTKind;
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::GetTypeInfoType: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib::GetTypeInfoType: E_NOTIMPL");
         return E_NOTIMPL;
     }
 
     virtual HRESULT STDMETHODCALLTYPE GetTypeInfoOfGuid(REFGUID guid,
                                                         ITypeInfo **ppTInfo) override
     {
-        SAL_INFO("extensions.olebridge", "CXTypeLib@" << this << "::GetTypeInfoOfGuid(" << guid << ")");
+        SAL_INFO("extensions.olebridge", this << "@CXTypeLib::GetTypeInfoOfGuid(" << guid << ")");
         if (!ppTInfo)
             return E_POINTER;
 
@@ -489,14 +489,14 @@ public:
     virtual HRESULT STDMETHODCALLTYPE GetLibAttr(TLIBATTR **ppTLibAttr) override
     {
         (void) ppTLibAttr;
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::GetLibAttr: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib::GetLibAttr: E_NOTIMPL");
         return E_NOTIMPL;
     }
 
     virtual HRESULT STDMETHODCALLTYPE GetTypeComp(ITypeComp **ppTComp) override
     {
         (void) ppTComp;
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::GetTypeComp: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib::GetTypeComp: E_NOTIMPL");
         return E_NOTIMPL;
     }
 
@@ -511,7 +511,7 @@ public:
         (void) pBstrDocString;
         (void) pdwHelpContext;
         (void) pBstrHelpFile;
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::GetDocumentation: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib::GetDocumentation: E_NOTIMPL");
         return E_NOTIMPL;
     }
 
@@ -522,7 +522,7 @@ public:
         (void) szNameBuf;
         (void) lHashVal;
         (void) pfName;
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::IsName: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib:IsName: E_NOTIMPL");
         return E_NOTIMPL;
     }
 
@@ -537,14 +537,14 @@ public:
         (void) ppTInfo;
         (void) rgMemId;
         (void) pcFound;
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::FindName: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib::FindName: E_NOTIMPL");
         return E_NOTIMPL;
     }
 
     virtual void STDMETHODCALLTYPE ReleaseTLibAttr(TLIBATTR *pTLibAttr) override
     {
         (void) pTLibAttr;
-        SAL_WARN("extensions.olebridge", "CXTypeLib@" << this << "::ReleaseTLibAttr: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXTypeLib::ReleaseTLibAttr: E_NOTIMPL");
     }
 
 private:
@@ -558,7 +558,7 @@ void CXTypeInfo::InitForCoclass(Reference<XInterface> xOrigin,
                                 const IID& rIID,
                                 Reference<XMultiServiceFactory> xMSF)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo::InitForCoclass() this=" << this << " for " << rIID << " (" << sImplementationName << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::InitForCoclass(" << sImplementationName << "," << rIID << ")");
     meKind = Kind::COCLASS;
     mxOrigin = xOrigin;
     msImplementationName = sImplementationName;
@@ -571,7 +571,7 @@ void CXTypeInfo::InitForClassItself(Reference<XInterface> xOrigin,
                                     const IID& rIID,
                                     Reference<XMultiServiceFactory> xMSF)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo::InitForClassItself() this=" << this << " for " << rIID << " (" << sImplementationName << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::InitForClassItself(" << sImplementationName << "," << rIID << ")");
     meKind = Kind::MAIN;
     mxOrigin = xOrigin;
     msImplementationName = sImplementationName;
@@ -585,7 +585,7 @@ void CXTypeInfo::InitForOutgoing(Reference<XInterface> xOrigin,
                                  Reference<XMultiServiceFactory> xMSF,
                                  Type aType)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo::InitForOutgoing() this=" << this << " for " << rIID << " (" << sInterfaceName << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::InitForOutgoing(" << sInterfaceName << "," << rIID << ")");
     meKind = Kind::OUTGOING;
     mxOrigin = xOrigin;
     msInterfaceName = sInterfaceName;
@@ -596,7 +596,7 @@ void CXTypeInfo::InitForOutgoing(Reference<XInterface> xOrigin,
 
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetTypeAttr(TYPEATTR **ppTypeAttr)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetTypeAttr()");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetTypeAttr");
 
     if (!ppTypeAttr)
         return E_POINTER;
@@ -667,7 +667,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetTypeAttr(TYPEATTR **ppTypeAttr)
     pTypeAttr->wMinorVerNum = 0;
     pTypeAttr->idldescType.wIDLFlags = IDLFLAG_NONE;
 
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetTypeAttr(): " << pTypeAttr);
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetTypeAttr: " << pTypeAttr);
 
     *ppTypeAttr = pTypeAttr;
 
@@ -677,7 +677,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetTypeAttr(TYPEATTR **ppTypeAttr)
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetTypeComp(ITypeComp **ppTComp)
 {
     (void) ppTComp;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::GetTypeComp: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::GetTypeComp: E_NOTIMPL");
     return E_NOTIMPL;
 }
 
@@ -742,7 +742,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetFuncDesc(UINT index,
         (*ppFuncDesc)->cScodes = 0;
         (*ppFuncDesc)->wFuncFlags = FUNCFLAG_FRESTRICTED;
 
-        SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetFuncDesc(" << index << "): S_OK: " << *ppFuncDesc);
+        SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetFuncDesc(" << index << "): S_OK: " << *ppFuncDesc);
 
         return S_OK;
     }
@@ -776,7 +776,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetFuncDesc(UINT index,
     (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_VOID; // ???
     (*ppFuncDesc)->wFuncFlags = 0;
 
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetFuncDesc(" << index << "): S_OK: " << *ppFuncDesc);
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetFuncDesc(" << index << "): S_OK: " << *ppFuncDesc);
 
     return S_OK;
 }
@@ -786,7 +786,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetVarDesc(UINT index,
 {
     (void) index;
     (void) ppVarDesc;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::GetVarDesc: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::GetVarDesc: E_NOTIMPL");
     return E_NOTIMPL;
 }
 
@@ -795,7 +795,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetNames(MEMBERID memid,
                                                UINT cMaxNames,
                                                UINT *pcNames)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetNames(" << memid << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetNames(" << memid << ")");
     assert(meKind != Kind::COCLASS);
 
     if (!rgBstrNames)
@@ -830,7 +830,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetNames(MEMBERID memid,
     if (memid > aMethods.getLength() - 3)
         return E_INVALIDARG;
 
-    SAL_INFO("extensions.olebridge", "...CXTypeInfo@" << this << "::GetNames(" << memid << "): " << aMethods[memid + 2]->getName());
+    SAL_INFO("extensions.olebridge", "..." << this << "@CXTypeInfo::GetNames(" << memid << "): " << aMethods[memid + 2]->getName());
     rgBstrNames[0] = SysAllocString((LPOLESTR) aMethods[memid + 2]->getName().pData->buffer);
     *pcNames = 1;
 
@@ -840,7 +840,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetNames(MEMBERID memid,
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetRefTypeOfImplType(UINT index,
                                                            HREFTYPE *pRefType)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetRefTypeOfImplType(" << index << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetRefTypeOfImplType(" << index << ")");
 
     if (!pRefType)
         return E_POINTER;
@@ -855,7 +855,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetRefTypeOfImplType(UINT index,
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetImplTypeFlags(UINT index,
                                                        INT *pImplTypeFlags)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetImplTypeFlags(" << index << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetImplTypeFlags(" << index << ")");
 
     if (!pImplTypeFlags)
         return E_POINTER;
@@ -878,7 +878,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetIDsOfNames(LPOLESTR *rgszNames,
     (void) rgszNames;
     (void) cNames;
     (void) pMemId;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::GetIDsOfNames: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::GetIDsOfNames: E_NOTIMPL");
     return E_NOTIMPL;
 }
 
@@ -897,7 +897,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::Invoke(PVOID pvInstance,
     (void) pVarResult;
     (void) pExcepInfo;
     (void) puArgErr;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::Invoke: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::Invoke: E_NOTIMPL");
     return E_NOTIMPL;
 }
 
@@ -907,7 +907,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetDocumentation(MEMBERID memid,
                                                        DWORD *pdwHelpContext,
                                                        BSTR *pBstrHelpFile)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetDocumentation(" << memid << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetDocumentation(" << memid << ")");
     if (pBstrName)
     {
         if (memid == MEMBERID_NIL)
@@ -945,14 +945,14 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetDllEntry(MEMBERID memid,
     (void) pBstrDllName;
     (void) pBstrName;
     (void) pwOrdinal;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::GetDllEntry: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::GetDllEntry: E_NOTIMPL");
     return E_NOTIMPL;
 }
 
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetRefTypeInfo(HREFTYPE hRefType,
                                                      ITypeInfo **ppTInfo)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetRefTypeInfo(" << hRefType << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetRefTypeInfo(" << hRefType << ")");
 
     if (!ppTInfo)
         return E_POINTER;
@@ -994,7 +994,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::AddressOfMember(MEMBERID memid,
     (void) memid;
     (void) invKind;
     (void) ppv;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::AddressOfMember: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::AddressOfMember: E_NOTIMPL");
     return E_NOTIMPL;
 }
 
@@ -1005,7 +1005,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::CreateInstance(IUnknown *pUnkOuter,
     (void) pUnkOuter;
     (void) riid;
     (void) ppvObj;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::CreateInstance: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::CreateInstance: E_NOTIMPL");
     return E_NOTIMPL;
 }
 
@@ -1014,7 +1014,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetMops(MEMBERID memid,
 {
     (void) memid;
     (void) pBstrMops;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::GetMops: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::GetMops: E_NOTIMPL");
     return E_NOTIMPL;
 }
 
@@ -1024,7 +1024,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetMops(MEMBERID memid,
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetContainingTypeLib(ITypeLib **ppTLib,
                                                            UINT *pIndex)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetContainingTypeLib");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::GetContainingTypeLib");
 
     if (!ppTLib || !pIndex)
         return E_POINTER;
@@ -1048,14 +1048,14 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetContainingTypeLib(ITypeLib **ppTLib,
 
 void STDMETHODCALLTYPE CXTypeInfo::ReleaseTypeAttr(TYPEATTR *pTypeAttr)
 {
-    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::ReleaseTypeAttr(" << pTypeAttr << ")");
+    SAL_INFO("extensions.olebridge", this << "@CXTypeInfo::ReleaseTypeAttr(" << pTypeAttr << ")");
 
     delete pTypeAttr;
 }
 
 void STDMETHODCALLTYPE CXTypeInfo::ReleaseFuncDesc(FUNCDESC *pFuncDesc)
 {
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::ReleaseFuncDesc(" << pFuncDesc << ")");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::ReleaseFuncDesc(" << pFuncDesc << ")");
 
     delete pFuncDesc;
 }
@@ -1063,12 +1063,12 @@ void STDMETHODCALLTYPE CXTypeInfo::ReleaseFuncDesc(FUNCDESC *pFuncDesc)
 void STDMETHODCALLTYPE CXTypeInfo::ReleaseVarDesc(VARDESC *pVarDesc)
 {
     (void) pVarDesc;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::ReleaseVarDesc: NOTIMPL");
+    SAL_WARN("extensions.olebridge", this << "@CXTypeInfo::ReleaseVarDesc: E_NOTIMPL");
 }
 
 STDMETHODIMP InterfaceOleWrapper::GetTypeInfo(unsigned int iTInfo, LCID, ITypeInfo ** ppTInfo)
 {
-    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::GetTypeInfo(" << iTInfo << ")");
+    SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::GetTypeInfo(" << iTInfo << ")");
 
     if (!ppTInfo)
         return E_POINTER;
@@ -1108,7 +1108,7 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
                                                 LCID /*lcid*/,
                                                 DISPID * rgdispid )
 {
-    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::GetIDsOfNames("
+    SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::GetIDsOfNames("
              << OUString(o3tl::toU(rgszNames[0]))
              << (cNames > 1 ? "...!" : "") << "," << cNames << ")");
 
@@ -1442,7 +1442,7 @@ void SAL_CALL InterfaceOleWrapper::initialize( const Sequence< Any >& aArguments
         if (xServiceInfo.is())
             m_sImplementationName = xServiceInfo->getImplementationName();
 
-        SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::initialize for "
+        SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::initialize for "
                  << (m_sImplementationName.isEmpty()?"an unknown implementation":m_sImplementationName));
         break;
     }
@@ -1718,7 +1718,7 @@ STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMember,
                                          EXCEPINFO * pexcepinfo,
                                          unsigned int * puArgErr )
 {
-    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::Invoke(" << dispidMember << ")");
+    SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::Invoke(" << dispidMember << ")");
 
     comphelper::ProfileZone aZone("COM Bridge");
     HRESULT ret = S_OK;
@@ -2276,7 +2276,7 @@ public:
               Reference<XMultiServiceFactory>& xMSF,
               ooo::vba::TypeAndIID aTypeAndIID)
     {
-        SAL_INFO("extensions.olebridge", "CXConnectionPoint::Init() this=" << this << " for " << pInterfaceOleWrapper->getImplementationName());
+        SAL_INFO("extensions.olebridge", this << "@CXConnectionPoint::Init for " << pInterfaceOleWrapper->getImplementationName());
 
         IUnknown *pUnknown;
         if (SUCCEEDED(QueryInterface(IID_IUnknown, (void **)&pUnknown)))
@@ -2293,7 +2293,7 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE GetConnectionInterface(IID *pIID) override
     {
-        SAL_WARN("extensions.olebridge", "CXConnectionPoint@" << this << "::GetConnectionInterface(" << *pIID << "): NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXConnectionPoint::GetConnectionInterface(" << *pIID << "): E_NOTIMPL");
 
         // FIXME: Needed?
 
@@ -2303,7 +2303,7 @@ public:
     virtual HRESULT STDMETHODCALLTYPE GetConnectionPointContainer(IConnectionPointContainer **ppCPC) override
     {
         (void) ppCPC;
-        SAL_WARN("extensions.olebridge", "CXConnectionPoint@" << this << "::GetConnectionInterface: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXConnectionPoint::GetConnectionInterface: E_NOTIMPL");
 
         // FIXME: Needed?
 
@@ -2313,7 +2313,7 @@ public:
     virtual HRESULT STDMETHODCALLTYPE Advise(IUnknown *pUnkSink,
                                              DWORD *pdwCookie) override
     {
-        SAL_INFO("extensions.olebridge", "CXConnectionPoint@" << this << "::Advise(" << pUnkSink << ")");
+        SAL_INFO("extensions.olebridge", this << "@CXConnectionPoint::Advise(" << pUnkSink << ")");
 
         if (!pdwCookie)
             return E_POINTER;
@@ -2334,7 +2334,7 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE Unadvise(DWORD dwCookie) override
     {
-        SAL_INFO("extensions.olebridge", "CXConnectionPoint@" << this << "::Unadvise(" << dwCookie << ")");
+        SAL_INFO("extensions.olebridge", this << "@CXConnectionPoint::Unadvise(" << dwCookie << ")");
 
         if (dwCookie == 0 || dwCookie > mvISinks.size())
             return E_POINTER;
@@ -2351,7 +2351,7 @@ public:
     virtual HRESULT STDMETHODCALLTYPE EnumConnections(IEnumConnections **ppEnum) override
     {
         (void) ppEnum;
-        SAL_WARN("extensions.olebridge", "CXConnectionPoint@" << this << "::EnumConnections: NOTIMPL");
+        SAL_WARN("extensions.olebridge", this << "@CXConnectionPoint::EnumConnections: E_NOTIMPL");
         return E_NOTIMPL;
     }
 
@@ -2588,7 +2588,7 @@ STDMETHODIMP InterfaceOleWrapper::GetNameSpaceParent(
 HRESULT STDMETHODCALLTYPE InterfaceOleWrapper::GetClassInfo (
     /* [out] */ ITypeInfo **ppTI)
 {
-    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::GetClassInfo");
+    SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::GetClassInfo");
 
     if (!ppTI)
         return E_POINTER;
@@ -2624,7 +2624,7 @@ HRESULT STDMETHODCALLTYPE InterfaceOleWrapper::EnumConnectionPoints(
     /* [out] */ IEnumConnectionPoints **ppEnum)
 {
     (void) ppEnum;
-    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::EnumConnectionPoints");
+    SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::EnumConnectionPoints");
     return ResultFromScode(E_NOTIMPL);
 }
 
@@ -2632,7 +2632,7 @@ HRESULT STDMETHODCALLTYPE InterfaceOleWrapper::FindConnectionPoint(
     /* [in] */ REFIID riid,
     /* [out] */ IConnectionPoint **ppCP)
 {
-    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::FindConnectionPoint " << riid);
+    SAL_INFO("extensions.olebridge", this << "@InterfaceOleWrapper::FindConnectionPoint(" << riid << ")");
 
     if (!ppCP)
         return E_POINTER;
commit 6d31384aa74fc57883c51488b2a66161eaa894cb
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Apr 23 20:50:43 2018 +0300

    Initial steps to make also Calc usable from Automation clients
    
    Largely parallel to what we do for Writer.
    
    Yes, there is a fair amount of duplicated code now for the outgoing
    ("sink") stuff in sw and sc, that should be factored out (to
    vbahelper, probably).
    
    Change-Id: I8df4a81c3b9043e8d6b0b206e3c04660205987c7
    (cherry picked from commit b9ef6b66e7a67a448b1a840c47146d8789a92a6d)

diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 08020c8a3e96..ad31b1025ad6 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -54,6 +54,10 @@ DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50
 // {82154421-0FBF-11d4-8313-005004526AB4}
 DEFINE_GUID(OID_LibreOfficeWriterApplication, 0x82154421, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
 
+// For Calc
+// {82154425-0FBF-11d4-8313-005004526AB4}
+DEFINE_GUID(OID_LibreOfficeCalcApplication, 0x82154425, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
+
 OneInstanceOleWrapper::OneInstanceOleWrapper(  const Reference<XMultiServiceFactory>& smgr,
                                                std::function<const Reference<XInterface>()> xInstFunction )
     : m_refCount(0)
@@ -488,6 +492,18 @@ OleServer::OleServer( const Reference<XMultiServiceFactory>& smgr):
                                 return xApplication;
                             },
                             &OID_LibreOfficeWriterApplication );
+
+    (void) provideInstance( [&]
+                            {
+                                // Ditto for sc
+                                static const Reference<XInterface> xCalcGlobals = m_smgr->createInstance("ooo.vba.excel.Globals");
+                                const Reference<ooo::vba::XHelperInterface> xHelperInterface(xCalcGlobals, UNO_QUERY);
+                                Any aApplication = xHelperInterface->Application();
+                                Reference<XInterface> xApplication;
+                                aApplication >>= xApplication;
+                                return xApplication;
+                            },
+                            &OID_LibreOfficeCalcApplication );
 }
 
 OleServer::~OleServer()
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index e315b27ddaf3..ceceaf777d97 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -30,6 +30,8 @@ interface XApplication
     interface ::com::sun::star::beans::XExactName;
     interface ::com::sun::star::script::XInvocation;
 
+    interface XConnectable;
+
 //  interface ::ooo::vba::XHelperInterface;
 
     [attribute, readonly] any Selection;
diff --git a/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl b/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl
index d9b1da42bc4b..9e601c5331d6 100644
--- a/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl
+++ b/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl
@@ -25,6 +25,8 @@ module ooo {  module vba {  module excel {
 
 interface XApplicationOutgoing : XInterfaceWithIID
 {
+    void WorkbookOpen([in] any Wb);
+    void WorkbookBeforeClose([in] any Wb, [out] any Cancel);
 };
 
 }; }; };
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 9e1432c0a8c3..65c895501cd8 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -33,7 +33,11 @@ $(eval $(call gb_Library_use_custom_headers,sc,\
     officecfg/registry \
 ))
 
-$(eval $(call gb_Library_use_sdk_api,sc))
+$(eval $(call gb_Library_use_api,sc,\
+	udkapi \
+	offapi \
+	oovbaapi \
+))
 
 $(eval $(call gb_Library_use_externals,sc,\
     boost_headers \
diff --git a/sc/Library_scd.mk b/sc/Library_scd.mk
index 1b491afc5cd8..1a6a132f74f9 100644
--- a/sc/Library_scd.mk
+++ b/sc/Library_scd.mk
@@ -18,7 +18,11 @@ $(eval $(call gb_Library_set_include,scd,\
 
 $(eval $(call gb_Library_use_external,scd,boost_headers))
 
-$(eval $(call gb_Library_use_sdk_api,scd))
+$(eval $(call gb_Library_use_api,scd,\
+	udkapi \
+	offapi \
+	oovbaapi \
+))
 
 $(eval $(call gb_Library_use_libraries,scd,\
 	comphelper \
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index e4b6fe154e89..4766ed02f096 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -21,7 +21,11 @@ $(eval $(call gb_Library_set_include,scfilt,\
 
 $(eval $(call gb_Library_set_precompiled_header,scfilt,$(SRCDIR)/sc/inc/pch/precompiled_scfilt))
 
-$(eval $(call gb_Library_use_sdk_api,scfilt))
+$(eval $(call gb_Library_use_api,scfilt,\
+	udkapi \
+	offapi \
+	oovbaapi \
+))
 
 $(eval $(call gb_Library_use_custom_headers,scfilt,\
 	oox/generated \
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index d576ca51a5c1..7105f59e11db 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -28,7 +28,11 @@ $(eval $(call gb_Library_use_custom_headers,scui,\
     officecfg/registry \
 ))
 
-$(eval $(call gb_Library_use_sdk_api,scui))
+$(eval $(call gb_Library_use_api,scui,\
+	udkapi \
+	offapi \
+	oovbaapi \
+))
 
 $(eval $(call gb_Library_use_externals,scui,\
 	boost_headers \
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 8b37972da39b..3969205ceae7 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -28,6 +28,7 @@
 #include "global.hxx"
 #include "shellids.hxx"
 #include <unotools/options.hxx>
+#include <ooo/vba/XSinkCaller.hpp>
 
 #include <algorithm>
 #include <vector>
@@ -105,6 +106,9 @@ class ScModule: public SfxModule, public SfxListener, public utl::ConfigurationL
     bool                mbIsInSharedDocSaving:1;
 
     std::map<sal_uInt16, std::vector<VclPtr<vcl::Window> > > m_mapRefWindow;
+
+    css::uno::Reference< ooo::vba::XSinkCaller > mxAutomationApplicationEventsCaller;
+
 public:
                     SFX_DECL_INTERFACE(SCID_APP)
 
@@ -243,6 +247,9 @@ public:
     SC_DLLPUBLIC void   RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd );
     SC_DLLPUBLIC void   UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd );
     SC_DLLPUBLIC vcl::Window * Find1RefWindow( sal_uInt16 nSlotId, vcl::Window *pWndAncestor );
+
+    SC_DLLPUBLIC void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller);
+    SC_DLLPUBLIC void CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments);
 };
 
 #define SC_MOD() ( static_cast<ScModule*>(SfxApplication::GetModule(SfxToolsModule::Calc)) )
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 81830b695cdc..06203baaca57 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2278,4 +2278,15 @@ SfxStyleFamilies* ScModule::CreateStyleFamilies()
     return pStyleFamilies;
 }
 
+void ScModule::RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller)
+{
+    mxAutomationApplicationEventsCaller = xCaller;
+}
+
+void ScModule::CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments)
+{
+    if (mxAutomationApplicationEventsCaller.is())
+        mxAutomationApplicationEventsCaller->CallSinks(Method, Arguments);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 396eb3fcada3..663a0c82f97f 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/util/PathSettings.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <ooo/vba/XExecutableDialog.hpp>
+#include <ooo/vba/excel/XApplicationOutgoing.hpp>
 #include <ooo/vba/excel/XlCalculation.hpp>
 #include <ooo/vba/excel/XlMousePointer.hpp>
 #include <ooo/vba/office/MsoShapeType.hpp>
@@ -128,6 +129,41 @@ ScVbaAppSettings::ScVbaAppSettings() :
 
 struct ScVbaStaticAppSettings : public ::rtl::Static< ScVbaAppSettings, ScVbaStaticAppSettings > {};
 
+class ScVbaApplicationOutgoingConnectionPoint : public cppu::WeakImplHelper<XConnectionPoint>
+{
+private:
+    ScVbaApplication* mpApp;
+
+public:
+    ScVbaApplicationOutgoingConnectionPoint( ScVbaApplication* pApp );
+
+    // XConnectionPoint
+    sal_uInt32 SAL_CALL Advise(const uno::Reference< XSink >& Sink ) override;
+    void SAL_CALL Unadvise( sal_uInt32 Cookie ) override;
+};
+
+sal_uInt32
+ScVbaApplication::AddSink( const uno::Reference< XSink >& xSink )
+{
+    {
+        SolarMutexGuard aGuard;
+        ScDLL::Init();
+    }
+    // No harm in potentially calling this several times
+    SC_MOD()->RegisterAutomationApplicationEventsCaller( uno::Reference< XSinkCaller >(this) );
+    mvSinks.push_back(xSink);
+    return mvSinks.size();;
+}
+
+void
+ScVbaApplication::RemoveSink( sal_uInt32 nNumber )
+{
+    if (nNumber < 1 || nNumber > mvSinks.size())
+        return;
+
+    mvSinks[nNumber-1] = uno::Reference< XSink >();
+}
+
 ScVbaApplication::ScVbaApplication( const uno::Reference<uno::XComponentContext >& xContext ) :
     ScVbaApplication_BASE( xContext ),
     mrAppSettings( ScVbaStaticAppSettings::get() ),
@@ -1383,6 +1419,52 @@ void SAL_CALL ScVbaApplication::Undo()
         dispatchExecute( pViewShell, SID_UNDO );
 }
 
+// XInterfaceWithIID
+
+OUString SAL_CALL
+ScVbaApplication::getIID()
+{
+    return OUString("{82154425-0FBF-11d4-8313-005004526AB4}");
+}
+
+// XConnectable
+
+OUString SAL_CALL
+ScVbaApplication::GetIIDForClassItselfNotCoclass()
+{
+    return OUString("{82154426-0FBF-11D4-8313-005004526AB4}");
+}
+
+TypeAndIID SAL_CALL
+ScVbaApplication::GetConnectionPoint()
+{
+    TypeAndIID aResult =
+        { excel::XApplicationOutgoing::static_type(),
+          "{82154427-0FBF-11D4-8313-005004526AB4}"
+        };
+
+    return aResult;
+}
+
+uno::Reference<XConnectionPoint> SAL_CALL
+ScVbaApplication::FindConnectionPoint()
+{
+    uno::Reference<XConnectionPoint> xCP(new ScVbaApplicationOutgoingConnectionPoint(this));
+    return xCP;
+}
+
+// XSinkCaller
+
+void SAL_CALL
+ScVbaApplication::CallSinks( const OUString& Method, uno::Sequence< uno::Any >& Arguments )
+{
+    for (auto& i : mvSinks)
+    {
+        if (i.is())
+            i->Call(Method, Arguments);
+    }
+}
+
 OUString
 ScVbaApplication::getServiceImplName()
 {
@@ -1411,4 +1493,24 @@ sdecl::ServiceDecl const serviceDecl(
     "ooo.vba.excel.Application" );
 }
 
+// ScVbaApplicationOutgoingConnectionPoint
+
+ScVbaApplicationOutgoingConnectionPoint::ScVbaApplicationOutgoingConnectionPoint( ScVbaApplication* pApp ) :
+    mpApp(pApp)
+{
+}
+
+// XConnectionPoint
+sal_uInt32 SAL_CALL
+ScVbaApplicationOutgoingConnectionPoint::Advise( const uno::Reference< XSink >& Sink )
+{
+    return mpApp->AddSink(Sink);
+}
+
+void SAL_CALL
+ScVbaApplicationOutgoingConnectionPoint::Unadvise( sal_uInt32 Cookie )
+{
+    mpApp->RemoveSink( Cookie );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbaapplication.hxx b/sc/source/ui/vba/vbaapplication.hxx
index 9a0d3137febb..6c9c58588ada 100644
--- a/sc/source/ui/vba/vbaapplication.hxx
+++ b/sc/source/ui/vba/vbaapplication.hxx
@@ -19,6 +19,10 @@
 #ifndef INCLUDED_SC_SOURCE_UI_VBA_VBAAPPLICATION_HXX
 #define INCLUDED_SC_SOURCE_UI_VBA_VBAAPPLICATION_HXX
 
+#include <vector>
+
+#include <ooo/vba/XSink.hpp>
+#include <ooo/vba/XSinkCaller.hpp>
 #include <ooo/vba/excel/XWorksheetFunction.hpp>
 #include <ooo/vba/excel/XApplication.hpp>
 #include <ooo/vba/excel/XFileDialog.hpp>
@@ -28,7 +32,7 @@
 #include <vbahelper/vbaapplicationbase.hxx>
 #include <cppuhelper/implbase.hxx>
 
-typedef cppu::ImplInheritanceHelper< VbaApplicationBase, ov::excel::XApplication > ScVbaApplication_BASE;
+typedef cppu::ImplInheritanceHelper< VbaApplicationBase, ov::excel::XApplication, ov::XSinkCaller > ScVbaApplication_BASE;
 
 struct ScVbaAppSettings;
 
@@ -45,6 +49,8 @@ private:
     /// @throws css::uno::RuntimeException
     OUString getOfficePath( const OUString& sPath );
 
+    std::vector<css::uno::Reference< ooo::vba::XSink >> mvSinks;
+
 protected:
     virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override;
 
@@ -55,6 +61,9 @@ public:
     /** Returns true, if VBA document events are enabled. */
     static bool getDocumentEventsEnabled();
 
+    sal_uInt32 AddSink( const css::uno::Reference< ooo::vba::XSink >& xSink );
+    void RemoveSink( sal_uInt32 nNumber );
+
     // XExactName
     virtual OUString SAL_CALL getExactName( const OUString& aApproximateName ) override;
 
@@ -136,9 +145,21 @@ public:
     virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) override;
     virtual css::uno::Any SAL_CALL Caller( const css::uno::Any& aIndex ) override;
     virtual void SAL_CALL Undo() override;
+
     // XHelperInterface
     virtual OUString getServiceImplName() override;
     virtual css::uno::Sequence<OUString> getServiceNames() override;
+
+    // XInterfaceWithIID
+    virtual OUString SAL_CALL getIID() override;
+
+    // XConnectable
+    virtual OUString SAL_CALL GetIIDForClassItselfNotCoclass() override;
+    virtual ov::TypeAndIID SAL_CALL GetConnectionPoint() override;
+    virtual css::uno::Reference<ov::XConnectionPoint> SAL_CALL FindConnectionPoint() override;
+
+    // XSinkCaller
+    virtual void SAL_CALL CallSinks( const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments ) override;
 };
 #endif // INCLUDED_SC_SOURCE_UI_VBA_VBAAPPLICATION_HXX
 
commit c84fed290975811cc7c1c5632c9ec84bbaa1be36
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue May 15 22:14:40 2018 +0300

    Avoid crash if pDocShell is null
    
    Change-Id: I4d43bdd6789bdf01cd9b7b38377b19294a544477
    (cherry picked from commit 8a2f30e548f930f0ddd869e07f58947616ba9ea4)

diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index aec28eb93563..6b8b4f9c2610 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -621,8 +621,11 @@ void SwXTextDocument::dispose()
 
 void SwXTextDocument::close( sal_Bool bDeliverOwnership )
 {
-    uno::Sequence< uno::Any > aArgs;
-    pDocShell->CallAutomationDocumentEventSinks( "Close", aArgs );
+    if(pDocShell)
+    {
+        uno::Sequence< uno::Any > aArgs;
+        pDocShell->CallAutomationDocumentEventSinks( "Close", aArgs );
+    }
     SolarMutexGuard aGuard;
     if(IsValid() && m_pHiddenViewFrame)
         lcl_DisposeView( m_pHiddenViewFrame, pDocShell);
commit 6d420a91aa7becf732d51f0a4a6786efc99043f6
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 21 01:27:08 2018 +0300

    Add ooo.vba.excel.XApplicationOutgoing
    
    Change-Id: I50ba5482742296609187e8b41bd3a2910c44ca4e
    (cherry picked from commit a03d44076f74d73398d632cee5358bfc3103dd01)

diff --git a/oovbaapi/UnoApi_oovbaapi.mk b/oovbaapi/UnoApi_oovbaapi.mk
index 009405a80ca7..bb9601f8152b 100644
--- a/oovbaapi/UnoApi_oovbaapi.mk
+++ b/oovbaapi/UnoApi_oovbaapi.mk
@@ -219,6 +219,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,oovbaapi,ooo/vba/dao,\
 $(eval $(call gb_UnoApi_add_idlfiles,oovbaapi,ooo/vba/excel,\
     Constants \
 	XApplication \
+	XApplicationOutgoing \
 	XAxes \
 	XAxis \
 	XAxisTitle \
diff --git a/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl b/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl
new file mode 100644
index 000000000000..d9b1da42bc4b
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XApplicationOutgoing.idl
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef __ooo_vba_excel_XApplicationOutgoing_idl__
+#define __ooo_vba_excel_XApplicationOutgoing_idl__
+
+module ooo {  module vba {  module excel {
+
+// Despite being here in ooo::vba, this has nothing to do with "VBA" (Visual Basic for
+// Applications), or the VBA compatibility in StarBasic. This is related to using LibreOffice from
+// (OLE) Automation clients. It is here anyway because much of the API available to such clients
+// is identical to that offered to StarBasic code written in a VBA-like fashion.
+
+// This interface exists for technical reasons only, we don't actually have any UNO object that
+// would implement (inherit from) this. We just advertise the type of this interface from Writer to
+// the Automation-UNO bridge code (in extensions/source/ole) so that it can tell the Automation
+// client what the Automation server expects and construct a corresponding COM interface that can
+// receive the callbacks. Or something like that.
+
+interface XApplicationOutgoing : XInterfaceWithIID
+{
+};
+
+}; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 320415d67a577cea1502e35ef6f0923384ec4f30
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sun Apr 22 10:02:53 2018 +0300

    Add entries for Calc.Applcation
    
    Change-Id: Icee6f97abf9182621e43a0039b52c2f2e141fa01
    (cherry picked from commit b7939ff897a173086643819451c7b2b4553c11c3)

diff --git a/scp2/source/calc/registryitem_calc.scp b/scp2/source/calc/registryitem_calc.scp
index beb890f472d9..7464e701ca7c 100644
--- a/scp2/source/calc/registryitem_calc.scp
+++ b/scp2/source/calc/registryitem_calc.scp
@@ -806,6 +806,21 @@ RegistryItem gid_Regitem_Openoffice_Calcdocument_1_Shell_Printto_Command
     Value = "\"<progpath>\program\soffice.exe\" -pt \"%2\" \"%1\"";
 End
 
+RegistryItem gid_Regitem_CalcApplication
+    ParentID = PREDEFINED_HKEY_CLASSES_ROOT;
+    ModuleID = gid_Module_Prg_Calc_Bin;
+    Subkey = "Calc.Application\CLSID";
+    Value = "{82154425-0FBF-11d4-8313-005004526AB4}";
+    Styles = ();
+End
+
+RegistryItem gid_Regitem_Clsid__82154425_0FBF_11d4_8313_005004526AB4__Localserver32
+    ParentID = PREDEFINED_HKEY_CLASSES_ROOT;
+    ModuleID = gid_Module_Prg_Wrt_Bin;
+    Subkey = "CLSID\{82154425-0FBF-11d4-8313-005004526AB4}\LocalServer32";
+    Value = "<progpath>\program\soffice.exe --nodefault --nologo";
+End
+
 // .fods
 
 RegistryItem gid_Regitem__Fods
commit 8c772f78e9ce3c9dcfb32728ce388ac1c53cb74f
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 21 01:50:16 2018 +0300

    Move two functions to perhaps less confusing locations
    
    Change-Id: I4360c588ee4866f4e680095c0cd0e8f7aceaa6d7
    (cherry picked from commit fcf5a8f0f32dd97acee8271c1ccfc50e159667b5)

diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx
index 52cb6411d1ce..897be10a8c11 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -305,12 +305,6 @@ SwVbaApplication::getIID()
     return OUString("{82154421-0FBF-11d4-8313-005004526AB4}");
 }
 
-uno::Reference< frame::XModel >
-SwVbaApplication::getCurrentDocument()
-{
-    return getCurrentWordDoc( mxContext );
-}
-
 // XConnectable
 
 OUString SAL_CALL
@@ -337,8 +331,6 @@ SwVbaApplication::FindConnectionPoint()
     return xCP;
 }
 
-// XHelperInterface
-
 OUString
 SwVbaApplication::getServiceImplName()
 {
@@ -357,9 +349,10 @@ SwVbaApplication::getServiceNames()
     return aServiceNames;
 }
 
-SwVbaApplicationOutgoingConnectionPoint::SwVbaApplicationOutgoingConnectionPoint( SwVbaApplication* pApp ) :
-    mpApp(pApp)
+uno::Reference< frame::XModel >
+SwVbaApplication::getCurrentDocument()
 {
+    return getCurrentWordDoc( mxContext );
 }
 
 // XSinkCaller
@@ -376,6 +369,11 @@ SwVbaApplication::CallSinks( const OUString& Method, uno::Sequence< uno::Any >&
 
 // SwVbaApplicationOutgoingConnectionPoint
 
+SwVbaApplicationOutgoingConnectionPoint::SwVbaApplicationOutgoingConnectionPoint( SwVbaApplication* pApp ) :
+    mpApp(pApp)
+{
+}
+
 // XConnectionPoint
 sal_uInt32 SAL_CALL
 SwVbaApplicationOutgoingConnectionPoint::Advise( const uno::Reference< XSink >& Sink )
commit 92ac33362cb8ae0bed1fef7232b30ce15ef25425
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 21 00:29:04 2018 +0300

    Can simplify, our IDL compiler is more clever nowadays
    
    Change-Id: Ia5f8c0fcc8d1eb9f6ec3db82b947a16ed3762d01
    (cherry picked from commit c4cd61e7efd0c898c7bd304747c595871e97be6f)

diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index e08627651507..e315b27ddaf3 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -21,20 +21,9 @@
 
 #include <com/sun/star/beans/XExactName.idl>
 #include <com/sun/star/script/XInvocation.idl>
-#include <ooo/vba/XHelperInterface.idl>
-#include <ooo/vba/XAssistant.idl>
-#include <ooo/vba/XFileDialog.idl>
 
 module ooo {  module vba {  module excel {
 
-interface XRange;
-interface XWorkbook;
-interface XWorkbooks;
-interface XWorksheets;
-interface XWorksheetFunction;
-interface XWindow;
-interface XWorksheet;
-
 interface XApplication
 {
     // Application serves as WorksheetFunction object with little differences
commit d5a356944964f9c4d4aaa4c8d109b2497fd26428
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Apr 17 00:35:56 2018 +0300

    Add window geometry attributes, too, to ooo.vba.word.XApplication
    
    Like the other similar attributes and methods added lately, they just
    forward to the corresponding attributes of the "active
    window". Whether setting and retrieving such then actually does
    something useful or not I don't know. My main concern is that
    Automation and COM clients at least won't complain and abort because
    of unimplemented APIs.
    
    Change-Id: Ia8d22e3137d314268ac6771bb355e9f0686f52dc

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list