[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 22 commits - basic/source extensions/Library_oleautobridge.mk extensions/source external/boost include/comphelper oovbaapi/ooo stoc/source unotools/source vbahelper/source

Tor Lillqvist tml at collabora.com
Thu May 31 18:39:43 UTC 2018


 basic/source/classes/sbxmod.cxx                   |   27 -
 extensions/Library_oleautobridge.mk               |    6 
 extensions/source/ole/ole2uno.hxx                 |    5 
 extensions/source/ole/oleobjw.cxx                 |  144 ++---
 extensions/source/ole/oleobjw.hxx                 |   10 
 extensions/source/ole/servprov.cxx                |  277 +++--------
 extensions/source/ole/servprov.hxx                |  130 +----
 extensions/source/ole/servreg.cxx                 |    8 
 extensions/source/ole/unoconversionutilities.hxx  |   32 -
 extensions/source/ole/unoobjw.cxx                 |  539 +++++++++++++++++++---
 extensions/source/ole/unoobjw.hxx                 |   42 -
 external/boost/UnpackedTarball_boost.mk           |    2 
 external/boost/windows-no-utf8-locales.patch.0    |   20 
 include/comphelper/asyncquithandler.hxx           |   60 ++
 include/comphelper/windowsdebugoutput.hxx         |    2 
 oovbaapi/ooo/vba/XApplicationBase.idl             |    8 
 stoc/source/invocation/invocation.cxx             |   62 +-
 unotools/source/i18n/resmgr.cxx                   |   70 ++
 vbahelper/source/vbahelper/vbaapplicationbase.cxx |   20 
 19 files changed, 911 insertions(+), 553 deletions(-)

New commits:
commit 01ebbba2bbd2333c9bade8bf5b41e61ab9a3ec65
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 5 22:00:54 2018 +0200

    Add code to VbaApplicationBase::Quit() for the Automation client case
    
    Change-Id: I4354adf5353bdfb0b080b24a5c49e3d22539eb23
    Reviewed-on: https://gerrit.libreoffice.org/55051
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit d7f69b1cb4dbdd39970d56d0c340d7abb92fbdc1)

diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 61cb7d3d0e74..b09de686dd31 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -37,6 +37,7 @@
 #include <rtl/ref.hxx>
 #include <tools/datetime.hxx>
 #include <vcl/timer.hxx>
+#include <vcl/svapp.hxx>
 
 #include <basic/sbx.hxx>
 #include <basic/sbstar.hxx>
@@ -45,6 +46,8 @@
 #include <basic/sbmod.hxx>
 #include <basic/vbahelper.hxx>
 
+#include <comphelper/asyncquithandler.hxx>
+
 #include "vbacommandbars.hxx"
 
 #include <unordered_map>
@@ -441,6 +444,15 @@ void VbaApplicationBase::Quit()
                 pBasic->QuitAndExitApplication();
         }
     }
+    else
+    {
+        // This is the case of a call from an (OLE) Automation client.
+
+        // TODO: Probably we should just close any document windows open by the "application"
+        // (Writer or Calc) the call being handled is for. And only then, if no document windows
+        // are left open, quit the actual LibreOffice application.
+        Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ) );
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 737ea470d16f6b323811029c33abd2945decc087
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Mar 7 09:47:03 2018 +0200

    Whitespace fix
    
    Change-Id: Ife4040b181f0688d67de4a2a36e2d2f810e4fce5
    (cherry picked from commit 925fe6609f39098ee69d94087f11e593a60476a1)

diff --git a/oovbaapi/ooo/vba/XApplicationBase.idl b/oovbaapi/ooo/vba/XApplicationBase.idl
index ab9ca062bd1e..90ba919407d4 100644
--- a/oovbaapi/ooo/vba/XApplicationBase.idl
+++ b/oovbaapi/ooo/vba/XApplicationBase.idl
@@ -24,16 +24,14 @@
 
 module ooo {  module vba {
 
-
-
 interface XApplicationBase
 {
     interface ::ooo::vba::XHelperInterface;
 
     [attribute] boolean ScreenUpdating;
     [attribute] boolean DisplayStatusBar;
-     [attribute] boolean Interactive;
-     [attribute] boolean Visible;
+    [attribute] boolean Interactive;
+    [attribute] boolean Visible;
 
     [attribute, readonly] string Version;
     [attribute, readonly] any VBE;
@@ -47,8 +45,6 @@ interface XApplicationBase
     void Undo();
 };
 
-
-
 }; };
 
 #endif
commit 5e1ce67cc5b86ef59aa8767cbe99f9fe95aea51a
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 5 21:52:05 2018 +0200

    Factor out AsyncQuitHandler to be usable elsewhere, too
    
    Or do we already have the corresponding functionality somewhere, and
    SbModule::Run() could be changed to use that instead?
    
    Change-Id: I6f45d4a023f9f9d9a24ab6934117a712ccbe75e2
    Reviewed-on: https://gerrit.libreoffice.org/55048
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit cac718bfe606c363fa4538db8c6d21f28f139f58)

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index f68d541d69a9..aa1b4684e920 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -55,6 +55,7 @@
 
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/asyncquithandler.hxx>
 #include <map>
 #include <com/sun/star/reflection/ProxyFactory.hpp>
 #include <com/sun/star/uno/XAggregation.hpp>
@@ -416,32 +417,6 @@ bool getDefaultVBAMode( StarBASIC* pb )
     return xVBACompat.is() && xVBACompat->getVBACompatibilityMode();
 }
 
-class AsyncQuitHandler
-{
-    AsyncQuitHandler() {}
-
-public:
-    AsyncQuitHandler(const AsyncQuitHandler&) = delete;
-    const AsyncQuitHandler& operator=(const AsyncQuitHandler&) = delete;
-    static AsyncQuitHandler& instance()
-    {
-        static AsyncQuitHandler dInst;
-        return dInst;
-    }
-
-    static void QuitApplication()
-    {
-        uno::Reference< frame::XDesktop2 > xDeskTop = frame::Desktop::create( comphelper::getProcessComponentContext() );
-        xDeskTop->terminate();
-    }
-    DECL_STATIC_LINK( AsyncQuitHandler, OnAsyncQuit, void*, void );
-};
-
-IMPL_STATIC_LINK_NOARG( AsyncQuitHandler, OnAsyncQuit, void*, void )
-{
-    QuitApplication();
-}
-
 // A Basic module has set EXTSEARCH, so that the elements, that the module contains,
 // could be found from other module.
 
diff --git a/include/comphelper/asyncquithandler.hxx b/include/comphelper/asyncquithandler.hxx
new file mode 100644
index 000000000000..9c7a3c1a6289
--- /dev/null
+++ b/include/comphelper/asyncquithandler.hxx
@@ -0,0 +1,60 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ASYNCQUITHANDLER_HXX
+#define INCLUDED_COMPHELPER_ASYNCQUITHANDLER_HXX
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <tools/link.hxx>
+
+// Use: Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ) );
+
+class AsyncQuitHandler
+{
+    AsyncQuitHandler() {}
+
+public:
+    AsyncQuitHandler(const AsyncQuitHandler&) = delete;
+    const AsyncQuitHandler& operator=(const AsyncQuitHandler&) = delete;
+
+    static AsyncQuitHandler& instance()
+    {
+        static AsyncQuitHandler aInst;
+        return aInst;
+    }
+
+    static void QuitApplication()
+    {
+        css::uno::Reference<css::frame::XDesktop2> xDesktop
+            = css::frame::Desktop::create(comphelper::getProcessComponentContext());
+        xDesktop->terminate();
+    }
+
+    DECL_STATIC_LINK(AsyncQuitHandler, OnAsyncQuit, void*, void);
+};
+
+IMPL_STATIC_LINK_NOARG(AsyncQuitHandler, OnAsyncQuit, void*, void) { QuitApplication(); }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4979792e6cdef9e19848e5f676acb60c3d1926d2
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Feb 22 00:47:30 2018 +0200

    We might need to handle form controls as properties for OLE clients after all
    
    Start a bit of work on that.
    
    Change-Id: I7775f9598a81d64e9716996027b01f7f8e29745b
    Reviewed-on: https://gerrit.libreoffice.org/55043
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 2b6a84c8f699c9da115ce297ad19b8f480ab608f)

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 44ceeee791ef..fb4c8d780e14 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -47,10 +47,12 @@
 #include <com/sun/star/script/XInvocation2.hpp>
 #include <com/sun/star/script/MemberType.hpp>
 #include <com/sun/star/reflection/XIdlReflection.hpp>
+#include <ooo/vba/msforms/XCheckBox.hpp>
 #include <osl/interlck.h>
 #include <com/sun/star/uno/genfunc.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/profilezone.hxx>
+#include <comphelper/windowsdebugoutput.hxx>
 #include <o3tl/char16_t2wchar_t.hxx>
 
 #include "comifaces.hxx"
