summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-03-19 13:08:47 +0200
committerNoel Grandin <noel@peralex.com>2013-03-20 07:32:53 +0200
commita066525b42a1ab8dc60e10a5d62819c259904f32 (patch)
tree0c21130ff82a482ab80de0fcc3c73be0125d06f5 /sfx2
parent6999a50efaaf802ccd4c7eb7957af17cc32602be (diff)
fdo#46808, Convert a bunch of comphelper::ComponentContext stuff
.. to Reference<XComponentContext> mostly in the dbaccess module, but it also affected some other modules. Change-Id: I09b3f6fe7a9b33498b11d98b5521b5aeeb8882be
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/frmload.hxx6
-rw-r--r--sfx2/source/appl/appserv.cxx9
-rw-r--r--sfx2/source/view/frame2.cxx6
-rw-r--r--sfx2/source/view/frmload.cxx16
4 files changed, 19 insertions, 18 deletions
diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx
index fe5874ab2758..35f106ee8b2e 100644
--- a/sfx2/inc/frmload.hxx
+++ b/sfx2/inc/frmload.hxx
@@ -31,7 +31,6 @@
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
@@ -40,7 +39,6 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/factory.hxx>
-#include <comphelper/componentcontext.hxx>
#include <comphelper/namedvaluecollection.hxx>
class SfxFilter;
@@ -48,10 +46,10 @@ class SfxFilterMatcher;
class SAL_DLLPRIVATE SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo >
{
- ::comphelper::ComponentContext m_aContext;
+ ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > m_aContext;
public:
- SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory );
+ SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext >& _rxContext );
SFX_DECL_XSERVICEINFO
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index bd813e0f4e34..f845a05e14b4 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -1157,14 +1157,15 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
// which conflicts, at the latest, with the framework's concept of loading into _blank frames.
// So, since we know that our frame loader can handle it, we skip the generic framework loader
// mechanism, and the type detection (which doesn't know about the Basic IDE).
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference< XSynchronousFrameLoader > xLoader( aContext.createComponent(
- SfxFrameLoader_Impl::impl_getStaticImplementationName() ), UNO_QUERY_THROW );
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ Reference< XSynchronousFrameLoader > xLoader(
+ xContext->getServiceManager()->createInstanceWithContext(SfxFrameLoader_Impl::impl_getStaticImplementationName(), xContext),
+ UNO_QUERY_THROW );
::comphelper::NamedValueCollection aLoadArgs;
aLoadArgs.put( "Model", pBasicIDE->GetModel() );
aLoadArgs.put( "URL", ::rtl::OUString( "private:factory/sbasic" ) );
- Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext.getUNOContext() ) );
+ Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( xContext ) );
if ( !xTargetFrame.is() )
xTargetFrame = SfxFrame::CreateBlankFrame();
ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" );
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index dbcafa187056..75964a5deeb3 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -244,9 +244,9 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nV
try
{
// create and initialize new top level frame for this window
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference < XDesktop2 > xDesktop = Desktop::create( aContext.getUNOContext() );
- Reference < XFrame > xFrame( aContext.createComponent( "com.sun.star.frame.Frame"), UNO_QUERY_THROW );
+ Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ Reference < XDesktop2 > xDesktop = Desktop::create( xContext );
+ Reference < XFrame > xFrame( xContext->getServiceManager()->createInstanceWithContext("com.sun.star.frame.Frame", xContext), UNO_QUERY_THROW );
Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW );
xFrame->initialize( xWin.get() );
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 26b1ec7a179a..7fb15389ef7d 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -49,6 +49,7 @@
#include <comphelper/interaction.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <framework/interaction.hxx>
#include <rtl/logfile.hxx>
@@ -87,6 +88,7 @@ using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::util::XCloseable;
using ::com::sun::star::document::XViewDataSupplier;
using ::com::sun::star::container::XIndexAccess;
@@ -95,8 +97,8 @@ using ::com::sun::star::frame::XController;
using ::com::sun::star::frame::XModel2;
/** === end UNO using === **/
-SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory )
- :m_aContext( _rxFactory )
+SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XComponentContext >& _rxContext )
+ :m_aContext( _rxContext )
{
}
@@ -115,7 +117,7 @@ const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUSt
return 0;
Reference< XTypeDetection > xDetect(
- m_aContext.createComponent( "com.sun.star.document.TypeDetection" ),
+ m_aContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", m_aContext),
UNO_QUERY_THROW);
::comphelper::NamedValueCollection aNewArgs;
@@ -160,7 +162,7 @@ const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( con
aQuery.put( "DocumentService", i_rServiceName );
const Reference< XContainerQuery > xQuery(
- m_aContext.createComponent( "com.sun.star.document.FilterFactory" ),
+ m_aContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.FilterFactory", m_aContext),
UNO_QUERY_THROW );
const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
@@ -582,7 +584,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
// create the new doc
const ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() );
- xModel.set( m_aContext.createComponent( sServiceName ), UNO_QUERY_THROW );
+ xModel.set( m_aContext->getServiceManager()->createInstanceWithContext(sServiceName, m_aContext), UNO_QUERY_THROW );
// load resp. init it
const Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW );
@@ -693,9 +695,9 @@ rtl::OUString SfxFrameLoader_Impl::impl_getStaticImplementationName()
}
/* Helper for registry */
-UNOREFERENCE< UNOXINTERFACE > SAL_CALL SfxFrameLoader_Impl::impl_createInstance( const UNOREFERENCE< UNOXMULTISERVICEFACTORY >& xServiceManager ) throw( UNOEXCEPTION )
+Reference< UNOXINTERFACE > SAL_CALL SfxFrameLoader_Impl::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( UNOEXCEPTION )
{
- return UNOREFERENCE< UNOXINTERFACE >( *new SfxFrameLoader_Impl( xServiceManager ) );
+ return Reference< XInterface >( *new SfxFrameLoader_Impl( comphelper::getComponentContext(xServiceManager) ) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */