[Libreoffice-commits] core.git: Branch 'aoo/trunk' - extensions/source

Steve Yin steve_y at apache.org
Mon Dec 9 00:13:08 PST 2013


 extensions/source/ole/oleobjw.cxx |   73 ++++++++++++++++++++++----------------
 1 file changed, 43 insertions(+), 30 deletions(-)

New commits:
commit b0fa50814d9f5b5900df7bd8c00b54d57a010a20
Author: Steve Yin <steve_y at apache.org>
Date:   Mon Dec 9 06:15:26 2013 +0000

    Bug 123816 - Cannot send email with attachment via VBA code taking Notes as mail application

diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index b4688c0..578c308 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -2333,56 +2333,69 @@ void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** p
    //else no entry for sFuncName, pFuncDesc will not be filled in
 }
 
-VARTYPE IUnknownWrapper_Impl::getElementTypeDesc(const TYPEDESC *desc)
+VARTYPE lcl_getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType )
 {
     VARTYPE _type( VT_NULL );
-
-    if (desc->vt == VT_PTR)
-    {
-        _type = getElementTypeDesc(desc->lptdesc);
-        _type |= VT_BYREF;
-    }
-    else if (desc->vt == VT_SAFEARRAY)
+    if ( pTypeInfo )
     {
-        _type = getElementTypeDesc(desc->lptdesc);
-        _type |= VT_ARRAY;
-    }
-    else if (desc->vt == VT_USERDEFINED)
-    {
-        ITypeInfo* thisInfo = getTypeInfo(); //kept by this instance
-        CComPtr<ITypeInfo>  spRefInfo;
-        thisInfo->GetRefTypeInfo(desc->hreftype, & spRefInfo.p);
-        if (spRefInfo)
+        CComPtr<ITypeInfo> spRefInfo;
+        pTypeInfo->GetRefTypeInfo( nHrefType, &spRefInfo.p );
+        if ( spRefInfo )
         {
-            TypeAttr  attr(spRefInfo);
-            spRefInfo->GetTypeAttr( & attr);
-            if (attr->typekind == TKIND_ENUM)
+            TypeAttr attr( spRefInfo );
+            spRefInfo->GetTypeAttr( &attr );
+            if ( attr->typekind == TKIND_ENUM )
             {
-                //We use the type of the first enum value.
-                if (attr->cVars == 0)
+                // We use the type of the first enum value.
+                if ( attr->cVars == 0 )
                 {
-                    throw BridgeRuntimeError(OUSTR("[automation bridge] Could "
-                        "not obtain type description"));
+                    throw BridgeRuntimeError(OUSTR("[automation bridge] Could not obtain type description"));
                 }
-                VarDesc var(spRefInfo);
-                spRefInfo->GetVarDesc(0, & var);
+                VarDesc var( spRefInfo );
+                spRefInfo->GetVarDesc( 0, &var );
                 _type = var->lpvarValue->vt;
             }
-            else if (attr->typekind == TKIND_INTERFACE)
+            else if ( attr->typekind == TKIND_INTERFACE )
             {
                 _type = VT_UNKNOWN;
             }
-            else if (attr->typekind == TKIND_DISPATCH)
+            else if ( attr->typekind == TKIND_DISPATCH )
             {
                 _type = VT_DISPATCH;
             }
+            else if ( attr->typekind == TKIND_ALIAS )
+            {
+                // TKIND_ALIAS is a type that is an alias for another type. So get that alias type.
+                _type = lcl_getUserDefinedElementType( pTypeInfo, attr->tdescAlias.hreftype );
+            }
             else
             {
-                throw BridgeRuntimeError(OUSTR("[automation bridge] "
-                    "Unhandled user defined type."));
+                throw BridgeRuntimeError( OUSTR("[automation bridge] Unhandled user defined type.") );
             }
         }
     }
+    return _type;
+}
+
+VARTYPE IUnknownWrapper_Impl::getElementTypeDesc(const TYPEDESC *desc)
+{
+    VARTYPE _type( VT_NULL );
+
+    if (desc->vt == VT_PTR)
+    {
+        _type = getElementTypeDesc(desc->lptdesc);
+        _type |= VT_BYREF;
+    }
+    else if (desc->vt == VT_SAFEARRAY)
+    {
+        _type = getElementTypeDesc(desc->lptdesc);
+        _type |= VT_ARRAY;
+    }
+    else if (desc->vt == VT_USERDEFINED)
+    {
+        ITypeInfo* thisInfo = getTypeInfo(); //kept by this instance
+        _type = lcl_getUserDefinedElementType( thisInfo, desc->hreftype );
+    }
     else
     {
         _type = desc->vt;


More information about the Libreoffice-commits mailing list