summaryrefslogtreecommitdiff
path: root/comphelper
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 /comphelper
parent3bb22684c3e0e865f1635ba52ea84630ff766b8c (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 'comphelper')
-rw-r--r--comphelper/source/eventattachermgr/eventattachermgr.cxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 644d2d9a54ef..9b2402604b7c 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -23,6 +23,7 @@
#endif
#include <osl/mutex.hxx>
#include <osl/diagnose.h>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/eventattachermgr.hxx>
#include <com/sun/star/beans/XIntrospection.hpp>
#include <com/sun/star/io/XObjectInputStream.hpp>
@@ -31,6 +32,7 @@
#include <com/sun/star/io/XMarkableStream.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/reflection/theCoreReflection.hpp>
#include <com/sun/star/reflection/XIdlClass.hpp>
#include <com/sun/star/reflection/XIdlReflection.hpp>
#include <com/sun/star/reflection/XIdlMethod.hpp>
@@ -94,14 +96,14 @@ class ImplEventAttacherManager
OInterfaceContainerHelper aScriptListeners;
// Instance of EventAttacher
Reference< XEventAttacher2 > xAttacher;
- Reference< XMultiServiceFactory > mxSMgr;
+ Reference< XComponentContext > mxContext;
Reference< XIdlReflection > mxCoreReflection;
Reference< XIntrospection > mxIntrospection;
Reference< XTypeConverter > xConverter;
sal_Int16 nVersion;
public:
ImplEventAttacherManager( const Reference< XIntrospection > & rIntrospection,
- const Reference< XMultiServiceFactory > rSMgr );
+ const Reference< XComponentContext > xContext );
~ImplEventAttacherManager();
// Methods of XEventAttacherManager
@@ -361,7 +363,7 @@ Reference< XEventAttacherManager > createEventAttacherManager( const Reference<
if ( xIFace.is() )
{
Reference< XIntrospection > xIntrospection( xIFace, UNO_QUERY);
- return new ImplEventAttacherManager( xIntrospection, rSMgr );
+ return new ImplEventAttacherManager( xIntrospection, comphelper::ComponentContext(rSMgr).getUNOContext() );
}
}
@@ -370,19 +372,20 @@ Reference< XEventAttacherManager > createEventAttacherManager( const Reference<
//-----------------------------------------------------------------------------
ImplEventAttacherManager::ImplEventAttacherManager( const Reference< XIntrospection > & rIntrospection,
- const Reference< XMultiServiceFactory > rSMgr )
+ const Reference< XComponentContext > xContext )
: aScriptListeners( aLock )
- , mxSMgr( rSMgr )
+ , mxContext( xContext )
, mxIntrospection( rIntrospection )
{
- if ( rSMgr.is() )
+ if ( xContext.is() )
{
- Reference< XInterface > xIFace( rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.EventAttacher" )) ) );
+ Reference< XInterface > xIFace( xContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.EventAttacher" )), xContext) );
if ( xIFace.is() )
{
xAttacher = Reference< XEventAttacher2 >::query( xIFace );
}
- xConverter = Converter::create(comphelper::ComponentContext(rSMgr).getUNOContext());
+ xConverter = Converter::create(xContext);
}
Reference< XInitialization > xInit( xAttacher, UNO_QUERY );
@@ -405,8 +408,7 @@ Reference< XIdlReflection > ImplEventAttacherManager::getReflection() throw( Exc
// Do we already have a service? If not, create one.
if( !mxCoreReflection.is() )
{
- Reference< XInterface > xIFace( mxSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.CoreReflection" )) ) );
- mxCoreReflection = Reference< XIdlReflection >( xIFace, UNO_QUERY);
+ mxCoreReflection = theCoreReflection::get(mxContext);
}
return mxCoreReflection;
}