summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2010-05-11 11:26:34 +0200
committerIvo Hinkelmann <ihi@openoffice.org>2010-05-11 11:26:34 +0200
commit774ba3eac37196d435855cadd115a1249d441c78 (patch)
tree6d691a67e175eee0283720ad7b967405ef480ce0 /extensions
parent5820bb8db3e482e9796c9ccf6e8d8c5e015926e3 (diff)
parent83b03e3e90d84e2f1732ee305a944ec668ad5c1d (diff)
CWS-TOOLING: integrate CWS npower14miscfixes
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/ole/oleobjw.cxx40
-rw-r--r--extensions/source/ole/oleobjw.hxx1
2 files changed, 41 insertions, 0 deletions
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 79baf3c7d8df..ea9377ccf596 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -422,6 +422,46 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
{
o2u_attachCurrentThread();
ITypeInfo * pInfo = getTypeInfo();
+ // I was going to implement an XServiceInfo interface to allow the type
+ // of the automation object to be exposed.. but it seems
+ // from looking at comments in the code that it is possible for
+ // this object to actually wrap an UNO object ( I guess if automation is
+ // used from MSO to create Openoffice objects ) Therefore, those objects
+ // will more than likely already have their own XServiceInfo interface.
+ // Instead here I chose a name that should be illegal both in COM and
+ // UNO ( from an IDL point of view ) therefore I think this is a safe
+ // hack
+ if ( aPropertyName.equals( rtl::OUString::createFromAscii("$GetTypeName") ))
+ {
+ if ( pInfo && m_sTypeName.getLength() == 0 )
+ {
+ m_sTypeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") );
+ CComBSTR sName;
+
+ if ( SUCCEEDED( pInfo->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) )
+ {
+ rtl::OUString sTmp( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName)));
+ if ( sTmp.indexOf('_') == 0 )
+ sTmp = sTmp.copy(1);
+ // do we own the memory for pTypeLib, msdn doco is vague
+ // I'll assume we do
+ CComPtr< ITypeLib > pTypeLib;
+ unsigned int index;
+ if ( SUCCEEDED( pInfo->GetContainingTypeLib( &pTypeLib.p, &index )) )
+ {
+ if ( SUCCEEDED( pTypeLib->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) )
+ {
+ rtl::OUString sLibName( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName)));
+ m_sTypeName = sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sTmp );
+
+ }
+ }
+ }
+
+ }
+ ret <<= m_sTypeName;
+ return ret;
+ }
FuncDesc aDescGet(pInfo);
FuncDesc aDescPut(pInfo);
VarDesc aVarDesc(pInfo);
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
index 6d46452eb088..230de2b7dcf8 100644
--- a/extensions/source/ole/oleobjw.hxx
+++ b/extensions/source/ole/oleobjw.hxx
@@ -234,6 +234,7 @@ protected:
Sequence<Type> m_seqTypes;
CComPtr<IUnknown> m_spUnknown;
CComPtr<IDispatch> m_spDispatch;
+ rtl::OUString m_sTypeName; // is "" ( not initialised ), "IDispatch" ( we have no idea ) or "SomeLibrary.SomeTypeName" if we managed to get a type
/** This value is set dureing XInitialization::initialize. It indicates that the COM interface
was transported as VT_DISPATCH in a VARIANT rather then a VT_UNKNOWN
*/