@@ -107,6 +109,8 @@ InterfaceOleWrapper::~InterfaceOleWrapper()
 
 STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, LPVOID FAR * ppv)
 {
+    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::QueryInterface " << riid);
+
     HRESULT ret= S_OK;
 
     if( !ppv)
@@ -179,12 +183,263 @@ STDMETHODIMP  InterfaceOleWrapper::getOriginalUnoStruct( Any * pStruct)
 
 STDMETHODIMP InterfaceOleWrapper::GetTypeInfoCount( unsigned int * /*pctinfo*/ )
 {
-    return E_NOTIMPL ;
+    SAL_WARN("extensions.olebridge", "InterfaceOleWrapper@" << this << "::GetTypeInfoCount: NOTIMPL");
+    return E_NOTIMPL;
 }
 
-STDMETHODIMP InterfaceOleWrapper::GetTypeInfo(unsigned int /*itinfo*/, LCID /*lcid*/, ITypeInfo ** /*pptinfo*/)
+class CXTypeInfo : public ITypeInfo,
+                   public CComObjectRoot
 {
-    return E_NOTIMPL;
+public:
+    BEGIN_COM_MAP(CXTypeInfo)
+        COM_INTERFACE_ENTRY(ITypeInfo)
+    END_COM_MAP()
+
+    DECLARE_NOT_AGGREGATABLE(CXTypeInfo)
+
+    void Init(InterfaceOleWrapper* pInterfaceOleWrapper)
+    {
+        SAL_INFO("extensions.olebridge", "CXTypeInfo::Init() this=" << this << " for " << pInterfaceOleWrapper->getImplementationName());
+        mpInterfaceOleWrapper = pInterfaceOleWrapper;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetTypeAttr(TYPEATTR **ppTypeAttr) override
+    {
+        (void) ppTypeAttr;
+        SAL_WARN("extensions.olebridge", "CXTypeInfo::GetTypeAttr: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetTypeComp(ITypeComp **ppTComp) override
+    {
+        (void) ppTComp;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetTypeComp: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetFuncDesc(UINT index,
+                                                  FUNCDESC **ppFuncDesc) override
+    {
+        (void) index;
+        (void) ppFuncDesc;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetFuncDesc: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetVarDesc(UINT index,
+                                                 VARDESC **ppVarDesc) override
+    {
+        (void) index;
+        (void) ppVarDesc;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetVarDesc: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetNames(MEMBERID memid,
+                                               BSTR *rgBstrNames,
+                                               UINT cMaxNames,
+                                               UINT *pcNames) override
+    {
+        (void) memid;
+        (void) rgBstrNames;
+        (void) cMaxNames;
+        (void) pcNames;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetNames: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetRefTypeOfImplType(UINT index,
+                                                           HREFTYPE *pRefType) override
+    {
+        (void) index;
+        (void) pRefType;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetRefTypeOfImplType: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetImplTypeFlags(UINT index,
+                                                       INT *pImplTypeFlags) override
+    {
+        (void) index;
+        (void) pImplTypeFlags;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetImplTypeFlags: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(LPOLESTR *rgszNames,
+                                                    UINT cNames,
+                                                    MEMBERID *pMemId) override
+    {
+        (void) rgszNames;
+        (void) cNames;
+        (void) pMemId;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetIDsOfNames: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE Invoke(PVOID pvInstance,
+                                             MEMBERID memid,
+                                             WORD wFlags,
+                                             DISPPARAMS *pDispParams,
+                                             VARIANT *pVarResult,
+                                             EXCEPINFO *pExcepInfo,
+                                             UINT *puArgErr) override
+    {
+        (void) pvInstance;
+        (void) memid;
+        (void) wFlags;
+        (void) pDispParams;
+        (void) pVarResult;
+        (void) pExcepInfo;
+        (void) puArgErr;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::Invoke: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetDocumentation(MEMBERID memid,
+                                                       BSTR *pBstrName,
+                                                       BSTR *pBstrDocString,
+                                                       DWORD *pdwHelpContext,
+                                                       BSTR *pBstrHelpFile) override
+    {
+        SAL_INFO("extensions.olebridge", "CxTypeInfo::GetDocumentation(" << memid << ")");
+        if (pBstrName)
+        {
+            if (memid == MEMBERID_NIL)
+            {
+                *pBstrName = SysAllocString(o3tl::toW(mpInterfaceOleWrapper->getImplementationName().getStr()));
+            }
+            else if (memid == DISPID_VALUE)
+            {
+                // MEMBERIDs are the same as DISPIDs, apparently?
+                *pBstrName = SysAllocString(L"Value");
+            }
+            else
+            {
+                *pBstrName = SysAllocString(L"Unknown");
+            }
+        }
+        if (pBstrDocString)
+            *pBstrDocString = SysAllocString(L"");;
+        if (pdwHelpContext)
+            *pdwHelpContext = 0;
+        if (pBstrHelpFile)
+            *pBstrHelpFile = NULL;
+
+        return S_OK;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetDllEntry(MEMBERID memid,
+                                                  INVOKEKIND invKind,
+                                                  BSTR *pBstrDllName,
+                                                  BSTR *pBstrName,
+                                                  WORD *pwOrdinal) override
+    {
+        (void) memid;
+        (void) invKind;
+        (void) pBstrDllName;
+        (void) pBstrName;
+        (void) pwOrdinal;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetDllEntry: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetRefTypeInfo(HREFTYPE hRefType,
+                                                     ITypeInfo **ppTInfo) override
+    {
+        (void) hRefType;
+        (void) ppTInfo;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetRefTypeInfo: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE AddressOfMember(MEMBERID memid,
+                                                      INVOKEKIND invKind,
+                                                      PVOID *ppv) override
+    {
+        (void) memid;
+        (void) invKind;
+        (void) ppv;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::AddressOfMember: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown *pUnkOuter,
+                                                     REFIID riid,
+                                                     PVOID *ppvObj) override
+    {
+        (void) pUnkOuter;
+        (void) riid;
+        (void) ppvObj;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::CreateInstance: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetMops(MEMBERID memid,
+                                              BSTR *pBstrMops) override
+    {
+        (void) memid;
+        (void) pBstrMops;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetMops: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE GetContainingTypeLib(ITypeLib **ppTLib,
+                                                           UINT *pIndex) override
+    {
+        (void) ppTLib;
+        (void) pIndex;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::GetContainingTypeLib: NOTIMPL");
+        return E_NOTIMPL;
+    }
+
+    virtual void STDMETHODCALLTYPE ReleaseTypeAttr(TYPEATTR *pTypeAttr) override
+    {
+        (void) pTypeAttr;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::ReleaseTypeAttr: NOTIMPL");
+    }
+
+    virtual void STDMETHODCALLTYPE ReleaseFuncDesc(FUNCDESC *pFuncDesc) override
+    {
+        (void) pFuncDesc;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::ReleaseFuncDesc: NOTIMPL");
+    }
+
+    virtual void STDMETHODCALLTYPE ReleaseVarDesc(VARDESC *pVarDesc) override
+    {
+        (void) pVarDesc;
+        SAL_WARN("extensions.olebridge", "CxTypeInfo::ReleaseVarDesc: NOTIMPL");
+    }
+
+private:
+    InterfaceOleWrapper* mpInterfaceOleWrapper;
+};
+
+STDMETHODIMP InterfaceOleWrapper::GetTypeInfo(unsigned int iTInfo, LCID, ITypeInfo ** ppTInfo)
+{
+    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::GetTypeInfo(" << iTInfo << ")");
+
+    if (!ppTInfo)
+        return E_POINTER;
+
+    if (iTInfo != 0)
+        return E_NOTIMPL;
+
+    HRESULT ret = S_OK;
+
+    CComObject<CXTypeInfo>* pTypeInfo;
+
+    ret = CComObject<CXTypeInfo>::CreateInstance(&pTypeInfo);
+    if (FAILED(ret))
+        return ret;
+
+    pTypeInfo->AddRef();
+
+    pTypeInfo->Init(this);
+
+    *ppTInfo = pTypeInfo;
+
+    return S_OK;
 }
 
 STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
@@ -193,6 +448,10 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
                                                 LCID /*lcid*/,
                                                 DISPID * rgdispid )
 {
+    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::GetIDsOfNames("
+             << OUString(o3tl::toU(rgszNames[0]))
+             << (cNames > 1 ? "...!" : "") << "," << cNames << ")");
+
     HRESULT ret = DISP_E_UNKNOWNNAME;
     try
     {
@@ -200,6 +459,8 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
         if( ! rgdispid)
             return E_POINTER;
 
+        // FIXME: Handle the cNames > 1 case
+
         if( ! _wcsicmp( *rgszNames, JSCRIPT_VALUE_FUNC) ||
             ! _wcsicmp( *rgszNames, BRIDGE_VALUE_FUNC))
         {
@@ -230,6 +491,8 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
                 if (m_xExactName.is())
                 {
                     exactName = m_xExactName->getExactName(name);
+                    if (exactName.isEmpty())
+                        exactName = name;
                 }
                 else
                 {
@@ -269,6 +532,7 @@ STDMETHODIMP InterfaceOleWrapper::GetIDsOfNames(REFIID /*riid*/,
             else
             {
                 *rgdispid = (*iter).second;
+                SAL_INFO("extensions.olebridge", "  " << name << ": " << *rgdispid);
                 ret = S_OK;
             }
         }
@@ -513,6 +777,13 @@ void SAL_CALL InterfaceOleWrapper::initialize( const Sequence< Any >& aArguments
         aArguments[0] >>= m_xInvocation;
         aArguments[1] >>= m_xOrigin;
         aArguments[2] >>= m_defaultValueType;
+
+        Reference<XServiceInfo> xServiceInfo(m_xOrigin, UNO_QUERY);
+        if (xServiceInfo.is())
+            m_sImplementationName = xServiceInfo->getImplementationName();
+
+        SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::initialize for "
+                 << (m_sImplementationName.isEmpty()?"an unknown implementation":m_sImplementationName));
         break;
     }
 
@@ -787,6 +1058,8 @@ STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMember,
                                          EXCEPINFO * pexcepinfo,
                                          unsigned int * puArgErr )
 {
+    SAL_INFO("extensions.olebridge", "InterfaceOleWrapper@" << this << "::Invoke(" << dispidMember << ")");
+
     comphelper::ProfileZone aZone("COM Bridge");
     HRESULT ret = S_OK;
 
@@ -1142,9 +1415,19 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short
 // DISPID_VALUE | The DEFAULT Value is required in JScript when the situation
 // is that we put an object into an Array object ( out parameter). We have to return
 // IDispatch otherwise the object cannot be accessed from the Script.
-        if( dispidMember == DISPID_VALUE && wFlags == DISPATCH_PROPERTYGET
+        if( dispidMember == DISPID_VALUE && (wFlags & DISPATCH_PROPERTYGET) != 0
             && m_defaultValueType != VT_EMPTY && pvarResult != nullptr)
         {
+            // Special case hack: If it is a ScVbaCheckBox, return the boolean value
+            Reference<ooo::vba::msforms::XCheckBox> xCheckBox(m_xOrigin, UNO_QUERY);
+            if (xCheckBox.is())
+            {
+                bHandled = true;
+                Any aValue = xCheckBox->getValue();
+                anyToVariant(pvarResult, aValue);
+                return S_OK;
+            }
+
             bHandled= true;
             if( m_defaultValueType == VT_DISPATCH)
             {
diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx
index 528d6a342a04..f77d2aba10d5 100644
--- a/extensions/source/ole/unoobjw.hxx
+++ b/extensions/source/ole/unoobjw.hxx
@@ -159,6 +159,10 @@ public:
     virtual Reference< XInterface > createUnoWrapperInstance() override;
     virtual Reference< XInterface > createComWrapperInstance() override;
 
+    const OUString& getImplementationName() const
+    {
+        return m_sImplementationName;
+    }
 
 protected:
     virtual HRESULT doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult,
@@ -194,6 +198,8 @@ protected:
     // see InterfaceOleWrapper::Invoke
     VARTYPE                         m_defaultValueType;
 
+    // The name of the implementation. Can be empty if unknown.
+    OUString                        m_sImplementationName;
 };
 
 /*****************************************************************************
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index 59082fe97f20..bf003165b2a9 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -475,8 +475,12 @@ sal_Bool Invocation_Impl::hasMethod( const OUString& Name )
 
 sal_Bool Invocation_Impl::hasProperty( const OUString& Name )
 {
-    if (!mbFromOLE && _xDirect.is())
-        return _xDirect->hasProperty( Name );
+    if (_xDirect.is())
+    {
+        bool bRet = _xDirect->hasProperty( Name );
+        if (bRet || !mbFromOLE)
+            return bRet;
+    }
     // PropertySet
     if( _xIntrospectionAccess.is()
         && _xIntrospectionAccess->hasProperty( Name, PropertyConcept::ALL ^ PropertyConcept::DANGEROUS ) )
@@ -490,8 +494,16 @@ sal_Bool Invocation_Impl::hasProperty( const OUString& Name )
 
 Any Invocation_Impl::getValue( const OUString& PropertyName )
 {
-    if (!mbFromOLE && _xDirect.is())
-        return _xDirect->getValue( PropertyName );
+    try
+    {
+        if (_xDirect.is())
+            return _xDirect->getValue( PropertyName );
+    }
+    catch (RuntimeException &)
+    {
+        if (!mbFromOLE)
+            throw;
+    }
     try
     {
         // PropertySet
commit 40e24d40fe0add043a851ee5ca454cadae6c52c0
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Feb 14 22:17:57 2018 +0200

    Hack to make properties work better from Automation clients
    
    There were a couple of problems apparent at this stage when using the
    ooovbaapi things from a test Automation client (written in VBScript,
    to be precise).
    
    Accessing for instance the ActiveDocument property of an
    ooo::vba::word::XGlobals instance worked fine. But properties of other
    objects, like instances of ooo::vba::word::XDocument, did not work.
    
    When attempting to access any property of an
    ooo::vba::word::XDocument, the code ended up calling the hasProperty()
    of SwVbaDocuemnt. That function is for checking a totally different
    kind of "properties", namely named form controls. Why form controls
    are con-fused with oovbaapi properties I don't know. Maybe it is
    intentional and as expected when using the oovbaapi from the built-in
    Basic interpreter in LibreOffice. Or then just an accident in history.
    Still, surely it can't be changed, that would break Basic scripts
    embedded in existing ODF documents.
    
    Anyway, from an OLE Automation client, for instance when asking for
    the Content property of an ooo::vba::word::XDocument object, we
    definitely don't want any form control that happens to have the name
    "Content". We want an object with two integer properties, Start and
    End.
    
    Make this work by always creating an invocation factory instead of
    using the object itself. Pass the invocation factory's
    createInstanceWithArguments() function an extra argument indicating
    this is the case of use from OLE Automation.
    
    In the Invocation_Impl class in the stoc module, when this extra
    argument is noticed, set a new mbFromOLE flag. Modify the behaviour
    slightly when that is true. I am not at all sure that this will work
    in all cases, but let's see, at least for simple tests so far it had
    the intended effect.
    
    Another issue was that looking up these properties was case sensitive.
    This is wrong at least from languages like VBScript. Use the mbFromOLE
    flag also to affect the case sensitivity behaviour.
    
    Maybe I should simply make sure that _xDirect is null in the
    Automation case? _Direct (a reference to an XInvocation) being
    non-null probably means that we are using the document interface's own
    implementation of XInvocation, which is probably always wrong in the
    OLE Automation case. (Just see the SwVbaDocument implementations of
    hasProperty() and invoke(), for instance.)
    
    Change-Id: I2fd174f69f430893aef538cc9bf2a99d1c86b567
    Reviewed-on: https://gerrit.libreoffice.org/55023
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 7873bba6c1e5de580ef28d0ecf68d154dd57e726)

diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index bfe363f7cd2a..771a15cc48b7 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -1388,20 +1388,18 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
         }
     }
     // If we have no UNO wrapper nor the IDispatch yet then we have to create
-    // a wrapper. For that we need an XInvocation from the UNO object.
+    // a wrapper. For that we need an XInvocation.
 
-    // get an XInvocation or create one using the invocation service
-    Reference<XInvocation> xInv(xInt, UNO_QUERY);
-    if ( ! xInv.is())
+    // create an XInvocation using the invocation service
+    Reference<XInvocation> xInv;
+    Reference<XSingleServiceFactory> xInvFactory= getInvocationFactory(rObj);
+    if (xInvFactory.is())
     {
-        Reference<XSingleServiceFactory> xInvFactory= getInvocationFactory(rObj);
-        if (xInvFactory.is())
-        {
-            Sequence<Any> params(1);
-            params.getArray()[0] = rObj;
-            Reference<XInterface> xInt2 = xInvFactory->createInstanceWithArguments(params);
-            xInv.set(xInt2, UNO_QUERY);
-        }
+        Sequence<Any> params(2);
+        params.getArray()[0] = rObj;
+        params.getArray()[1] = makeAny(OUString("FromOLE"));
+        Reference<XInterface> xInt2 = xInvFactory->createInstanceWithArguments(params);
+        xInv.set(xInt2, UNO_QUERY);
     }
 
     if (xInv.is())
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index 614b4b4b9cf6..59082fe97f20 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -98,7 +98,8 @@ class Invocation_Impl
 public:
     Invocation_Impl( const Any & rAdapted, const Reference<XTypeConverter> &,
                                            const Reference<XIntrospection> &,
-                                           const Reference<XIdlReflection> & );
+                                           const Reference<XIdlReflection> &,
+                                           bool bFromOLE );
 
     // XInterface
     virtual Any         SAL_CALL queryInterface( const Type & aType) override;
@@ -212,6 +213,8 @@ private:
 
 
     Reference<XExactName>               _xENDirect, _xENIntrospection;
+
+    bool                                mbFromOLE;
 };
 
 
@@ -220,11 +223,13 @@ Invocation_Impl::Invocation_Impl
     const Any & rAdapted,
     const Reference<XTypeConverter> & rTC,
     const Reference<XIntrospection> & rI,
-    const Reference<XIdlReflection> & rCR
+    const Reference<XIdlReflection> & rCR,
+    bool bFromOLE
 )
     : xTypeConverter( rTC )
     , xIntrospection( rI )
     , xCoreReflection( rCR )
+    , mbFromOLE( bFromOLE )
 {
     setMaterial( rAdapted );
 }
@@ -247,8 +252,9 @@ Any SAL_CALL Invocation_Impl::queryInterface( const Type & aType )
     if( aType  == cppu::UnoType<XExactName>::get())
     {
         // Invocation does not support XExactName, if direct object supports
-        // XInvocation, but not XExactName.
-        if ((_xDirect.is() && _xENDirect.is()) ||
+        // XInvocation, but not XExactName. Except when called from OLE Automation.
+        if (mbFromOLE ||
+            (_xDirect.is() && _xENDirect.is()) ||
             (!_xDirect.is() && _xENIntrospection.is()))
         {
             return makeAny( Reference< XExactName >( static_cast< XExactName* >(this) ) );
@@ -301,7 +307,8 @@ Any SAL_CALL Invocation_Impl::queryInterface( const Type & aType )
     {
         // Invocation does not support XInvocation2, if direct object supports
         // XInvocation, but not XInvocation2.
-        if ( ( _xDirect.is() && _xDirect2.is()) ||
+        if ( mbFromOLE ||
+             ( _xDirect.is() && _xDirect2.is()) ||
              (!_xDirect.is() && _xIntrospectionAccess.is() ) )
         {
             return makeAny( Reference< XInvocation2 >( static_cast< XInvocation2* >(this) ) );
@@ -344,7 +351,7 @@ void Invocation_Impl::setMaterial( const Any& rMaterial )
     // First do this outside the guard
     _xDirect.set( rMaterial, UNO_QUERY );
 
-    if( _xDirect.is() )
+    if( !mbFromOLE && _xDirect.is() )
     {
         // Consult object directly
         _xElementAccess.set( _xDirect, UNO_QUERY );
@@ -458,7 +465,7 @@ Reference<XIntrospectionAccess> Invocation_Impl::getIntrospection()
 
 sal_Bool Invocation_Impl::hasMethod( const OUString& Name )
 {
-    if (_xDirect.is())
+    if (!mbFromOLE && _xDirect.is())
         return _xDirect->hasMethod( Name );
     if( _xIntrospectionAccess.is() )
         return _xIntrospectionAccess->hasMethod( Name, MethodConcept::ALL ^ MethodConcept::DANGEROUS );
@@ -468,7 +475,7 @@ sal_Bool Invocation_Impl::hasMethod( const OUString& Name )
 
 sal_Bool Invocation_Impl::hasProperty( const OUString& Name )
 {
-    if (_xDirect.is())
+    if (!mbFromOLE && _xDirect.is())
         return _xDirect->hasProperty( Name );
     // PropertySet
     if( _xIntrospectionAccess.is()
@@ -483,7 +490,7 @@ sal_Bool Invocation_Impl::hasProperty( const OUString& Name )
 
 Any Invocation_Impl::getValue( const OUString& PropertyName )
 {
-    if (_xDirect.is())
+    if (!mbFromOLE && _xDirect.is())
         return _xDirect->getValue( PropertyName );
     try
     {
@@ -591,7 +598,7 @@ void Invocation_Impl::setValue( const OUString& PropertyName, const Any& Value )
 Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>& InParams,
                                 Sequence<sal_Int16>& OutIndices, Sequence<Any>& OutParams )
 {
-    if (_xDirect.is())
+    if (!mbFromOLE && _xDirect.is())
         return _xDirect->invoke( FunctionName, InParams, OutIndices, OutParams );
 
     if (_xIntrospectionAccess.is())
@@ -1100,17 +1107,26 @@ Reference<XInterface> InvocationService::createInstance()
 Reference<XInterface> InvocationService::createInstanceWithArguments(
     const Sequence<Any>& rArguments )
 {
+    if (rArguments.getLength() == 2)
+    {
+        OUString aArg1;
+        if ((rArguments[1] >>= aArg1) &&
+            aArg1 == "FromOLE")
+        {
+            return Reference< XInterface >
+                ( *new Invocation_Impl( *rArguments.getConstArray(),
+                                        xTypeConverter, xIntrospection, xCoreReflection, true ) );
+        }
+    }
     if (rArguments.getLength() == 1)
     {
         return Reference< XInterface >
             ( *new Invocation_Impl( *rArguments.getConstArray(),
-              xTypeConverter, xIntrospection, xCoreReflection ) );
-    }
-    else
-    {
-        //TODO:throw( Exception("no default construction of invocation adapter possible!", *this) );
-        return Reference<XInterface>();
+                                    xTypeConverter, xIntrospection, xCoreReflection, false ) );
     }
+
+    //TODO:throw( Exception("no default construction of invocation adapter possible!", *this) );
+    return Reference<XInterface>();
 }
 
 /// @throws RuntimeException
commit 46aba03f2982ad77fba5522b696ff3f5a6b45157
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 13 18:41:24 2018 +0200

    Provide also an ooo.vba.word.XApplication object
    
    Create the objects on offer to Automation clients lazily
    
    It would be silly to create the ooo.vba.word.XApplication in every
    LibreOffice instance, even if no Writer functionality was going to be
    used at all in that process.
    
    I did not have to do what the old FIXME said, "make Application a
    proper service", whatever that means.
    
    Change-Id: I02a0ceb6290012b4bb6afacadc03871feaf57406
    Reviewed-on: https://gerrit.libreoffice.org/55005
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 0667df70dc749ae50ce29713308f14d624f2a683)

diff --git a/extensions/Library_oleautobridge.mk b/extensions/Library_oleautobridge.mk
index 70b518c50d41..ec59f715c504 100644
--- a/extensions/Library_oleautobridge.mk
+++ b/extensions/Library_oleautobridge.mk
@@ -13,7 +13,11 @@ $(eval $(call gb_Library_Library,oleautobridge))
 
 $(eval $(call gb_Library_set_componentfile,oleautobridge,extensions/source/ole/oleautobridge))
 
-$(eval $(call gb_Library_use_sdk_api,oleautobridge))
+$(eval $(call gb_Library_use_api,oleautobridge,\
+    offapi \
+    oovbaapi \
+    udkapi \
+))
 
 $(eval $(call gb_Library_set_include,oleautobridge,\
 	$(foreach inc,$(ATL_INCLUDE),-I$(inc)) \
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 05d84e1ae118..15aa544441db 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -29,6 +29,7 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <o3tl/any.hxx>
 #include <o3tl/char16_t2wchar_t.hxx>
+#include <ooo/vba/XHelperInterface.hpp>
 
 using namespace cppu;
 using namespace osl;
@@ -43,10 +44,14 @@ using namespace com::sun::star::bridge::ModelDependent;
 // {82154420-0FBF-11d4-8313-005004526AB4}
 DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
 
+// FIXME: This GUID is just the above with the initial part bumped by one. Is that good enough?
+// {82154421-0FBF-11d4-8313-005004526AB4}
+DEFINE_GUID(OID_LibreOfficeWriterApplication, 0x82154421, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
+
 OneInstanceOleWrapper::OneInstanceOleWrapper(  const Reference<XMultiServiceFactory>& smgr,
-                                               const Reference<XInterface>& xInst )
+                                               std::function<const Reference<XInterface>()> xInstFunction )
     : m_refCount(0)
-    , m_xInst(xInst)
+    , m_xInstFunction(xInstFunction)
     , m_factoryHandle(0)
     , m_smgr(smgr)
 {
@@ -127,9 +132,10 @@ STDMETHODIMP OneInstanceOleWrapper::CreateInstance(IUnknown FAR* punkOuter,
     HRESULT ret = ResultFromScode(E_UNEXPECTED);
     punkOuter = nullptr;
 
-    if (m_xInst.is())
+    const Reference<XInterface>& xInst = m_xInstFunction();
+    if (xInst.is())
     {
-        Any usrAny(&m_xInst, cppu::UnoType<decltype(m_xInst)>::get());
+        Any usrAny(&xInst, cppu::UnoType<decltype(xInst)>::get());
         sal_uInt8 arId[16];
         rtl_getGlobalProcessId( arId);
         Any oleAny = m_bridgeSupplier->createBridge(usrAny,
@@ -456,7 +462,23 @@ OleServer::OleServer( const Reference<XMultiServiceFactory>& smgr):
         a >>= m_bridgeSupplier;
     }
 
-    (void) provideInstance( m_smgr, &OID_ServiceManager );
+    (void) provideInstance( [&]
+                            {
+                                return m_smgr;
+                            },
+                            &OID_ServiceManager );
+
+    (void) provideInstance( [&]
+                            {
+                                const Reference<XInterface> xWordGlobals = m_smgr->createInstance("ooo.vba.word.Globals");
+                                xWordGlobals->acquire();
+                                const Reference<ooo::vba::XHelperInterface> xHelperInterface(xWordGlobals, UNO_QUERY);
+                                Any aApplication = xHelperInterface->Application();
+                                Reference<XInterface> xApplication;
+                                aApplication >>= xApplication;
+                                return xApplication;
+                            },
+                            &OID_LibreOfficeWriterApplication );
 }
 
 OleServer::~OleServer()
@@ -486,9 +508,9 @@ css::uno::Sequence<OUString> OleServer::getSupportedServiceNames()
         "com.sun.star.bridge.oleautomation.ApplicationRegistration"};
 }
 
-bool OleServer::provideInstance(const Reference<XInterface>& xInst, GUID const * guid)
+bool OleServer::provideInstance(std::function<const Reference<XInterface>()> xInstFunction, GUID const * guid)
 {
-    OneInstanceOleWrapper* pWrapper = new OneInstanceOleWrapper( m_smgr, xInst );
+    OneInstanceOleWrapper* pWrapper = new OneInstanceOleWrapper( m_smgr, xInstFunction );
 
     pWrapper->AddRef();
     m_wrapperList.push_back(pWrapper);
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index a57ead04a51d..68af7ba6cce8 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_SERVPROV_HXX
 #define INCLUDED_EXTENSIONS_SOURCE_OLE_SERVPROV_HXX
 
+#include <functional>
+
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <cppuhelper/implbase.hxx>
@@ -56,7 +58,7 @@ class OneInstanceOleWrapper : public IClassFactory
 public:
 
     OneInstanceOleWrapper( const Reference<XMultiServiceFactory>& smgr,
-                           const Reference<XInterface>& xInst );
+                           std::function<const Reference<XInterface>()> xInstFunction );
     virtual ~OneInstanceOleWrapper();
 
     bool registerClass(GUID const * pGuid);
@@ -73,7 +75,7 @@ public:
 
 protected:
     oslInterlockedCount m_refCount;
-    Reference<XInterface>       m_xInst;
+    std::function<const Reference<XInterface>()> m_xInstFunction;
     DWORD               m_factoryHandle;
     Reference<XBridgeSupplier2> m_bridgeSupplier;
     Reference<XMultiServiceFactory> m_smgr;
@@ -173,7 +175,7 @@ public:
     css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
 
 protected:
-    bool provideInstance(const Reference<XInterface>& xInst, GUID const * guid);
+    bool provideInstance(std::function<const Reference<XInterface>()> xInstFunction, GUID const * guid);
 
     list< OneInstanceOleWrapper* > m_wrapperList;
     Reference< XBridgeSupplier2 >   m_bridgeSupplier;
commit ed6234c0ab6b04f95847f6ee40d77934b9b5f03f
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 13 18:37:28 2018 +0200

    Handle DISPID_NEWENUM
    
    We get that when an Automation client wants to enumerate an object
    that is a collection. We need to create an IEnumVARIANT object and
    return it (as an IUnknown).
    
    I wasted days on trying to implement this IEnumVARIANT object using
    the same twisty maze of helpers, wrappers, UNO conversion utilities,
    etc as used for the other stuff here. The other objects have both UNO
    and OLE personalities. Could not figure out how to do it.
    
    Then I decided to just do it brute force, following some sample code,
    not bothering with any UNO personality at all for the IEnumVARIANT
    thing, and it worked right away.
    
    Change-Id: I6a175ea80b75d48d2f0b793f143f3a84715522c1
    Reviewed-on: https://gerrit.libreoffice.org/54994
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 52eb78c8d2c9954733d95326922462a820d9f0dd)

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 9b9a86a83c52..44ceeee791ef 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -24,6 +24,10 @@
 #include <unordered_map>
 #include <vector>
 
+#include <atlbase.h>
+#include <atlcom.h>
+#include <comdef.h>
+
 #include <osl/diagnose.h>
 #include <salhelper/simplereferenceobject.hxx>
 #include <rtl/ustring.hxx>
@@ -36,6 +40,8 @@
 #include <com/sun/star/reflection/ParamInfo.hpp>
 #include <com/sun/star/beans/XExactName.hpp>
 #include <com/sun/star/container/NoSuchElementException.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
 
 #include <com/sun/star/beans/XMaterialHolder.hpp>
 #include <com/sun/star/script/XInvocation2.hpp>
@@ -1040,6 +1046,92 @@ HRESULT InterfaceOleWrapper::doSetProperty( DISPPARAMS * /*pdispparams*/, VARIAN
     return ret;
 }
 
+class CXEnumVariant : public IEnumVARIANT,
+                      public CComObjectRoot
+{
+public:
+    CXEnumVariant()
+    {
+    }
+
+    ~CXEnumVariant()
+    {
+    }
+
+    BEGIN_COM_MAP(CXEnumVariant)
+        COM_INTERFACE_ENTRY(IEnumVARIANT)
+    END_COM_MAP()
+
+    DECLARE_NOT_AGGREGATABLE(CXEnumVariant)
+
+    // Creates and intializes the enumerator
+    void Init(InterfaceOleWrapper* pInterfaceOleWrapper,
+              const Reference< XEnumeration > xEnumeration)
+    {
+        mpInterfaceOleWrapper = pInterfaceOleWrapper;
+        mxEnumeration = xEnumeration;
+    }
+
+    // IEnumVARIANT
+    virtual HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT **ppEnum) override
+    {
+        (void) ppEnum;
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt,
+                                           VARIANT *rgVar,
+                                           ULONG *pCeltFetched) override
+    {
+        if (pCeltFetched)
+            *pCeltFetched = 0;
+
+        if (celt == 0)
+            return E_INVALIDARG;
+
+        if (rgVar == NULL || (celt != 1 && pCeltFetched == NULL))
+            return E_FAIL;
+
+        for (ULONG i = 0; i < celt; i++)
+            VariantInit(&rgVar[i]);
+
+        while (celt > 0)
+        {
+           if (!mxEnumeration->hasMoreElements())
+                return S_FALSE;
+            Any aElement = mxEnumeration->nextElement();
+            mpInterfaceOleWrapper->anyToVariant(rgVar, aElement);
+            // rgVar->pdispVal->AddRef(); ??
+            if (pCeltFetched)
+                (*pCeltFetched)++;
+            rgVar++;
+            celt--;
+        }
+        return S_OK;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE Reset() override
+    {
+        return E_NOTIMPL;
+    }
+
+    virtual HRESULT STDMETHODCALLTYPE STDMETHODCALLTYPE Skip(ULONG celt) override
+    {
+        while (celt > 0)
+        {
+            if (!mxEnumeration->hasMoreElements())
+                return S_FALSE;
+            mxEnumeration->nextElement();
+            celt--;
+        }
+        return S_OK;
+    }
+
+private:
+    InterfaceOleWrapper* mpInterfaceOleWrapper;
+    Reference<XEnumeration> mxEnumeration;
+};
+
 HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short wFlags,
                          DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
                          unsigned int * /*puArgErr*/, bool& bHandled)
@@ -1136,6 +1228,38 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short
                 return DISP_E_EXCEPTION;
             }
         }
+        else if (dispidMember == DISPID_NEWENUM)
+        {
+            bHandled = true;
+            if( !pvarResult)
+                return E_POINTER;
+
+            Reference< XEnumerationAccess > xEnumerationAccess(m_xOrigin, UNO_QUERY_THROW);
+            if (!xEnumerationAccess.is())
+                return DISP_E_MEMBERNOTFOUND;
+
+            Reference< XEnumeration > xEnumeration = xEnumerationAccess->createEnumeration();
+
+            CComObject<CXEnumVariant>* pEnumVar;
+
+            ret = CComObject<CXEnumVariant>::CreateInstance(&pEnumVar);
+            if (FAILED(ret))
+                return ret;
+
+            pEnumVar->AddRef();
+
+            pEnumVar->Init(this, xEnumeration);
+
+            pvarResult->vt = VT_UNKNOWN;
+            pvarResult->punkVal = NULL;
+
+            ret = pEnumVar->QueryInterface(IID_IUnknown, (void**)&pvarResult->punkVal);
+            if (FAILED(ret))
+            {
+                pEnumVar->Release();
+                return ret;
+            }
+        }
     }
     catch(const BridgeRuntimeError & e)
     {
commit 28d5b049e74f29214e97444c5c0d6d160cfd6b22
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Mar 6 10:02:44 2018 +0200

    Bin some ASCII graphics
    
    Change-Id: I53ef86a997f4ae1c0ad84bb381327cba3143dd4c
    (cherry picked from commit 3ebaf1a9fb28be42358f5460e5ab7322d4f1dee8)

diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 2ed78493be97..61cb7d3d0e74 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -54,10 +54,8 @@ using namespace ::ooo::vba;
 
 #define OFFICEVERSION "11.0"
 
-// ====VbaTimerInfo==================================
 typedef ::std::pair< OUString, ::std::pair< double, double > > VbaTimerInfo;
 
-// ====VbaTimer==================================
 class VbaTimer
 {
     Timer m_aTimer;
@@ -135,7 +133,6 @@ IMPL_LINK_NOARG(VbaTimer, MacroCallHdl, Timer *, void)
     {}
 }
 
-// ====VbaTimerInfoHash==================================
 struct VbaTimerInfoHash
 {
     size_t operator()( const VbaTimerInfo& rTimerInfo ) const
@@ -146,10 +143,8 @@ struct VbaTimerInfoHash
     }
 };
 
-// ====VbaTimerHashMap==================================
 typedef std::unordered_map< VbaTimerInfo, VbaTimer*, VbaTimerInfoHash > VbaTimerHashMap;
 
-// ====VbaApplicationBase_Impl==================================
 struct VbaApplicationBase_Impl final
 {
     VbaTimerHashMap m_aTimerHash;
@@ -170,7 +165,6 @@ struct VbaApplicationBase_Impl final
     }
 };
 
-// ====VbaApplicationBase==================================
 VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentContext >& xContext )
                     : ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext )
                     , m_pImpl( new VbaApplicationBase_Impl )
commit 60e12085febb22973bb8f9d6d751f5d639f2ee49
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 13 18:28:42 2018 +0200

    Add one line of hopefully correctly understood explanation
    
    Change-Id: Ib22583a45c03a4b7c3b4ff73e9d28f47ab31bc4f
    (cherry picked from commit 9bbb71d4a003d00a3361f337b3f96d4a19a35562)

diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx
index d2fa9c4ac8cc..528d6a342a04 100644
--- a/extensions/source/ole/unoobjw.hxx
+++ b/extensions/source/ole/unoobjw.hxx
@@ -73,6 +73,9 @@ typedef std::unordered_map
     MemberInfo
 > IdToMemberInfoMap;
 
+// An InterfaceOleWrapper object can wrap either a UNO struct or a UNO
+// interface as a COM IDispatchEx and IUnoObjectWrapper.
+
 class InterfaceOleWrapper : public WeakImplHelper<XBridgeSupplier2, XInitialization>,
                             public IDispatchEx,
                             public UnoConversionUtilities<InterfaceOleWrapper>,
commit a4d10e4f90c4d1fe465bf068f1cf7738664f8687
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 13 00:53:48 2018 +0200

    Bin noise part of comment
    
    Our convention is to just have the name of the abstract base class in
    a comment before the declaration of the concrete overrides of its
    abstract member functions. No need to say "Abstract struct" there.
    
    Change-Id: I2b9bdf0555af5280771370a6df56fd4c8623661a
    (cherry picked from commit 8d6f684067092a32e45a75e9290d7d19a753f726)

diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index 9bd602cfe87e..a57ead04a51d 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -114,7 +114,7 @@ public:
 
     css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
 
-    // Abstract struct UnoConversionUtilities
+    // UnoConversionUtilities
     Reference< XInterface > createUnoWrapperInstance() override;
     Reference< XInterface > createComWrapperInstance() override;
 protected:
@@ -141,7 +141,7 @@ public:
 
     css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
 
-    // Abstract struct UnoConversionUtilities
+    // UnoConversionUtilities
     Reference< XInterface > createUnoWrapperInstance() override;
     Reference< XInterface > createComWrapperInstance() override;
 
commit 529beac4690768a3810d7ff3afae884905495d24
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 13 00:34:30 2018 +0200

    IClassFactoryWrapper can go away now
    
    Change-Id: I7633648dc0398d2c1b6f04e6db9b18638a7451f5
    Reviewed-on: https://gerrit.libreoffice.org/54781
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index dbe046239263..05d84e1ae118 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -488,12 +488,12 @@ css::uno::Sequence<OUString> OleServer::getSupportedServiceNames()
 
 bool OleServer::provideInstance(const Reference<XInterface>& xInst, GUID const * guid)
 {
-    IClassFactoryWrapper* pFac = new OneInstanceOleWrapper( m_smgr, xInst );
+    OneInstanceOleWrapper* pWrapper = new OneInstanceOleWrapper( m_smgr, xInst );
 
-    pFac->AddRef();
-    m_wrapperList.push_back(pFac);
+    pWrapper->AddRef();
+    m_wrapperList.push_back(pWrapper);
 
-    return pFac->registerClass(guid);
+    return pWrapper->registerClass(guid);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index a1127f3adb2c..9bd602cfe87e 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -39,41 +39,19 @@ Reference< XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1(   const Re
 Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr);
 /// @throws Exception
 Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr);
-/*****************************************************************************
-
-    IClassFactoryWrapper
-
-    Specify abstract helper methods on class factories, which provide
-    UNO objects. These methods are used by objects of class OleServer,
-    to handle the OLE registration of different class factories.
-
-*****************************************************************************/
-
-class IClassFactoryWrapper : public IClassFactory
-{
-public:
-
-    virtual bool registerClass(GUID const * pGuid) = 0;
-    virtual bool deregisterClass() = 0;
-
-protected:
-    ~IClassFactoryWrapper() {}
-};
 
 /*****************************************************************************
 
     OneInstanceOleWrapper
 
-    Provides an single UNO object as OLE object. Handle the
-    OLE registration by overriding the abstract methods from
-    IClassFactoryWrapper.
+    Provides an single UNO object as OLE object.
 
-      Acts as a COM class factory. When IClassFactory::CreateInstance is being called
+    Acts as a COM class factory. When IClassFactory::CreateInstance is being called
     then it maps the XInstance member it to a COM object.
 
 *****************************************************************************/
 
-class OneInstanceOleWrapper : public IClassFactoryWrapper
+class OneInstanceOleWrapper : public IClassFactory
 {
 public:
 
@@ -81,8 +59,8 @@ public:
                            const Reference<XInterface>& xInst );
     virtual ~OneInstanceOleWrapper();
 
-    bool registerClass(GUID const * pGuid) override;
-    bool deregisterClass() override;
+    bool registerClass(GUID const * pGuid);
+    bool deregisterClass();
 
     /* IUnknown methods */
     STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
@@ -94,7 +72,6 @@ public:
     STDMETHOD(LockServer)(int fLock) override;
 
 protected:
-
     oslInterlockedCount m_refCount;
     Reference<XInterface>       m_xInst;
     DWORD               m_factoryHandle;
@@ -198,7 +175,7 @@ public:
 protected:
     bool provideInstance(const Reference<XInterface>& xInst, GUID const * guid);
 
-    list< IClassFactoryWrapper* > m_wrapperList;
+    list< OneInstanceOleWrapper* > m_wrapperList;
     Reference< XBridgeSupplier2 >   m_bridgeSupplier;
 
     Reference<XMultiServiceFactory> m_smgr;
commit 8e063cc9a5678702143b4668e2d4b170c25d2728
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 13 00:23:50 2018 +0200

    Bin dead code
    
    OleServer::provideService() was not called anywhere. That means the
    ProviderOleWrapper class is unused, too. Which is good, as it seemed
    to largely be identical to OneInstanceOleWrapper anyway.
    
    Change-Id: If8782d56ed1ec1bb173cfc18be585be4c331f335
    Reviewed-on: https://gerrit.libreoffice.org/54647
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 0f2157cb1513371829d7f8c415324cffed28c377)

diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index a6bb4ef58d80..dbe046239263 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -43,132 +43,6 @@ using namespace com::sun::star::bridge::ModelDependent;
 // {82154420-0FBF-11d4-8313-005004526AB4}
 DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
 
-ProviderOleWrapper::ProviderOleWrapper(const Reference<XMultiServiceFactory>& smgr,
-                                       const Reference<XSingleServiceFactory>& xSFact)
-    : m_xSingleServiceFactory(xSFact),
-      m_smgr( smgr)
-{
-    Reference<XInterface> xInt = smgr->createInstance("com.sun.star.bridge.oleautomation.BridgeSupplier");
-
-    if (xInt.is())
-    {
-        Any a= xInt->queryInterface( cppu::UnoType<XBridgeSupplier2>::get() );
-        a >>= m_bridgeSupplier;
-
-    }
-}
-
-ProviderOleWrapper::~ProviderOleWrapper()
-{
-}
-
-bool ProviderOleWrapper::registerClass(GUID const * pGuid)
-{
-    HRESULT hresult;
-
-    o2u_attachCurrentThread();
-
-    hresult = CoRegisterClassObject(
-            *pGuid,
-            this,
-            CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
-            REGCLS_MULTIPLEUSE,
-            &m_factoryHandle);
-
-    return (hresult == NOERROR);
-}
-
-bool ProviderOleWrapper::deregisterClass()
-{
-    HRESULT hresult = CoRevokeClassObject(m_factoryHandle);
-
-    return (hresult == NOERROR);
-}
-
-STDMETHODIMP ProviderOleWrapper::QueryInterface(REFIID riid, void FAR* FAR* ppv)
-{
-    if(IsEqualIID(riid, IID_IUnknown))
-    {
-        AddRef();
-        *ppv = static_cast<IUnknown*>(static_cast<IClassFactory*>(this));
-        return NOERROR;
-    }
-    else if (IsEqualIID(riid, IID_IClassFactory))
-    {
-        AddRef();
-        *ppv = static_cast<IClassFactory*>(this);
-        return NOERROR;
-    }
-
-    *ppv = nullptr;
-    return ResultFromScode(E_NOINTERFACE);
-}
-
-STDMETHODIMP_(ULONG) ProviderOleWrapper::AddRef()
-{
-    return osl_atomic_increment( &m_refCount);
-}
-
-STDMETHODIMP_(ULONG) ProviderOleWrapper::Release()
-{
-    MutexGuard aGuard( Mutex::getGlobalMutex());
-    ULONG refCount = --m_refCount;
-    if (m_refCount == 0)
-    {
-        delete this;
-    }
-
-    return refCount;
-}
-
-STDMETHODIMP ProviderOleWrapper::CreateInstance(IUnknown FAR* punkOuter,
-                                                REFIID riid,
-                                                void FAR* FAR* ppv)
-{
-    HRESULT ret = ResultFromScode(E_UNEXPECTED);
-    punkOuter = nullptr;
-
-    Reference<XInterface> xInstance;
-
-    if (m_xSingleServiceFactory.is())
-    {
-        xInstance = m_xSingleServiceFactory->createInstance();
-
-        if (xInstance.is())
-        {
-            Any usrAny(&xInstance, cppu::UnoType<decltype(xInstance)>::get());
-
-            sal_uInt8 arId[16];
-            rtl_getGlobalProcessId( arId );
-            Any oleAny = m_bridgeSupplier->createBridge(usrAny,
-                                        Sequence<sal_Int8>(reinterpret_cast<sal_Int8*>(arId), 16),
-                                        UNO,
-                                        OLE);
-
-
-            if (auto v = o3tl::tryAccess<sal_uIntPtr>(oleAny))
-            {
-                VARIANT* pVariant = reinterpret_cast<VARIANT*>(*v);
-
-                if (pVariant->vt == VT_DISPATCH)
-                {
-                    ret = pVariant->pdispVal->QueryInterface(riid, ppv);
-                }
-
-                VariantClear(pVariant);
-                CoTaskMemFree(pVariant);
-            }
-        }
-    }
-
-    return ret;
-}
-
-STDMETHODIMP ProviderOleWrapper::LockServer(int /*fLock*/)
-{
-    return NOERROR;
-}
-
 OneInstanceOleWrapper::OneInstanceOleWrapper(  const Reference<XMultiServiceFactory>& smgr,
                                                const Reference<XInterface>& xInst )
     : m_refCount(0)
@@ -612,16 +486,6 @@ css::uno::Sequence<OUString> OleServer::getSupportedServiceNames()
         "com.sun.star.bridge.oleautomation.ApplicationRegistration"};
 }
 
-bool OleServer::provideService(const Reference<XSingleServiceFactory>& xSFact, GUID const * guid)
-{
-    IClassFactoryWrapper* pFac = new ProviderOleWrapper( m_smgr, xSFact );
-
-    pFac->AddRef();
-    m_wrapperList.push_back(pFac);
-
-    return pFac->registerClass(guid);
-}
-
 bool OleServer::provideInstance(const Reference<XInterface>& xInst, GUID const * guid)
 {
     IClassFactoryWrapper* pFac = new OneInstanceOleWrapper( m_smgr, xInst );
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index b870228e542f..a1127f3adb2c 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -62,49 +62,6 @@ protected:
 
 /*****************************************************************************
 
-    ProviderOleWrapper
-
-    Provides an UNO service provider as OLE class factory. Handle the
-    OLE registration by overriding the abstract methods from
-    IClassFactoryWrapper.
-
-    Acts as a COM class factory. When IClassFactory::CreateInstance is being called
-    then it creates an service by help of the XSingleServiceFactory member and maps
-    maps it to a COM object.
-
-*****************************************************************************/
-
-class ProviderOleWrapper : public IClassFactoryWrapper
-{
-public:
-
-    ProviderOleWrapper( const Reference<XMultiServiceFactory>& smgr,
-                        const Reference<XSingleServiceFactory>& xSFactory);
-    virtual ~ProviderOleWrapper();
-
-    bool registerClass(GUID const * pGuid) override;
-    bool deregisterClass() override;
-
-    /* IUnknown methods */
-    STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
-    STDMETHOD_(ULONG, AddRef)() override;
-    STDMETHOD_(ULONG, Release)() override;
-
-    /* IClassFactory methods */
-    STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv) override;
-    STDMETHOD(LockServer)(int fLock) override;
-
-protected:
-
-    oslInterlockedCount m_refCount;
-    Reference<XSingleServiceFactory> m_xSingleServiceFactory;
-    DWORD               m_factoryHandle;
-    Reference<XBridgeSupplier2> m_bridgeSupplier;
-    Reference<XMultiServiceFactory> m_smgr;
-};
-
-/*****************************************************************************
-
     OneInstanceOleWrapper
 
     Provides an single UNO object as OLE object. Handle the
@@ -239,8 +196,6 @@ public:
     css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
 
 protected:
-
-    bool provideService(const Reference<XSingleServiceFactory>& xMulFact, GUID const * guid);
     bool provideInstance(const Reference<XInterface>& xInst, GUID const * guid);
 
     list< IClassFactoryWrapper* > m_wrapperList;
commit 116e8acdab560def3ce705402a4942ebac82abbb
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 13 00:08:41 2018 +0200

    In fact it's simpler to not have m_guid fields in these two classes at all
    
    We can just pass the GUID as parameter to the single member function
    registerClass() that needs it. This perhaps means the same class can
    be used in more cases, also for objects/classes that aren't going to
    be registered and don't need any GUID.
    
    Change-Id: I28703190c52b14236c6f613dd4acbe359c075f5c
    Reviewed-on: https://gerrit.libreoffice.org/54622
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 17ad73232ff604329e6532817570cb40342857e8)

diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 0d1e98cd34c5..a6bb4ef58d80 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -44,9 +44,8 @@ using namespace com::sun::star::bridge::ModelDependent;
 DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
 
 ProviderOleWrapper::ProviderOleWrapper(const Reference<XMultiServiceFactory>& smgr,
-                                       const Reference<XSingleServiceFactory>& xSFact, GUID const * pGuid)
+                                       const Reference<XSingleServiceFactory>& xSFact)
     : m_xSingleServiceFactory(xSFact),
-      m_guid(*pGuid),
       m_smgr( smgr)
 {
     Reference<XInterface> xInt = smgr->createInstance("com.sun.star.bridge.oleautomation.BridgeSupplier");
@@ -63,14 +62,14 @@ ProviderOleWrapper::~ProviderOleWrapper()
 {
 }
 
-bool ProviderOleWrapper::registerClass()
+bool ProviderOleWrapper::registerClass(GUID const * pGuid)
 {
     HRESULT hresult;
 
     o2u_attachCurrentThread();
 
     hresult = CoRegisterClassObject(
-            m_guid,
+            *pGuid,
             this,
             CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
             REGCLS_MULTIPLEUSE,
@@ -171,11 +170,9 @@ STDMETHODIMP ProviderOleWrapper::LockServer(int /*fLock*/)
 }
 
 OneInstanceOleWrapper::OneInstanceOleWrapper(  const Reference<XMultiServiceFactory>& smgr,
-                                               const Reference<XInterface>& xInst,
-                                               GUID const * pGuid )
+                                               const Reference<XInterface>& xInst )
     : m_refCount(0)
     , m_xInst(xInst)
-    , m_guid(*pGuid)
     , m_factoryHandle(0)
     , m_smgr(smgr)
 {
@@ -192,14 +189,14 @@ OneInstanceOleWrapper::~OneInstanceOleWrapper()
 {
 }
 
-bool OneInstanceOleWrapper::registerClass()
+bool OneInstanceOleWrapper::registerClass(GUID const * pGuid)
 {
     HRESULT hresult;
 
     o2u_attachCurrentThread();
 
     hresult = CoRegisterClassObject(
-            m_guid,
+            *pGuid,
             this,
             CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
             REGCLS_MULTIPLEUSE,
@@ -617,24 +614,22 @@ css::uno::Sequence<OUString> OleServer::getSupportedServiceNames()
 
 bool OleServer::provideService(const Reference<XSingleServiceFactory>& xSFact, GUID const * guid)
 {
-    IClassFactoryWrapper* pFac = new ProviderOleWrapper( m_smgr, xSFact, guid);
+    IClassFactoryWrapper* pFac = new ProviderOleWrapper( m_smgr, xSFact );
 
     pFac->AddRef();
-
     m_wrapperList.push_back(pFac);
 
-    return pFac->registerClass();
+    return pFac->registerClass(guid);
 }
 
 bool OleServer::provideInstance(const Reference<XInterface>& xInst, GUID const * guid)
 {
-    IClassFactoryWrapper* pFac =
-        new OneInstanceOleWrapper( m_smgr, xInst, guid );
+    IClassFactoryWrapper* pFac = new OneInstanceOleWrapper( m_smgr, xInst );
 
     pFac->AddRef();
     m_wrapperList.push_back(pFac);
 
-    return pFac->registerClass();
+    return pFac->registerClass(guid);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index 12360ba9dbae..b870228e542f 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -53,7 +53,7 @@ class IClassFactoryWrapper : public IClassFactory
 {
 public:
 
-    virtual bool registerClass() = 0;
+    virtual bool registerClass(GUID const * pGuid) = 0;
     virtual bool deregisterClass() = 0;
 
 protected:
@@ -79,10 +79,10 @@ class ProviderOleWrapper : public IClassFactoryWrapper
 public:
 
     ProviderOleWrapper( const Reference<XMultiServiceFactory>& smgr,
-                        const Reference<XSingleServiceFactory>& xSFactory, GUID const * pGuid);
+                        const Reference<XSingleServiceFactory>& xSFactory);
     virtual ~ProviderOleWrapper();
 
-    bool registerClass() override;
+    bool registerClass(GUID const * pGuid) override;
     bool deregisterClass() override;
 
     /* IUnknown methods */
@@ -98,7 +98,6 @@ protected:
 
     oslInterlockedCount m_refCount;
     Reference<XSingleServiceFactory> m_xSingleServiceFactory;
-    const GUID          m_guid;
     DWORD               m_factoryHandle;
     Reference<XBridgeSupplier2> m_bridgeSupplier;
     Reference<XMultiServiceFactory> m_smgr;
@@ -121,10 +120,11 @@ class OneInstanceOleWrapper : public IClassFactoryWrapper
 {
 public:
 
-    OneInstanceOleWrapper( const Reference<XMultiServiceFactory>& smgr, const Reference<XInterface>& xInst, GUID const * pGuid );
+    OneInstanceOleWrapper( const Reference<XMultiServiceFactory>& smgr,
+                           const Reference<XInterface>& xInst );
     virtual ~OneInstanceOleWrapper();
 
-    bool registerClass() override;
+    bool registerClass(GUID const * pGuid) override;
     bool deregisterClass() override;
 
     /* IUnknown methods */
@@ -140,7 +140,6 @@ protected:
 
     oslInterlockedCount m_refCount;
     Reference<XInterface>       m_xInst;
-    const GUID          m_guid;
     DWORD               m_factoryHandle;
     Reference<XBridgeSupplier2> m_bridgeSupplier;
     Reference<XMultiServiceFactory> m_smgr;
commit 435da4c292abe84e1809ca62fd3a35e57f862fc0
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 6 15:32:31 2018 +0200

    These fields can be const
    
    Change-Id: I379770f93799668e44beab03fb64ceddffabe85a
    Reviewed-on: https://gerrit.libreoffice.org/49326
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 72fefd7ab6fd551effcf821e4e257df2756bece1)

diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 31e03283acd6..0d1e98cd34c5 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -46,10 +46,9 @@ DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50
 ProviderOleWrapper::ProviderOleWrapper(const Reference<XMultiServiceFactory>& smgr,
                                        const Reference<XSingleServiceFactory>& xSFact, GUID const * pGuid)
     : m_xSingleServiceFactory(xSFact),
+      m_guid(*pGuid),
       m_smgr( smgr)
 {
-    m_guid = *pGuid;
-
     Reference<XInterface> xInt = smgr->createInstance("com.sun.star.bridge.oleautomation.BridgeSupplier");
 
     if (xInt.is())
@@ -176,11 +175,10 @@ OneInstanceOleWrapper::OneInstanceOleWrapper(  const Reference<XMultiServiceFact
                                                GUID const * pGuid )
     : m_refCount(0)
     , m_xInst(xInst)
+    , m_guid(*pGuid)
     , m_factoryHandle(0)
     , m_smgr(smgr)
 {
-    m_guid = *pGuid;
-
     Reference<XInterface> xInt = m_smgr->createInstance("com.sun.star.bridge.oleautomation.BridgeSupplier");
 
     if (xInt.is())
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index 13c4e370fd10..12360ba9dbae 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -98,7 +98,7 @@ protected:
 
     oslInterlockedCount m_refCount;
     Reference<XSingleServiceFactory> m_xSingleServiceFactory;
-    GUID                m_guid;
+    const GUID          m_guid;
     DWORD               m_factoryHandle;
     Reference<XBridgeSupplier2> m_bridgeSupplier;
     Reference<XMultiServiceFactory> m_smgr;
@@ -140,7 +140,7 @@ protected:
 
     oslInterlockedCount m_refCount;
     Reference<XInterface>       m_xInst;
-    GUID                m_guid;
+    const GUID          m_guid;
     DWORD               m_factoryHandle;
     Reference<XBridgeSupplier2> m_bridgeSupplier;
     Reference<XMultiServiceFactory> m_smgr;
commit 91da710c77d90102d71e0550688e314111f99681
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Feb 12 18:56:10 2018 +0200

    There is nothing called o2u_anyToVariant
    
    Change-Id: I7118843fde87a2d587f0e4ec99d146c379da618e
    (cherry picked from commit 79a6290969d5c1feab56158b6cf0dd0a4b52d53e)

diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index ba932700e10a..bfe363f7cd2a 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -187,7 +187,7 @@ protected:
     Reference<XTypeConverter> getTypeConverter();
 
     // This member determines what class is used to convert a UNO object
-    // or struct to a COM object. It is passed along to the o2u_anyToVariant
+    // or struct to a COM object. It is passed along to the anyToVariant
     // function in the createBridge function implementation
     const sal_uInt8 m_nUnoWrapperClass;
     const sal_uInt8 m_nComWrapperClass;
commit 3a79c6c006fa836f6c748ac4a3acc4aa64122402
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Feb 12 18:55:05 2018 +0200

    These fields can be const
    
    Change-Id: I103f06b9c7f14ac7eff9911ab5bebc4c98e7d41f
    Reviewed-on: https://gerrit.libreoffice.org/54614
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 7c7b3c70e1def37ee707827e75d0afa00b0b3619)

diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index cbc43fc497df..ba932700e10a 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -189,8 +189,8 @@ protected:
     // This member determines what class is used to convert a UNO object
     // or struct to a COM object. It is passed along to the o2u_anyToVariant
     // function in the createBridge function implementation
-    sal_uInt8 m_nUnoWrapperClass;
-    sal_uInt8 m_nComWrapperClass;
+    const sal_uInt8 m_nUnoWrapperClass;
+    const sal_uInt8 m_nComWrapperClass;
 
     // The servicemanager is either a local smgr or remote when the service
     // com.sun.star.bridge.OleBridgeSupplierVar1 is used. This service can be
commit e3e1938466697298c90541a63bd87ebd4cf98996
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Feb 12 17:27:06 2018 +0200

    No need for this #pragma once
    
    Change-Id: I219226060ebf4b8b86c8f0487fc679f22f73812a
    Reviewed-on: https://gerrit.libreoffice.org/54468
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 7a2b7693452dec3d30778301ae3a294bfaed344b)

diff --git a/extensions/source/ole/ole2uno.hxx b/extensions/source/ole/ole2uno.hxx
index e4d83c48b73b..99a3e7ae17e4 100644
--- a/extensions/source/ole/ole2uno.hxx
+++ b/extensions/source/ole/ole2uno.hxx
@@ -20,11 +20,6 @@
 #ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_OLE2UNO_HXX
 #define INCLUDED_EXTENSIONS_SOURCE_OLE_OLE2UNO_HXX
 
-
-#ifdef _MSC_VER
-#pragma once
-#endif
-
 #include "wincrap.hxx"
 
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
commit 6b77ef839737b5cc22965b82cfae0390e89f74f3
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Feb 12 17:27:48 2018 +0200

    We only support MSVC anyway for our Windows-specific code
    
    Change-Id: I68dfd0832747c7c319e40ee28a4461623e95102f
    Reviewed-on: https://gerrit.libreoffice.org/54482
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 69322f8b539cd9f98e0ee5f9afc7c3df0d897493)

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index dfd81970db59..9b9a86a83c52 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -65,10 +65,6 @@ using namespace com::sun::star::lang;
 using namespace com::sun::star::bridge::ModelDependent;
 using namespace com::sun::star::reflection;
 
-#ifndef _MSC_VER
-extern "C" const GUID IID_IDispatchEx;
-#endif
-
 std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > UnoObjToWrapperMap;
 static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource);
 static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource);
commit bca5abfdd56cecfaf500d4f8fa0a2b015f034e06
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed May 16 18:08:59 2018 +0300

    Don't ever attempt to initialise a std::locale with a UTF-8 locale on Windows
    
    As I said in 2ff121f298e64ff204621220622472fe697d599d, passing a
    POSIX-style locale name to the std::locale constructor on Windows is
    decidedly odd, and apparently boost adds insult to injury by even
    really attempting to use a UTF-8 one if that is what our code thinks
    it wants. Or something.
    
    This commit avoids the ton of
    "warn:unotools.i18n:7996:3544:unotools/source/i18n/resmgr.cxx:123: CRT
    Report Hook: ASSERT: f:\dd\vctools\crt\crtw32\stdcpp\xmbtowc.c(89) :
    Assertion failed: ploc->_Mbcurmax == 1 || ploc->_Mbcurmax == 2" we
    otherwise get when built with --enable-dbgutil and a current VS2015
    (or 2017?).
    
    Change-Id: I3a774dff7b12d9960f553c9f242e0463c6d13d5d
    Reviewed-on: https://gerrit.libreoffice.org/54444
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index 4156bf7c3261..b4211bb2fe73 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -37,6 +37,8 @@ boost_patches += clang-cl.patch.0
 boost_patches += boost_1_60_0.undef.warning.patch
 boost_patches += boost_1_63_0.undef.warning.patch.1
 
+boost_patches += windows-no-utf8-locales.patch.0
+
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,boost))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,boost,$(BOOST_TARBALL)))
diff --git a/external/boost/windows-no-utf8-locales.patch.0 b/external/boost/windows-no-utf8-locales.patch.0
new file mode 100644
index 000000000000..66038cad70fb
--- /dev/null
+++ b/external/boost/windows-no-utf8-locales.patch.0
@@ -0,0 +1,20 @@
+Don't ever attempt to initialise a std::locale with a UTF-8 locale on Windows -*- Mode: Diff -*-
+
+--- libs/locale/src/std/std_backend.cpp
++++ libs/locale/src/std/std_backend.cpp
+@@ -109,12 +109,13 @@
+                 #endif
+             }
+             else {
++                #if !defined(BOOST_WINDOWS)
+                 if(loadable(lid)) {
+                     name_ = lid;
+                     utf_mode_ = utf8_native_with_wide;
+                 }
+-                #if defined(BOOST_WINDOWS)
+-                else if(loadable(win_name)) {
++                #else
++                if(loadable(win_name)) {
+                     name_ = win_name;
+                     utf_mode_ = utf8_from_wide;
+                 }
commit 0f106de7dceaa8e48a53b014dbd58e15837e577d
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Feb 12 16:13:10 2018 +0200

    Drop _Impl class name suffix where pointless
    
    I.e. where there is no other LibreOffice, or system, or 3rd-party
    library thing with just the un-suffixed name that they would be a
    pimpl of, etc. Why bother calling something InterfaceOleWrapper_Impl
    when there is nothing that would be called InterfaceOleWrapper? It
    just makes the code seem more complicated and harder to read.
    
    An "implementation" of something is what everything that is not fully
    abstract *is*. We don't suffix the name of every non-abstract class
    with _Impl elsewhere either.
    
    Also drop two unused structs.
    
    Change-Id: I2755e6da78d8e4ded5291688dc90510b5f8b498b
    Reviewed-on: https://gerrit.libreoffice.org/54411
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit a48f22db7dd1bfeff62007a655566ddaad79aebd)

diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 13ae64cde6c8..fb965e7b478e 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -77,16 +77,16 @@ std::unordered_map<sal_uIntPtr,sal_uIntPtr> WrapperToAdapterMap;
 
 std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > ComPtrToWrapperMap;
 
-IUnknownWrapper_Impl::IUnknownWrapper_Impl( Reference<XMultiServiceFactory> const & xFactory,
-                                           sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
-    UnoConversionUtilities<IUnknownWrapper_Impl>( xFactory, unoWrapperClass, comWrapperClass),
+IUnknownWrapper::IUnknownWrapper( Reference<XMultiServiceFactory> const & xFactory,
+                                  sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
+    UnoConversionUtilities<IUnknownWrapper>( xFactory, unoWrapperClass, comWrapperClass),
     m_pxIdlClass( nullptr), m_eJScript( JScriptUndefined),
     m_bComTlbIndexInit(false),  m_bHasDfltMethod(false), m_bHasDfltProperty(false)
 {
 }
 
 
-IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
+IUnknownWrapper::~IUnknownWrapper()
 {
     o2u_attachCurrentThread();
     MutexGuard guard(getBridgeMutex());
@@ -112,7 +112,7 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
         ComPtrToWrapperMap.erase(it_c);
 }
 
-Any IUnknownWrapper_Impl::queryInterface(const Type& t)
+Any IUnknownWrapper::queryInterface(const Type& t)
 {
     if (t == cppu::UnoType<XDefaultMethod>::get() && !m_bHasDfltMethod )
         return Any();
@@ -130,14 +130,14 @@ Any IUnknownWrapper_Impl::queryInterface(const Type& t)
         XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation, XAutomationInvocation >::queryInterface(t);
 }
 
-Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection()
+Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper::getIntrospection()
 {
     Reference<XIntrospectionAccess> ret;
 
     return ret;
 }
 
-Any SAL_CALL IUnknownWrapper_Impl::invokeGetProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
+Any SAL_CALL IUnknownWrapper::invokeGetProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
 {
     Any aResult;
     try
@@ -159,13 +159,13 @@ Any SAL_CALL IUnknownWrapper_Impl::invokeGetProperty( const OUString& aPropertyN
     catch ( const Exception& e )
     {
        throw RuntimeException("[automation bridge] unexpected exception in "
-               "IUnknownWrapper_Impl::invokeGetProperty ! Message : \n" +
+               "IUnknownWrapper::invokeGetProperty ! Message : \n" +
                 e.Message);
     }
     return aResult;
 }
 
-Any SAL_CALL IUnknownWrapper_Impl::invokePutProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
+Any SAL_CALL IUnknownWrapper::invokePutProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
 {
     Any aResult;
     try
@@ -187,14 +187,14 @@ Any SAL_CALL IUnknownWrapper_Impl::invokePutProperty( const OUString& aPropertyN
     catch ( const Exception& e )
     {
        throw RuntimeException("[automation bridge] unexpected exception in "
-               "IUnknownWrapper_Impl::invokePutProperty ! Message : \n" +
+               "IUnknownWrapper::invokePutProperty ! Message : \n" +
                 e.Message);
     }
     return aResult;
 }
 
 
-Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
+Any SAL_CALL IUnknownWrapper::invoke( const OUString& aFunctionName,
              const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex,
              Sequence< Any >& aOutParam )
 {
@@ -242,19 +242,19 @@ Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
     catch (const Exception & e)
     {
         throw RuntimeException("[automation bridge] unexpected exception in "
-                                     "IUnknownWrapper_Impl::invoke ! Message : \n" +
+                                     "IUnknownWrapper::invoke ! Message : \n" +
                                e.Message);
 
     }
     catch(...)
     {
         throw RuntimeException("[automation bridge] unexpected exception in "
-                  "IUnknownWrapper_Impl::Invoke !");
+                  "IUnknownWrapper::Invoke !");
     }
     return ret;
 }
 
-void SAL_CALL IUnknownWrapper_Impl::setValue( const OUString& aPropertyName,
+void SAL_CALL IUnknownWrapper::setValue( const OUString& aPropertyName,
                  const Any& aValue )
 {
     if ( ! m_spDispatch )
@@ -409,7 +409,7 @@ void SAL_CALL IUnknownWrapper_Impl::setValue( const OUString& aPropertyName,
     catch (const Exception & e)
     {
         throw RuntimeException("[automation bridge] unexpected exception in "
-                               "IUnknownWrapper_Impl::setValue ! Message : \n" +
+                               "IUnknownWrapper::setValue ! Message : \n" +
                                e.Message);
 
     }
@@ -417,11 +417,11 @@ void SAL_CALL IUnknownWrapper_Impl::setValue( const OUString& aPropertyName,
     {
         throw RuntimeException(
             "[automation bridge] unexpected exception in "
-            "IUnknownWrapper_Impl::setValue !");
+            "IUnknownWrapper::setValue !");
     }
 }
 
-Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
+Any SAL_CALL IUnknownWrapper::getValue( const OUString& aPropertyName )
 {
     if ( ! m_spDispatch )
     {
@@ -551,19 +551,19 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
     catch (const Exception & e)
     {
         throw RuntimeException("[automation bridge] unexpected exception in "
-                               "IUnknownWrapper_Impl::getValue ! Message : \n" +
+                               "IUnknownWrapper::getValue ! Message : \n" +
                                e.Message);
     }
     catch (...)
     {
         throw RuntimeException(
             "[automation bridge] unexpected exception in "
-            "IUnknownWrapper_Impl::getValue !");
+            "IUnknownWrapper::getValue !");
     }
     return ret;
 }
 
-sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMethod( const OUString& aName )
+sal_Bool SAL_CALL IUnknownWrapper::hasMethod( const OUString& aName )
 {
     if ( ! m_spDispatch )
     {
@@ -600,18 +600,18 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMethod( const OUString& aName )
     catch (const Exception & e)
     {
         throw RuntimeException("[automation bridge] unexpected exception in "
-                               "IUnknownWrapper_Impl::hasMethod ! Message : \n" +
+                               "IUnknownWrapper::hasMethod ! Message : \n" +
                                e.Message);
     }
     catch (...)
     {
         throw RuntimeException("[automation bridge] unexpected exception in "
-            "IUnknownWrapper_Impl::hasMethod !");
+            "IUnknownWrapper::hasMethod !");
     }
     return ret;
 }
 
-sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
+sal_Bool SAL_CALL IUnknownWrapper::hasProperty( const OUString& aName )
 {
     if ( ! m_spDispatch )
     {
@@ -649,19 +649,19 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
     catch (const Exception & e)
     {
         throw RuntimeException("[automation bridge] unexpected exception in "
-                               "IUnknownWrapper_Impl::hasProperty ! Message : \n" +
+                               "IUnknownWrapper::hasProperty ! Message : \n" +
                                e.Message);
 
     }
     catch (...)
     {
         throw RuntimeException("[automation bridge] unexpected exception in "
-            "IUnknownWrapper_Impl::hasProperty !");
+            "IUnknownWrapper::hasProperty !");
     }
     return ret;
 }
 
-Any SAL_CALL IUnknownWrapper_Impl::createBridge( const Any& modelDepObject,
+Any SAL_CALL IUnknownWrapper::createBridge( const Any& modelDepObject,
                 const Sequence< sal_Int8 >& /*aProcessId*/, sal_Int16 sourceModelType,
                  sal_Int16 destModelType )
 {
@@ -707,10 +707,10 @@ Any SAL_CALL IUnknownWrapper_Impl::createBridge( const Any& modelDepObject,
     @exception InvocationTargetException
     @RuntimeException
 */
-Any  IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
-                                                  const Sequence< Any >& Params,
-                                                  Sequence< sal_Int16 >& OutParamIndex,
-                                                  Sequence< Any >& OutParam)
+Any  IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
+                                             const Sequence< Any >& Params,
+                                             Sequence< sal_Int16 >& OutParamIndex,
+                                             Sequence< Any >& OutParam)
 {
     Any ret;
     HRESULT hr= S_OK;
@@ -928,7 +928,7 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
                         if( !SUCCEEDED( CComObject<JScriptOutParam>::CreateInstance( &pParamObject)))
                         {
                             throw BridgeRuntimeError(
-                                      "[automation bridge]IUnknownWrapper_Impl::"
+                                      "[automation bridge]IUnknownWrapper::"
                                       "invokeWithDispIdUnoTlb\n"
                                       "Could not create out parameter at index: " +
                                 OUString::number((sal_Int32) i));
@@ -948,7 +948,7 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
                             CComDispatchDriver dispDriver( pDisp);
                             if(FAILED( dispDriver.PutPropertyByName( L"0", &varParam)))
                                 throw BridgeRuntimeError(
-                                    "[automation bridge]IUnknownWrapper_Impl::"
+                                    "[automation bridge]IUnknownWrapper::"
                                     "invokeWithDispIdUnoTlb\n"
                                     "Could not set property \"0\" for the in/out "
                                     "param!");
@@ -1071,14 +1071,14 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
             catch (IllegalArgumentException & e)
             {
                 e.Message =
-                    "[automation bridge]IUnknownWrapper_Impl::invokeWithDispIdUnoTlb\n"
+                    "[automation bridge]IUnknownWrapper::invokeWithDispIdUnoTlb\n"
                     "Could not convert return value! \n Message: \n" + e.Message;
                 throw;
             }
             catch (CannotConvertException & e)
             {
                 e.Message =
-                    "[automation bridge]IUnknownWrapper_Impl::invokeWithDispIdUnoTlb\n"
+                    "[automation bridge]IUnknownWrapper::invokeWithDispIdUnoTlb\n"
                     "Could not convert return value! \n Message: \n" + e.Message;
                 throw;
             }
@@ -1141,7 +1141,7 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
 
 
 // XInitialization
-void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArguments )
+void SAL_CALL IUnknownWrapper::initialize( const Sequence< Any >& aArguments )
 {
     // 1.parameter is IUnknown
     // 2.parameter is a boolean which indicates if the COM pointer was a IUnknown or IDispatch
@@ -1187,7 +1187,7 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
                 {
                     getFuncDesc( usName, &aDescGet );
                     if ( !aDescGet )
-                        throw BridgeRuntimeError( "[automation bridge]IUnknownWrapper_Impl::initialize() Failed to get Function or Property desc. for " + usName );
+                        throw BridgeRuntimeError( "[automation bridge]IUnknownWrapper::initialize() Failed to get Function or Property desc. for " + usName );
                 }
                 // now for some funny heuristics to make basic understand what to do
                 // a single aDescGet ( that doesn't take any params ) would be
@@ -1212,14 +1212,14 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
         catch( const Exception& e )
         {
             throw RuntimeException(
-                    "[automation bridge] unexpected exception in IUnknownWrapper_Impl::initialize() error message: \n" + e.Message );
+                    "[automation bridge] unexpected exception in IUnknownWrapper::initialize() error message: \n" + e.Message );
         }
     }
 }
 
 
 // XDirectInvocation
-uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, const uno::Sequence< uno::Any >& aParams )
+uno::Any SAL_CALL IUnknownWrapper::directInvoke( const OUString& aName, const uno::Sequence< uno::Any >& aParams )
 {
     Any aResult;
 
@@ -1464,7 +1464,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
     return aResult;
 }
 
-sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMember( const OUString& aName )
+sal_Bool SAL_CALL IUnknownWrapper::hasMember( const OUString& aName )
 {
     if ( ! m_spDispatch )
     {
@@ -1479,11 +1479,11 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMember( const OUString& aName )
 
 
 // UnoConversionUtilities --------------------------------------------------------------------------------
-Reference< XInterface > IUnknownWrapper_Impl::createUnoWrapperInstance()
+Reference< XInterface > IUnknownWrapper::createUnoWrapperInstance()
 {
     if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL)
     {
-        Reference<XWeak> xWeak= static_cast<XWeak*>( new InterfaceOleWrapper_Impl(
+        Reference<XWeak> xWeak= static_cast<XWeak*>( new InterfaceOleWrapper(
                                 m_smgr, m_nUnoWrapperClass, m_nComWrapperClass));
         return Reference<XInterface>( xWeak, UNO_QUERY);
     }
@@ -1496,15 +1496,15 @@ Reference< XInterface > IUnknownWrapper_Impl::createUnoWrapperInstance()
     else
         return Reference<XInterface>();
 }
-Reference<XInterface> IUnknownWrapper_Impl::createComWrapperInstance()
+Reference<XInterface> IUnknownWrapper::createComWrapperInstance()
 {
-    Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl(
+    Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper(
                             m_smgr, m_nUnoWrapperClass, m_nComWrapperClass));
     return Reference<XInterface>( xWeak, UNO_QUERY);
 }
 
 
-void IUnknownWrapper_Impl::getMethodInfo(const OUString& sName, TypeDescription& methodInfo)
+void IUnknownWrapper::getMethodInfo(const OUString& sName, TypeDescription& methodInfo)
 {
     TypeDescription desc= getInterfaceMemberDescOfCurrentCall(sName);
     if( desc.is())
@@ -1515,7 +1515,7 @@ void IUnknownWrapper_Impl::getMethodInfo(const OUString& sName, TypeDescription&
     }
 }
 
-void IUnknownWrapper_Impl::getAttributeInfo(const OUString& sName, TypeDescription& attributeInfo)
+void IUnknownWrapper::getAttributeInfo(const OUString& sName, TypeDescription& attributeInfo)
 {
     TypeDescription desc= getInterfaceMemberDescOfCurrentCall(sName);
     if( desc.is())
@@ -1527,7 +1527,7 @@ void IUnknownWrapper_Impl::getAttributeInfo(const OUString& sName, TypeDescripti
         }
     }
 }
-TypeDescription IUnknownWrapper_Impl::getInterfaceMemberDescOfCurrentCall(const OUString& sName)
+TypeDescription IUnknownWrapper::getInterfaceMemberDescOfCurrentCall(const OUString& sName)
 {
     TypeDescription ret;
 
@@ -1568,7 +1568,7 @@ TypeDescription IUnknownWrapper_Impl::getInterfaceMemberDescOfCurrentCall(const
     return ret;
 }
 
-bool IUnknownWrapper_Impl::isJScriptObject()
+bool IUnknownWrapper::isJScriptObject()
 {
     if(  m_eJScript == JScriptUndefined)
     {
@@ -1606,10 +1606,10 @@ bool IUnknownWrapper_Impl::isJScriptObject()
     @RuntimeException
     @BridgeRuntimeError
 */
-Any  IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
-                                                  const Sequence< Any >& Params,
-                                                  Sequence< sal_Int16 >& OutParamIndex,
-                                                  Sequence< Any >& OutParam)
+Any  IUnknownWrapper::invokeWithDispIdComTlb(const OUString& sFuncName,
+                                             const Sequence< Any >& Params,
+                                             Sequence< sal_Int16 >& OutParamIndex,
+                                             Sequence< Any >& OutParam)
 {
     // Get type info for the call. It can be a method call or property put or
     // property get operation.
@@ -1618,11 +1618,11 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
     return invokeWithDispIdComTlb( aFuncDesc, sFuncName, Params, OutParamIndex, OutParam );
 }
 
-Any  IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
-                                                  const OUString& sFuncName,
-                                                  const Sequence< Any >& Params,
-                                                  Sequence< sal_Int16 >& OutParamIndex,
-                                                  Sequence< Any >& OutParam)
+Any  IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
+                                             const OUString& sFuncName,
+                                             const Sequence< Any >& Params,
+                                             Sequence< sal_Int16 >& OutParamIndex,
+                                             Sequence< Any >& OutParam)
 {
     Any ret;
     HRESULT result;
@@ -2090,9 +2090,9 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
     return ret;
 }
 
-void IUnknownWrapper_Impl::getFuncDescForInvoke(const OUString & sFuncName,
-                                                const Sequence<Any> & seqArgs,
-                                                FUNCDESC** pFuncDesc)
+void IUnknownWrapper::getFuncDescForInvoke(const OUString & sFuncName,
+                                           const Sequence<Any> & seqArgs,
+                                           FUNCDESC** pFuncDesc)
 {
     int nUnoArgs = seqArgs.getLength();
     const Any * arArgs = seqArgs.getConstArray();
@@ -2143,14 +2143,14 @@ void IUnknownWrapper_Impl::getFuncDescForInvoke(const OUString & sFuncName,
         *pFuncDesc = aFuncDesc.Detach();
     }
 }
-bool IUnknownWrapper_Impl::getDispid(const OUString& sFuncName, DISPID * id)
+bool IUnknownWrapper::getDispid(const OUString& sFuncName, DISPID * id)
 {
     OSL_ASSERT(m_spDispatch);
     LPOLESTR lpsz = const_cast<LPOLESTR> (o3tl::toW(sFuncName.getStr()));
     HRESULT hr = m_spDispatch->GetIDsOfNames(IID_NULL, &lpsz, 1, LOCALE_USER_DEFAULT, id);
     return hr == S_OK;
 }
-void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** pFuncDesc)
+void IUnknownWrapper::getFuncDesc(const OUString & sFuncName, FUNCDESC ** pFuncDesc)
 
 {
     OSL_ASSERT( * pFuncDesc == nullptr);
@@ -2217,8 +2217,8 @@ void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** p
    //else no entry found for sFuncName, pFuncDesc will not be filled in
 }
 
-void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** pFuncDescGet,
-                                       FUNCDESC** pFuncDescPut, VARDESC** pVarDesc)
+void IUnknownWrapper::getPropDesc(const OUString & sFuncName, FUNCDESC ** pFuncDescGet,
+                                  FUNCDESC** pFuncDescPut, VARDESC** pVarDesc)
 {
     OSL_ASSERT( * pFuncDescGet == nullptr && * pFuncDescPut == nullptr);
     buildComTlbIndex();
@@ -2287,7 +2287,7 @@ void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** p
    //else no entry for sFuncName, pFuncDesc will not be filled in
 }
 
-VARTYPE IUnknownWrapper_Impl::getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType )
+VARTYPE IUnknownWrapper::getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType )
 {
     VARTYPE _type( VT_NULL );
     if ( pTypeInfo )
@@ -2331,7 +2331,7 @@ VARTYPE IUnknownWrapper_Impl::getUserDefinedElementType( ITypeInfo* pTypeInfo, c
     return _type;
 }
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list