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

Tor Lillqvist tml at collabora.com
Thu May 31 10:44:18 UTC 2018


 extensions/source/ole/unoobjw.cxx |  107 +++++++++++++++++++++++++++++++++++---
 1 file changed, 100 insertions(+), 7 deletions(-)

New commits:
commit b34d42129178731a841c52aac186f5d9f4fa817e
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Apr 9 15:35:40 2018 +0300

    A few SAL_INFO tweaks
    
    Change-Id: I4a9c6341891bc80d8ab7648ed972d57739aa4f4a

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 57b054e66ec4..ddcf1ddf89f5 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -792,7 +792,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetNames(MEMBERID memid,
                                                UINT cMaxNames,
                                                UINT *pcNames)
 {
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::GetNames(" << memid << ")");
+    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetNames(" << memid << ")");
     assert(meKind != Kind::COCLASS);
 
     if (!rgBstrNames)
@@ -827,6 +827,7 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetNames(MEMBERID memid,
     if (memid > aMethods.getLength() - 3)
         return E_INVALIDARG;
 
+    SAL_INFO("extensions.olebridge", "...CXTypeInfo@" << this << "::GetNames(" << memid << "): " << aMethods[memid + 2]->getName());
     rgBstrNames[0] = SysAllocString((LPOLESTR) aMethods[memid + 2]->getName().pData->buffer);
     *pcNames = 1;
 
commit 27a1351122dbab79536870d7080307defbcae433
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Apr 9 15:33:03 2018 +0300

    First attempt at implementing CXTypeInfo::GetFuncDesc() and ReleaseFuncDesc()
    
    The returned information for the methods is fairly bogus, though. Not
    sure now (a few months after I wrote the code) whether this added
    functionality was actually needed, or whether I just added it for
    potential future need, and with the intent that it needs to be
    improved significantly then later if actually needed.
    
    Change-Id: Ifb132f494cdd7172b4b1d05cc26e2370ea595f41

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index c76320195abe..57b054e66ec4 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -681,10 +681,101 @@ HRESULT STDMETHODCALLTYPE CXTypeInfo::GetTypeComp(ITypeComp **ppTComp)
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetFuncDesc(UINT index,
                                                   FUNCDESC **ppFuncDesc)
 {
-    (void) index;
-    (void) ppFuncDesc;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::GetFuncDesc: NOTIMPL");
-    return E_NOTIMPL;
+    if (!ppFuncDesc)
+        return E_POINTER;
+
+    if (meKind != Kind::OUTGOING)
+        return E_NOTIMPL;
+
+    if (index <= 6)
+    {
+        *ppFuncDesc = new FUNCDESC;
+        (*ppFuncDesc)->memid = 0x60000000 + index;
+        (*ppFuncDesc)->lprgscode = NULL;
+        (*ppFuncDesc)->lprgelemdescParam = NULL;
+        (*ppFuncDesc)->funckind = FUNC_DISPATCH;
+        (*ppFuncDesc)->invkind = INVOKE_FUNC;
+        (*ppFuncDesc)->callconv = CC_STDCALL;
+        switch (index)
+        {
+        case 0: // QueryInterface
+            (*ppFuncDesc)->cParams = 2;
+            (*ppFuncDesc)->elemdescFunc.tdesc.lptdesc = NULL;
+            (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_VOID;
+            break;
+        case 1: // AddRef
+            (*ppFuncDesc)->cParams = 0;
+            (*ppFuncDesc)->elemdescFunc.tdesc.lptdesc = NULL;
+            (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_UI4;
+            break;
+        case 2: // Release
+            (*ppFuncDesc)->cParams = 1;
+            (*ppFuncDesc)->elemdescFunc.tdesc.lptdesc = NULL;
+            (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_UI4;
+            break;
+        case 3: // GetTypeInfoCount
+            (*ppFuncDesc)->cParams = 1;
+            (*ppFuncDesc)->elemdescFunc.tdesc.lptdesc = NULL;
+            (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_VOID;
+            break;
+        case 4: // GetTypeInfo
+            (*ppFuncDesc)->cParams = 3;
+            (*ppFuncDesc)->elemdescFunc.tdesc.lptdesc = NULL;
+            (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_VOID;
+            break;
+        case 5: // GetIDsOfNames
+            (*ppFuncDesc)->cParams = 5;
+            (*ppFuncDesc)->elemdescFunc.tdesc.lptdesc = NULL;
+            (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_VOID;
+            break;
+        case 6: // Invoke
+            (*ppFuncDesc)->cParams = 8;
+            (*ppFuncDesc)->elemdescFunc.tdesc.lptdesc = NULL;
+            (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_VOID;
+            break;
+        }
+        (*ppFuncDesc)->cParamsOpt = 0;
+        (*ppFuncDesc)->oVft = index * sizeof(void*);
+        (*ppFuncDesc)->cScodes = 0;
+        (*ppFuncDesc)->wFuncFlags = FUNCFLAG_FRESTRICTED;
+
+        SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetFuncDesc(" << index << "): S_OK: " << *ppFuncDesc);
+
+        return S_OK;
+    }
+
+    Reference<XIdlReflection> xRefl = theCoreReflection::get(comphelper::getComponentContext(mxMSF));
+    assert(xRefl.is());
+
+    Reference<XIdlClass> xClass = xRefl->forName(maType.getTypeName());
+    assert(xClass.is());
+
+    auto aMethods = xClass->getMethods();
+    assert(xClass->getTypeClass() == TypeClass_INTERFACE &&
+           aMethods.getLength() > 0);
+
+    if (index > (UINT)(aMethods.getLength() - 3 + 3 + 4))
+        return E_INVALIDARG;
+
+    *ppFuncDesc = new FUNCDESC;
+
+    (*ppFuncDesc)->memid = index - 6;
+    (*ppFuncDesc)->lprgscode = NULL;
+    (*ppFuncDesc)->lprgelemdescParam = NULL;
+    (*ppFuncDesc)->funckind = FUNC_DISPATCH;
+    (*ppFuncDesc)->invkind = INVOKE_FUNC;
+    (*ppFuncDesc)->callconv = CC_STDCALL;
+    (*ppFuncDesc)->cParams = aMethods[index - 4]->getParameterInfos().getLength();
+    (*ppFuncDesc)->cParamsOpt = 0;
+    (*ppFuncDesc)->oVft = index * sizeof(void*);
+    (*ppFuncDesc)->cScodes = 0;
+    (*ppFuncDesc)->elemdescFunc.tdesc.lptdesc = NULL; // ???
+    (*ppFuncDesc)->elemdescFunc.tdesc.vt = VT_VOID; // ???
+    (*ppFuncDesc)->wFuncFlags = 0;
+
+    SAL_INFO("extensions.olebridge", "CXTypeInfo@" << this << "::GetFuncDesc(" << index << "): S_OK: " << *ppFuncDesc);
+
+    return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE CXTypeInfo::GetVarDesc(UINT index,
@@ -960,8 +1051,9 @@ void STDMETHODCALLTYPE CXTypeInfo::ReleaseTypeAttr(TYPEATTR *pTypeAttr)
 
 void STDMETHODCALLTYPE CXTypeInfo::ReleaseFuncDesc(FUNCDESC *pFuncDesc)
 {
-    (void) pFuncDesc;
-    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::ReleaseFuncDesc: NOTIMPL");
+    SAL_WARN("extensions.olebridge", "CXTypeInfo@" << this << "::ReleaseFuncDesc(" << pFuncDesc << ")");
+
+    delete pFuncDesc;
 }
 
 void STDMETHODCALLTYPE CXTypeInfo::ReleaseVarDesc(VARDESC *pVarDesc)


More information about the Libreoffice-commits mailing list