Author: steve_y
Date: Mon Dec  9 06:15:26 2013
New Revision: 1549481

URL: http://svn.apache.org/r1549481
Log:
Bug 123816 - Cannot send email with attachment via VBA code taking Notes as 
mail application

Modified:
    openoffice/trunk/main/extensions/source/ole/oleobjw.cxx

Modified: openoffice/trunk/main/extensions/source/ole/oleobjw.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/extensions/source/ole/oleobjw.cxx?rev=1549481&r1=1549480&r2=1549481&view=diff
==============================================================================
--- openoffice/trunk/main/extensions/source/ole/oleobjw.cxx (original)
+++ openoffice/trunk/main/extensions/source/ole/oleobjw.cxx Mon Dec  9 06:15:26 
2013
@@ -2333,6 +2333,50 @@ void IUnknownWrapper_Impl::getPropDesc(c
    //else no entry for sFuncName, pFuncDesc will not be filled in    
 }
 
+VARTYPE lcl_getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD 
nHrefType )
+{
+    VARTYPE _type( VT_NULL );
+    if ( pTypeInfo )
+    {
+        CComPtr<ITypeInfo> spRefInfo;
+        pTypeInfo->GetRefTypeInfo( nHrefType, &spRefInfo.p );
+        if ( spRefInfo )
+        {
+            TypeAttr attr( spRefInfo );
+            spRefInfo->GetTypeAttr( &attr );
+            if ( attr->typekind == TKIND_ENUM )
+            {
+                // We use the type of the first enum value.
+                if ( attr->cVars == 0 )
+                {
+                    throw BridgeRuntimeError(OUSTR("[automation bridge] Could 
not obtain type description"));
+                }
+                VarDesc var( spRefInfo );
+                spRefInfo->GetVarDesc( 0, &var );
+                _type = var->lpvarValue->vt;
+            }
+            else if ( attr->typekind == TKIND_INTERFACE )
+            {
+                _type = VT_UNKNOWN;
+            }
+            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.") );
+            }
+        }
+    }
+    return _type;
+}
+
 VARTYPE IUnknownWrapper_Impl::getElementTypeDesc(const TYPEDESC *desc)
 {
        VARTYPE _type( VT_NULL );
@@ -2350,38 +2394,7 @@ VARTYPE IUnknownWrapper_Impl::getElement
        else if (desc->vt == VT_USERDEFINED)
        {
                ITypeInfo* thisInfo = getTypeInfo(); //kept by this instance
-               CComPtr<ITypeInfo>      spRefInfo;
-               thisInfo->GetRefTypeInfo(desc->hreftype, & spRefInfo.p);
-               if (spRefInfo)
-               {
-                       TypeAttr  attr(spRefInfo);
-                       spRefInfo->GetTypeAttr( & attr);
-                       if (attr->typekind == TKIND_ENUM)
-                       {
-                               //We use the type of the first enum value.
-                               if (attr->cVars == 0)
-                               {
-                                       throw 
BridgeRuntimeError(OUSTR("[automation bridge] Could "
-                                               "not obtain type description"));
-                               }
-                               VarDesc var(spRefInfo);
-                               spRefInfo->GetVarDesc(0, & var);
-                               _type = var->lpvarValue->vt; 
-                       }
-                       else if (attr->typekind == TKIND_INTERFACE)
-                       {
-                               _type = VT_UNKNOWN;
-                       }
-                       else if (attr->typekind == TKIND_DISPATCH)
-                       {
-                               _type = VT_DISPATCH;
-                       }
-                       else 
-                       {
-                               throw BridgeRuntimeError(OUSTR("[automation 
bridge] "
-                                       "Unhandled user defined type."));
-                       }
-               }
+               _type = lcl_getUserDefinedElementType( thisInfo, desc->hreftype 
);
        }
        else
        {


Reply via email to