summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-04 16:12:17 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-05 15:46:55 +0200
commitb679a2a02180c017bd8b596fb2e4f283bad93b75 (patch)
treedecf939bbd22a2507e8cd9e6c2e41ded49352aa3 /extensions
parentRelax ICC profile version for PDF/1-a to 2.4 (diff)
downloadcore-b679a2a02180c017bd8b596fb2e4f283bad93b75.tar.gz
core-b679a2a02180c017bd8b596fb2e4f283bad93b75.zip
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')
-rw-r--r--extensions/source/ole/unoobjw.cxx34
-rw-r--r--extensions/test/ole/cpnt/cpnt.cxx35
2 files changed, 33 insertions, 36 deletions
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 641e643234dc..cb0c40839c6d 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/beans/MethodConcept.hpp>
#include <com/sun/star/beans/PropertyConcept.hpp>
#include <com/sun/star/script/FailReason.hpp>
+#include <com/sun/star/reflection/theCoreReflection.hpp>
#include <com/sun/star/reflection/ParamInfo.hpp>
#include <com/sun/star/beans/XExactName.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
@@ -53,6 +54,7 @@
#include <com/sun/star/reflection/XIdlReflection.hpp>
#include <osl/interlck.h>
#include <com/sun/star/uno/genfunc.h>
+#include <comphelper/componentcontext.hxx>
#include <cppuhelper/implbase1.hxx>
#include "comifaces.hxx"
@@ -1120,27 +1122,23 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
sal_Bool bStruct= sal_False;
- Reference<XInterface> xIntCore= m_smgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")));
- Reference<XIdlReflection> xRefl( xIntCore, UNO_QUERY);
- if( xRefl.is() )
+ Reference<XIdlReflection> xRefl = theCoreReflection::get(comphelper::ComponentContext(m_smgr).getUNOContext());
+ // the first parameter is in DISPPARAMS rgvargs contains the name of the struct.
+ CComVariant arg;
+ if( pdispparams->cArgs == 1 && SUCCEEDED( arg.ChangeType( VT_BSTR, &pdispparams->rgvarg[0])) )
{
- // the first parameter is in DISPPARAMS rgvargs contains the name of the struct.
- CComVariant arg;
- if( pdispparams->cArgs == 1 && SUCCEEDED( arg.ChangeType( VT_BSTR, &pdispparams->rgvarg[0])) )
+ Reference<XIdlClass> classStruct= xRefl->forName( reinterpret_cast<const sal_Unicode*>(arg.bstrVal));
+ if( classStruct.is())
{
- Reference<XIdlClass> classStruct= xRefl->forName( reinterpret_cast<const sal_Unicode*>(arg.bstrVal));
- if( classStruct.is())
- {
- Any anyStruct;
- classStruct->createObject( anyStruct);
- CComVariant var;
- anyToVariant( &var, anyStruct );
+ Any anyStruct;
+ classStruct->createObject( anyStruct);
+ CComVariant var;
+ anyToVariant( &var, anyStruct );
- if( var.vt == VT_DISPATCH)
- {
- VariantCopy( pvarResult, & var);
- bStruct= sal_True;
- }
+ if( var.vt == VT_DISPATCH)
+ {
+ VariantCopy( pvarResult, & var);
+ bStruct= sal_True;
}
}
}
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: