diff options
author | Noel Grandin <noel@peralex.com> | 2012-09-04 16:12:17 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-05 15:46:55 +0200 |
commit | b679a2a02180c017bd8b596fb2e4f283bad93b75 (patch) | |
tree | decf939bbd22a2507e8cd9e6c2e41ded49352aa3 /extensions/test/ole/cpnt | |
parent | 3bb22684c3e0e865f1635ba52ea84630ff766b8c (diff) |
fdo#46808, Adapt reflection::CoreReflection UNO service to new style
The XComponent part of the interface made no sense for a singleton,
so it was removed.
Explicitly document the 'theCoreReflection' singleton and move it
into it's own file.
Deprecated the now old CoreReflection service.
Change-Id: Ib8befa87c7da7eb53a2f587948fd54a64c082472
Diffstat (limited to 'extensions/test/ole/cpnt')
-rw-r--r-- | extensions/test/ole/cpnt/cpnt.cxx | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/extensions/test/ole/cpnt/cpnt.cxx b/extensions/test/ole/cpnt/cpnt.cxx index b20795ecf003..0f9448815f95 100644 --- a/extensions/test/ole/cpnt/cpnt.cxx +++ b/extensions/test/ole/cpnt/cpnt.cxx @@ -33,12 +33,14 @@ #include <com/sun/star/registry/XRegistryKey.hpp> #include <osl/diagnose.h> #include <uno/environment.h> +#include <comphelper/componentcontext.hxx> #include <cppuhelper/factory.hxx> // OPTIONAL is a constant in com.sun.star.beans.PropertyAttributes but it must be // undef'd in some header files #define OPTIONAL OPTIONAL #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/script/XInvocation.hpp> +#include <com/sun/star/reflection/theCoreReflection.hpp> #include <com/sun/star/reflection/XIdlReflection.hpp> #include <com/sun/star/lang/XEventListener.hpp> @@ -1491,27 +1493,24 @@ void SAL_CALL OComponent::testInterface( const Reference< XCallback >& xCallbac } case 101: { - Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY); - if( xRefl.is()) - { - Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct"); - Any any; - if( xClass.is()) - xClass->createObject( any); - - if( any.getValueTypeClass() == TypeClass_STRUCT) - { - SimpleStruct* pStruct= ( SimpleStruct*) any.getValue(); - pStruct->message= OUString(RTL_CONSTASCII_USTRINGPARAM("This struct was created in OleTest")); + Reference<XIdlReflection> xRefl( theCoreReflection::get(comphelper::ComponentContext(m_rFactory).getUNOContext()) ); + Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct"); + Any any; + if( xClass.is()) + xClass->createObject( any); - SimpleStruct aStruct; - any >>= aStruct; - xCallback->inoutStruct( aStruct); - // a Struct should now contain a different message - MessageBox( NULL, W2T(aStruct.message), _T("OleTest in out parameter"), MB_OK); - } + if( any.getValueTypeClass() == TypeClass_STRUCT) + { + SimpleStruct* pStruct= ( SimpleStruct*) any.getValue(); + pStruct->message= OUString(RTL_CONSTASCII_USTRINGPARAM("This struct was created in OleTest")); + SimpleStruct aStruct; + any >>= aStruct; + xCallback->inoutStruct( aStruct); + // a Struct should now contain a different message + MessageBox( NULL, W2T(aStruct.message), _T("OleTest in out parameter"), MB_OK); } + break; } case 102: |