diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-19 13:15:15 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-19 13:16:38 +0200 |
commit | 03a9f139bd9ea1a4f9096fc982e6b326def58532 (patch) | |
tree | bfb7a08bb4831a1a46b48c3bb49afa77ca436349 /comphelper | |
parent | e8a169c93d7e2443a2e56afe7e99cd0721a2c27b (diff) |
ComponentContext::getUnoContext -> getComponentContext simplification
...and some further clean-up.
Change-Id: If5dce53e382b56390c502d0d0d93fc06cbfe33ea
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/container/enumerablemap.cxx | 11 | ||||
-rw-r--r-- | comphelper/source/eventattachermgr/eventattachermgr.cxx | 5 | ||||
-rw-r--r-- | comphelper/source/misc/logging.cxx | 14 | ||||
-rw-r--r-- | comphelper/source/property/opropertybag.cxx | 7 | ||||
-rw-r--r-- | comphelper/source/property/opropertybag.hxx | 13 | ||||
-rw-r--r-- | comphelper/source/streaming/seekableinput.cxx | 4 |
6 files changed, 22 insertions, 32 deletions
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index 45f1c5cb4eae..058310e4cd09 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -22,7 +22,6 @@ #include "comphelper/anytostring.hxx" #include "comphelper/anycompare.hxx" #include "comphelper/componentbase.hxx" -#include "comphelper/componentcontext.hxx" #include "comphelper/extract.hxx" #include <com/sun/star/container/XEnumerableMap.hpp> @@ -191,7 +190,7 @@ namespace comphelper ,public ComponentBase { protected: - EnumerableMap( const ComponentContext& _rContext ); + EnumerableMap(); virtual ~EnumerableMap(); // XInitialization @@ -238,7 +237,6 @@ namespace comphelper private: ::osl::Mutex m_aMutex; - ComponentContext m_aContext; MapData m_aData; ::std::vector< ::com::sun::star::uno::WeakReference< XInterface > > @@ -347,10 +345,9 @@ namespace comphelper //= EnumerableMap //==================================================================== //-------------------------------------------------------------------- - EnumerableMap::EnumerableMap( const ComponentContext& _rContext ) + EnumerableMap::EnumerableMap() :Map_IFace( m_aMutex ) ,ComponentBase( Map_IFace::rBHelper ) - ,m_aContext( _rContext ) { } @@ -729,9 +726,9 @@ namespace comphelper } //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL EnumerableMap::Create( const Reference< XComponentContext >& _context ) + Reference< XInterface > SAL_CALL EnumerableMap::Create( SAL_UNUSED_PARAMETER const Reference< XComponentContext >& ) { - return *new EnumerableMap( ComponentContext( _context ) ); + return *new EnumerableMap; } //==================================================================== diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index 9b2402604b7c..85ed313a11fe 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx @@ -23,8 +23,8 @@ #endif #include <osl/mutex.hxx> #include <osl/diagnose.h> -#include <comphelper/componentcontext.hxx> #include <comphelper/eventattachermgr.hxx> +#include <comphelper/processfactory.hxx> #include <com/sun/star/beans/XIntrospection.hpp> #include <com/sun/star/io/XObjectInputStream.hpp> #include <com/sun/star/io/XPersistObject.hpp> @@ -45,7 +45,6 @@ #include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx> -#include <comphelper/componentcontext.hxx> #include <deque> #include <algorithm> @@ -363,7 +362,7 @@ Reference< XEventAttacherManager > createEventAttacherManager( const Reference< if ( xIFace.is() ) { Reference< XIntrospection > xIntrospection( xIFace, UNO_QUERY); - return new ImplEventAttacherManager( xIntrospection, comphelper::ComponentContext(rSMgr).getUNOContext() ); + return new ImplEventAttacherManager( xIntrospection, comphelper::getComponentContext(rSMgr) ); } } diff --git a/comphelper/source/misc/logging.cxx b/comphelper/source/misc/logging.cxx index 19f7f42b7222..d5c4656c0db0 100644 --- a/comphelper/source/misc/logging.cxx +++ b/comphelper/source/misc/logging.cxx @@ -19,10 +19,10 @@ #include <comphelper/logging.hxx> -#include <comphelper/componentcontext.hxx> #include <com/sun/star/logging/LoggerPool.hpp> #include <com/sun/star/logging/LogLevel.hpp> +#include <com/sun/star/resource/OfficeResourceLoader.hpp> #include <com/sun/star/resource/XResourceBundle.hpp> #include <com/sun/star/resource/XResourceBundleLoader.hpp> @@ -53,7 +53,7 @@ namespace comphelper class EventLogger_Impl { private: - ::comphelper::ComponentContext m_aContext; + Reference< XComponentContext > m_aContext; ::rtl::OUString m_sLoggerName; Reference< XLogger > m_xLogger; @@ -68,7 +68,7 @@ namespace comphelper inline bool isValid() const { return m_xLogger.is(); } inline const ::rtl::OUString& getName() const { return m_sLoggerName; } inline const Reference< XLogger >& getLogger() const { return m_xLogger; } - inline const ::comphelper::ComponentContext& getContext() const { return m_aContext; } + inline Reference< XComponentContext > getContext() const { return m_aContext; } private: void impl_createLogger_nothrow(); @@ -82,7 +82,7 @@ namespace comphelper { try { - Reference< XLoggerPool > xPool( LoggerPool::get( m_aContext.getUNOContext() ), UNO_QUERY_THROW ); + Reference< XLoggerPool > xPool( LoggerPool::get( m_aContext ) ); if ( !m_sLoggerName.isEmpty() ) m_xLogger = xPool->getNamedLogger( m_sLoggerName ); else @@ -224,7 +224,7 @@ namespace comphelper }; //-------------------------------------------------------------------- - bool lcl_loadBundle_nothrow( const ComponentContext& _rContext, ResourceBasedEventLogger_Data& _rLoggerData ) + bool lcl_loadBundle_nothrow( Reference< XComponentContext > const & _rContext, ResourceBasedEventLogger_Data& _rLoggerData ) { if ( _rLoggerData.bBundleLoaded ) return _rLoggerData.xBundle.is(); @@ -234,7 +234,9 @@ namespace comphelper try { - Reference< XResourceBundleLoader > xLoader( _rContext.getSingleton( "com.sun.star.resource.OfficeResourceLoader" ), UNO_QUERY_THROW ); + Reference< XResourceBundleLoader > xLoader( + com::sun::star::resource::OfficeResourceLoader::get( + _rContext ) ); _rLoggerData.xBundle = Reference< XResourceBundle >( xLoader->loadBundle_Default( _rLoggerData.sBundleBaseName ), UNO_QUERY_THROW ); } catch( const Exception& e ) diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index 8331d2fd8d00..40764a409816 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -58,10 +58,9 @@ namespace comphelper //= OPropertyBag //==================================================================== //-------------------------------------------------------------------- - OPropertyBag::OPropertyBag( const Reference< XComponentContext >& _rxContext ) + OPropertyBag::OPropertyBag() :OPropertyBag_PBase( GetBroadcastHelper(), this ) ,::cppu::IEventNotificationHook() - ,m_aContext( _rxContext ) ,m_bAutoAddProperties( false ) ,m_NotifyListeners(m_aMutex) ,m_isModified(false) @@ -116,9 +115,9 @@ namespace comphelper } //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OPropertyBag::Create( const Reference< XComponentContext >& _rxContext ) + Reference< XInterface > SAL_CALL OPropertyBag::Create( SAL_UNUSED_PARAMETER const Reference< XComponentContext >& ) { - return *new OPropertyBag( _rxContext ); + return *new OPropertyBag; } //-------------------------------------------------------------------- diff --git a/comphelper/source/property/opropertybag.hxx b/comphelper/source/property/opropertybag.hxx index f5dbf4ebfd9c..2127c6611c94 100644 --- a/comphelper/source/property/opropertybag.hxx +++ b/comphelper/source/property/opropertybag.hxx @@ -30,11 +30,11 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/container/XSet.hpp> +#include <boost/noncopyable.hpp> #include <cppuhelper/implbase6.hxx> #include <comphelper/propstate.hxx> #include <comphelper/broadcasthelper.hxx> #include <comphelper/propertybag.hxx> -#include <comphelper/componentcontext.hxx> #include <comphelper/uno3.hxx> #include <map> @@ -76,11 +76,9 @@ namespace comphelper ,public OPropertyBag_PBase ,public OPropertyBag_Base ,public ::cppu::IEventNotificationHook + ,private boost::noncopyable { private: - ::comphelper::ComponentContext - m_aContext; - /// our IPropertyArrayHelper implementation ::std::auto_ptr< ::cppu::OPropertyArrayHelper > m_pArrayHelper; @@ -97,8 +95,6 @@ namespace comphelper bool m_isModified; public: - OPropertyBag( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); - // XServiceInfo - static versions static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException ); static ::rtl::OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException ); @@ -106,6 +102,7 @@ namespace comphelper SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); protected: + OPropertyBag(); virtual ~OPropertyBag(); DECLARE_XINTERFACE() DECLARE_XTYPEPROVIDER() @@ -215,10 +212,6 @@ namespace comphelper */ void impl_setPropertyValues_throw( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rProps ); - private: - OPropertyBag(); // never implemented - OPropertyBag( const OPropertyBag& ); // never implemented - OPropertyBag& operator=( const OPropertyBag& ); // never implemented protected: using ::cppu::OPropertySetHelper::getPropertyValues; using ::cppu::OPropertySetHelper::setPropertyValues; diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index 41ee54e70017..795b3b73a4a4 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.cxx @@ -21,7 +21,7 @@ #include <com/sun/star/io/XOutputStream.hpp> -#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> #include <comphelper/seekableinput.hxx> using namespace ::com::sun::star; @@ -93,7 +93,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl() throw uno::RuntimeException(); uno::Reference< io::XOutputStream > xTempOut( - io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()), + io::TempFile::create(comphelper::getComponentContext(m_xFactory)), uno::UNO_QUERY_THROW ); copyInputToOutput_Impl( m_xOriginalStream, xTempOut ); |