- SafeArrayUnaccessData(oleVariant.parray);
- }
- else if ( oleVariant.vt & VT_BYREF )
- {
- switch ( oleVariant.vt & VT_TYPEMASK )
- {
- case VT_VARIANT:
- {
- VARIANTARG& oleReference = *((LPVARIANT)oleVariant.byref);
- if (!wxConvertOleToVariant(oleReference,variant))
- return false;
- break;
- }
-
- default:
- wxLogError(wxT("wxAutomationObject::ConvertOleToVariant: [as yet] unhandled reference %X"),oleVariant.vt);
- return false;
- }
- }
- else // simply type (not array or reference)
- {
- switch (oleVariant.vt & VT_TYPEMASK)
- {
- case VT_BSTR:
- {
- wxString str(wxConvertStringFromOle(oleVariant.bstrVal));
- variant = str;
- break;
- }
- case VT_DATE:
- {
-#if wxUSE_DATETIME
- unsigned short dosDate = 0;
- unsigned short dosTime = 0;
- VariantTimeToDosDateTime(oleVariant.date, & dosDate, & dosTime);
-
- long dosDateTime = (dosDate << 16) | dosTime;
- wxDateTime date;
- date.SetFromDOS(dosDateTime);
- variant = date;
-#endif
- break;
- }
- case VT_I4:
- {
- variant = (long) oleVariant.lVal;
- break;
- }
- case VT_I2:
- {
- variant = (long) oleVariant.iVal;
- break;
- }
-
- case VT_BOOL:
- {
-#if (defined(_MSC_VER) && (_MSC_VER <= 1000) && !defined(__MWERKS__) ) //GC
-#ifndef HAVE_BOOL // Can't use bool operator if no native bool type
- variant = (long) (oleVariant.bool != 0);
-#else
- variant = (bool) (oleVariant.bool != 0);
-#endif
-#else
-#ifndef HAVE_BOOL // Can't use bool operator if no native bool type
- variant = (long) (oleVariant.boolVal != 0);
-#else
- variant = (bool) (oleVariant.boolVal != 0);
-#endif
-#endif
- break;
- }
- case VT_R8:
- {
- variant = oleVariant.dblVal;
- break;
- }
- case VT_DISPATCH:
- {
- variant = (void*) oleVariant.pdispVal;
- break;
- }
- case VT_NULL:
- {
- variant.MakeNull();
- break;
- }
- case VT_EMPTY:
- {
- break; // Ignore Empty Variant, used only during destruction of objects
- }
- default:
- {
- wxLogError(wxT("wxAutomationObject::ConvertOleToVariant: Unknown variant value type %X -> %X"),oleVariant.vt,oleVariant.vt&VT_TYPEMASK);
- return false;
- }
- }
- }