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 /basctl/source | |
parent | e8a169c93d7e2443a2e56afe7e99cd0721a2c27b (diff) |
ComponentContext::getUnoContext -> getComponentContext simplification
...and some further clean-up.
Change-Id: If5dce53e382b56390c502d0d0d93fc06cbfe33ea
Diffstat (limited to 'basctl/source')
-rw-r--r-- | basctl/source/basicide/bastype2.cxx | 1 | ||||
-rw-r--r-- | basctl/source/basicide/doceventnotifier.cxx | 7 | ||||
-rw-r--r-- | basctl/source/basicide/documentenumeration.cxx | 9 | ||||
-rw-r--r-- | basctl/source/basicide/documentenumeration.hxx | 9 | ||||
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 3 | ||||
-rw-r--r-- | basctl/source/basicide/scriptdocument.cxx | 32 |
6 files changed, 35 insertions, 26 deletions
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index 725b721de4e4..bd9858a7525d 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -39,7 +39,6 @@ #include <com/sun/star/script/XLibraryContainerPassword.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <comphelper/processfactory.hxx> -#include <comphelper/componentcontext.hxx> #include <sfx2/dispatch.hxx> #include <map> diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx index 28133d1150a9..a36ce20a80aa 100644 --- a/basctl/source/basicide/doceventnotifier.cxx +++ b/basctl/source/basicide/doceventnotifier.cxx @@ -27,7 +27,6 @@ #include <tools/diagnose_ex.h> -#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <osl/mutex.hxx> @@ -209,9 +208,11 @@ namespace basctl xBroadcaster.set( m_xModel, UNO_QUERY_THROW ); else { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< com::sun::star::uno::XComponentContext > aContext( + comphelper::getProcessComponentContext() ); xBroadcaster.set( - aContext.createComponent( "com.sun.star.frame.GlobalEventBroadcaster" ), + aContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.frame.GlobalEventBroadcaster", aContext ), UNO_QUERY_THROW ); } diff --git a/basctl/source/basicide/documentenumeration.cxx b/basctl/source/basicide/documentenumeration.cxx index 87f521cc5393..1527a8a6931d 100644 --- a/basctl/source/basicide/documentenumeration.cxx +++ b/basctl/source/basicide/documentenumeration.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <tools/diagnose_ex.h> @@ -60,10 +61,10 @@ namespace basctl { namespace docs { //==================================================================== struct DocumentEnumeration_Data { - ::comphelper::ComponentContext aContext; + Reference< com::sun::star::uno::XComponentContext > aContext; const IDocumentDescriptorFilter* pFilter; - DocumentEnumeration_Data( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter ) + DocumentEnumeration_Data( Reference< com::sun::star::uno::XComponentContext > const & _rContext, const IDocumentDescriptorFilter* _pFilter ) :aContext( _rContext ) ,pFilter( _pFilter ) { @@ -74,7 +75,7 @@ namespace basctl { namespace docs { //= DocumentEnumeration //==================================================================== //-------------------------------------------------------------------- - DocumentEnumeration::DocumentEnumeration( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter ) + DocumentEnumeration::DocumentEnumeration( Reference< com::sun::star::uno::XComponentContext > const & _rContext, const IDocumentDescriptorFilter* _pFilter ) :m_pData( new DocumentEnumeration_Data( _rContext, _pFilter ) ) { } @@ -173,7 +174,7 @@ namespace basctl { namespace docs { try { - const Reference< XDesktop > xDesktop( m_pData->aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + const Reference< XDesktop > xDesktop( m_pData->aContext->getServiceManager()->createInstanceWithContext( "com.sun.star.frame.Desktop", m_pData->aContext ), UNO_QUERY_THROW ); const Reference< XFramesSupplier > xSuppFrames( xDesktop, UNO_QUERY_THROW ); const Reference< XFrames > xFrames( xSuppFrames->getFrames(), UNO_SET_THROW ); const Sequence< Reference< XFrame > > aFrames( xFrames->queryFrames( FrameSearchFlag::ALL ) ); diff --git a/basctl/source/basicide/documentenumeration.hxx b/basctl/source/basicide/documentenumeration.hxx index 4ee864626fed..cd4af37a4d87 100644 --- a/basctl/source/basicide/documentenumeration.hxx +++ b/basctl/source/basicide/documentenumeration.hxx @@ -22,12 +22,15 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XController.hpp> - -#include <comphelper/componentcontext.hxx> +#include <com/sun/star/uno/Reference.hxx> #include <memory> #include <vector> +namespace com { namespace sun { namespace star { namespace uno { + class XComponentContext; +} } } } + //........................................................................ namespace basctl { namespace docs { //........................................................................ @@ -75,7 +78,7 @@ namespace basctl { namespace docs { class DocumentEnumeration { public: - DocumentEnumeration( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter = NULL ); + DocumentEnumeration( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & _rContext, const IDocumentDescriptorFilter* _pFilter = NULL ); ~DocumentEnumeration(); /** retrieves a list of all currently known documents in the application diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 5500ae02a656..20b4bcd99105 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -56,7 +56,6 @@ #include <com/sun/star/ucb/NameClash.hpp> #include "com/sun/star/packages/manifest/XManifestWriter.hpp" #include <unotools/pathoptions.hxx> -#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/util/VetoException.hpp> @@ -1360,7 +1359,7 @@ void LibPage::ExportAsPackage( const String& aLibName ) // write into pipe: Reference<packages::manifest::XManifestWriter> xManifestWriter( xMSF->createInstance ( DEFINE_CONST_UNICODE("com.sun.star.packages.manifest.ManifestWriter") ), UNO_QUERY ); - Reference<io::XOutputStream> xPipe( io::Pipe::create(comphelper::ComponentContext(xMSF).getUNOContext()), UNO_QUERY_THROW ); + Reference<io::XOutputStream> xPipe( io::Pipe::create(comphelper::getComponentContext(xMSF)), UNO_QUERY_THROW ); xManifestWriter->writeManifestSequence( xPipe, Sequence< Sequence<beans::PropertyValue> >( &manifest[ 0 ], manifest.size() ) ); diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 751a33219215..dfede33a0f73 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -57,7 +57,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/documentinfo.hxx> -#include <comphelper/componentcontext.hxx> #include <osl/mutex.hxx> @@ -183,9 +182,9 @@ namespace basctl { _out_rModels.clear(); - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); FilterDocuments aFilter( _bVisibleOnly ); - docs::DocumentEnumeration aEnum( aContext, &aFilter ); + docs::DocumentEnumeration aEnum( + comphelper::getProcessComponentContext(), &aFilter ); aEnum.getDocuments( _out_rModels ); } @@ -624,20 +623,25 @@ namespace basctl if ( _eType == E_DIALOGS ) { // create dialog model - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< XComponentContext > aContext( + comphelper::getProcessComponentContext() ); Reference< XNameContainer > xDialogModel; if ( _rxExistingDialogModel.is() ) xDialogModel = _rxExistingDialogModel; else - if ( !aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel", xDialogModel ) ) - return false; + xDialogModel.set( + ( aContext->getServiceManager()-> + createInstanceWithContext( + "com.sun.star.awt.UnoControlDialogModel", + aContext ) ), + UNO_QUERY_THROW ); // import dialog model Reference< XInputStreamProvider > xISP( aElement, UNO_QUERY_THROW ); if ( !_rxExistingDialogModel.is() ) { Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW ); - ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() ); + ::xmlscript::importDialogModel( xInput, xDialogModel, aContext, isDocument() ? getDocument() : Reference< XModel >() ); } // set new name as property @@ -645,7 +649,7 @@ namespace basctl xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) ); // export dialog model - xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() ); + xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext, isDocument() ? getDocument() : Reference< XModel >() ); aElement <<= xISP; } @@ -747,17 +751,19 @@ namespace basctl return false; // create new dialog model - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XNameContainer > xDialogModel; - if ( !aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel", xDialogModel ) ) - return false; + Reference< XComponentContext > aContext( + comphelper::getProcessComponentContext() ); + Reference< XNameContainer > xDialogModel( + aContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.awt.UnoControlDialogModel", aContext ), + UNO_QUERY_THROW ); // set name property Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW ); xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) ); // export dialog model - _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() ); + _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext, isDocument() ? getDocument() : Reference< XModel >() ); // insert dialog into library xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) ); |