diff options
203 files changed, 1172 insertions, 1578 deletions
diff --git a/basctl/source/basicide/documentenumeration.cxx b/basctl/source/basicide/documentenumeration.cxx index 1527a8a6931d..0ac8d4220c51 100644 --- a/basctl/source/basicide/documentenumeration.cxx +++ b/basctl/source/basicide/documentenumeration.cxx @@ -20,7 +20,7 @@ #include "documentenumeration.hxx" -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -40,7 +40,8 @@ namespace basctl { namespace docs { using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::frame::XDesktop; + using ::com::sun::star::frame::Desktop; + using ::com::sun::star::frame::XDesktop2; using ::com::sun::star::container::XEnumerationAccess; using ::com::sun::star::container::XEnumeration; using ::com::sun::star::uno::Any; @@ -174,9 +175,8 @@ namespace basctl { namespace docs { try { - 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 Reference< XDesktop2 > xDesktop = Desktop::create( m_pData->aContext ); + const Reference< XFrames > xFrames( xDesktop->getFrames(), UNO_SET_THROW ); const Sequence< Reference< XFrame > > aFrames( xFrames->queryFrames( FrameSearchFlag::ALL ) ); lcl_getDocuments_nothrow( aFrames, _out_rDocuments, m_pData->pFilter ); diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx index 966a6ece6a30..e88f1bbefb31 100644 --- a/basctl/source/basicide/iderdll.cxx +++ b/basctl/source/basicide/iderdll.cxx @@ -39,6 +39,7 @@ #include <propbrw.hxx> #include <svl/srchitem.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> #include <boost/scoped_ptr.hpp> @@ -70,7 +71,7 @@ public: class DllInstance : public comphelper::scoped_disposing_solar_mutex_reset_ptr<Dll> { public: - DllInstance() : comphelper::scoped_disposing_solar_mutex_reset_ptr<Dll>(::com::sun::star::uno::Reference<com::sun::star::lang::XComponent>(comphelper::getProcessServiceFactory()->createInstance(OUString("com.sun.star.frame.Desktop")), ::com::sun::star::uno::UNO_QUERY_THROW), new Dll) + DllInstance() : comphelper::scoped_disposing_solar_mutex_reset_ptr<Dll>(Reference<lang::XComponent>( frame::Desktop::create(comphelper::getProcessComponentContext()), UNO_QUERY_THROW), new Dll) { } }; diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 5f0078d67660..7175fe93ebe3 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <svtools/ehdl.hxx> #include <svtools/sfxecode.hxx> #include <unotools/pathoptions.hxx> @@ -52,7 +53,9 @@ namespace basic /** === begin UNO using === **/ using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::frame::XModel; + using ::com::sun::star::frame::Desktop; using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::embed::XStorage; @@ -328,9 +331,8 @@ namespace basic // global constants // StarDesktop - Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); - pBasicManager->SetGlobalUNOConstant( "StarDesktop", - makeAny( xSMgr->createInstance("com.sun.star.frame.Desktop"))); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + pBasicManager->SetGlobalUNOConstant( "StarDesktop", makeAny( Desktop::create(xContext))); // (BasicLibraries and DialogLibraries have automatically been added in SetLibraryContainerInfo) diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx index d5c24667f39a..d1c34e4025c8 100644 --- a/basic/source/basmgr/vbahelper.cxx +++ b/basic/source/basmgr/vbahelper.cxx @@ -23,7 +23,7 @@ #include <map> #include <vector> #include <com/sun/star/container/XEnumeration.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -70,8 +70,7 @@ DocumentsEnumeration::DocumentsEnumeration( const uno::Reference< frame::XModel { uno::Reference< frame::XModuleManager2 > xModuleManager( lclCreateModuleManager() ); ::rtl::OUString aIdentifier = xModuleManager->identify( rxModel ); - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); uno::Reference< container::XEnumerationAccess > xComponentsEA( xDesktop->getComponents(), uno::UNO_SET_THROW ); uno::Reference< container::XEnumeration > xEnumeration( xComponentsEA->createEnumeration(), uno::UNO_SET_THROW ); while( xEnumeration->hasMoreElements() ) diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 173a3cee2ac1..d3da40a5a4a6 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -44,7 +44,7 @@ #include <com/sun/star/awt/XDialogProvider.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <basic/basicmanagerrepository.hxx> #include <basic/basmgr.hxx> @@ -433,8 +433,6 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit (void)bWrite; Reference< XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory() ); - if( !xMSF.is() ) - return; // We need at least 1 parameter if ( rPar.Count() < 2 ) @@ -473,8 +471,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit { return; } - Reference< XComponentContext > xContext( - comphelper::getComponentContext( xMSF ) ); + Reference< XComponentContext > xContext( comphelper::getComponentContext( xMSF ) ); // Import the DialogModel Reference< XInputStream > xInput( xISP->createInputStream() ); @@ -510,33 +507,30 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit // If we found the dialog then it belongs to the Search basic if ( !pFoundBasic ) { - Reference< frame::XDesktop > xDesktop( xMSF->createInstance(OUString("com.sun.star.frame.Desktop")), UNO_QUERY); + Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( xContext ); Reference< container::XEnumeration > xModels; - if ( xDesktop.is() ) + Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY ); + if ( xComponents.is() ) { - Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY ); - if ( xComponents.is() ) - { - xModels.set( xComponents->createEnumeration(), UNO_QUERY ); - } - if ( xModels.is() ) + xModels.set( xComponents->createEnumeration(), UNO_QUERY ); + } + if ( xModels.is() ) + { + while ( xModels->hasMoreElements() ) { - while ( xModels->hasMoreElements() ) + Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY ); + if ( xNextModel.is() ) { - Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY ); - if ( xNextModel.is() ) + BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel ); + if ( pMgr ) { - BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel ); - if ( pMgr ) - { - aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic ); - } - if ( aDlgLibAny.hasValue() ) - { - bDocDialog = true; - xModel = xNextModel; - break; - } + aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic ); + } + if ( aDlgLibAny.hasValue() ) + { + bDocDialog = true; + xModel = xNextModel; + break; } } } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index b192a4f12913..dc6688777f99 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -44,6 +44,7 @@ #include <basic/vbahelper.hxx> #include <cppuhelper/implbase3.hxx> #include <unotools/eventcfg.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/vba/XVBACompatibility.hpp> @@ -477,13 +478,8 @@ public: void QuitApplication() { - uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - { - uno::Reference< frame::XDesktop > xDeskTop( xFactory->createInstance( OUString( "com.sun.star.frame.Desktop" ) ), uno::UNO_QUERY ); - if ( xDeskTop.is() ) - xDeskTop->terminate(); - } + uno::Reference< frame::XDesktop2 > xDeskTop = frame::Desktop::create( comphelper::getProcessComponentContext() ); + xDeskTop->terminate(); } DECL_LINK( OnAsyncQuit, void* ); }; diff --git a/bridges/test/testoffice.cxx b/bridges/test/testoffice.cxx index 9d01beed3ced..0fca5082a61b 100644 --- a/bridges/test/testoffice.cxx +++ b/bridges/test/testoffice.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <cppuhelper/weak.hxx> @@ -128,11 +129,7 @@ void testWriter( const Reference < XComponent > & rCmp ) void testDocument( const Reference < XMultiServiceFactory > & rSmgr ) { - Reference < XComponentLoader > rLoader( - rSmgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ))), - UNO_QUERY ); - - OSL_ASSERT( rLoader.is() ); + Reference < XDesktop2 > rLoader = Desktop::create( comphelper::getComponentContext(rSmgr) ); sal_Char *urls[] = { "private:factory/swriter", diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx index 5d4e8a593b46..67ff9fa490fe 100644 --- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx +++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> //............................................................................. namespace chart @@ -52,14 +52,9 @@ CreationWizardUnoDlg::CreationWizardUnoDlg( const uno::Reference< uno::XComponen , m_pDialog( 0 ) , m_bUnlockControllersOnExecute(false) { - uno::Reference< frame::XDesktop > xDesktop( - m_xCC->getServiceManager()->createInstanceWithContext( - "com.sun.star.frame.Desktop" , m_xCC ), uno::UNO_QUERY ); - if( xDesktop.is() ) - { - uno::Reference< frame::XTerminateListener > xListener( this ); - xDesktop->addTerminateListener( xListener ); - } + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xCC); + uno::Reference< frame::XTerminateListener > xListener( this ); + xDesktop->addTerminateListener( xListener ); } CreationWizardUnoDlg::~CreationWizardUnoDlg() { @@ -290,14 +285,9 @@ void SAL_CALL CreationWizardUnoDlg::disposing() try { - uno::Reference< frame::XDesktop > xDesktop( - m_xCC->getServiceManager()->createInstanceWithContext( - "com.sun.star.frame.Desktop" , m_xCC ), uno::UNO_QUERY ); - if( xDesktop.is() ) - { - uno::Reference< frame::XTerminateListener > xListener( this ); - xDesktop->removeTerminateListener( xListener ); - } + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xCC); + uno::Reference< frame::XTerminateListener > xListener( this ); + xDesktop->removeTerminateListener( xListener ); } catch( const uno::Exception & ex ) { diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index bfb89202cbbe..7f66efbc628b 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1323,13 +1323,12 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) return bReturn; // handle accelerators - if( ! m_apAccelExecute.get() && m_xFrame.is() && m_xCC.is() && m_xCC->getServiceManager().is() ) + if( ! m_apAccelExecute.get() && m_xFrame.is() && m_xCC.is() ) { m_apAccelExecute.reset( ::svt::AcceleratorExecute::createAcceleratorHelper()); OSL_ASSERT( m_apAccelExecute.get()); if( m_apAccelExecute.get() ) - m_apAccelExecute->init( - uno::Reference< lang::XMultiServiceFactory >( m_xCC->getServiceManager(), uno::UNO_QUERY ), m_xFrame ); + m_apAccelExecute->init( m_xCC, m_xFrame ); } KeyCode aKeyCode( rKEvt.GetKeyCode()); diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx index 4dd42bddb931..dfbd2070d9a2 100644 --- a/comphelper/source/misc/officerestartmanager.cxx +++ b/comphelper/source/misc/officerestartmanager.cxx @@ -20,7 +20,7 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/awt/XRequestCallback.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <comphelper_module.hxx> @@ -129,11 +129,7 @@ void SAL_CALL OOfficeRestartManager::notify( const uno::Any& /* aData */ ) if ( m_xContext.is() ) { - uno::Reference< lang::XMultiComponentFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_SET_THROW ); - uno::Reference< frame::XDesktop > xDesktop( - xFactory->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), m_xContext ), - uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xContext); // Turn Quickstarter veto off uno::Reference< beans::XPropertySet > xPropertySet( xDesktop, uno::UNO_QUERY_THROW ); diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx index b7d0abd075d5..3ab3f752719d 100644 --- a/connectivity/source/cpool/ZPoolCollection.cxx +++ b/connectivity/source/cpool/ZPoolCollection.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/reflection/ProxyFactory.hpp> #include <com/sun/star/sdbc/DriverManager.hpp> #include <comphelper/extract.hxx> @@ -72,13 +73,13 @@ static const ::rtl::OUString& getEnableNodeName() } //-------------------------------------------------------------------- -OPoolCollection::OPoolCollection(const Reference< XMultiServiceFactory >& _rxFactory) - :m_xServiceFactory(_rxFactory) +OPoolCollection::OPoolCollection(const Reference< XComponentContext >& _rxContext) + :m_xContext(_rxContext) { // bootstrap all objects supporting the .sdb.Driver service - m_xManager = DriverManager::create( comphelper::getComponentContext(m_xServiceFactory) ); + m_xManager = DriverManager::create( m_xContext ); - m_xProxyFactory = ProxyFactory::create( comphelper::getComponentContext(m_xServiceFactory) ); + m_xProxyFactory = ProxyFactory::create( m_xContext ); Reference<XPropertySet> xProp(getConfigPoolRoot(),UNO_QUERY); if ( xProp.is() ) @@ -87,9 +88,8 @@ OPoolCollection::OPoolCollection(const Reference< XMultiServiceFactory >& _rxF osl_atomic_increment( &m_refCount ); { - m_xDesktop = Reference< ::com::sun::star::frame::XDesktop>( m_xServiceFactory->createInstance(::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY); - if ( m_xDesktop.is() ) - m_xDesktop->addTerminateListener(this); + m_xDesktop = ::com::sun::star::frame::Desktop::create( m_xContext ); + m_xDesktop->addTerminateListener(this); } osl_atomic_decrement( &m_refCount ); @@ -164,7 +164,7 @@ Sequence< ::rtl::OUString > SAL_CALL OPoolCollection::getSupportedServiceNames( //---------------------------------------OPoolCollection---------------------------------- Reference< XInterface > SAL_CALL OPoolCollection::CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) { - return static_cast<XDriverManager*>(new OPoolCollection(_rxFactory)); + return static_cast<XDriverManager*>(new OPoolCollection(comphelper::getComponentContext(_rxFactory))); } //-------------------------------------------------------------------------- @@ -332,8 +332,7 @@ OConnectionPool* OPoolCollection::getConnectionPool(const ::rtl::OUString& _sImp Reference< XInterface > OPoolCollection::createWithServiceFactory(const ::rtl::OUString& _rPath) const { return createWithProvider( - com::sun::star::configuration::theDefaultProvider::get( - comphelper::getComponentContext(m_xServiceFactory)), + com::sun::star::configuration::theDefaultProvider::get(m_xContext), _rPath); } //------------------------------------------------------------------------ diff --git a/connectivity/source/cpool/ZPoolCollection.hxx b/connectivity/source/cpool/ZPoolCollection.hxx index 6fb05bb31339..b601c53a21e2 100644 --- a/connectivity/source/cpool/ZPoolCollection.hxx +++ b/connectivity/source/cpool/ZPoolCollection.hxx @@ -29,7 +29,8 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XEventListener.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/reflection/XProxyFactory.hpp> #include <comphelper/stl_types.hxx> @@ -65,11 +66,11 @@ namespace connectivity MapDriver2DriverRef m_aDriverProxies; ::osl::Mutex m_aMutex; OConnectionPools m_aPools; // the driver pools - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverManager2 > m_xManager; ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XProxyFactory > m_xProxyFactory; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xConfigNode; // config node for generel connection pooling - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> m_xDesktop; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2> m_xDesktop; private: OPoolCollection(); // never implemented @@ -77,7 +78,7 @@ namespace connectivity int operator= (const OPoolCollection&); // never implemented OPoolCollection( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); // some configuration helper methods ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createWithServiceFactory(const ::rtl::OUString& _rPath) const; diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx index 6576fc1a729b..3ba98f43182c 100644 --- a/connectivity/source/drivers/calc/CConnection.cxx +++ b/connectivity/source/drivers/calc/CConnection.cxx @@ -24,6 +24,7 @@ #include "resource/calc_res.hrc" #include "resource/sharedresources.hxx" #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <tools/urlobj.hxx> @@ -32,6 +33,7 @@ #include <unotools/pathoptions.hxx> #include <connectivity/dbexception.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <comphelper/processfactory.hxx> #include <rtl/logfile.hxx> using namespace connectivity::calc; @@ -126,13 +128,7 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() aArgs[nPos].Value <<= m_sPassword; } - Reference< XComponentLoader > xDesktop( getDriver()->getFactory()->createInstance( - ::rtl::OUString("com.sun.star.frame.Desktop")), UNO_QUERY ); - if (!xDesktop.is()) - { - OSL_FAIL("no desktop"); - throw SQLException(); - } + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getDriver()->getFactory()) ); Reference< XComponent > xComponent; Any aLoaderException; try diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index a805bfcf7756..25087d2ebd24 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -33,7 +33,7 @@ #include <jvmfwk/framework.h> #include <com/sun/star/reflection/XProxyFactory.hpp> #include <com/sun/star/embed/XStorage.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/util/XFlushable.hpp> #include "HTerminateListener.hxx" @@ -372,13 +372,10 @@ namespace connectivity static Reference< XTerminateListener> s_xTerminateListener; if( !s_xTerminateListener.is() ) { - Reference< XDesktop > xDesktop( m_xFactory->createInstance( ::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(m_xFactory) ); - if( xDesktop.is() ) - { - s_xTerminateListener = new OConnectionController(this); - xDesktop->addTerminateListener(s_xTerminateListener); - } + s_xTerminateListener = new OConnectionController(this); + xDesktop->addTerminateListener(s_xTerminateListener); } Reference< XComponent> xIfc = new OHsqlConnection( this, xOrig, comphelper::getComponentContext(m_xFactory) ); xConnection.set(xIfc,UNO_QUERY); diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx index 04ee1195631d..9f32fdb54329 100644 --- a/connectivity/source/drivers/kab/KDriver.cxx +++ b/connectivity/source/drivers/kab/KDriver.cxx @@ -45,8 +45,8 @@ using namespace connectivity::kab; // = KabImplModule // ======================================================================= // -------------------------------------------------------------------------------- -KabImplModule::KabImplModule( const Reference< XMultiServiceFactory >& _rxFactory ) - :m_xORB(_rxFactory) +KabImplModule::KabImplModule( const Reference< XComponentContext >& _rxContext ) + :m_xContext(_rxContext) ,m_bAttemptedLoadModule(false) ,m_bAttemptedInitialize(false) ,m_hConnectorModule(NULL) @@ -55,7 +55,7 @@ KabImplModule::KabImplModule( const Reference< XMultiServiceFactory >& _rxFactor ,m_pApplicationShutdownFunc(NULL) ,m_pKDEVersionCheckFunc(NULL) { - if ( !m_xORB.is() ) + if ( !m_xContext.is() ) throw NullPointerException(); } @@ -181,8 +181,7 @@ bool KabImplModule::impl_doAllowNewKDEVersion() try { Reference< XMultiServiceFactory > xConfigProvider( - com::sun::star::configuration::theDefaultProvider::get( - comphelper::getComponentContext( m_xORB ) ) ); + com::sun::star::configuration::theDefaultProvider::get( m_xContext ) ); Sequence< Any > aCreationArgs(1); aCreationArgs[0] <<= PropertyValue( ::rtl::OUString( "nodepath" ), @@ -303,20 +302,18 @@ void KabImplModule::shutdown() // = KabDriver // ======================================================================= KabDriver::KabDriver( - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) : KDriver_BASE(m_aMutex), - m_xMSFactory(_rxFactory), - m_aImplModule(_rxFactory) + m_xContext(_rxContext), + m_aImplModule(_rxContext) { - if ( !m_xMSFactory.is() ) + if ( !m_xContext.is() ) throw NullPointerException(); osl_atomic_increment( &m_refCount ); try { - Reference< XDesktop > xDesktop( - m_xMSFactory->createInstance( ::rtl::OUString( "com.sun.star.frame.Desktop" ) ), - UNO_QUERY_THROW ); + Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext); xDesktop->addTerminateListener( this ); } catch( const Exception& ) @@ -462,7 +459,7 @@ const sal_Char* KabDriver::impl_getAsciiImplementationName() // -------------------------------------------------------------------------------- Reference< XInterface > SAL_CALL KabDriver::Create( const Reference< XMultiServiceFactory >& _rxFactory ) throw( Exception ) { - return *(new KabDriver(_rxFactory)); + return *(new KabDriver( comphelper::getComponentContext(_rxFactory))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/kab/KDriver.hxx b/connectivity/source/drivers/kab/KDriver.hxx index 1243f7425185..678f5a835924 100644 --- a/connectivity/source/drivers/kab/KDriver.hxx +++ b/connectivity/source/drivers/kab/KDriver.hxx @@ -47,8 +47,8 @@ namespace connectivity class KabImplModule { private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; /// Did we already attempt to load the module and to retrieve the symbols? bool m_bAttemptedLoadModule; @@ -62,7 +62,7 @@ namespace connectivity KDEVersionCheckFunction m_pKDEVersionCheckFunc; public: - KabImplModule( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); + KabImplModule( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); /** determines whether there is a KDE present in the environment */ @@ -151,8 +151,8 @@ namespace connectivity ::osl::Mutex m_aMutex; // mutex is need to control member access OWeakRefArray m_xConnections; // vector containing a list of all the // KabConnection objects for this Driver - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xMSFactory; // the multi-service factory + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; // the multi-service factory KabImplModule m_aImplModule; public: @@ -163,7 +163,7 @@ namespace connectivity static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - getComponentContext() const { return comphelper::getComponentContext(m_xMSFactory); } + getComponentContext() const { return m_xContext; } /** returns the driver's implementation name (being pure ASCII) for reference in various places */ @@ -174,7 +174,7 @@ namespace connectivity static ::rtl::OUString impl_getConfigurationSettingsPath(); protected: - KabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + KabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); // OComponentHelper virtual void SAL_CALL disposing(void); diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx index ea60ded3156c..a2adc78d11b2 100644 --- a/connectivity/source/drivers/macab/MacabDriver.cxx +++ b/connectivity/source/drivers/macab/MacabDriver.cxx @@ -27,6 +27,7 @@ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> #include "resource/macab_res.hrc" +#include <comphelper/processfactory.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -40,14 +41,11 @@ using namespace connectivity::macab; // = MacabImplModule // ======================================================================= // -------------------------------------------------------------------------------- -MacabImplModule::MacabImplModule( const Reference< XMultiServiceFactory >& _rxFactory ) - :m_xORB(_rxFactory) - ,m_bAttemptedLoadModule(false) +MacabImplModule::MacabImplModule( const Reference< XMultiServiceFactory >& _rxContext ) + :m_bAttemptedLoadModule(false) ,m_hConnectorModule(NULL) ,m_pConnectionFactoryFunc(NULL) { - if ( !m_xORB.is() ) - throw NullPointerException(); } // -------------------------------------------------------------------------------- @@ -172,20 +170,18 @@ void MacabImplModule::shutdown() // = MacabDriver // ======================================================================= MacabDriver::MacabDriver( - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) : MacabDriver_BASE(m_aMutex), - m_xMSFactory(_rxFactory), + m_xContext(_rxContext), m_aImplModule(_rxFactory) { - if ( !m_xMSFactory.is() ) + if ( !m_xContext.is() ) throw NullPointerException(); osl_atomic_increment( &m_refCount ); try { - Reference< XDesktop > xDesktop( - m_xMSFactory->createInstance( ::rtl::OUString( "com.sun.star.frame.Desktop" ) ), - UNO_QUERY_THROW ); + Reference< XDesktop2 > xDesktop = frame::Desktop::create( m_xContext ); xDesktop->addTerminateListener( this ); } catch( const Exception& ) @@ -331,7 +327,7 @@ const sal_Char* MacabDriver::impl_getAsciiImplementationName() // -------------------------------------------------------------------------------- Reference< XInterface > SAL_CALL MacabDriver::Create( const Reference< XMultiServiceFactory >& _rxFactory ) throw( Exception ) { - return *(new MacabDriver(_rxFactory)); + return *(new MacabDriver(comphelper::getComponentContext(_rxFactory))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabDriver.hxx b/connectivity/source/drivers/macab/MacabDriver.hxx index cbfe0c035bdc..d1d6fe24515b 100644 --- a/connectivity/source/drivers/macab/MacabDriver.hxx +++ b/connectivity/source/drivers/macab/MacabDriver.hxx @@ -23,7 +23,6 @@ #include <com/sun/star/sdbc/XDriver.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> -#include <comphelper/processfactory.hxx> #include <cppuhelper/compbase3.hxx> #include <osl/module.h> @@ -49,16 +48,13 @@ namespace connectivity class MacabImplModule { private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - /// Did we already attempt to load the module and to retrieve the symbols? bool m_bAttemptedLoadModule; oslModule m_hConnectorModule; ConnectionFactoryFunction m_pConnectionFactoryFunc; public: - MacabImplModule( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); + MacabImplModule(); /** determines whether there is a mac OS present in the environment */ @@ -124,8 +120,8 @@ namespace connectivity ::osl::Mutex m_aMutex; // mutex is need to control member access OWeakRefArray m_xConnections; // vector containing a list of all the // MacabConnection objects for this Driver - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xMSFactory; // the multi-service factory + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; // the multi-service factory MacabImplModule m_aImplModule; public: @@ -136,7 +132,7 @@ namespace connectivity static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - getComponentContext() const { return comphelper::getComponentContext(m_xMSFactory); } + getComponentContext() const { return m_xContext; } /** returns the driver's implementation name (being pure ASCII) for reference in various places */ @@ -147,7 +143,7 @@ namespace connectivity static ::rtl::OUString impl_getConfigurationSettingsPath(); protected: - MacabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + MacabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); // OComponentHelper virtual void SAL_CALL disposing(void); diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx index 389aa6dcd546..be8d8e637ae2 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx @@ -19,7 +19,7 @@ #include "MNSTerminateListener.hxx" #include <comphelper/processfactory.hxx> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include "bootstrap/MNSInit.hxx" @@ -63,15 +63,8 @@ void SAL_CALL MNSTerminateListener::notifyTermination( const EventObject& /*aEve void MNSTerminateListener::addTerminateListener() { - Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - - if( xFact.is() ) - { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY ); - - if( xDesktop.is() ) - xDesktop->addTerminateListener(mxTerminateListener); - } + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + xDesktop->addTerminateListener(mxTerminateListener); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index e261ad09a8d6..d9125aff8927 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -32,6 +32,7 @@ #include <svl/stritem.hxx> #include "svtools/treelistentry.hxx" #include <com/sun/star/embed/StorageFactory.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp> #include <sal/macros.h> @@ -77,7 +78,6 @@ using namespace com::sun::star; //----------------------------------------------- static ::rtl::OUString SERVICE_UICONFIGMGR (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager" )); -static ::rtl::OUString SERVICE_DESKTOP (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" )); static ::rtl::OUString MODULEPROP_SHORTNAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" )); static ::rtl::OUString MODULEPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryUIName" )); @@ -839,7 +839,7 @@ void SfxAcceleratorConfigPage::InitAccCfg() m_xFrame = GetFrame(); if ( !m_xFrame.is() ) { - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(m_xSMGR->createInstance(SERVICE_DESKTOP), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) ); m_xFrame = xDesktop->getActiveFrame(); } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index aadccd82cb94..3b4e49f6f572 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -67,7 +67,7 @@ #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/UICommandDescription.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> #include <com/sun/star/ui/XUIConfigurationListener.hpp> @@ -760,15 +760,13 @@ SfxTabPage *CreateSvxEventConfigPage( Window *pParent, const SfxItemSet& rSet ) sal_Bool impl_showKeyConfigTabPage( const css::uno::Reference< css::frame::XFrame >& xFrame ) { - static ::rtl::OUString SERVICENAME_DESKTOP ("com.sun.star.frame.Desktop" ); static ::rtl::OUString MODULEID_STARTMODULE ("com.sun.star.frame.StartModule" ); try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XModuleManager2 > xMM (css::frame::ModuleManager::create(xContext)); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); + css::uno::Reference< css::frame::XModuleManager2 > xMM = css::frame::ModuleManager::create(xContext); if (xFrame.is()) { @@ -1650,8 +1648,6 @@ void SvxConfigPage::Reset( const SfxItemSet& ) uno::Reference < css::ui::XUIConfigurationManager > xCfgMgr; uno::Reference < css::ui::XUIConfigurationManager > xDocCfgMgr; - uno::Reference< lang::XMultiServiceFactory > xServiceManager( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW ); @@ -1780,10 +1776,8 @@ void SvxConfigPage::Reset( const SfxItemSet& ) uno::Sequence< uno::Reference< frame::XFrame > > aFrameList; try { - uno::Reference< frame::XFramesSupplier > xFramesSupplier( - xServiceManager->createInstance( - OUString( "com.sun.star.frame.Desktop" ) ), - uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( + xContext ); uno::Reference< frame::XFrames > xFrames = xFramesSupplier->getFrames(); @@ -1876,20 +1870,17 @@ void SvxConfigPage::Reset( const SfxItemSet& ) ::rtl::OUString sModuleID; try { - uno::Reference< lang::XMultiServiceFactory > xServiceManager( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( + ::comphelper::getProcessComponentContext() ); - uno::Reference< frame::XFramesSupplier > xFramesSupplier( - xServiceManager->createInstance( - OUString( "com.sun.star.frame.Desktop" ) ), - uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( + xContext ); if ( !_inout_rxFrame.is() ) - _inout_rxFrame = xFramesSupplier->getActiveFrame(); + _inout_rxFrame = xDesktop->getActiveFrame(); if ( !_inout_rxFrame.is() ) { - uno::Reference< frame::XDesktop > xDesktop( xFramesSupplier, uno::UNO_QUERY_THROW ); _inout_rxFrame = xDesktop->getCurrentFrame(); } @@ -1903,7 +1894,7 @@ void SvxConfigPage::Reset( const SfxItemSet& ) } uno::Reference< css::frame::XModuleManager2 > xModuleManager( - css::frame::ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ); + css::frame::ModuleManager::create( xContext ) ); try { diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 4043252a4967..3b0344c1a3f0 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/script/browse/XBrowseNodeFactory.hpp> #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp> #include <com/sun/star/frame/ModuleManager.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/document/XScriptInvocationContext.hpp> @@ -802,12 +802,7 @@ Reference< XInterface > SfxConfigGroupListBox_Impl::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName ) { Reference< XInterface > xModel; - Reference< lang::XMultiComponentFactory > mcf = - xCtx->getServiceManager(); - Reference< frame::XDesktop > desktop ( - mcf->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ), xCtx ), - UNO_QUERY ); + Reference< frame::XDesktop2 > desktop = frame::Desktop::create( xCtx ); Reference< container::XEnumerationAccess > componentsAccess = desktop->getComponents(); diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx index 8020deb3ecd6..fa994c25cad6 100644 --- a/cui/source/customize/eventdlg.cxx +++ b/cui/source/customize/eventdlg.cxx @@ -20,6 +20,7 @@ #include <svtools/svmedit.hxx> #include <tools/diagnose_ex.h> #include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/GlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XModuleManager.hpp> @@ -179,10 +180,8 @@ IMPL_LINK( SvxEventConfigPage, SelectHdl_Impl, ListBox *, pBox ) { bool isReadonly = sal_False; - uno::Reference< frame::XFramesSupplier > xFramesSupplier( - ::comphelper::getProcessServiceFactory()->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), - uno::UNO_QUERY ); + uno::Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( + ::comphelper::getProcessComponentContext() ); uno::Reference< frame::XFrame > xFrame = xFramesSupplier->getActiveFrame(); diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index dfa8af78f897..658c81a822f4 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -44,7 +44,7 @@ #include <com/sun/star/script/browse/XBrowseNodeFactory.hpp> #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp> #include <com/sun/star/frame/ModuleManager.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> @@ -591,12 +591,7 @@ SvxConfigGroupListBox::getDocumentModel( Reference< XComponentContext >& xCtx, OUString& docName ) { Reference< XInterface > xModel; - Reference< lang::XMultiComponentFactory > mcf = - xCtx->getServiceManager(); - Reference< frame::XDesktop > desktop ( - mcf->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), xCtx ), - UNO_QUERY ); + Reference< frame::XDesktop2 > desktop = Desktop::create(xCtx); Reference< container::XEnumerationAccess > componentsAccess = desktop->getComponents(); diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index 3ce1ba13ce7c..6430658f0b09 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -26,7 +26,7 @@ // UNO-Stuff #include <comphelper/processfactory.hxx> #include <com/sun/star/awt/XBitmap.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/document/XLinkTargetSupplier.hpp> @@ -244,66 +244,58 @@ sal_Bool SvxHlinkDlgMarkWnd::RefreshFromDoc( OUString aURL ) { mnError = LERR_NOERROR; - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); + uno::Reference< lang::XComponent > xComp; + + if( !aURL.isEmpty() ) { - uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), - uno::UNO_QUERY ); - if( xDesktop.is() ) + // load from url + uno::Reference< frame::XComponentLoader > xLoader( xDesktop, uno::UNO_QUERY ); + if( xLoader.is() ) { - uno::Reference< lang::XComponent > xComp; - - if( !aURL.isEmpty() ) - { - // load from url - uno::Reference< frame::XComponentLoader > xLoader( xDesktop, uno::UNO_QUERY ); - if( xLoader.is() ) - { - try - { - uno::Sequence< beans::PropertyValue > aArg(1); - aArg.getArray()[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "Hidden" )); - aArg.getArray()[0].Value <<= (sal_Bool) sal_True; - xComp = xLoader->loadComponentFromURL( aURL, OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0, aArg ); - } - catch( const io::IOException& ) - { - - } - catch( const lang::IllegalArgumentException& ) - { - - } - } - } - else + try { - // the component with user focus ( current document ) - xComp = xDesktop->getCurrentComponent(); + uno::Sequence< beans::PropertyValue > aArg(1); + aArg.getArray()[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "Hidden" )); + aArg.getArray()[0].Value <<= (sal_Bool) sal_True; + xComp = xLoader->loadComponentFromURL( aURL, OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0, aArg ); } - - if( xComp.is() ) + catch( const io::IOException& ) { - uno::Reference< document::XLinkTargetSupplier > xLTS( xComp, uno::UNO_QUERY ); - if( xLTS.is() ) - { - if( FillTree( xLTS->getLinks() ) == 0 ) - mnError = LERR_NOENTRIES; - } - else - mnError = LERR_DOCNOTOPEN; - - if ( !aURL.isEmpty() ) - xComp->dispose(); } - else + catch( const lang::IllegalArgumentException& ) { - if( !aURL.isEmpty() ) - mnError=LERR_DOCNOTOPEN; + } } } + else + { + // the component with user focus ( current document ) + xComp = xDesktop->getCurrentComponent(); + } + + if( xComp.is() ) + { + uno::Reference< document::XLinkTargetSupplier > xLTS( xComp, uno::UNO_QUERY ); + + if( xLTS.is() ) + { + if( FillTree( xLTS->getLinks() ) == 0 ) + mnError = LERR_NOENTRIES; + } + else + mnError = LERR_DOCNOTOPEN; + + if ( !aURL.isEmpty() ) + xComp->dispose(); + } + else + { + if( !aURL.isEmpty() ) + mnError=LERR_DOCNOTOPEN; + } return (mnError==0); } /************************************************************************* diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index c3ee4883e789..f4b1e9480cf1 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/script/provider/ScriptErrorRaisedException.hpp> #include <com/sun/star/script/provider/ScriptExceptionRaisedException.hpp> #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/script/XInvocation.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> @@ -252,12 +253,7 @@ Reference< XInterface > SFTreeListBox::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName ) { Reference< XInterface > xModel; - Reference< lang::XMultiComponentFactory > mcf = - xCtx->getServiceManager(); - Reference< frame::XDesktop > desktop ( - mcf->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ), xCtx ), - UNO_QUERY ); + Reference< frame::XDesktop2 > desktop = frame::Desktop::create(xCtx); Reference< container::XEnumerationAccess > componentsAccess = desktop->getComponents(); diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx index ee6fa4069664..36a02501d356 100644 --- a/cui/source/inc/treeopt.hxx +++ b/cui/source/inc/treeopt.hxx @@ -129,7 +129,6 @@ struct LastPageSaver // class OfaTreeOptionsDialog -------------------------------------------- namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } } -namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } } namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } } struct OptionsPageInfo; @@ -179,8 +178,6 @@ private: void LoadExtensionOptions( const rtl::OUString& rExtensionId ); rtl::OUString GetModuleIdentifier( const com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory >& xMFac, - const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame ); Module* LoadModule( const rtl::OUString& rModuleIdentifier ); VectorOfNodes LoadNodes( Module* pModule, const rtl::OUString& rExtensionId ); diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index c1539fccf9d2..10db1d46f87a 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/util/URLTransformer.hpp> @@ -324,13 +324,12 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl) IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl) { - uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference < uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); try { uno::Reference< lang::XMultiServiceFactory > xConfigProvider( - com::sun::star::configuration::theDefaultProvider::get( - comphelper::getProcessComponentContext() ) ); + com::sun::star::configuration::theDefaultProvider::get( xContext ) ); beans::NamedValue aProperty; aProperty.Name = "nodepath"; @@ -347,14 +346,11 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl) util::URL aURL; xNameAccess->getByName("URL") >>= aURL.Complete; - uno::Reference < util::XURLTransformer > xTransformer( - util::URLTransformer::create( comphelper::getProcessComponentContext() ) ); + uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create( xContext ) ); xTransformer->parseStrict(aURL); - uno::Reference < frame::XDesktop > xDesktop( - xFactory->createInstance( "com.sun.star.frame.Desktop" ), - uno::UNO_QUERY_THROW ); + uno::Reference < frame::XDesktop2 > xDesktop = frame::Desktop::create( xContext ); uno::Reference< frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), uno::UNO_QUERY ); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index df853efc0c43..30cffee230f2 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -55,7 +55,7 @@ #include <com/sun/star/awt/XContainerWindowProvider.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/loader/CannotActivateFactoryException.hpp> #include <com/sun/star/util/XMacroExpander.hpp> @@ -1490,13 +1490,11 @@ rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame ) { rtl::OUString sIdentifier; Reference < XFrame > xCurrentFrame( _xFrame ); - Reference < XModuleManager2 > xModuleManager( ModuleManager::create(::comphelper::getProcessComponentContext()) ); + Reference < XModuleManager2 > xModuleManager = ModuleManager::create(::comphelper::getProcessComponentContext()); if ( !xCurrentFrame.is() ) { - Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - if ( xDesktop.is() ) - xCurrentFrame = xDesktop->getCurrentFrame(); + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + xCurrentFrame = xDesktop->getCurrentFrame(); } if ( xCurrentFrame.is() ) @@ -1599,7 +1597,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) rtl::OUString aFactory = getCurrentFactory_Impl( _xFrame ); - rtl::OUString sTemp = GetModuleIdentifier( comphelper::getProcessServiceFactory(), _xFrame ); + rtl::OUString sTemp = GetModuleIdentifier( _xFrame ); DBG_ASSERT( sTemp == aFactory, "S H I T!!!" ); // Writer and Writer/Web options @@ -1927,8 +1925,7 @@ void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtension // when called by Tools - Options then load nodes of active module if ( rExtensionId.isEmpty() ) { - Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory(); - pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ) ); + pModule = LoadModule( GetModuleIdentifier( Reference< XFrame >() ) ); } VectorOfNodes aNodeList = LoadNodes( pModule, rExtensionId ); @@ -1937,19 +1934,17 @@ void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtension delete pModule; } -rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier( - const Reference< XMultiServiceFactory >& xMFac, const Reference< XFrame >& rFrame ) +rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier( const Reference< XFrame >& rFrame ) { rtl::OUString sModule; Reference < XFrame > xCurrentFrame( rFrame ); - Reference < XModuleManager2 > xModuleManager( ModuleManager::create(comphelper::getComponentContext(xMFac)) ); + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + Reference < XModuleManager2 > xModuleManager = ModuleManager::create(xContext); if ( !xCurrentFrame.is() ) { - Reference < XDesktop > xDesktop( xMFac->createInstance( - "com.sun.star.frame.Desktop" ), UNO_QUERY ); - if ( xDesktop.is() ) - xCurrentFrame = xDesktop->getCurrentFrame(); + Reference < XDesktop2 > xDesktop = Desktop::create( xContext ); + xCurrentFrame = xDesktop->getCurrentFrame(); } if ( xCurrentFrame.is() ) diff --git a/dbaccess/inc/dataview.hxx b/dbaccess/inc/dataview.hxx index 11e7fc0291be..70fcf034af6f 100644 --- a/dbaccess/inc/dataview.hxx +++ b/dbaccess/inc/dataview.hxx @@ -21,7 +21,7 @@ #include "dbaccessdllapi.h" -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <svtools/acceleratorexecute.hxx> #include <sal/macros.h> #include <vcl/fixed.hxx> @@ -34,7 +34,7 @@ namespace dbaui class IController; class DBACCESS_DLLPUBLIC ODataView : public Window { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; // the service factory to work with + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; // the service factory to work with protected: IController& m_rController; // the controller in where we resides in @@ -44,7 +44,7 @@ namespace dbaui public: ODataView( Window* pParent, IController& _rController, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& , + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& , WinBits nStyle = 0 ); virtual ~ODataView(); @@ -63,7 +63,7 @@ namespace dbaui */ virtual void resizeControls(const Size& /*_rDiff*/) { Resize(); } - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xServiceFactory;} + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() { return m_xContext;} // the default implementation simply calls resizeAll( GetSizePixel() ) virtual void Resize(); diff --git a/dbaccess/qa/extras/macros-test.cxx b/dbaccess/qa/extras/macros-test.cxx index 4be3e655c455..b3f30b9f432c 100644 --- a/dbaccess/qa/extras/macros-test.cxx +++ b/dbaccess/qa/extras/macros-test.cxx @@ -33,6 +33,7 @@ #include <unotest/macros_test.hxx> #include <rtl/strbuf.hxx> #include <osl/file.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <sfx2/app.hxx> #include <sfx2/docfilt.hxx> @@ -99,9 +100,7 @@ void DBAccessTest::setUp() // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure, // which is a private symbol to us, gets called - mxDesktop = Reference<com::sun::star::frame::XDesktop>( getMultiServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - CPPUNIT_ASSERT(mxDesktop.is()); + mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); } void DBAccessTest::tearDown() diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index c4c625fde1d4..b5372d42f0d0 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XImporter.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> @@ -97,11 +97,11 @@ namespace dbaccess class DatabaseDocumentLoader : public DatabaseDocumentLoader_Base { private: - Reference< XDesktop > m_xDesktop; + Reference< XDesktop2 > m_xDesktop; ::std::list< const ODatabaseModelImpl* > m_aDatabaseDocuments; public: - DatabaseDocumentLoader( const comphelper::ComponentContext& _aContext); + DatabaseDocumentLoader( const Reference<XComponentContext> & rxContext); inline void append(const ODatabaseModelImpl& _rModelImpl ) { @@ -117,12 +117,12 @@ namespace dbaccess virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); }; - DatabaseDocumentLoader::DatabaseDocumentLoader( const comphelper::ComponentContext& _aContext ) + DatabaseDocumentLoader::DatabaseDocumentLoader( const Reference<XComponentContext> & rxContext ) { acquire(); try { - m_xDesktop.set( _aContext.createComponent( (rtl::OUString)SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW ); + m_xDesktop.set( Desktop::create(rxContext) ); m_xDesktop->addTerminateListener( this ); } catch( const Exception& ) @@ -173,7 +173,7 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon ,m_aContext( _rxContext ) ,m_aContainerListeners(m_aMutex) { - m_pDatabaseDocumentLoader = new DatabaseDocumentLoader( m_aContext ); + m_pDatabaseDocumentLoader = new DatabaseDocumentLoader( _rxContext ); #ifndef DISABLE_SCRIPTING ::basic::BasicManagerRepository::registerCreationListener( *this ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index ece5bc465e82..e3c799d49acc 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/embed/XEmbedPersist.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XTransactionBroadcaster.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -2061,10 +2062,8 @@ Reference< XTitle > ODatabaseDocument::impl_getTitleHelper_throw() { if ( ! m_xTitleHelper.is ()) { - Reference< XUntitledNumbers > xDesktop( - m_pImpl->m_aContext.createComponent( "com.sun.star.frame.Desktop" ), - UNO_QUERY_THROW ); - uno::Reference< frame::XModel > xThis (getThis(), uno::UNO_QUERY_THROW); + Reference< XUntitledNumbers > xDesktop(Desktop::create(m_pImpl->m_aContext.getUNOContext()), uno::UNO_QUERY_THROW); + Reference< frame::XModel > xThis (getThis(), uno::UNO_QUERY_THROW); ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(m_pImpl->m_aContext.getUNOContext()); m_xTitleHelper.set(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index d3e660e3ea3e..d0fd4dc0d9fd 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XController.hpp> @@ -603,9 +604,9 @@ namespace } } -void ODocumentDefinition::impl_removeFrameFromDesktop_throw( const ::comphelper::ComponentContext& _rContxt, const Reference< XFrame >& _rxFrame ) +void ODocumentDefinition::impl_removeFrameFromDesktop_throw( const Reference<XComponentContext> & _rxContext, const Reference< XFrame >& _rxFrame ) { - Reference< XFramesSupplier > xDesktop( _rContxt.createComponent( (::rtl::OUString)SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW ); + Reference< XDesktop2 > xDesktop = Desktop::create( _rxContext ); Reference< XFrames > xFrames( xDesktop->getFrames(), UNO_QUERY_THROW ); xFrames->remove( _rxFrame ); } @@ -630,7 +631,7 @@ void ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow( const bool i_bR xTopWindow->toFront(); // remove the frame from the desktop's frame collection because we need full control of it. - impl_removeFrameFromDesktop_throw( m_aContext, xFrame ); + impl_removeFrameFromDesktop_throw( m_aContext.getUNOContext(), xFrame ); // ensure that we ourself are kept alive as long as the embedded object's frame is // opened @@ -1560,16 +1561,13 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC xParentFrame = lcl_getDatabaseDocumentFrame( *m_pImpl->m_pDataSource ); if ( !xParentFrame.is() ) { // i87957 we need a parent frame - Reference< XComponentLoader > xDesktop( m_aContext.createComponent( (::rtl::OUString)SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW ); - xParentFrame.set( xDesktop, UNO_QUERY ); - if ( xParentFrame.is() ) + Reference< XDesktop2 > xDesktop = Desktop::create( m_aContext.getUNOContext() ); + xParentFrame.set( xDesktop, UNO_QUERY_THROW ); + Reference<util::XCloseable> xCloseable(m_pImpl->m_pDataSource->getModel_noCreate(),UNO_QUERY); + if ( xCloseable.is() ) { - Reference<util::XCloseable> xCloseable(m_pImpl->m_pDataSource->getModel_noCreate(),UNO_QUERY); - if ( xCloseable.is() ) - { - xCloseable->addCloseListener(this); - m_bRemoveListener = sal_True; - } + xCloseable->addCloseListener(this); + m_bRemoveListener = sal_True; } } OSL_ENSURE( xParentFrame.is(), "ODocumentDefinition::fillLoadArgs: no parent frame!" ); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 7b426031ea72..553a61f28cee 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -214,7 +214,7 @@ private: @raises ::com::sun::star::uno::RuntimeException */ static void impl_removeFrameFromDesktop_throw( - const ::comphelper::ComponentContext& _rContxt, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rContxt, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ); diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index e75835cc66bb..a7c48330db81 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrameLoader.hpp> @@ -343,24 +344,21 @@ namespace } // ................................................................... - Reference< XWindow > lcl_getTopMostWindow( const ::comphelper::ComponentContext& _rContext ) + Reference< XWindow > lcl_getTopMostWindow( const Reference<XComponentContext> & _rxContext ) { Reference< XWindow > xWindow; // get the top most window - Reference < XFramesSupplier > xDesktop; - if ( _rContext.createComponent( "com.sun.star.frame.Desktop", xDesktop ) ) + Reference < XDesktop2 > xDesktop = Desktop::create(_rxContext); + Reference < XFrame > xActiveFrame = xDesktop->getActiveFrame(); + if ( xActiveFrame.is() ) { - Reference < XFrame > xActiveFrame = xDesktop->getActiveFrame(); - if ( xActiveFrame.is() ) - { - xWindow = xActiveFrame->getContainerWindow(); - Reference<XFrame> xFrame = xActiveFrame; - while ( xFrame.is() && !xFrame->isTop() ) - xFrame.set(xFrame->getCreator(),UNO_QUERY); + xWindow = xActiveFrame->getContainerWindow(); + Reference<XFrame> xFrame = xActiveFrame; + while ( xFrame.is() && !xFrame->isTop() ) + xFrame.set(xFrame->getCreator(),UNO_QUERY); - if ( xFrame.is() ) - xWindow = xFrame->getContainerWindow(); - } + if ( xFrame.is() ) + xWindow = xFrame->getContainerWindow(); } return xWindow; } @@ -373,7 +371,7 @@ sal_Bool DBContentLoader::impl_executeNewDatabaseWizard( Reference< XModel >& _r aWizardArgs[0] <<= PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")), 0, - makeAny( lcl_getTopMostWindow( m_aContext ) ), + makeAny( lcl_getTopMostWindow( m_aContext.getUNOContext() ) ), PropertyState_DIRECT_VALUE); aWizardArgs[1] <<= PropertyValue( diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 990e5ae4edaf..8ad67807c5d5 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -46,6 +46,7 @@ #include <xmloff/xmluconv.hxx> #include "xmlHelper.hxx" #include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> @@ -124,13 +125,11 @@ namespace dbaxml s_bFirstTime = false; try { - uno::Reference<frame::XComponentLoader> xFrameLoad( m_xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))) - ,uno::UNO_QUERY); + uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create( comphelper::getComponentContext(m_xFactory) ); const ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; - uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY_THROW)->findFrame(sTarget,nFrameSearchFlag); - xFrameLoad.set( xFrame,uno::UNO_QUERY); + uno::Reference< frame::XFrame> xFrame = xDesktop->findFrame(sTarget,nFrameSearchFlag); + uno::Reference<frame::XComponentLoader> xFrameLoad(xFrame,uno::UNO_QUERY); if ( xFrameLoad.is() ) { diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc index 390d92dd7541..50be6eceb979 100644 --- a/dbaccess/source/inc/stringconstants.inc +++ b/dbaccess/source/inc/stringconstants.inc @@ -208,7 +208,6 @@ IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_TABLES, "com.sun.star.sdbcx.Tables"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_QUERIES, "com.sun.star.sdb.Queries"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_INDEXCOLUMN, "com.sun.star.sdbcx.IndexColumn"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_KEYCOLUMN, "com.sun.star.sdbcx.KeyColumn"); -IMPLEMENT_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP, "com.sun.star.frame.Desktop"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_I18N_COLLATOR, "com.sun.star.i18n.Collator"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_TABLEDEFINITION, "com.sun.star.sdb.TableDefinition"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_COMMAND_DEFINITION, "com.sun.star.sdb.CommandDefinition"); diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index e3e51372d225..43366805df60 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -444,7 +444,7 @@ void SAL_CALL OApplicationController::disposing() //-------------------------------------------------------------------- sal_Bool OApplicationController::Construct(Window* _pParent) { - setView( * new OApplicationView( _pParent, getORB(), *this, m_ePreviewMode ) ); + setView( * new OApplicationView( _pParent, comphelper::getComponentContext(getORB()), *this, m_ePreviewMode ) ); getView()->SetUniqueId(UID_APP_VIEW); // late construction diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index e4e41dd96417..a053679f1436 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -604,7 +604,7 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon if ( !m_pLists[E_TABLE] ) { OTableTreeListBox* pTreeView = new OTableTreeListBox(this - ,getBorderWin().getView()->getORB() + ,uno::Reference<lang::XMultiServiceFactory>(getBorderWin().getView()->getORB()->getServiceManager(), uno::UNO_QUERY_THROW) ,WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP ,sal_False); pTreeView->SetHelpId(HID_APP_TABLE_TREE); @@ -776,7 +776,9 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine // ----------------------------------------------------------------------------- DBTreeListBox* OAppDetailPageHelper::createSimpleTree( const rtl::OString& _sHelpId, const Image& _rImage) { - DBTreeListBox* pTreeView = new DBTreeListBox(this,getBorderWin().getView()->getORB(),WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP); + DBTreeListBox* pTreeView = new DBTreeListBox(this, + uno::Reference<lang::XMultiServiceFactory>(getBorderWin().getView()->getORB()->getServiceManager(), uno::UNO_QUERY_THROW), + WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP); pTreeView->SetHelpId( _sHelpId ); return createTree( pTreeView, _rImage ); } @@ -1142,7 +1144,7 @@ void OAppDetailPageHelper::showPreview( const ::rtl::OUString& _sDataSourceName, { try { - m_xFrame = Reference < XFrame > ( getBorderWin().getView()->getORB()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame")) ), UNO_QUERY ); + m_xFrame = Reference < XFrame > ( getBorderWin().getView()->getORB()->getServiceManager()->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame")), getBorderWin().getView()->getORB() ), UNO_QUERY ); m_xFrame->initialize( m_xWindow ); // no layout manager (and thus no toolbars) in the preview @@ -1166,7 +1168,8 @@ void OAppDetailPageHelper::showPreview( const ::rtl::OUString& _sDataSourceName, Reference< XDatabaseDocumentUI > xApplication( getBorderWin().getView()->getAppController().getXController(), UNO_QUERY ); SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr< DatabaseObjectView > pDispatcher( new ResultSetBrowser( - getBorderWin().getView()->getORB(), xApplication, NULL, _bTable + uno::Reference<lang::XMultiServiceFactory>(getBorderWin().getView()->getORB()->getServiceManager(), uno::UNO_QUERY_THROW), + xApplication, NULL, _bTable ) ); SAL_WNODEPRECATED_DECLARATIONS_POP pDispatcher->setTargetFrame( m_xFrame ); diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index cb26fabd6b27..d33d0e75066e 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -477,8 +477,8 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList ) try { - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( - ModuleUIConfigurationManagerSupplier::create(comphelper::getComponentContext(getDetailView()->getBorderWin().getView()->getORB())) ); + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = + ModuleUIConfigurationManagerSupplier::create( getDetailView()->getBorderWin().getView()->getORB() ); Reference< XUIConfigurationManager > xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OfficeDatabaseDocument" ) ) ); diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx index a57b03dd30d9..1402466c31c4 100644 --- a/dbaccess/source/ui/app/AppView.cxx +++ b/dbaccess/source/ui/app/AppView.cxx @@ -200,7 +200,7 @@ OApplicationDetailView* OAppBorderWindow::getDetailView() const DBG_NAME(OApplicationView); //------------------------------------------------------------------------------ OApplicationView::OApplicationView( Window* pParent - ,const Reference< XMultiServiceFactory >& _rxOrb + ,const Reference< XComponentContext >& _rxOrb ,IApplicationController& _rAppController ,PreviewMode _ePreviewMode ) : diff --git a/dbaccess/source/ui/app/AppView.hxx b/dbaccess/source/ui/app/AppView.hxx index ab2c3ff50452..9c9cddf0e239 100644 --- a/dbaccess/source/ui/app/AppView.hxx +++ b/dbaccess/source/ui/app/AppView.hxx @@ -101,7 +101,7 @@ namespace dbaui virtual void DataChanged( const DataChangedEvent& rDCEvt ); public: OApplicationView( Window* pParent - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ,IApplicationController& _rAppController ,PreviewMode _ePreviewMode ); diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index fc7237eb1f24..13b59603bf2a 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -849,7 +849,7 @@ sal_Bool SbaXDataBrowserController::Construct(Window* pParent) // --------------- // create the view - setView( * new UnoDataBrowserView( pParent, *this, getORB() ) ); + setView( * new UnoDataBrowserView( pParent, *this, comphelper::getComponentContext(getORB()) ) ); if (!getBrowserView()) return sal_False; diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx index 168a494dc29e..c29ea1d53246 100644 --- a/dbaccess/source/ui/browser/brwview.cxx +++ b/dbaccess/source/ui/browser/brwview.cxx @@ -72,8 +72,8 @@ DBG_NAME(UnoDataBrowserView) // ------------------------------------------------------------------------- UnoDataBrowserView::UnoDataBrowserView( Window* pParent, IController& _rController, - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rFactory) - :ODataView(pParent,_rController,_rFactory) + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) + :ODataView(pParent,_rController,_rxContext) ,m_pTreeView(NULL) ,m_pSplitter(NULL) ,m_pVclControl(NULL) @@ -93,7 +93,7 @@ void UnoDataBrowserView::Construct(const Reference< ::com::sun::star::awt::XCont m_xMe = VCLUnoHelper::CreateControlContainer(this); // create the (UNO-) control - m_xGrid = new SbaXGridControl(getORB()); + m_xGrid = new SbaXGridControl(Reference<XMultiServiceFactory>(getORB()->getServiceManager(), UNO_QUERY_THROW) ); OSL_ENSURE(m_xGrid.is(), "UnoDataBrowserView::Construct : could not create a grid control !"); // in design mode (for the moment) m_xGrid->setDesignMode(sal_True); diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx index 923b9d1e3fbc..b9c5f81e5e61 100644 --- a/dbaccess/source/ui/browser/dataview.cxx +++ b/dbaccess/source/ui/browser/dataview.cxx @@ -67,10 +67,10 @@ namespace dbaui // ------------------------------------------------------------------------- ODataView::ODataView( Window* pParent, IController& _rController, - const Reference< XMultiServiceFactory >& _rFactory, + const Reference< XComponentContext >& _rxContext, WinBits nStyle) :Window(pParent,nStyle) - ,m_xServiceFactory(_rFactory) + ,m_xContext(_rxContext) ,m_rController( _rController ) ,m_aSeparator( this ) { @@ -205,7 +205,7 @@ namespace dbaui // ----------------------------------------------------------------------------- void ODataView::attachFrame(const Reference< XFrame >& _xFrame) { - m_pAccel->init(m_xServiceFactory,_xFrame); + m_pAccel->init(m_xContext, _xFrame); } //......................................................................... } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index a3f7a48a23fa..8d123a6878b8 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/form/XGridColumnFactory.hpp> #include <com/sun/star/form/XLoadable.hpp> #include <com/sun/star/form/XReset.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -3515,41 +3516,38 @@ void SbaTableQueryBrowser::implAdministrate( SvTreeListEntry* _pApplyTo ) { // get the desktop object sal_Int32 nFrameSearchFlag = FrameSearchFlag::ALL | FrameSearchFlag::GLOBAL ; - Reference< XComponentLoader > xFrameLoader(getORB()->createInstance(SERVICE_FRAME_DESKTOP),UNO_QUERY); + Reference< XDesktop2 > xFrameLoader = Desktop::create( comphelper::getComponentContext(getORB()) ); - if ( xFrameLoader.is() ) + // the initial selection + SvTreeListEntry* pTopLevelSelected = _pApplyTo; + while (pTopLevelSelected && m_pTreeView->getListBox().GetParent(pTopLevelSelected)) + pTopLevelSelected = m_pTreeView->getListBox().GetParent(pTopLevelSelected); + ::rtl::OUString sInitialSelection; + if (pTopLevelSelected) + sInitialSelection = getDataSourceAcessor( pTopLevelSelected ); + + Reference< XDataSource > xDataSource( getDataSourceByName( sInitialSelection, getView(), comphelper::getComponentContext(getORB()), NULL ) ); + Reference< XModel > xDocumentModel( getDataSourceOrModel( xDataSource ), UNO_QUERY ); + + if ( xDocumentModel.is() ) { - // the initial selection - SvTreeListEntry* pTopLevelSelected = _pApplyTo; - while (pTopLevelSelected && m_pTreeView->getListBox().GetParent(pTopLevelSelected)) - pTopLevelSelected = m_pTreeView->getListBox().GetParent(pTopLevelSelected); - ::rtl::OUString sInitialSelection; - if (pTopLevelSelected) - sInitialSelection = getDataSourceAcessor( pTopLevelSelected ); + Reference< XInteractionHandler2 > xInteractionHandler( + InteractionHandler::createWithParent(comphelper::getComponentContext(getORB()), 0) ); - Reference< XDataSource > xDataSource( getDataSourceByName( sInitialSelection, getView(), comphelper::getComponentContext(getORB()), NULL ) ); - Reference< XModel > xDocumentModel( getDataSourceOrModel( xDataSource ), UNO_QUERY ); + ::comphelper::NamedValueCollection aLoadArgs; + aLoadArgs.put( "Model", xDocumentModel ); + aLoadArgs.put( "InteractionHandler", xInteractionHandler ); + aLoadArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG ); - if ( xDocumentModel.is() ) - { - Reference< XInteractionHandler2 > xInteractionHandler( - InteractionHandler::createWithParent(comphelper::getComponentContext(getORB()), 0) ); - - ::comphelper::NamedValueCollection aLoadArgs; - aLoadArgs.put( "Model", xDocumentModel ); - aLoadArgs.put( "InteractionHandler", xInteractionHandler ); - aLoadArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG ); - - Sequence< PropertyValue > aLoadArgPV; - aLoadArgs >>= aLoadArgPV; - - xFrameLoader->loadComponentFromURL( - xDocumentModel->getURL(), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")), - nFrameSearchFlag, - aLoadArgPV - ); - } + Sequence< PropertyValue > aLoadArgPV; + aLoadArgs >>= aLoadArgPV; + + xFrameLoader->loadComponentFromURL( + xDocumentModel->getURL(), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")), + nFrameSearchFlag, + aLoadArgPV + ); } } catch( const Exception& ) diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 55690f915e2f..2ea3cd0896fb 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -55,6 +55,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/XDocumentDataSource.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -65,7 +66,6 @@ #include <com/sun/star/ucb/InteractiveIOException.hpp> #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> -#include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/sdbc/XDriverAccess.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/ucb/IOErrorCode.hpp> @@ -963,7 +963,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { private: Reference< XComponentLoader > m_xFrameLoader; - Reference< XDesktop > m_xDesktop; + Reference< XDesktop2 > m_xDesktop; Reference< XInteractionHandler2 > m_xInteractionHandler; ::rtl::OUString m_sURL; OAsyncronousLink m_aAsyncCaller; @@ -990,7 +990,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { try { - m_xDesktop.set( _rxORB->createInstance( SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW ); + m_xDesktop.set( Desktop::create(comphelper::getComponentContext(_rxORB)) ); m_xFrameLoader.set( m_xDesktop, UNO_QUERY_THROW ); m_xInteractionHandler = InteractionHandler::createWithParent(comphelper::getComponentContext(_rxORB), 0); diff --git a/dbaccess/source/ui/inc/JoinDesignView.hxx b/dbaccess/source/ui/inc/JoinDesignView.hxx index e0e9321abd65..d21f722748d2 100644 --- a/dbaccess/source/ui/inc/JoinDesignView.hxx +++ b/dbaccess/source/ui/inc/JoinDesignView.hxx @@ -45,7 +45,7 @@ namespace dbaui public: OJoinDesignView(Window* pParent, OJoinController& _rController, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); virtual ~OJoinDesignView(); // set the view readonly or not diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx index 07a55ce1e537..ff95e71a6a2b 100644 --- a/dbaccess/source/ui/inc/QueryDesignView.hxx +++ b/dbaccess/source/ui/inc/QueryDesignView.hxx @@ -75,7 +75,7 @@ namespace dbaui sal_Bool m_bInSplitHandler; public: - OQueryDesignView(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + OQueryDesignView(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); virtual ~OQueryDesignView(); virtual sal_Bool isCutAllowed(); diff --git a/dbaccess/source/ui/inc/QueryViewSwitch.hxx b/dbaccess/source/ui/inc/QueryViewSwitch.hxx index 9fab832cd6fa..c8fc0809389b 100644 --- a/dbaccess/source/ui/inc/QueryViewSwitch.hxx +++ b/dbaccess/source/ui/inc/QueryViewSwitch.hxx @@ -38,7 +38,7 @@ namespace dbaui OQueryTextView* m_pTextView; sal_Bool m_bAddTableDialogWasVisible; // true if so public: - OQueryViewSwitch(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + OQueryViewSwitch(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); virtual ~OQueryViewSwitch(); virtual sal_Bool isCutAllowed(); @@ -82,7 +82,7 @@ namespace dbaui OQueryContainerWindow* getContainer() const; void SetPosSizePixel( Point _rPt,Size _rSize); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const; protected: // return the Rectangle where I can paint myself virtual void resizeDocumentView(Rectangle& rRect); diff --git a/dbaccess/source/ui/inc/RelationDesignView.hxx b/dbaccess/source/ui/inc/RelationDesignView.hxx index 850effc813b9..0d106bf584bf 100644 --- a/dbaccess/source/ui/inc/RelationDesignView.hxx +++ b/dbaccess/source/ui/inc/RelationDesignView.hxx @@ -34,7 +34,7 @@ namespace dbaui class ORelationDesignView : public OJoinDesignView { public: - ORelationDesignView(Window* pParent, ORelationController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + ORelationDesignView(Window* pParent, ORelationController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); virtual ~ORelationDesignView(); // set the statement for representation diff --git a/dbaccess/source/ui/inc/TableDesignView.hxx b/dbaccess/source/ui/inc/TableDesignView.hxx index 06a5f6f3b8ec..79c6e42ea600 100644 --- a/dbaccess/source/ui/inc/TableDesignView.hxx +++ b/dbaccess/source/ui/inc/TableDesignView.hxx @@ -77,7 +77,7 @@ namespace dbaui public: OTableDesignView( Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&, OTableController& _rController); virtual ~OTableDesignView(); diff --git a/dbaccess/source/ui/inc/brwview.hxx b/dbaccess/source/ui/inc/brwview.hxx index f5c39e7c16e7..049227cef2b5 100644 --- a/dbaccess/source/ui/inc/brwview.hxx +++ b/dbaccess/source/ui/inc/brwview.hxx @@ -62,7 +62,7 @@ namespace dbaui public: UnoDataBrowserView( Window* pParent, IController& _rController, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); virtual ~UnoDataBrowserView(); /// late construction diff --git a/dbaccess/source/ui/inc/querycontainerwindow.hxx b/dbaccess/source/ui/inc/querycontainerwindow.hxx index ff6d5fffb650..7301f094364e 100644 --- a/dbaccess/source/ui/inc/querycontainerwindow.hxx +++ b/dbaccess/source/ui/inc/querycontainerwindow.hxx @@ -54,7 +54,7 @@ namespace dbaui DECL_LINK( SplitHdl, void* ); public: - OQueryContainerWindow(Window* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&); + OQueryContainerWindow(Window* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); ~OQueryContainerWindow(); virtual void Construct(); diff --git a/dbaccess/source/ui/inc/queryview.hxx b/dbaccess/source/ui/inc/queryview.hxx index 5e9302174f15..62a27a937c3e 100644 --- a/dbaccess/source/ui/inc/queryview.hxx +++ b/dbaccess/source/ui/inc/queryview.hxx @@ -27,7 +27,7 @@ namespace dbaui class OQueryView : public OJoinDesignView { public: - OQueryView(Window* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + OQueryView(Window* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); virtual ~OQueryView(); virtual sal_Bool isCutAllowed() = 0; diff --git a/dbaccess/source/ui/querydesign/JoinDesignView.cxx b/dbaccess/source/ui/querydesign/JoinDesignView.cxx index ad7cf9eace71..b5d0c440cd30 100644 --- a/dbaccess/source/ui/querydesign/JoinDesignView.cxx +++ b/dbaccess/source/ui/querydesign/JoinDesignView.cxx @@ -53,8 +53,8 @@ namespace dbaui // = OJoinDesignView // ============================================================================= // ----------------------------------------------------------------------------- -OJoinDesignView::OJoinDesignView(Window* _pParent, OJoinController& _rController,const Reference< XMultiServiceFactory >& _rFactory) - :ODataView( _pParent, _rController, _rFactory ) +OJoinDesignView::OJoinDesignView(Window* _pParent, OJoinController& _rController,const Reference< XComponentContext >& _rxContext) + :ODataView( _pParent, _rController, _rxContext ) ,m_pTableView(NULL) ,m_rController( _rController ) { diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 816991ad8a8d..20a6ebd003de 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -2520,8 +2520,8 @@ DBG_NAME(OQueryDesignView) OQueryDesignView::OQueryDesignView( OQueryContainerWindow* _pParent, OQueryController& _rController, - const Reference< XMultiServiceFactory >& _rFactory) - :OQueryView( _pParent, _rController, _rFactory ) + const Reference< XComponentContext >& _rxContext) + :OQueryView( _pParent, _rController, _rxContext ) ,m_aSplitter( this ) ,m_eChildFocus(NONE) ,m_bInSplitHandler( sal_False ) diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx index 4a584efdf845..b6a9dbe00ee8 100644 --- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx +++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx @@ -32,13 +32,13 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; DBG_NAME(OQueryViewSwitch) -OQueryViewSwitch::OQueryViewSwitch(OQueryContainerWindow* _pParent, OQueryController& _rController,const Reference< XMultiServiceFactory >& _rFactory) +OQueryViewSwitch::OQueryViewSwitch(OQueryContainerWindow* _pParent, OQueryController& _rController,const Reference< XComponentContext >& _rxContext) : m_bAddTableDialogWasVisible(sal_False) { DBG_CTOR(OQueryViewSwitch,NULL); m_pTextView = new OQueryTextView(_pParent); - m_pDesignView = new OQueryDesignView( _pParent, _rController, _rFactory ); + m_pDesignView = new OQueryDesignView( _pParent, _rController, _rxContext ); } // ----------------------------------------------------------------------------- OQueryViewSwitch::~OQueryViewSwitch() @@ -309,7 +309,7 @@ void OQueryViewSwitch::SetPosSizePixel( Point _rPt,Size _rSize) m_pTextView->SetPosSizePixel( _rPt,_rSize); } // ----------------------------------------------------------------------------- -Reference< XMultiServiceFactory > OQueryViewSwitch::getORB() const +Reference< XComponentContext > OQueryViewSwitch::getORB() const { return m_pDesignView->getORB(); } diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx index 06d84f3989bc..dc342f56ae04 100644 --- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx +++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx @@ -45,13 +45,13 @@ namespace dbaui //= OQueryContainerWindow //===================================================================== DBG_NAME(OQueryContainerWindow) - OQueryContainerWindow::OQueryContainerWindow(Window* pParent, OQueryController& _rController,const Reference< XMultiServiceFactory >& _rFactory) - :ODataView( pParent, _rController, _rFactory ) + OQueryContainerWindow::OQueryContainerWindow(Window* pParent, OQueryController& _rController,const Reference< XComponentContext >& _rxContext) + :ODataView( pParent, _rController, _rxContext ) ,m_pViewSwitch(NULL) ,m_pBeamer(NULL) { DBG_CTOR(OQueryContainerWindow,NULL); - m_pViewSwitch = new OQueryViewSwitch( this, _rController, _rFactory ); + m_pViewSwitch = new OQueryViewSwitch( this, _rController, _rxContext ); m_pSplitter = new Splitter(this,WB_VSCROLL); m_pSplitter->Hide(); @@ -195,7 +195,7 @@ namespace dbaui ::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::AddWindow)); - Reference < XFrame > xBeamerFrame( m_pViewSwitch->getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame"))),UNO_QUERY ); + Reference < XFrame > xBeamerFrame( m_pViewSwitch->getORB()->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame")), m_pViewSwitch->getORB()),UNO_QUERY ); m_xBeamer.set( xBeamerFrame ); OSL_ENSURE(m_xBeamer.is(),"No frame created!"); m_xBeamer->initialize( VCLUnoHelper::GetInterface ( m_pBeamer ) ); diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index d0ea41b81516..22109df206bd 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -1107,7 +1107,7 @@ sal_Bool OQueryController::Construct(Window* pParent) { // TODO: we have to check if we should create the text- or the design- view - setView( * new OQueryContainerWindow( pParent, *this, getORB() ) ); + setView( * new OQueryContainerWindow( pParent, *this, comphelper::getComponentContext(getORB()) ) ); return OJoinController::Construct(pParent); } diff --git a/dbaccess/source/ui/querydesign/queryview.cxx b/dbaccess/source/ui/querydesign/queryview.cxx index 124540498195..e49c7b000c9f 100644 --- a/dbaccess/source/ui/querydesign/queryview.cxx +++ b/dbaccess/source/ui/querydesign/queryview.cxx @@ -27,8 +27,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; DBG_NAME(OQueryView) // ------------------------------------------------------------------------- -OQueryView::OQueryView(Window* _pParent, OQueryController& _rController,const Reference< XMultiServiceFactory >& _rFactory) - :OJoinDesignView( _pParent, _rController, _rFactory ) +OQueryView::OQueryView(Window* _pParent, OQueryController& _rController,const Reference< XComponentContext >& _rxContext) + :OJoinDesignView( _pParent, _rController, _rxContext ) { DBG_CTOR(OQueryView,NULL); diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index abe665bd88b2..2e999e8e118e 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -249,7 +249,7 @@ void ORelationController::impl_initialize() // ----------------------------------------------------------------------------- sal_Bool ORelationController::Construct(Window* pParent) { - setView( * new ORelationDesignView( pParent, *this, getORB() ) ); + setView( * new ORelationDesignView( pParent, *this, comphelper::getComponentContext(getORB()) ) ); OJoinController::Construct(pParent); return sal_True; } diff --git a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx index 31676ce96f7b..602b79323d89 100644 --- a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx +++ b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx @@ -46,8 +46,8 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; DBG_NAME(ORelationDesignView) -ORelationDesignView::ORelationDesignView(Window* _pParent, ORelationController& _rController,const Reference< XMultiServiceFactory >& _rFactory) - :OJoinDesignView( _pParent, _rController, _rFactory ) +ORelationDesignView::ORelationDesignView(Window* _pParent, ORelationController& _rController,const Reference< XComponentContext >& _rxContext) + :OJoinDesignView( _pParent, _rController, _rxContext ) { DBG_CTOR(ORelationDesignView,NULL); } diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 869af3d4268e..91c5352e923b 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -565,7 +565,7 @@ void OTableController::impl_initialize() // ----------------------------------------------------------------------------- sal_Bool OTableController::Construct(Window* pParent) { - setView( * new OTableDesignView( pParent, getORB(), *this ) ); + setView( * new OTableDesignView( pParent, comphelper::getComponentContext(getORB()), *this ) ); OTableController_BASE::Construct(pParent); return sal_True; } diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx index 499d2149c594..a82ae839d9cc 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx @@ -187,7 +187,7 @@ void OTableBorderWindow::GetFocus() DBG_NAME(OTableDesignView); //------------------------------------------------------------------------------ OTableDesignView::OTableDesignView( Window* pParent, - const Reference< XMultiServiceFactory >& _rxOrb, + const Reference< XComponentContext >& _rxOrb, OTableController& _rController ) : ODataView( pParent, _rController,_rxOrb ) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 493f19065491..7f87969d82ff 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -44,7 +44,7 @@ #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/util/XFlushable.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/view/XPrintable.hpp> #include <com/sun/star/awt/XTopWindow.hpp> @@ -632,7 +632,7 @@ void Desktop::DeInit() Reference< XComponent >( comphelper::getProcessComponentContext(), UNO_QUERY_THROW )-> dispose(); - // nobody should get a destroyd service factory... + // nobody should get a destroyed service factory... ::comphelper::setProcessServiceFactory( NULL ); // clear lockfile @@ -663,26 +663,15 @@ sal_Bool Desktop::QueryExit() const sal_Char SUSPEND_QUICKSTARTVETO[] = "SuspendQuickstartVeto"; - Reference< ::com::sun::star::frame::XDesktop > - xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.frame.Desktop") ), - UNO_QUERY ); + Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); + Reference< XPropertySet > xPropertySet(xDesktop, UNO_QUERY_THROW); + xPropertySet->setPropertyValue( OUString(SUSPEND_QUICKSTARTVETO ), Any((sal_Bool)sal_True) ); - Reference < ::com::sun::star::beans::XPropertySet > xPropertySet( xDesktop, UNO_QUERY ); - if ( xPropertySet.is() ) - { - Any a; - a <<= (sal_Bool)sal_True; - xPropertySet->setPropertyValue( OUString(SUSPEND_QUICKSTARTVETO ), a ); - } - - sal_Bool bExit = ( !xDesktop.is() || xDesktop->terminate() ); + sal_Bool bExit = xDesktop->terminate(); - - if ( !bExit && xPropertySet.is() ) + if ( !bExit ) { - Any a; - a <<= (sal_Bool)sal_False; - xPropertySet->setPropertyValue( OUString(SUSPEND_QUICKSTARTVETO ), a ); + xPropertySet->setPropertyValue( OUString(SUSPEND_QUICKSTARTVETO ), Any((sal_Bool)sal_False) ); } else { @@ -1104,8 +1093,8 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave , xSMGR->createInstance(SERVICENAME_RECOVERYUI), css::uno::UNO_QUERY_THROW); - Reference< css::util::XURLTransformer > xURLParser( - css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); + Reference< css::util::XURLTransformer > xURLParser = + css::util::URLTransformer::create(::comphelper::getProcessComponentContext()); css::util::URL aURL; if (bEmergencySave) @@ -1404,16 +1393,15 @@ int Desktop::Main() utl::Bootstrap::reloadData(); SetSplashScreenProgress(20); - Reference< XMultiServiceFactory > xSMgr = - ::comphelper::getProcessServiceFactory(); + Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< XRestartManager > xRestartManager( - OfficeRestartManager::get(comphelper::getProcessComponentContext())); + Reference< XRestartManager > xRestartManager( OfficeRestartManager::get(xContext) ); - Reference< XDesktop > xDesktop; + Reference< XDesktop2 > xDesktop; try { - RegisterServices(comphelper::getProcessComponentContext()); + RegisterServices(xContext); SetSplashScreenProgress(25); @@ -1495,12 +1483,11 @@ int Desktop::Main() SvtPathOptions().SetWorkPath( aWorkPath ); } - xDesktop = Reference<XDesktop>( xSMgr->createInstance( - OUString( "com.sun.star.frame.Desktop" )), UNO_QUERY ); + xDesktop = css::frame::Desktop::create( xContext ); // create service for loadin SFX (still needed in startup) pExecGlobals->xGlobalBroadcaster = Reference < css::document::XEventListener > - ( css::frame::GlobalEventBroadcaster::create(comphelper::getComponentContext(xSMgr)), UNO_QUERY_THROW ); + ( css::frame::GlobalEventBroadcaster::create(xContext), UNO_QUERY_THROW ); /* ensure existance of a default window that messages can be dispatched to This is for the benefit of testtool which uses PostUserEvent extensively @@ -1848,7 +1835,7 @@ sal_Bool Desktop::InitializeQuickstartMode( Reference< XMultiServiceFactory >& r sal_Bool bQuickstart = shouldLaunchQuickstart(); - // Try to instanciate quickstart service. This service is not mandatory, so + // Try to instantiate quickstart service. This service is not mandatory, so // do nothing if service is not available // #i105753# the following if was invented for performance @@ -1984,17 +1971,13 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs ) Sequence < com::sun::star::beans::PropertyValue > args(1); args[0].Name = ::rtl::OUString("Hidden"); args[0].Value <<= sal_True; - Reference < XComponentLoader > xLoader( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY ); - - if ( !xLoader.is() ) - return; + Reference < XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); if ( rArgs.IsWriter() ) { try { - Reference < ::com::sun::star::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rtl::OUString("private:factory/swriter"), + Reference < ::com::sun::star::util::XCloseable > xDoc( xDesktop->loadComponentFromURL( rtl::OUString("private:factory/swriter"), ::rtl::OUString("_blank"), 0, args ), UNO_QUERY_THROW ); xDoc->close( sal_False ); } @@ -2006,7 +1989,7 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs ) { try { - Reference < ::com::sun::star::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rtl::OUString("private:factory/scalc"), + Reference < ::com::sun::star::util::XCloseable > xDoc( xDesktop->loadComponentFromURL( rtl::OUString("private:factory/scalc"), ::rtl::OUString("_blank"), 0, args ), UNO_QUERY_THROW ); xDoc->close( sal_False ); } @@ -2018,7 +2001,7 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs ) { try { - Reference < ::com::sun::star::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rtl::OUString("private:factory/sdraw"), + Reference < ::com::sun::star::util::XCloseable > xDoc( xDesktop->loadComponentFromURL( rtl::OUString("private:factory/sdraw"), ::rtl::OUString("_blank"), 0, args ), UNO_QUERY_THROW ); xDoc->close( sal_False ); } @@ -2030,7 +2013,7 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs ) { try { - Reference < ::com::sun::star::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rtl::OUString("private:factory/simpress"), + Reference < ::com::sun::star::util::XCloseable > xDoc( xDesktop->loadComponentFromURL( rtl::OUString("private:factory/simpress"), ::rtl::OUString("_blank"), 0, args ), UNO_QUERY_THROW ); xDoc->close( sal_False ); } @@ -2044,8 +2027,7 @@ void Desktop::PreloadConfigurationData() { Reference< XMultiServiceFactory > rFactory = ::comphelper::getProcessServiceFactory(); Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< XNameAccess > xNameAccess( - css::frame::UICommandDescription::create(xContext) ); + Reference< XNameAccess > xNameAccess = css::frame::UICommandDescription::create(xContext); rtl::OUString aWriterDoc( "com.sun.star.text.TextDocument" ); rtl::OUString aCalcDoc( "com.sun.star.sheet.SpreadsheetDocument" ); @@ -2445,10 +2427,8 @@ void Desktop::OpenClients() } // no default document if a document was loaded by recovery or by command line or if soffice is used as server - Reference< XFramesSupplier > xTasksSupplier( - ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.frame.Desktop") ), - ::com::sun::star::uno::UNO_QUERY_THROW ); - Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY_THROW ); + Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); + Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY_THROW ); if ( xList->hasElements() ) return; @@ -2582,18 +2562,17 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) case ApplicationEvent::TYPE_APPEAR: if ( !GetCommandLineArgs().IsInvisible() ) { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); // find active task - the active task is always a visible task - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > - xDesktop( xSMGR->createInstance( OUString("com.sun.star.frame.Desktop") ), - ::com::sun::star::uno::UNO_QUERY ); - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTask = xDesktop->getActiveFrame(); + Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); + Reference< css::frame::XFrame > xTask = xDesktop->getActiveFrame(); if ( !xTask.is() ) { // get any task if there is no active one - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xList( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY ); - if ( xList->getCount()>0 ) + Reference< css::container::XIndexAccess > xList( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY ); + if ( xList->getCount() > 0 ) xList->getByIndex(0) >>= xTask; } @@ -2605,11 +2584,8 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) else { // no visible task that could be activated found - Reference< XFrame > xBackingFrame; Reference< ::com::sun::star::awt::XWindow > xContainerWindow; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xDesktopFrame( xDesktop, UNO_QUERY ); - - xBackingFrame = xDesktopFrame->findFrame(OUString( "_blank" ), 0); + Reference< XFrame > xBackingFrame = xDesktop->findFrame(OUString( "_blank" ), 0); if (xBackingFrame.is()) xContainerWindow = xBackingFrame->getContainerWindow(); if (xContainerWindow.is()) @@ -2709,17 +2685,11 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) // The user will try it again, in case nothing happens .-) try { - Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< css::frame::XDispatchProvider > - xDesktop( xSMGR->createInstance( OUString("com.sun.star.frame.Desktop") ), - ::com::sun::star::uno::UNO_QUERY ); + Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); - // check provider ... we know it's weak reference only - if ( ! xDesktop.is()) - return; - - Reference< css::util::XURLTransformer > xParser( css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); + Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(xContext); css::util::URL aCommand; if( rAppEvent.GetData() == ::rtl::OUString("PREFERENCES") ) aCommand.Complete = rtl::OUString( ".uno:OptionsTreeDialog" ); @@ -2845,52 +2815,47 @@ void Desktop::ShowBackingComponent(Desktop * progress) { return; } - Reference< XMultiServiceFactory > xSMgr( - comphelper::getProcessServiceFactory(), UNO_SET_THROW); - Reference< XFrame > xDesktopFrame( - xSMgr->createInstance("com.sun.star.frame.Desktop"), UNO_QUERY); - if (xDesktopFrame.is()) + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + Reference< css::lang::XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); + Reference< XDesktop2 > xDesktop = css::frame::Desktop::create(xContext); + if (progress != 0) { + progress->SetSplashScreenProgress(60); + } + Reference< XFrame > xBackingFrame = xDesktop->findFrame(OUString( "_blank" ), 0); + Reference< ::com::sun::star::awt::XWindow > xContainerWindow; + + if (xBackingFrame.is()) + xContainerWindow = xBackingFrame->getContainerWindow(); + if (xContainerWindow.is()) + { + SetDocumentExtendedStyle(xContainerWindow); if (progress != 0) { - progress->SetSplashScreenProgress(60); + progress->SetSplashScreenProgress(75); } - Reference< XFrame > xBackingFrame; - Reference< ::com::sun::star::awt::XWindow > xContainerWindow; + Sequence< Any > lArgs(1); + lArgs[0] <<= xContainerWindow; - xBackingFrame = xDesktopFrame->findFrame(OUString( "_blank" ), 0); - if (xBackingFrame.is()) - xContainerWindow = xBackingFrame->getContainerWindow(); - if (xContainerWindow.is()) + Reference< XController > xBackingComp( + xSMgr->createInstanceWithArguments(OUString( "com.sun.star.frame.StartModule" ), lArgs), UNO_QUERY); + if (xBackingComp.is()) { - SetDocumentExtendedStyle(xContainerWindow); + Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); + // Attention: You MUST(!) call setComponent() before you call attachFrame(). + // Because the backing component set the property "IsBackingMode" of the frame + // to true inside attachFrame(). But setComponent() reset this state everytimes ... + xBackingFrame->setComponent(xBackingWin, xBackingComp); if (progress != 0) { - progress->SetSplashScreenProgress(75); + progress->SetSplashScreenProgress(100); } - Sequence< Any > lArgs(1); - lArgs[0] <<= xContainerWindow; - - Reference< XController > xBackingComp( - xSMgr->createInstanceWithArguments(OUString( "com.sun.star.frame.StartModule" ), lArgs), UNO_QUERY); - if (xBackingComp.is()) + xBackingComp->attachFrame(xBackingFrame); + if (progress != 0) { - Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); - // Attention: You MUST(!) call setComponent() before you call attachFrame(). - // Because the backing component set the property "IsBackingMode" of the frame - // to true inside attachFrame(). But setComponent() reset this state everytimes ... - xBackingFrame->setComponent(xBackingWin, xBackingComp); - if (progress != 0) - { - progress->SetSplashScreenProgress(100); - } - xBackingComp->attachFrame(xBackingFrame); - if (progress != 0) - { - progress->CloseSplashScreen(); - } - xContainerWindow->setVisible(sal_True); + progress->CloseSplashScreen(); } + xContainerWindow->setVisible(sal_True); } } } diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index e832377ff418..0ac65aa72a7e 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/util/CloseVetoException.hpp> #include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/URL.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -165,9 +165,7 @@ DispatchWatcher::~DispatchWatcher() sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequestsList, bool bNoTerminate ) { - Reference< XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), - UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); DispatchList::const_iterator p; std::vector< DispatchHolder > aDispatches; @@ -279,14 +277,12 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch aURL.Complete = aName; Reference < XDispatch > xDispatcher ; - Reference < XDispatchProvider > xProvider ( xDesktop, UNO_QUERY ); Reference < XURLTransformer > xParser ( URLTransformer::create(::comphelper::getProcessComponentContext()) ); if( xParser.is() == sal_True ) xParser->parseStrict( aURL ); - if( xProvider.is() == sal_True ) - xDispatcher = xProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); + xDispatcher = xDesktop->queryDispatch( aURL, ::rtl::OUString(), 0 ); if( xDispatcher.is() == sal_True ) { @@ -309,14 +305,12 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch aURL.Complete = aName; Reference < XDispatch > xDispatcher ; - Reference < XDispatchProvider > xProvider ( xDesktop, UNO_QUERY ); Reference < XURLTransformer > xParser ( URLTransformer::create(::comphelper::getProcessComponentContext()) ); if( xParser.is() == sal_True ) xParser->parseStrict( aURL ); - if( xProvider.is() == sal_True ) - xDispatcher = xProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); + xDispatcher = xDesktop->queryDispatch( aURL, ::rtl::OUString(), 0 ); if( xDispatcher.is() == sal_True ) { @@ -605,16 +599,13 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch if ( bEmpty && !bNoTerminate /*m_aRequestContainer.empty()*/ ) { // We have to check if we have an open task otherwise we have to shutdown the office. - Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY ); aGuard.clear(); - Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY ); + Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY ); if ( !xList->hasElements() ) { // We don't have any task open so we have to shutdown ourself!! - Reference< XDesktop > xDesktop2( xTasksSupplier, UNO_QUERY ); - if ( xDesktop2.is() ) - return xDesktop2->terminate(); + return xDesktop->terminate(); } } @@ -637,17 +628,13 @@ void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) th if ( !nCount && !OfficeIPCThread::AreRequestsPending() ) { // We have to check if we have an open task otherwise we have to shutdown the office. - Reference< XFramesSupplier > xTasksSupplier( ::comphelper::getProcessServiceFactory()->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), - UNO_QUERY ); - Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY ); if ( !xList->hasElements() ) { // We don't have any task open so we have to shutdown ourself!! - Reference< XDesktop > xDesktop( xTasksSupplier, UNO_QUERY ); - if ( xDesktop.is() ) - xDesktop->terminate(); + xDesktop->terminate(); } } } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 579c5bc840f9..65ca88fa73cf 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -26,6 +26,7 @@ #include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/configuration/theDefaultProvider.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "dp_gui_dialog2.hxx" #include "dp_gui_extensioncmdqueue.hxx" @@ -91,10 +92,8 @@ TheExtensionManager::TheExtensionManager( Window *pParent, { // the registration should be done after the construction has been ended // otherwise an exception prevents object creation, but it is registered as a listener - m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext( - OUString("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY ); - if ( m_xDesktop.is() ) - m_xDesktop->addTerminateListener( this ); + m_xDesktop.set( frame::Desktop::create(xContext), uno::UNO_QUERY_THROW ); + m_xDesktop->addTerminateListener( this ); } } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index e292baf03532..ec2734e80cee 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -27,7 +27,7 @@ #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/deployment/XExtensionManager.hpp" #include "com/sun/star/deployment/ExtensionManager.hpp" -#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XDesktop2.hpp" #include "com/sun/star/frame/XTerminateListener.hpp" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/util/XModifyListener.hpp" @@ -49,7 +49,7 @@ class TheExtensionManager : { private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2 > m_xDesktop; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes; diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index d41d57f37419..0664071ef5aa 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -49,7 +49,7 @@ #include "com/sun/star/deployment/XExtensionManager.hpp" #include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/deployment/XUpdateInformationProvider.hpp" -#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "com/sun/star/frame/XDispatch.hpp" #include "com/sun/star/frame/XDispatchProvider.hpp" #include "com/sun/star/lang/IllegalArgumentException.hpp" @@ -837,13 +837,12 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, util::URL aURL; xNameAccess->getByName(OUSTR("URL")) >>= aURL.Complete; - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference < util::XURLTransformer > xTransformer = util::URLTransformer::create(xContext); xTransformer->parseStrict(aURL); - uno::Reference < frame::XDesktop > xDesktop( xFactory->createInstance( OUSTR( "com.sun.star.frame.Desktop" ) ), - uno::UNO_QUERY_THROW ); + uno::Reference < frame::XDesktop2 > xDesktop = frame::Desktop::create( xContext ); uno::Reference< frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), uno::UNO_QUERY_THROW ); uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); diff --git a/desktop/test/deployment/active/active_native.cxx b/desktop/test/deployment/active/active_native.cxx index 3e5e0c5581c8..ce88274c63c7 100644 --- a/desktop/test/deployment/active/active_native.cxx +++ b/desktop/test/deployment/active/active_native.cxx @@ -29,7 +29,7 @@ #include "com/sun/star/awt/XWindowPeer.hpp" #include "com/sun/star/beans/PropertyValue.hpp" #include "com/sun/star/frame/DispatchDescriptor.hpp" -#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "com/sun/star/frame/XDispatch.hpp" #include "com/sun/star/frame/XDispatchProvider.hpp" #include "com/sun/star/frame/XFrame.hpp" @@ -216,23 +216,21 @@ void Dispatch::dispatch( css::uno::Sequence< css::beans::PropertyValue > const &) throw (css::uno::RuntimeException) { + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(context_); + css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->getCurrentFrame(); + css::uno::Reference< css::awt::XWindowPeer > xWindowPeer( xFrame->getComponentWindow(), css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create(context_); css::uno::Reference< css::awt::XMessageBox > box( - css::awt::Toolkit::create(context_)->createMessageBox( - css::uno::Reference< css::awt::XWindowPeer >( - css::uno::Reference< css::frame::XFrame >( - css::uno::Reference< css::frame::XDesktop >( - (context_->getServiceManager()-> - createInstanceWithContext( - "com.sun.star.frame.Desktop", context_)), - css::uno::UNO_QUERY_THROW)->getCurrentFrame(), - css::uno::UNO_SET_THROW)->getComponentWindow(), - css::uno::UNO_QUERY_THROW), + xToolkit->createMessageBox( + xWindowPeer, css::awt::Rectangle(), "infobox", css::awt::MessageBoxButtons::BUTTONS_OK, "active", "native"), css::uno::UNO_SET_THROW); + box->execute(); - css::uno::Reference< css::lang::XComponent >( - box, css::uno::UNO_QUERY_THROW)->dispose(); + + css::uno::Reference< css::lang::XComponent > xComponent(box, css::uno::UNO_QUERY_THROW); + xComponent->dispose(); } static cppu::ImplementationEntry const services[] = { diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx index c3fb5a3b0e72..819f6ab0ef59 100644 --- a/desktop/test/deployment/passive/passive_native.cxx +++ b/desktop/test/deployment/passive/passive_native.cxx @@ -29,7 +29,7 @@ #include "com/sun/star/awt/XWindowPeer.hpp" #include "com/sun/star/beans/PropertyValue.hpp" #include "com/sun/star/frame/DispatchDescriptor.hpp" -#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "com/sun/star/frame/XDispatch.hpp" #include "com/sun/star/frame/XDispatchProvider.hpp" #include "com/sun/star/frame/XFrame.hpp" @@ -213,23 +213,21 @@ void Dispatch::dispatch( css::uno::Sequence< css::beans::PropertyValue > const &) throw (css::uno::RuntimeException) { + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(context_); + css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->getCurrentFrame(); + css::uno::Reference< css::awt::XWindowPeer > xWindowPeer( xFrame->getComponentWindow(), css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create(context_); css::uno::Reference< css::awt::XMessageBox > box( - css::awt::Toolkit::create(context_)->createMessageBox( - css::uno::Reference< css::awt::XWindowPeer >( - css::uno::Reference< css::frame::XFrame >( - css::uno::Reference< css::frame::XDesktop >( - (context_->getServiceManager()-> - createInstanceWithContext( - "com.sun.star.frame.Desktop", context_)), - css::uno::UNO_QUERY_THROW)->getCurrentFrame(), - css::uno::UNO_SET_THROW)->getComponentWindow(), - css::uno::UNO_QUERY_THROW), + xToolkit->createMessageBox( + xWindowPeer, css::awt::Rectangle(), "infobox", css::awt::MessageBoxButtons::BUTTONS_OK, "passive", "native"), css::uno::UNO_SET_THROW); + box->execute(); - css::uno::Reference< css::lang::XComponent >( - box, css::uno::UNO_QUERY_THROW)->dispose(); + + css::uno::Reference< css::lang::XComponent > xComponent(box, css::uno::UNO_QUERY_THROW); + xComponent->dispose(); } static cppu::ImplementationEntry const services[] = { diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 7fa98c15481c..733e66b3d2cc 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -25,6 +25,7 @@ #include <editeng/unolingu.hxx> #include <rtl/logfile.hxx> #include <unotools/pathoptions.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/lang/XEventListener.hpp> @@ -441,7 +442,7 @@ typedef cppu::WeakImplHelper1 < XEventListener > LinguMgrAppExitLstnrBaseClass; class LinguMgrAppExitLstnr : public LinguMgrAppExitLstnrBaseClass { - uno::Reference< XComponent > xDesktop; + uno::Reference< XDesktop2 > xDesktop; public: LinguMgrAppExitLstnr(); @@ -460,14 +461,9 @@ LinguMgrAppExitLstnr::LinguMgrAppExitLstnr() // add object to frame::Desktop EventListeners in order to properly call // the AtExit function at appliction exit. - uno::Reference< XMultiServiceFactory > xMgr = getProcessServiceFactory(); - if ( xMgr.is() ) - { - xDesktop = uno::Reference< XComponent > ( xMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ) ), UNO_QUERY ) ; - if (xDesktop.is()) - xDesktop->addEventListener( this ); - } + uno::Reference< XComponentContext > xContext = getProcessComponentContext(); + xDesktop = Desktop::create( xContext ); + xDesktop->addEventListener( this ); } LinguMgrAppExitLstnr::~LinguMgrAppExitLstnr() @@ -637,11 +633,8 @@ uno::Reference< XDictionaryList > LinguMgr::GetDicList() pExitLstnr = new LinguMgrExitLstnr; uno::Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() ); - if (xMgr.is()) - { - xDicList = uno::Reference< XDictionaryList > ( xMgr->createInstance( - A2OU("com.sun.star.linguistic2.DictionaryList") ), UNO_QUERY ); - } + xDicList = uno::Reference< XDictionaryList > ( xMgr->createInstance( + A2OU("com.sun.star.linguistic2.DictionaryList") ), UNO_QUERY ); return xDicList; } @@ -654,11 +647,8 @@ uno::Reference< XPropertySet > LinguMgr::GetProp() pExitLstnr = new LinguMgrExitLstnr; uno::Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() ); - if (xMgr.is()) - { - xProp = uno::Reference< XPropertySet > ( xMgr->createInstance( - A2OU("com.sun.star.linguistic2.LinguProperties") ), UNO_QUERY ); - } + xProp = uno::Reference< XPropertySet > ( xMgr->createInstance( + A2OU("com.sun.star.linguistic2.LinguProperties") ), UNO_QUERY ); return xProp; } diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index f30eb5e1a6b0..47367f7cfa74 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XDispatchHelper.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> @@ -173,26 +173,20 @@ DocumentHolder::DocumentHolder( const uno::Reference< lang::XMultiServiceFactory aArg.Value <<= sal_False; m_aOutplaceFrameProps[1] <<= aArg; - const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XDesktop > xDesktop( m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); - if ( xDesktop.is() ) + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( comphelper::getComponentContext(m_xFactory) ); + m_refCount++; + try { - m_refCount++; - try - { - xDesktop->addTerminateListener( this ); - } - catch ( const uno::Exception& ) - { - } - m_refCount--; - - aArg.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentFrame")); - aArg.Value <<= xDesktop; //TODO/LATER: should use parent document frame - m_aOutplaceFrameProps[2] <<= aArg; + xDesktop->addTerminateListener( this ); } - else - m_aOutplaceFrameProps.realloc( 2 ); + catch ( const uno::Exception& ) + { + } + m_refCount--; + + aArg.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentFrame")); + aArg.Value <<= xDesktop; //TODO/LATER: should use parent document frame + m_aOutplaceFrameProps[2] <<= aArg; } //--------------------------------------------------------------------------- @@ -253,15 +247,12 @@ void DocumentHolder::CloseFrame() //--------------------------------------------------------------------------- void DocumentHolder::FreeOffice() { - const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XDesktop > xDesktop( m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); - if ( xDesktop.is() ) - { - xDesktop->removeTerminateListener( this ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( comphelper::getComponentContext(m_xFactory) ); + xDesktop->removeTerminateListener( this ); - // the following code is commented out since for now there is still no completely correct way to detect - // whether the office can be terminated, so it is better to have unnecessary process running than - // to loose any data + // the following code is commented out since for now there is still no completely correct way to detect + // whether the office can be terminated, so it is better to have unnecessary process running than + // to loose any data // uno::Reference< frame::XFramesSupplier > xFramesSupplier( xDesktop, uno::UNO_QUERY ); // if ( xFramesSupplier.is() ) @@ -277,7 +268,6 @@ void DocumentHolder::FreeOffice() // {} // } // } - } } //--------------------------------------------------------------------------- diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 01475efcc85a..7447b9c68315 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> @@ -115,64 +116,58 @@ sal_Bool OwnView_Impl::CreateModelFromURL( const ::rtl::OUString& aFileURL ) if ( !aFileURL.isEmpty() ) { try { - uno::Reference < frame::XComponentLoader > xDocumentLoader( - m_xFactory->createInstance ( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) )), - uno::UNO_QUERY ); + uno::Reference < frame::XDesktop2 > xDocumentLoader = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); - if ( xDocumentLoader.is() ) - { - uno::Sequence< beans::PropertyValue > aArgs( m_aFilterName.isEmpty() ? 4 : 5 ); + uno::Sequence< beans::PropertyValue > aArgs( m_aFilterName.isEmpty() ? 4 : 5 ); - aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" )); - aArgs[0].Value <<= aFileURL; + aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" )); + aArgs[0].Value <<= aFileURL; - aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" )); - aArgs[1].Value <<= sal_True; + aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" )); + aArgs[1].Value <<= sal_True; - aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); - aArgs[2].Value <<= uno::Reference< task::XInteractionHandler >( - static_cast< ::cppu::OWeakObject* >( new DummyHandler_Impl() ), uno::UNO_QUERY ); + aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); + aArgs[2].Value <<= uno::Reference< task::XInteractionHandler >( + static_cast< ::cppu::OWeakObject* >( new DummyHandler_Impl() ), uno::UNO_QUERY ); - aArgs[3].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DontEdit" )); - aArgs[3].Value <<= sal_True; + aArgs[3].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DontEdit" )); + aArgs[3].Value <<= sal_True; - if ( !m_aFilterName.isEmpty() ) - { - aArgs[4].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); - aArgs[4].Value <<= m_aFilterName; - } + if ( !m_aFilterName.isEmpty() ) + { + aArgs[4].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); + aArgs[4].Value <<= m_aFilterName; + } - uno::Reference< frame::XModel > xModel( xDocumentLoader->loadComponentFromURL( - aFileURL, - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )), - 0, - aArgs ), - uno::UNO_QUERY ); + uno::Reference< frame::XModel > xModel( xDocumentLoader->loadComponentFromURL( + aFileURL, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )), + 0, + aArgs ), + uno::UNO_QUERY ); - if ( xModel.is() ) + if ( xModel.is() ) + { + uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY ); + if ( xBroadCaster.is() ) + xBroadCaster->addEventListener( uno::Reference< document::XEventListener >( + static_cast< ::cppu::OWeakObject* >( this ), + uno::UNO_QUERY ) ); + + uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); + if ( xCloseable.is() ) { - uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY ); - if ( xBroadCaster.is() ) - xBroadCaster->addEventListener( uno::Reference< document::XEventListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); - - uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); - if ( xCloseable.is() ) - { - xCloseable->addCloseListener( uno::Reference< util::XCloseListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); + xCloseable->addCloseListener( uno::Reference< util::XCloseListener >( + static_cast< ::cppu::OWeakObject* >( this ), + uno::UNO_QUERY ) ); - ::osl::MutexGuard aGuard( m_aMutex ); - m_xModel = xModel; - bResult = sal_True; - } + ::osl::MutexGuard aGuard( m_aMutex ); + m_xModel = xModel; + bResult = sal_True; } } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } } diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index 8ddfb66703ff..acd4d57ec440 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XStatusListener.hpp> @@ -91,13 +91,8 @@ DocumentHolder::DocumentHolder( m_nMacroExecMode( document::MacroExecMode::USE_CONFIG ), m_bLink( sal_False ) { - static const ::rtl::OUString aServiceName ( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XDesktop > xDesktop( - m_xFactory->createInstance( aServiceName ), - uno::UNO_QUERY ); - if ( xDesktop.is() ) - xDesktop->addTerminateListener( (frame::XTerminateListener*)this ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); + xDesktop->addTerminateListener( (frame::XTerminateListener*)this ); } @@ -390,13 +385,8 @@ HRESULT DocumentHolder::InPlaceActivate( // load the model into the frame LoadDocInFrame( sal_True ); - static const ::rtl::OUString aDesktopServiceName ( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XFramesSupplier > xDesktop( - m_xFactory->createInstance( aDesktopServiceName ), - uno::UNO_QUERY ); - if(xDesktop.is()) - xDesktop->getFrames()->append(m_xFrame); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); + xDesktop->getFrames()->append(m_xFrame); // determine the menuhandle to get menutitems. if(m_xLayoutManager.is()) { @@ -645,15 +635,9 @@ BOOL DocumentHolder::Undo(void) void DocumentHolder::FreeOffice() { - const ::rtl::OUString aServiceName( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XDesktop > xDesktop( - m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); - if ( xDesktop.is() ) - { - xDesktop->removeTerminateListener( - (frame::XTerminateListener*)this ); - } + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); + xDesktop->removeTerminateListener( + (frame::XTerminateListener*)this ); } void DocumentHolder::DisconnectFrameDocument( sal_Bool bComplete ) @@ -812,15 +796,9 @@ uno::Reference< frame::XFrame > DocumentHolder::DocumentFrame() { if(! m_xFrame.is() ) { - rtl::OUString aDesktopSrvNm( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")); - - uno::Reference<frame::XDesktop> xDesktop( - m_xFactory->createInstance(aDesktopSrvNm), - uno::UNO_QUERY); + uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); - uno::Reference<frame::XFrame> xFrame( - xDesktop,uno::UNO_QUERY); + uno::Reference<frame::XFrame> xFrame(xDesktop,uno::UNO_QUERY); // the frame will be registered on desktop here, later when the document // is loaded into the frame in ::show() method the terminate listener will be removed diff --git a/extensions/source/nsplugin/source/so_instance.cxx b/extensions/source/nsplugin/source/so_instance.cxx index 7e636836aedc..20f54c1a025b 100644 --- a/extensions/source/nsplugin/source/so_instance.cxx +++ b/extensions/source/nsplugin/source/so_instance.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/DispatchHelper.hpp> #include <com/sun/star/frame/XDispatchProviderInterception.hpp> #include <com/sun/star/lang/SystemDependent.hpp> @@ -199,17 +200,10 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent) {} // get frames supplier - Reference< frame::XFramesSupplier > m_xFramesSupplier( - mxRemoteMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), - uno::UNO_QUERY ); - if ( !m_xFramesSupplier.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not get desktop\n"); - return sal_False; - } + Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( xContext ); // get frames - m_xFrames = m_xFramesSupplier->getFrames(); + m_xFrames = xFramesSupplier->getFrames(); if ( !m_xFrames.is() ) { debug_fprintf(NSP_LOG_APPEND, "can not get frames from FramesSupplier\n"); diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx index c916431d35b0..fa504aacdea5 100644 --- a/extensions/source/plugin/base/context.cxx +++ b/extensions/source/plugin/base/context.cxx @@ -47,27 +47,29 @@ #include <sal/log.hxx> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <tools/fsys.hxx> #include <tools/urlobj.hxx> #include <cppuhelper/implbase1.hxx> using namespace com::sun::star::io; +using namespace com::sun::star::frame; namespace ext_plug { class FileSink : public ::cppu::WeakAggImplHelper1< ::com::sun::star::io::XOutputStream > { private: - Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr; + Reference< ::com::sun::star::uno::XComponentContext > m_xContext; FILE* fp; - Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin; + Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin; ::rtl::OUString m_aMIMEType; ::rtl::OUString m_aTarget; ::rtl::OUString m_aFileName; public: - FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > &, + FileSink( const Reference< ::com::sun::star::uno::XComponentContext > &, const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, @@ -85,11 +87,11 @@ using namespace ext_plug; class XPluginContext_Impl : public ::cppu::WeakAggImplHelper1< ::com::sun::star::plugin::XPluginContext > { - Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr; + Reference< ::com::sun::star::uno::XComponentContext > m_xContext; rtl_TextEncoding m_aEncoding; public: - XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); + XPluginContext_Impl( const Reference< ::com::sun::star::uno::XComponentContext > & ); virtual ~XPluginContext_Impl(); @@ -105,11 +107,11 @@ public: Reference< ::com::sun::star::plugin::XPluginContext > XPluginManager_Impl::createPluginContext() throw() { - return new XPluginContext_Impl( m_xSMgr ); + return new XPluginContext_Impl( m_xContext ); } -XPluginContext_Impl::XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) - : m_xSMgr( rSMgr ), +XPluginContext_Impl::XPluginContext_Impl( const Reference< ::com::sun::star::uno::XComponentContext > & rxContext ) + : m_xContext( rxContext ), m_aEncoding( osl_getThreadTextEncoding() ) { } @@ -127,9 +129,7 @@ XPluginContext_Impl::~XPluginContext_Impl() void XPluginContext_Impl::getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException ) { - Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString("com.sun.star.frame.Desktop") ); - if( ! xInst.is() ) - return; + Reference< XDesktop2 > xDesktop = Desktop::create(m_xContext); if( target.isEmpty() ) { @@ -146,10 +146,9 @@ void XPluginContext_Impl::getURL(const Reference< ::com::sun::star::plugin::XPlu return; } - Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY ); XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin ); - if( xLoader.is() && pPlugin ) + if( pPlugin ) { try { @@ -159,7 +158,7 @@ void XPluginContext_Impl::getURL(const Reference< ::com::sun::star::plugin::XPlu Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 ); Reference< ::com::sun::star::lang::XComponent > xComp = - xLoader->loadComponentFromURL( + xDesktop->loadComponentFromURL( url, target, ::com::sun::star::frame::FrameSearchFlag::PARENT | @@ -220,13 +219,10 @@ void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPl } } - Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString("com.sun.star.frame.Desktop") ); - if( ! xInst.is() ) - return ; + Reference< XDesktop2 > xDesktop = Desktop::create(m_xContext); - Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY ); XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin ); - if( xLoader.is() && pPlugin ) + if( pPlugin ) { try { @@ -238,7 +234,7 @@ void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPl aValues[1].Value <<= ::rtl::OStringToOUString( (char*)( file ? aBuf : buf ).getConstArray(), m_aEncoding ); Sequence< ::com::sun::star::beans::PropertyValue > aArgs( aValues, 2 ); Reference< ::com::sun::star::lang::XComponent > xComp = - xLoader->loadComponentFromURL( + xDesktop->loadComponentFromURL( url, target, ::com::sun::star::frame::FrameSearchFlag::PARENT | @@ -268,16 +264,16 @@ void XPluginContext_Impl::postURLNotify(const Reference< ::com::sun::star::plugi void XPluginContext_Impl::newStream( const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source ) throw( ::com::sun::star::plugin::PluginException, RuntimeException ) { - FileSink* pNewSink = new FileSink( m_xSMgr, plugin, mimetype, target, source ); + FileSink* pNewSink = new FileSink( m_xContext, plugin, mimetype, target, source ); pNewSink->acquire(); } -FileSink::FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, const Reference< ::com::sun::star::plugin::XPlugin > & plugin, +FileSink::FileSink( const Reference< ::com::sun::star::uno::XComponentContext > & rxContext, const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source ) : - m_xSMgr( rSMgr ), + m_xContext( rxContext ), m_xPlugin( plugin ), m_aMIMEType( mimetype ), m_aTarget( target ) @@ -305,11 +301,10 @@ void FileSink::closeOutput() throw() if( fp ) fclose( fp ); - Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString("com.sun.star.frame.Desktop") ); - Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create(m_xContext); XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( m_xPlugin ); - if( xLoader.is() && pPlugin ) + if( pPlugin ) { try { @@ -319,7 +314,7 @@ void FileSink::closeOutput() throw() Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 ); Reference< ::com::sun::star::lang::XComponent > xComp = - xLoader->loadComponentFromURL( + xDesktop->loadComponentFromURL( m_aFileName, m_aTarget, ::com::sun::star::frame::FrameSearchFlag::PARENT | diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx index 12ff1a457f4e..80c6939a3e65 100644 --- a/extensions/source/plugin/base/manager.cxx +++ b/extensions/source/plugin/base/manager.cxx @@ -42,6 +42,7 @@ #include <cstdarg> #include <comphelper/string.hxx> +#include <comphelper/processfactory.hxx> #include "plugin/impl.hxx" @@ -99,7 +100,7 @@ const Sequence< ::rtl::OUString >& PluginManager::getAdditionalSearchPaths() //================================================================================================== Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( Exception ) { - Reference< XInterface > xService = *new XPluginManager_Impl( rSMgr ); + Reference< XInterface > xService = *new XPluginManager_Impl( comphelper::getComponentContext(rSMgr) ); return xService; } @@ -136,10 +137,10 @@ Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames_Static return aSNS; } -XPluginManager_Impl::XPluginManager_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) -: m_xSMgr( rSMgr ) +XPluginManager_Impl::XPluginManager_Impl( const Reference< ::com::sun::star::uno::XComponentContext > & rxContext ) +: m_xContext( rxContext ) { - PluginManager::setServiceFactory( rSMgr ); + PluginManager::setServiceFactory( Reference< ::com::sun::star::lang::XMultiServiceFactory>(rxContext->getServiceManager(), UNO_QUERY_THROW) ); } XPluginManager_Impl::~XPluginManager_Impl() @@ -189,7 +190,7 @@ Sequence<com::sun::star::plugin::PluginDescription> XPluginManager_Impl::getPlug Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext >& acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype) throw( RuntimeException,::com::sun::star::plugin::PluginException ) { - XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr ); + XPlugin_Impl* pImpl = new XPlugin_Impl( Reference< ::com::sun::star::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW) ); pImpl->setPluginContext( acontext ); PluginManager::get().getPlugins().push_back( pImpl ); @@ -204,7 +205,7 @@ Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPlugin Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPluginFromURL( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const Reference< ::com::sun::star::awt::XToolkit > & toolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & parent, const ::rtl::OUString& url ) throw() { - XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr ); + XPlugin_Impl* pImpl = new XPlugin_Impl( Reference< ::com::sun::star::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW) ); Reference< ::com::sun::star::plugin::XPlugin > xRef = pImpl; pImpl->setPluginContext( acontext ); diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx index 5316fbe4eed7..dbb06a06be67 100644 --- a/extensions/source/plugin/inc/plugin/impl.hxx +++ b/extensions/source/plugin/inc/plugin/impl.hxx @@ -287,9 +287,9 @@ public: class XPluginManager_Impl : public cppu::WeakAggImplHelper1< com::sun::star::plugin::XPluginManager > { - Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr; + Reference< com::sun::star::uno::XComponentContext > m_xContext; public: - XPluginManager_Impl( const Reference< com::sun::star::lang::XMultiServiceFactory > & ); + XPluginManager_Impl( const Reference< com::sun::star::uno::XComponentContext > & ); virtual ~XPluginManager_Impl(); static XPlugin_Impl* getXPluginFromNPP( NPP ); diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx index 48eab4cff6ed..49401768bacc 100644 --- a/extensions/source/propctrlr/formstrings.hxx +++ b/extensions/source/propctrlr/formstrings.hxx @@ -293,8 +293,6 @@ namespace pcr PCR_CONSTASCII_STRING( SERVICE_ADDRESS_CONVERSION, "com.sun.star.table.CellAddressConversion" ); PCR_CONSTASCII_STRING( SERVICE_RANGEADDRESS_CONVERSION, "com.sun.star.table.CellRangeAddressConversion" ); - PCR_CONSTASCII_STRING( SERVICE_DESKTOP, "com.sun.star.frame.Desktop" ); - //............................................................................ } // namespace pcr //............................................................................ diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 56f2d0fc63c3..134c3c7af3f3 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/script/Converter.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <tools/debug.hxx> #include <comphelper/extract.hxx> @@ -285,7 +286,7 @@ namespace pcr URL aURL; aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:OpenHyperlink" ) ); xTransformer->parseStrict( aURL ); - Reference< XDispatchProvider > xDispProv( m_aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference< XDesktop2 > xDispProv = Desktop::create( m_aContext.getUNOContext() ); Reference< XDispatch > xDispatch( xDispProv->queryDispatch( aURL, ::rtl::OUString(), 0 ), UNO_QUERY_THROW ); Sequence< PropertyValue > aDispatchArgs(1); diff --git a/extensions/source/propctrlr/sqlcommanddesign.cxx b/extensions/source/propctrlr/sqlcommanddesign.cxx index c6405ea43631..c419ec7f8ee6 100644 --- a/extensions/source/propctrlr/sqlcommanddesign.cxx +++ b/extensions/source/propctrlr/sqlcommanddesign.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XController.hpp> @@ -79,6 +80,8 @@ namespace pcr using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::frame::XDispatchProvider; using ::com::sun::star::frame::XDispatch; + using ::com::sun::star::frame::Desktop; + using ::com::sun::star::frame::XDesktop2; using ::com::sun::star::uno::Any; /** === end UNO using === **/ namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag; @@ -290,12 +293,10 @@ namespace pcr Reference< XFrame > xFrame; try { - Reference< XInterface > xDesktop ( m_xORB->createInstanceWithContext( SERVICE_DESKTOP, m_xContext ) ); - Reference< XFrame > xDesktopFrame ( xDesktop, UNO_QUERY_THROW ); - Reference< XFramesSupplier > xSuppDesktopFrames( xDesktopFrame, UNO_QUERY_THROW ); + Reference< XDesktop2 > xDesktop = Desktop::create(m_xContext); - Reference< XFrames > xDesktopFramesCollection( xSuppDesktopFrames->getFrames(), UNO_QUERY_THROW ); - xFrame = xDesktopFrame->findFrame( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" ) ), FrameSearchFlag::CREATE ); + Reference< XFrames > xDesktopFramesCollection( xDesktop->getFrames(), UNO_QUERY_THROW ); + xFrame = xDesktop->findFrame( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" ) ), FrameSearchFlag::CREATE ); OSL_ENSURE( xFrame.is(), "SQLCommandDesigner::impl_createEmptyParentlessTask_nothrow: could not create an empty frame!" ); xDesktopFramesCollection->remove( xFrame ); } diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx index 002e69104152..5a8f242447a2 100644 --- a/extensions/source/scanner/scanwin.cxx +++ b/extensions/source/scanner/scanwin.cxx @@ -23,7 +23,7 @@ #include <com/sun/star/util/XCloseBroadcaster.hpp> #include <com/sun/star/util/XCloseListener.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <cppuhelper/implbase1.hxx> #include <comphelper/processfactory.hxx> @@ -565,44 +565,14 @@ uno::Reference< frame::XFrame > ImpTwain::ImplGetActiveFrame() { try { - uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); + // query desktop instance + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); - if( xMgr.is() ) - { - // query desktop instance - uno::Reference< frame::XDesktop > xDesktop( xMgr->createInstance( - OUString("com.sun.star.frame.Desktop") ), uno::UNO_QUERY ); - - if( xDesktop.is() ) - { - // query property set from desktop, which contains the currently active frame - uno::Reference< beans::XPropertySet > xDesktopProps( xDesktop, uno::UNO_QUERY ); - - if( xDesktopProps.is() ) - { - uno::Any aActiveFrame; - - try - { - aActiveFrame = xDesktopProps->getPropertyValue( - OUString("ActiveFrame") ); - } - catch( const beans::UnknownPropertyException& ) - { - // property unknown. - OSL_FAIL("ImpTwain::ImplGetActiveFrame: ActiveFrame property unknown, cannot determine active frame!"); - return uno::Reference< frame::XFrame >(); - } + uno::Reference< frame::XFrame > xActiveFrame = xDesktop->getActiveFrame(); - uno::Reference< frame::XFrame > xActiveFrame; - - if( (aActiveFrame >>= xActiveFrame) && - xActiveFrame.is() ) - { - return xActiveFrame; - } - } - } + if( xActiveFrame.is() ) + { + return xActiveFrame; } } catch( const uno::Exception& ) diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index c8d25735bead..3deb8461980f 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -23,7 +23,7 @@ #include <cppuhelper/implbase1.hxx> #include <com/sun/star/beans/XFastPropertySet.hpp> #include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/DispatchResultEvent.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> @@ -724,12 +724,9 @@ ShutdownThread::run() xQuickStarter->setFastPropertyValue(0, uno::makeAny(false)); // Shutdown the office - uno::Reference< frame::XDesktop > xDesktop( - UpdateCheck::createService(UNISTRING("com.sun.star.frame.Desktop"), m_xContext), - uno::UNO_QUERY); + uno::Reference< frame::XDesktop2 > xDesktop = Desktop::create(m_xContext); - if( xDesktop.is() ) - xDesktop->terminate(); + xDesktop->terminate(); } //------------------------------------------------------------------------------ diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx index 2360daf7c722..62913cfd467c 100644 --- a/extensions/source/update/check/updatecheckjob.cxx +++ b/extensions/source/update/check/updatecheckjob.cxx @@ -28,7 +28,7 @@ #include <cppuhelper/implbase3.hxx> #include <cppuhelper/implementationentry.hxx> -#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "com/sun/star/frame/XTerminateListener.hpp" #include <com/sun/star/task/XJob.hpp> @@ -102,7 +102,7 @@ public: private: uno::Reference<uno::XComponentContext> m_xContext; - uno::Reference< frame::XDesktop > m_xDesktop; + uno::Reference< frame::XDesktop2 > m_xDesktop; std::auto_ptr< InitUpdateCheckJobThread > m_pInitThread; void handleExtensionUpdates( const uno::Sequence< beans::NamedValue > &rListProp ); @@ -152,9 +152,8 @@ void InitUpdateCheckJobThread::setTerminating() { UpdateCheckJob::UpdateCheckJob( const uno::Reference<uno::XComponentContext>& xContext ) : m_xContext(xContext) { - m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext( UNISTRING("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY ); - if ( m_xDesktop.is() ) - m_xDesktop->addTerminateListener( this ); + m_xDesktop.set( Desktop::create(xContext) ); + m_xDesktop->addTerminateListener( this ); } //------------------------------------------------------------------------------ diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index ff04abcfe192..98657d0c1216 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -53,7 +53,7 @@ #include "com/sun/star/container/XNameContainer.hpp" -#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/task/InteractionHandler.hpp" @@ -1085,15 +1085,10 @@ void UpdateHandler::createDialog() return; } - uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() ); - - if( xServiceManager.is() ) + if( mxContext.is() ) { - uno::Reference< frame::XDesktop > xDesktop( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.frame.Desktop"), mxContext ), - uno::UNO_QUERY ); - if ( xDesktop.is() ) - xDesktop->addTerminateListener( this ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( mxContext ); + xDesktop->addTerminateListener( this ); } loadStrings(); diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx index 2b4ecac979bb..7f5037cf9865 100644 --- a/filter/source/flash/swffilter.cxx +++ b/filter/source/flash/swffilter.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XExporter.hpp> @@ -31,6 +31,7 @@ #include <com/sun/star/io/XOutputStream.hpp> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase4.hxx> +#include <comphelper/processfactory.hxx> #include <osl/file.hxx> #include "swfexporter.hxx" @@ -263,9 +264,7 @@ sal_Bool FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue if(!xDrawPages.is()) return sal_False; - Reference< XDesktop > rDesktop( mxMSF->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY); - if (!rDesktop.is()) - return sal_False; + Reference< XDesktop2 > rDesktop = Desktop::create( comphelper::getComponentContext(mxMSF) ); Reference< XStorable > xStorable(rDesktop->getCurrentComponent(), UNO_QUERY); if (!xStorable.is()) diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 4289a30abb67..2bf32d0ce995 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -2018,7 +2018,7 @@ sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XDrawPage > & r sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxDrawPage ) { - Reference< XExporter > xExporter( mxMSF->createInstance( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ) ), UNO_QUERY ); + Reference< XExporter > xExporter( mxContext->getServiceManager()->createInstanceWithContext( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ), mxContext ), UNO_QUERY ); sal_Bool bRet = sal_False; if( xExporter.is() ) diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index bbe2a3c35dfd..2570fee33b30 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -24,7 +24,7 @@ #include <uno/environment.h> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawView.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/drawing/XDrawSubController.hpp> @@ -52,8 +52,7 @@ using namespace ::com::sun::star; // ------------- SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) : - mxMSF( rxCtx->getServiceManager(), - uno::UNO_QUERY_THROW ), + mxContext( rxCtx ), mpSVGDoc( NULL ), mpSVGExport( NULL ), mpSVGFontExport( NULL ), @@ -97,8 +96,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto { if( !mbExportAll && !mSelectedPages.hasElements() ) { - uno::Reference< frame::XDesktop > xDesktop(mxMSF->createInstance( "com.sun.star.frame.Desktop" ), - uno::UNO_QUERY_THROW); + uno::Reference< frame::XDesktop2 > xDesktop(frame::Desktop::create(mxContext)); uno::Reference< frame::XFrame > xFrame(xDesktop->getCurrentFrame(), uno::UNO_QUERY_THROW); uno::Reference<frame::XController > xController(xFrame->getController(), diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 975b7c6f226e..86694f217a23 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -277,7 +277,7 @@ public: private: - Reference< XMultiServiceFactory > mxMSF; + Reference< XComponentContext > mxContext; SvXMLElementExport* mpSVGDoc; SVGExport* mpSVGExport; SVGFontExport* mpSVGFontExport; diff --git a/filter/source/svg/svgimport.cxx b/filter/source/svg/svgimport.cxx index 15e1fe1b89c7..e3e7a7b7ee2b 100644 --- a/filter/source/svg/svgimport.cxx +++ b/filter/source/svg/svgimport.cxx @@ -64,13 +64,13 @@ sal_Bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) return sal_False; rtl::OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) ); - Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY ); + Reference < XDocumentHandler > xInternalHandler( mxContext->getServiceManager()->createInstanceWithContext( sXMLImportService, mxContext ), UNO_QUERY ); // The XImporter sets up an empty target document for XDocumentHandler to write to.. uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY); xImporter->setTargetDocument(mxDstDoc); - SVGReader aReader(mxMSF, xInputStream, xInternalHandler); + SVGReader aReader(uno::Reference<lang::XMultiServiceFactory>(mxContext->getServiceManager(), uno::UNO_QUERY_THROW), xInputStream, xInternalHandler); return aReader.parseAndConvert(); } diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 0c1cbfd30176..3bf4119c00b3 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -25,7 +25,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/component.hxx> #include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> #include <cppuhelper/implbase4.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -36,6 +36,7 @@ #include <tools/resmgr.hxx> #include <vcl/svapp.hxx> #include <rtl/instance.hxx> +#include <comphelper/processfactory.hxx> #include <svl/solar.hrc> @@ -125,12 +126,9 @@ XMLFilterDialogComponent::XMLFilterDialogComponent( const com::sun::star::uno::R mxMSF( rxMSF ), mpDialog( NULL ) { - Reference< XDesktop > xDesktop( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - if( xDesktop.is() ) - { - Reference< XTerminateListener > xListener( this ); - xDesktop->addTerminateListener( xListener ); - } + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(mxMSF) ); + Reference< XTerminateListener > xListener( this ); + xDesktop->addTerminateListener( xListener ); } //------------------------------------------------------------------------- diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 64932a96aaff..0c04cad42b1c 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -26,7 +26,7 @@ #include <com/sun/star/document/XEmbeddedObjectResolver.hpp> #include <com/sun/star/frame/GlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XConfigManager.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> @@ -415,19 +415,16 @@ void XMLFilterTestDialog::onExportBrowse() { m_sExportRecentFile = aDlg.GetPath(); - Reference< XComponentLoader > xLoader( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); + Reference< XDesktop2 > xLoader = Desktop::create( comphelper::getComponentContext(mxMSF) ); Reference< XInteractionHandler2 > xInter( InteractionHandler::createWithParent(comphelper::getComponentContext(mxMSF), 0) ); - if( xLoader.is() ) + OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); + Sequence< PropertyValue > aArguments(1); + aArguments[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); + aArguments[0].Value <<= xInter; + Reference< XComponent > xComp( xLoader->loadComponentFromURL( m_sExportRecentFile, aFrame, 0, aArguments ) ); + if( xComp.is() ) { - OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); - Sequence< PropertyValue > aArguments(1); - aArguments[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); - aArguments[0].Value <<= xInter; - Reference< XComponent > xComp( xLoader->loadComponentFromURL( m_sExportRecentFile, aFrame, 0, aArguments ) ); - if( xComp.is() ) - { - doExport( xComp ); - } + doExport( xComp ); } } } @@ -603,20 +600,17 @@ void XMLFilterTestDialog::import( const OUString& rURL ) { try { - Reference< XComponentLoader > xLoader( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); + Reference< XDesktop2 > xLoader = Desktop::create( comphelper::getComponentContext(mxMSF) ); Reference< XInteractionHandler2 > xInter( InteractionHandler::createWithParent(comphelper::getComponentContext(mxMSF), 0) ); - if( xLoader.is() ) - { - OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); - Sequence< PropertyValue > aArguments(2); - aArguments[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); - aArguments[0].Value <<= m_pFilterInfo->maFilterName; - aArguments[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); - aArguments[1].Value <<= xInter; + OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); + Sequence< PropertyValue > aArguments(2); + aArguments[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); + aArguments[0].Value <<= m_pFilterInfo->maFilterName; + aArguments[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); + aArguments[1].Value <<= xInter; - xLoader->loadComponentFromURL( rURL, aFrame, 0, aArguments ); - } + xLoader->loadComponentFromURL( rURL, aFrame, 0, aArguments ); if( m_pCBXDisplaySource->IsChecked() ) { @@ -700,39 +694,36 @@ Reference< XComponent > XMLFilterTestDialog::getFrontMostDocument( const OUStrin try { - Reference< XDesktop > xDesktop( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - if( xDesktop.is() ) + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(mxMSF) ); + Reference< XComponent > xTest( mxLastFocusModel ); + if( checkComponent( xTest, rServiceName ) ) + { + xRet = xTest; + } + else { - Reference< XComponent > xTest( mxLastFocusModel ); + xTest = (Reference< XComponent >)xDesktop->getCurrentComponent(); + if( checkComponent( xTest, rServiceName ) ) { xRet = xTest; } else { - xTest = (Reference< XComponent >)xDesktop->getCurrentComponent(); - - if( checkComponent( xTest, rServiceName ) ) - { - xRet = xTest; - } - else + Reference< XEnumerationAccess > xAccess( xDesktop->getComponents() ); + if( xAccess.is() ) { - Reference< XEnumerationAccess > xAccess( xDesktop->getComponents() ); - if( xAccess.is() ) + Reference< XEnumeration > xEnum( xAccess->createEnumeration() ); + if( xEnum.is() ) { - Reference< XEnumeration > xEnum( xAccess->createEnumeration() ); - if( xEnum.is() ) + while( xEnum->hasMoreElements() ) { - while( xEnum->hasMoreElements() ) + if( (xEnum->nextElement() >>= xTest) && xTest.is() ) { - if( (xEnum->nextElement() >>= xTest) && xTest.is() ) + if( checkComponent( xTest, rServiceName ) ) { - if( checkComponent( xTest, rServiceName ) ) - { - xRet = xTest; - break; - } + xRet = xTest; + break; } } } diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index 1ec494f91b88..f08b3f628a7e 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/xml/dom/XDocument.hpp> #include <com/sun/star/xml/dom/DocumentBuilder.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -49,7 +50,6 @@ CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aRepla return CSubmission::UNKNOWN_ERROR; try { - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); if (aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("all")) || aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("document"))) { @@ -58,8 +58,7 @@ CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aRepla xLoader = Reference< XComponentLoader >(aFrame, UNO_QUERY); if (!xLoader.is()) - xLoader = Reference< XComponentLoader >(xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ) ), UNO_QUERY_THROW); + xLoader = Reference< XComponentLoader >( Desktop::create(xContext), UNO_QUERY_THROW); // open the stream from the result... // build media descriptor diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx index 81e1711b4fef..8e2ac6f076e8 100644 --- a/framework/inc/classes/menumanager.hxx +++ b/framework/inc/classes/menumanager.hxx @@ -83,7 +83,7 @@ class MenuManager : public ThreadHelpBase , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory(); - static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,IMutex& _rMutex); + static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,IMutex& _rMutex); static void FillMenuImages( ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame, Menu* _pMenu, diff --git a/framework/inc/jobs/helponstartup.hxx b/framework/inc/jobs/helponstartup.hxx index 4111c98bbae0..09f949aae37b 100644 --- a/framework/inc/jobs/helponstartup.hxx +++ b/framework/inc/jobs/helponstartup.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/task/XJob.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <com/sun/star/frame/XModuleManager2.hpp> @@ -53,7 +54,7 @@ class HelpOnStartup : private ThreadHelpBase //....................................... /** @short reference to an uno service manager. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; //....................................... /** @short such module manager is used to classify new opened documents. */ @@ -61,7 +62,7 @@ class HelpOnStartup : private ThreadHelpBase //....................................... /** @short is needed to locate a might open help frame. */ - css::uno::Reference< css::frame::XFrame > m_xDesktop; + css::uno::Reference< css::frame::XDesktop2 > m_xDesktop; //....................................... /** @short provides read access to the underlying configuration. */ @@ -86,11 +87,11 @@ class HelpOnStartup : private ThreadHelpBase //--------------------------------------- /** @short create new instance of this class. - @param xSMGR + @param xContext reference to the uno service manager, which created this instance. Can be used later to create own needed uno resources on demand. */ - HelpOnStartup(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + HelpOnStartup(const css::uno::Reference< css::uno::XComponentContext >& xContext); //--------------------------------------- /** @short does nothing real ... diff --git a/framework/inc/jobs/job.hxx b/framework/inc/jobs/job.hxx index cd03bff7c824..7f18dc69a18f 100644 --- a/framework/inc/jobs/job.hxx +++ b/framework/inc/jobs/job.hxx @@ -32,7 +32,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/task/XJobListener.hpp> #include <com/sun/star/util/XCloseListener.hpp> @@ -128,7 +128,7 @@ class Job : public css::lang::XTypeProvider We are registered at this instance to listen for office shutdown events. It's neccessary supress it (if possible) or to react in the right way. */ - css::uno::Reference< css::frame::XDesktop > m_xDesktop; + css::uno::Reference< css::frame::XDesktop2 > m_xDesktop; /** A job can return a dispatch result event after finishing its work. diff --git a/framework/inc/services.h b/framework/inc/services.h index 6606328fcab5..e3131365e2ec 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -29,7 +29,6 @@ namespace framework{ //_________________________________________________________________________________________________________________ #define SERVICENAME_FRAME DECLARE_ASCII("com.sun.star.frame.Frame" ) -#define SERVICENAME_DESKTOP DECLARE_ASCII("com.sun.star.frame.Desktop" ) #define SERVICENAME_TASK DECLARE_ASCII("com.sun.star.frame.Task" ) #define SERVICENAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.frame.FrameLoaderFactory" ) #define SERVICENAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.document.FilterFactory" ) diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx index 0f5c65d1a3f9..d6d2aaea260f 100644 --- a/framework/inc/services/desktop.hxx +++ b/framework/inc/services/desktop.hxx @@ -32,7 +32,7 @@ #include <com/sun/star/frame/XUntitledNumbers.hpp> #include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <com/sun/star/frame/WindowArrange.hpp> #include <com/sun/star/frame/TerminationVetoException.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> @@ -47,7 +47,6 @@ #include <com/sun/star/frame/XDispatchProviderInterception.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameAction.hpp> -#include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <com/sun/star/frame/XTasksSupplier.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/lang/Locale.hpp> @@ -107,12 +106,8 @@ enum ELoadState class Desktop : // interfaces public css::lang::XTypeProvider , public css::lang::XServiceInfo , - public css::frame::XDesktop , - public css::frame::XComponentLoader , + public css::frame::XDesktop2 , public css::frame::XTasksSupplier , - public css::frame::XDispatchProvider , - public css::frame::XDispatchProviderInterception, - public css::frame::XFramesSupplier , // => XFrame => XComponent public css::frame::XDispatchResultListener , // => XEventListener public css::task::XInteractionHandler , public css::frame::XUntitledNumbers , diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx index d12f80c54555..54e4dc34ffd1 100644 --- a/framework/source/classes/menumanager.cxx +++ b/framework/source/classes/menumanager.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/util/XStringWidth.hpp> @@ -622,39 +622,35 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu ) } } -void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XMultiServiceFactory >& xServiceFactory,framework::IMutex& _rMutex ) +void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XComponentContext >& xContext,framework::IMutex& _rMutex ) { // update window list ::std::vector< ::rtl::OUString > aNewWindowListVector; - Reference< XDesktop > xDesktop( xServiceFactory->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( xContext ); sal_uInt16 nActiveItemId = 0; sal_uInt16 nItemId = START_ITEMID_WINDOWLIST; - if ( xDesktop.is() ) + Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); + Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); + sal_Int32 nFrameCount = xList->getCount(); + aNewWindowListVector.reserve(nFrameCount); + for (sal_Int32 i=0; i<nFrameCount; ++i ) { - Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY ); - Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); - Reference< XIndexAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY ); - sal_Int32 nCount = xList->getCount(); - aNewWindowListVector.reserve(nCount); - for (sal_Int32 i=0; i<nCount; ++i ) + Reference< XFrame > xFrame; + xList->getByIndex(i) >>= xFrame; + + if (xFrame.is()) { - Reference< XFrame > xFrame; - xList->getByIndex(i) >>= xFrame; + if ( xFrame == xCurrentFrame ) + nActiveItemId = nItemId; - if (xFrame.is()) + Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + if ( pWin && pWin->IsVisible() ) { - if ( xFrame == xCurrentFrame ) - nActiveItemId = nItemId; - - Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - if ( pWin && pWin->IsVisible() ) - { - aNewWindowListVector.push_back( pWin->GetText() ); - ++nItemId; - } + aNewWindowListVector.push_back( pWin->GetText() ); + ++nItemId; } } } @@ -767,7 +763,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu ) if ( m_aMenuItemCommand == aSpecialFileMenu || m_aMenuItemCommand == aSlotSpecialFileMenu || aCommand == aSpecialFileCommand ) UpdateSpecialFileMenu( pMenu ); else if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aCommand == aSpecialWindowCommand ) - UpdateSpecialWindowMenu( pMenu, getServiceFactory(), m_aLock ); + UpdateSpecialWindowMenu( pMenu, comphelper::getComponentContext(getServiceFactory()), m_aLock ); // Check if some modes have changed so we have to update our menu images if ( bShowMenuImages != m_bShowMenuImages ) @@ -866,28 +862,25 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu ) { // window list menu item selected - Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getServiceFactory()) ); - if ( xDesktop.is() ) + sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; + Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); + sal_Int32 nCount = xList->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) { - sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; - Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); - sal_Int32 nCount = xList->getCount(); - for ( sal_Int32 i=0; i<nCount; ++i ) - { - Reference< XFrame > xFrame; - xList->getByIndex(i) >>= xFrame; + Reference< XFrame > xFrame; + xList->getByIndex(i) >>= xFrame; - if ( xFrame.is() && nTaskId == nCurItemId ) - { - Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - pWin->GrabFocus(); - pWin->ToTop( TOTOP_RESTOREWHENMIN ); - break; - } - - nTaskId++; + if ( xFrame.is() && nTaskId == nCurItemId ) + { + Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + pWin->GrabFocus(); + pWin->ToTop( TOTOP_RESTOREWHENMIN ); + break; } + + nTaskId++; } } else diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx index 74e212bdc6d2..87dd6d302073 100644 --- a/framework/source/classes/taskcreator.cxx +++ b/framework/source/classes/taskcreator.cxx @@ -23,6 +23,7 @@ #include <loadenv/targethelper.hxx> #include <services.h> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/beans/NamedValue.hpp> @@ -102,7 +103,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const ::rtl:: css::beans::NamedValue aArg ; aArg.Name = rtl::OUString(ARGUMENT_PARENTFRAME); - aArg.Value <<= css::uno::Reference< css::frame::XFrame >(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); + aArg.Value <<= css::uno::Reference< css::frame::XFrame >( css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY_THROW); lArgs[0] <<= aArg; aArg.Name = rtl::OUString(ARGUMENT_CREATETOPWINDOW); diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index 258b5b575acd..675c507ab898 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -25,7 +25,7 @@ #include <services.h> #include <general.h> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/CommandGroup.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -39,6 +39,7 @@ #include "vcl/syswin.hxx" #include <osl/mutex.hxx> #include <unotools/moduleoptions.hxx> +#include <comphelper/processfactory.hxx> using namespace com::sun::star; @@ -299,7 +300,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback) // Analyze the environment a first time. // If we found some special cases, we can // make some decisions erliar! - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create(comphelper::getComponentContext(xSMGR)), css::uno::UNO_QUERY_THROW); FrameListAnalyzer aCheck1(xDesktop, xCloseFrame, FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT); // a) If the curent frame (where the close dispatch was requested for) does not have @@ -471,7 +472,7 @@ sal_Bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Referenc aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY_THROW); FrameListAnalyzer aCheck(xDesktop, xFrame, FrameListAnalyzer::E_ALL); sal_Int32 c = aCheck.m_lModelFrames.getLength(); @@ -573,8 +574,7 @@ sal_Bool CloseDispatcher::implts_terminateApplication() aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XDesktop > xDesktop( - xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ); return xDesktop->terminate(); } diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx index c609a83a6ecb..ed7959d41116 100644 --- a/framework/source/dispatch/startmoduledispatcher.cxx +++ b/framework/source/dispatch/startmoduledispatcher.cxx @@ -29,7 +29,7 @@ #include <services.h> #include <general.h> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/CommandGroup.hpp> #include <com/sun/star/awt/XTopWindow.hpp> @@ -41,6 +41,7 @@ #include <vcl/svapp.hxx> #include <osl/mutex.hxx> #include <unotools/moduleoptions.hxx> +#include <comphelper/processfactory.hxx> namespace framework{ @@ -152,7 +153,7 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere // <- SAFE ---------------------------------- css::uno::Reference< css::frame::XFramesSupplier > xDesktop( - xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY); FrameListAnalyzer aCheck( xDesktop, @@ -182,7 +183,7 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XFrame > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XDesktop2> xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ); css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->findFrame (SPECIALTARGET_BLANK, 0); css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow (); diff --git a/framework/source/jobs/helponstartup.cxx b/framework/source/jobs/helponstartup.cxx index 3d1285e3c222..0d90cf279467 100644 --- a/framework/source/jobs/helponstartup.cxx +++ b/framework/source/jobs/helponstartup.cxx @@ -39,7 +39,7 @@ #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> namespace framework{ @@ -69,7 +69,7 @@ static ::rtl::OUString ENVTYPE_DOCUMENTEVENT ("DOCUMENTEVENT"); //----------------------------------------------- -DEFINE_XSERVICEINFO_MULTISERVICE(HelpOnStartup , +DEFINE_XSERVICEINFO_MULTISERVICE_2(HelpOnStartup , ::cppu::OWeakObject , SERVICENAME_JOB , IMPLEMENTATIONNAME_HELPONSTARTUP) @@ -82,23 +82,20 @@ DEFINE_INIT_SERVICE(HelpOnStartup, see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations! */ // create some needed uno services and cache it - css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getComponentContext(m_xSMGR); - m_xModuleManager = css::frame::ModuleManager::create( xContext ); + m_xModuleManager = css::frame::ModuleManager::create( m_xContext ); - m_xDesktop = css::uno::Reference< css::frame::XFrame >( - m_xSMGR->createInstance(SERVICENAME_DESKTOP), - css::uno::UNO_QUERY_THROW); + m_xDesktop = css::frame::Desktop::create(m_xContext); m_xConfig = css::uno::Reference< css::container::XNameAccess >( ::comphelper::ConfigurationHelper::openConfig( - xContext, + m_xContext, CFG_PACKAGE_MODULES, ::comphelper::ConfigurationHelper::E_READONLY), css::uno::UNO_QUERY_THROW); // ask for office locale ::comphelper::ConfigurationHelper::readDirectKey( - xContext, + m_xContext, CFG_PACKAGE_SETUP, CFG_PATH_L10N, CFG_KEY_LOCALE, @@ -106,7 +103,7 @@ DEFINE_INIT_SERVICE(HelpOnStartup, // detect system ::comphelper::ConfigurationHelper::readDirectKey( - xContext, + m_xContext, CFG_PACKAGE_COMMON, CFG_PATH_HELP, CFG_KEY_HELPSYSTEM, @@ -128,9 +125,9 @@ DEFINE_INIT_SERVICE(HelpOnStartup, ) //----------------------------------------------- -HelpOnStartup::HelpOnStartup(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +HelpOnStartup::HelpOnStartup(const css::uno::Reference< css::uno::XComponentContext >& xContext) : ThreadHelpBase( ) - , m_xSMGR (xSMGR) + , m_xContext (xContext) { } @@ -265,7 +262,7 @@ void SAL_CALL HelpOnStartup::disposing(const css::lang::EventObject& aEvent) { // SAFE -> ResetableGuard aLock(m_aLock); - css::uno::Reference< css::frame::XFrame > xDesktop = m_xDesktop; + css::uno::Reference< css::frame::XDesktop2 > xDesktop = m_xDesktop; aLock.unlock(); // <- SAFE @@ -310,7 +307,6 @@ void SAL_CALL HelpOnStartup::disposing(const css::lang::EventObject& aEvent) // SAFE -> ResetableGuard aLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR (m_xSMGR, css::uno::UNO_QUERY_THROW); css::uno::Reference< css::container::XNameAccess > xConfig = m_xConfig; ::rtl::OUString sLocale = m_sLocale; ::rtl::OUString sSystem = m_sSystem; diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx index 62ec7ebdd573..a38c2f499c92 100644 --- a/framework/source/jobs/job.cxx +++ b/framework/source/jobs/job.cxx @@ -23,6 +23,7 @@ #include <general.h> #include <services.h> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/task/XJob.hpp> #include <com/sun/star/task/XAsyncJob.hpp> #include <com/sun/star/util/XCloseBroadcaster.hpp> @@ -337,7 +338,7 @@ void Job::die() m_xJob = css::uno::Reference< css::uno::XInterface >(); m_xFrame = css::uno::Reference< css::frame::XFrame >(); m_xModel = css::uno::Reference< css::frame::XModel >(); - m_xDesktop = css::uno::Reference< css::frame::XDesktop >(); + m_xDesktop = css::uno::Reference< css::frame::XDesktop2 >(); m_xResultListener = css::uno::Reference< css::frame::XDispatchResultListener >(); m_xResultSourceFake = css::uno::Reference< css::uno::XInterface >(); m_bPendingCloseFrame = sal_False; @@ -541,17 +542,14 @@ void Job::impl_startListening() { try { - m_xDesktop = css::uno::Reference< css::frame::XDesktop >(m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + m_xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) ); css::uno::Reference< css::frame::XTerminateListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); - if (m_xDesktop.is()) - { - m_xDesktop->addTerminateListener(xThis); - m_bListenOnDesktop = sal_True; - } + m_xDesktop->addTerminateListener(xThis); + m_bListenOnDesktop = sal_True; } catch(const css::uno::Exception&) { - m_xDesktop = css::uno::Reference< css::frame::XDesktop >(); + m_xDesktop.clear(); } } @@ -614,7 +612,7 @@ void Job::impl_stopListening() { css::uno::Reference< css::frame::XTerminateListener > xThis(static_cast< ::cppu::OWeakObject* >(this) , css::uno::UNO_QUERY); m_xDesktop->removeTerminateListener(xThis); - m_xDesktop = css::uno::Reference< css::frame::XDesktop >(); + m_xDesktop.clear(); m_bListenOnDesktop = sal_False; } catch(const css::uno::Exception&) @@ -887,7 +885,7 @@ void SAL_CALL Job::disposing( const css::lang::EventObject& aEvent ) throw(css:: if (m_xDesktop.is() && aEvent.Source == m_xDesktop) { - m_xDesktop = css::uno::Reference< css::frame::XDesktop >(); + m_xDesktop.clear(); m_bListenOnDesktop = sal_False; } else if (m_xFrame.is() && aEvent.Source == m_xFrame) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 78bc67c8c42f..0b5f95db11a1 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -50,6 +50,7 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/awt/XTopWindow.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XFrameLoader.hpp> #include <com/sun/star/frame/XSynchronousFrameLoader.hpp> @@ -972,7 +973,7 @@ sal_Bool LoadEnv::impl_furtherDocsAllowed() aVal >>= nMaxOpenDocuments; css::uno::Reference< css::frame::XFramesSupplier > xDesktop( - xSMGR->createInstance(SERVICENAME_DESKTOP), + css::frame::Desktop::create( comphelper::getComponentContext(xSMGR)), css::uno::UNO_QUERY_THROW); FrameListAnalyzer aAnalyzer(xDesktop, @@ -1295,7 +1296,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() // otherwhise - iterate through the tasks of the desktop container // to find out, which of them might contains the requested document - css::uno::Reference< css::frame::XFramesSupplier > xSupplier(m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XDesktop2 > xSupplier = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) ); css::uno::Reference< css::container::XIndexAccess > xTaskList(xSupplier->getFrames() , css::uno::UNO_QUERY); if (!xTaskList.is()) @@ -1436,7 +1437,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() if (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN(), sal_False) == sal_True) return css::uno::Reference< css::frame::XFrame >(); - css::uno::Reference< css::frame::XFramesSupplier > xSupplier(m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XFramesSupplier > xSupplier( css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) ), css::uno::UNO_QUERY); FrameListAnalyzer aTasksAnalyzer(xSupplier, css::uno::Reference< css::frame::XFrame >(), FrameListAnalyzer::E_BACKINGCOMPONENT); if (aTasksAnalyzer.m_xBackingComponent.is()) { diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 3d4a794eba89..d84086b69c0f 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/GlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XModel2.hpp> @@ -1988,7 +1989,7 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible) aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY); lcl_changeVisibility( xDesktop, bVisible ); aReadLock.unlock(); @@ -2128,8 +2129,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl if (pParams) xExternalProgress = pParams->m_xProgress; - css::uno::Reference< css::frame::XFramesSupplier > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); - ::rtl::OUString sBackupPath (SvtPathOptions().GetBackupPath()); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR)); + ::rtl::OUString sBackupPath(SvtPathOptions().GetBackupPath()); css::uno::Reference< css::frame::XController > xActiveController; css::uno::Reference< css::frame::XModel > xActiveModel ; @@ -2625,7 +2626,7 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XFrame > xDesktop( xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR)); ::std::vector< Reference< XComponent > > aCleanup; try @@ -3361,9 +3362,7 @@ void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList() try { - css::uno::Reference< css::frame::XFramesSupplier > xDesktop( - xSMGR->createInstance(SERVICENAME_DESKTOP), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR)); css::uno::Reference< css::container::XIndexAccess > xContainer( xDesktop->getFrames(), diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index c6d83b3cc86f..d633f8760b49 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -51,6 +51,7 @@ #include "rtl/ustrbuf.hxx" #include "osl/file.h" +#include "com/sun/star/frame/Desktop.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/configuration/theDefaultProvider.hpp" @@ -213,9 +214,8 @@ BackingWindow::BackingWindow( Window* i_pParent ) : maToolbox.ShowItem( nItemId_Info ); // get dispatch provider - mxDesktop = Reference<XDesktop>( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_DESKTOP ),UNO_QUERY ); - if( mxDesktop.is() ) - mxDesktopDispatchProvider = Reference< XDispatchProvider >( mxDesktop, UNO_QUERY ); + Reference<XDesktop2> xDesktop = Desktop::create( comphelper::getProcessComponentContext() ); + mxDesktopDispatchProvider = Reference< XDispatchProvider >( xDesktop, UNO_QUERY ); maWriterButton.SetHelpId( ".HelpId:StartCenter:WriterButton" ); maCalcButton.SetHelpId( ".HelpId:StartCenter:CalcButton" ); @@ -702,7 +702,7 @@ long BackingWindow::Notify( NotifyEvent& rNEvt ) if( ! mpAccExec ) { mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper(); - mpAccExec->init( comphelper::getProcessServiceFactory(), mxFrame); + mpAccExec->init( comphelper::getProcessComponentContext(), mxFrame); } const KeyEvent* pEvt = rNEvt.GetKeyEvent(); diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index fdacdbfa630e..94c16dd24eb6 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -75,7 +75,6 @@ namespace framework com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aArgSeq; }; - com::sun::star::uno::Reference<com::sun::star::frame::XDesktop> mxDesktop; com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider; com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame; com::sun::star::uno::Reference<com::sun::star::document::XEventBroadcaster> mxBroadcaster; diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 7913bdb1db5a..a695eb2000a9 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -79,10 +79,11 @@ namespace framework{ //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XINTERFACE_15 ( Desktop , +DEFINE_XINTERFACE_16 ( Desktop , OWeakObject , DIRECT_INTERFACE( css::lang::XTypeProvider ), DIRECT_INTERFACE( css::lang::XServiceInfo ), + DIRECT_INTERFACE( css::frame::XDesktop2 ), DIRECT_INTERFACE( css::frame::XDesktop ), DIRECT_INTERFACE( css::frame::XComponentLoader ), DIRECT_INTERFACE( css::frame::XTasksSupplier ), @@ -98,9 +99,10 @@ DEFINE_XINTERFACE_15 ( Desktop DIRECT_INTERFACE( css::frame::XUntitledNumbers ) ) -DEFINE_XTYPEPROVIDER_15 ( Desktop , +DEFINE_XTYPEPROVIDER_16 ( Desktop , css::lang::XTypeProvider , css::lang::XServiceInfo , + css::frame::XDesktop2 , css::frame::XDesktop , css::frame::XComponentLoader , css::frame::XTasksSupplier , @@ -118,7 +120,7 @@ DEFINE_XTYPEPROVIDER_15 ( Desktop DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( Desktop , ::cppu::OWeakObject , - SERVICENAME_DESKTOP , + DECLARE_ASCII("com.sun.star.frame.Desktop" ), IMPLEMENTATIONNAME_DESKTOP ) @@ -198,7 +200,7 @@ Desktop::Desktop( const css::uno::Reference< css::lang::XMultiServiceFactory >& // Init baseclasses first // Attention: Don't change order of initialization! // ThreadHelpBase is a struct with a lock as member. We can't use a lock as direct member! - // We must garant right initialization and a valid value of this to initialize other baseclasses! + // We must guarantee right initialization and a valid value of this to initialize other baseclasses! : ThreadHelpBase ( &Application::GetSolarMutex() ) , TransactionBase ( ) , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType > ( m_aLock.getShareableOslMutex() ) diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index 1cda58996e62..51f7a398ee86 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -41,7 +41,7 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/util/URLTransformer.hpp> @@ -301,7 +301,7 @@ void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted // first of all let the session be stored to be sure that we lose no information StoreSession( sal_False ); - css::uno::Reference< css::frame::XDesktop > xDesktop( m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) ); // honestly: how many implementations of XDesktop will we ever have? // so casting this directly to the implementation Desktop* pDesktop(dynamic_cast<Desktop*>(xDesktop.get())); diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 49c35c4cc83f..4303f4e58bc1 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/PopupMenuControllerFactory.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/util/XStringWidth.hpp> @@ -853,7 +853,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu ) ::rtl::OUString aMenuCommand( m_aMenuItemCommand ); if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aMenuCommand == aSpecialWindowCommand ) - MenuManager::UpdateSpecialWindowMenu( pMenu,getServiceFactory(),m_aLock ); + MenuManager::UpdateSpecialWindowMenu( pMenu, comphelper::getComponentContext(getServiceFactory()), m_aLock ); // Check if some modes have changed so we have to update our menu images sal_Int16 nSymbolsStyle = SvtMiscOptions().GetCurrentSymbolsStyle(); @@ -1078,27 +1078,24 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu ) { // window list menu item selected - Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getServiceFactory()) ); - if ( xDesktop.is() ) + sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; + Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); + sal_Int32 nCount = xList->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) { - sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; - Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); - sal_Int32 nCount = xList->getCount(); - for ( sal_Int32 i=0; i<nCount; ++i ) + Reference< XFrame > xFrame; + xList->getByIndex(i) >>= xFrame; + if ( xFrame.is() && nTaskId == nCurItemId ) { - Reference< XFrame > xFrame; - xList->getByIndex(i) >>= xFrame; - if ( xFrame.is() && nTaskId == nCurItemId ) - { - Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - pWin->GrabFocus(); - pWin->ToTop( TOTOP_RESTOREWHENMIN ); - break; - } - - nTaskId++; + Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + pWin->GrabFocus(); + pWin->ToTop( TOTOP_RESTOREWHENMIN ); + break; } + + nTaskId++; } } else diff --git a/linguistic/inc/linguistic/misc.hxx b/linguistic/inc/linguistic/misc.hxx index 32637ab6c90c..3f17f045a705 100644 --- a/linguistic/inc/linguistic/misc.hxx +++ b/linguistic/inc/linguistic/misc.hxx @@ -46,7 +46,7 @@ namespace com { namespace sun { namespace star { namespace beans { }}}} namespace com { namespace sun { namespace star { namespace frame { - class XDesktop; + class XDesktop2; }}}} class LocaleDataWrapper; @@ -59,7 +59,6 @@ class LocaleDataWrapper; #define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus" #define SN_LINGU_PROPERTIES "com.sun.star.linguistic2.LinguProperties" #define SN_DICTIONARY_LIST "com.sun.star.linguistic2.DictionaryList" -#define SN_DESKTOP "com.sun.star.frame.Desktop" namespace linguistic @@ -168,7 +167,7 @@ class AppExitListener : > { ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDesktop > xDesktop; + ::com::sun::star::frame::XDesktop2 > xDesktop; public: AppExitListener(); diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 536daf4a933d..d5f237224972 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -12,7 +12,7 @@ * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file + * License, Version 2.0 (the "License"); you may not use this file754 * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ @@ -30,7 +30,7 @@ #include <com/sun/star/beans/XFastPropertySet.hpp> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/beans/PropertyValues.hpp> @@ -743,20 +743,15 @@ AppExitListener::AppExitListener() { // add object to Desktop EventListeners in order to properly call // the AtExit function at appliction exit. - uno::Reference< XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); + uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); - if (xMgr.is()) + try { - try - { - xDesktop = uno::Reference< frame::XDesktop >( - xMgr->createInstance( A2OU( SN_DESKTOP ) ), UNO_QUERY ); - } - catch (uno::Exception &) - { - DBG_ASSERT( 0, "createInstance failed" ); - } + xDesktop = frame::Desktop::create(xContext); + } + catch (const uno::Exception &) + { + DBG_ASSERT( 0, "createInstance failed" ); } } diff --git a/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp/SimpleBootstrap_cpp.cxx b/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp/SimpleBootstrap_cpp.cxx index e76f64a05a24..780c18ebcd5b 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp/SimpleBootstrap_cpp.cxx +++ b/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp/SimpleBootstrap_cpp.cxx @@ -38,6 +38,7 @@ #include <sal/main.h> #include <cppuhelper/bootstrap.hxx> #include <com/sun/star/bridge/XUnoUrlResolver.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> @@ -71,10 +72,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) // get an instance of the remote office desktop UNO service // and query the XComponentLoader interface - Reference < XComponentLoader > xComponentLoader( - xServiceManager->createInstanceWithContext( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), - xContext ), UNO_QUERY_THROW ); + Reference < XDesktop2 > xComponentLoader = Desktop::create(xContext); // open a spreadsheet document Reference< XComponent > xComponent( xComponentLoader->loadComponentFromURL( diff --git a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx index a41008172fc8..988f15e896ab 100644 --- a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx +++ b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/bridge/XUnoUrlResolver.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/registry/XSimpleRegistry.hpp> @@ -131,10 +132,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) /* Creates an instance of a component which supports the services specified by the factory. Important: using the office component context. */ - Reference < XComponentLoader > xComponentLoader( - xMultiComponentFactoryServer->createInstanceWithContext( - OUString( "com.sun.star.frame.Desktop" ), - xComponentContext ), UNO_QUERY ); + Reference < XDesktop2 > xComponentLoader = Desktop::create(xComponentContext); /* Loads a component specified by an URL into the specified new or existing frame. diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 4ae182e80eb0..56e5f4811ba8 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -123,6 +123,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/runti )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\ AutoRecovery \ + Desktop \ DispatchHelper \ DispatchRecorderSupplier \ DocumentTemplates \ @@ -829,7 +830,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\ ContentHandler \ ContentHandlerFactory \ Controller \ - Desktop \ DesktopTask \ DesktopTasks \ DispatchProvider \ @@ -2480,6 +2480,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\ XController2 \ XControllerBorder \ XDesktop \ + XDesktop2 \ XDesktopTask \ XDispatch \ XDispatchHelper \ diff --git a/offapi/com/sun/star/frame/Desktop.idl b/offapi/com/sun/star/frame/Desktop.idl index d7a91c9009bb..c1a1c04c094a 100644 --- a/offapi/com/sun/star/frame/Desktop.idl +++ b/offapi/com/sun/star/frame/Desktop.idl @@ -19,11 +19,7 @@ #ifndef __com_sun_star_frame_Desktop_idl__ #define __com_sun_star_frame_Desktop_idl__ -#include <com/sun/star/frame/Frame.idl> -#include <com/sun/star/frame/XDesktop.idl> -#include <com/sun/star/frame/XComponentLoader.idl> -#include <com/sun/star/document/XEventBroadcaster.idl> -#include <com/sun/star/beans/XPropertySet.idl> +#include <com/sun/star/frame/XDesktop2.idl> module com { module sun { module star { module frame { @@ -37,33 +33,7 @@ interfaces, it's just because these frames use task windows. </p> */ -published service Desktop -{ - /** make it possible to be the global root of different separated frame trees - - <p> - It's not a must for a frame (neither a frame tree) to be a part of this - global tree. But such outstanding frames won't be accessible by the normal - frame API. - </p> - */ - service Frame; - - /** regulate life time of desktop environment and support high level - access to components of sub frame tree - */ - interface XDesktop; - - /** supports simple API for loading components into the frame environment - */ - interface XComponentLoader; - - /** @deprecated This interface is a documentation error. It was never thought to be supported - by this service. Please use the service <type cope="com::sun::star::frame">GlobalEventBroadcaster</type> - instead of this interface. - */ - interface com::sun::star::document::XEventBroadcaster; -}; +published service Desktop : XDesktop2; }; }; }; }; diff --git a/offapi/com/sun/star/frame/XDesktop2.idl b/offapi/com/sun/star/frame/XDesktop2.idl new file mode 100644 index 000000000000..4d81cc774185 --- /dev/null +++ b/offapi/com/sun/star/frame/XDesktop2.idl @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_frame_XDesktop2_idl__ +#define __com_sun_star_frame_XDesktop2_idl__ + +#include <com/sun/star/frame/XComponentLoader.idl> +#include <com/sun/star/frame/XDesktop.idl> +#include <com/sun/star/frame/XDispatchProvider.idl> +#include <com/sun/star/frame/XDispatchProviderInterception.idl> +#include <com/sun/star/frame/XFrame.idl> +#include <com/sun/star/frame/XFramesSupplier.idl> +#include <com/sun/star/task/XStatusIndicatorFactory.idl> + + +module com { module sun { module star { module frame { + +/** + @since LibreOffice 4.1 +*/ +published interface XDesktop2 +{ + /** provides access to dispatchers for the frame. + + <p> + What kind of URLs a frame accepts in the calls to <member>XDispatchProvider::queryDispatch()</member>, + and how the returned dispatcher handles dispatches is completely implementation dependent + (though of course the restrictions of <type>XDispatchProvider</type> must be met). + Frame implementations may (optionally) support special targets in the call to + <member>XDispatchProvider::queryDispatch()</member>. + Such special targets are passed as target frame name. They may, in addition, + require special frame search flags (see <type>FrameSearchFlag</type>), or, + in opposite, limit the set of allowed flags.<br> + Common special targets include: + <ul> + <li><b>_blank</b><br> is used to create a new frame when dispatching the URL.</li> + <li><b>_default</b><br> is used to recycle empty or create a new frame when dispatching the URL.</li> + <li><b>_self</b><br> forces the frame to dispatch the URL into itself. ("" means the same)</li> + <li><b>_parent</b><br> dispatches the URL into the parent frame.</li> + <li><b>_top</b><br> dispatches the URL into the top level frame, the frame where this is invoked belongs to.</li> + </ul> + </p> + + @see XDispatch + @see XFrame::findFrame() + */ + interface XDispatchProvider; + + /** supports interception mechanism for dispatched URLs + + <p> + Registered objects can intercept, suppress or reroute dispatched URLs. + If they support another interface too (<type>XInterceptorInfo</type>) + it's possible to perform it by directly calling of right interceptor without + using list of all registered ones. + </p> + */ + interface XDispatchProviderInterception; + + /** provides access to sub frames within this frame + */ + interface XFramesSupplier; + + /** regulate life time of desktop environment and support high level + access to components of sub frame tree + */ + interface XDesktop; + + /** supports simple API for loading components into the frame environment + */ + interface XComponentLoader; +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex 7df2fa7e1ba5..cebc489d5865 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 95dd078a82ad..8cd4d8d86928 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/XUnitConversion.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/graphic/GraphicObject.hpp> #include <com/sun/star/graphic/GraphicProvider.hpp> @@ -69,9 +70,7 @@ GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, c maGraphicObjScheme( CREATE_OUSTRING( "vnd.sun.star.GraphicObject:" ) ) { OSL_ENSURE( mxContext.is(), "GraphicHelper::GraphicHelper - missing component context" ); - Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY ); - OSL_ENSURE( xFactory.is(), "GraphicHelper::GraphicHelper - missing service factory" ); - if( xFactory.is() ) + if( mxContext.is() ) mxGraphicProvider.set( graphic::GraphicProvider::create( mxContext ) ); //! TODO: get colors from system @@ -109,9 +108,9 @@ GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, c // if no target frame has been passed (e.g. OLE objects), try to fallback to the active frame // TODO: we need some mechanism to keep and pass the parent frame Reference< XFrame > xFrame = rxTargetFrame; - if( !xFrame.is() && xFactory.is() ) try + if( !xFrame.is() && mxContext.is() ) try { - Reference< XFramesSupplier > xFramesSupp( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW ); + Reference< XDesktop2 > xFramesSupp = Desktop::create( mxContext ); xFrame = xFramesSupp->getActiveFrame(); } catch( Exception& ) diff --git a/remotebridges/examples/officeclient.cxx b/remotebridges/examples/officeclient.cxx index c672dd8463c6..400459e8e081 100644 --- a/remotebridges/examples/officeclient.cxx +++ b/remotebridges/examples/officeclient.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/lang/XMain.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/text/XTextDocument.hpp> @@ -157,47 +158,41 @@ sal_Int32 OfficeClientMain::run( const Sequence< OUString > & aArguments ) throw Reference< XMultiServiceFactory > rRemoteSMgr( r , UNO_QUERY ); - Reference < XComponentLoader > rLoader( - rRemoteSMgr->createInstance( OUString( "com.sun.star.frame.Desktop" )), - UNO_QUERY ); - - if( rLoader.is() ) + Reference < XDesktop2 > rLoader = Desktop::create( comphelper::getComponentContext(r) ); + + sal_Char *urls[] = { + "private:factory/swriter", + "private:factory/sdraw", + "private:factory/simpress", + "private:factory/scalc" + }; + + sal_Char *docu[]= { + "a new writer document ...\n", + "a new draw document ...\n", + "a new schedule document ...\n" , + "a new calc document ...\n" + }; + sal_Int32 i; + for( i = 0 ; i < 4 ; i ++ ) { + printf( "press any key to open %s\n" , docu[i] ); + getchar(); + + Reference< XComponent > rComponent = + rLoader->loadComponentFromURL( + OUString::createFromAscii( urls[i] ) , + OUString( "_blank"), + 0 , + Sequence < ::com::sun::star::beans::PropertyValue >() ); - sal_Char *urls[] = { - "private:factory/swriter", - "private:factory/sdraw", - "private:factory/simpress", - "private:factory/scalc" - }; - - sal_Char *docu[]= { - "a new writer document ...\n", - "a new draw document ...\n", - "a new schedule document ...\n" , - "a new calc document ...\n" - }; - sal_Int32 i; - for( i = 0 ; i < 4 ; i ++ ) + if( 0 == i ) { - printf( "press any key to open %s\n" , docu[i] ); - getchar(); - - Reference< XComponent > rComponent = - rLoader->loadComponentFromURL( - OUString::createFromAscii( urls[i] ) , - OUString( "_blank"), - 0 , - Sequence < ::com::sun::star::beans::PropertyValue >() ); - - if( 0 == i ) - { - testWriter( rComponent ); - } - printf( "press any key to close the document\n" ); - getchar(); - rComponent->dispose(); + testWriter( rComponent ); } + printf( "press any key to close the document\n" ); + getchar(); + rComponent->dispose(); } } diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 92267c311fd5..fdfe2c715cf3 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -52,6 +52,7 @@ #include <com/sun/star/embed/XEmbedPersist.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/StorageFactory.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> @@ -501,14 +502,12 @@ namespace { try { - uno::Reference<frame::XComponentLoader> xFrameLoad( m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) - ,m_xContext) - ,uno::UNO_QUERY); + uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(m_xContext); + uno::Reference<frame::XComponentLoader> xFrameLoad(xDesktop,uno::UNO_QUERY); ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; - uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag); - xFrameLoad.set( xFrame,uno::UNO_QUERY); + uno::Reference< frame::XFrame> xFrame = xDesktop->findFrame(sTarget,nFrameSearchFlag); + xFrameLoad.set(xFrame,uno::UNO_QUERY); if ( xFrameLoad.is() ) { @@ -2673,14 +2672,13 @@ uno::Reference< frame::XTitle > OReportDefinition::impl_getTitleHelper_throw() if ( ! m_pImpl->m_xTitleHelper.is ()) { - uno::Reference< frame::XUntitledNumbers > xDesktop(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop")) ,m_aProps->m_xContext),uno::UNO_QUERY_THROW); - uno::Reference< frame::XModel > xThis (static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_aProps->m_xContext); + uno::Reference< frame::XModel > xThis(static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW); ::framework::TitleHelper* pHelper = new ::framework::TitleHelper( m_aProps->m_xContext ); m_pImpl->m_xTitleHelper = uno::Reference< frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW); pHelper->setOwner (xThis ); - pHelper->connectWithUntitledNumbers (xDesktop); + pHelper->connectWithUntitledNumbers (uno::Reference<frame::XUntitledNumbers>(xDesktop, uno::UNO_QUERY_THROW)); } return m_pImpl->m_xTitleHelper; diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index 4af87c18e2e9..cc005a39ccfa 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -28,6 +28,7 @@ #include <comphelper/string.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> @@ -293,10 +294,7 @@ uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive if ( !xFrameLoad.is() ) { // if there is no frame given, find the right - xFrameLoad.set( m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) - ,m_xContext) - ,uno::UNO_QUERY); + xFrameLoad.set( frame::Desktop::create(m_xContext), uno::UNO_QUERY); ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag); diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx index 37edf05fe71f..efaae2c8bafd 100644 --- a/reportdesign/source/ui/inc/DesignView.hxx +++ b/reportdesign/source/ui/inc/DesignView.hxx @@ -97,7 +97,7 @@ namespace rptui public: ODesignView(Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&, OReportController& _rController); virtual ~ODesignView(); diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index 004cbe73b105..7e42e54a30f6 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/XVisualObject.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/io/XObjectInputStream.hpp> #include <com/sun/star/io/XObjectOutputStream.hpp> @@ -102,7 +102,7 @@ namespace rptui ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition; ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportEngine > m_xReportEngine; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XComponentLoader > m_xFrameLoader; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2 > m_xFrameLoader; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xRowSetMediator; diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index d9a4f7f0b83f..8014a820dd96 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -87,7 +87,7 @@ public: DBG_NAME( rpt_ODesignView ) //------------------------------------------------------------------------------ ODesignView::ODesignView( Window* pParent, - const Reference< XMultiServiceFactory >& _rxOrb, + const Reference< XComponentContext >& _rxOrb, OReportController& _rController) : ODataView( pParent, _rController, _rxOrb, WB_DIALOGCONTROL ) ,m_aSplitWin(this) diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 8a46d0a29cd2..da66390983a8 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -87,6 +87,7 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/TextAlign.hpp> #include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/status/FontHeight.hpp> #include <com/sun/star/report/XFormattedField.hpp> #include <com/sun/star/sdb/SQLContext.hpp> @@ -1692,7 +1693,7 @@ void OReportController::impl_initialize( ) listen(true); setEditable( !m_aReportModel->IsReadOnly() ); - m_xFormatter.set(util::NumberFormatter::create(comphelper::getComponentContext(getORB())), UNO_QUERY_THROW); + m_xFormatter.set(util::NumberFormatter::create(m_xContext), UNO_QUERY_THROW); m_xFormatter->attachNumberFormatsSupplier(Reference< XNumberFormatsSupplier>(m_xReportDefinition,uno::UNO_QUERY)); ::comphelper::MediaDescriptor aDescriptor( m_xReportDefinition->getArgs() ); @@ -1801,7 +1802,7 @@ void OReportController::doOpenHelpAgent() // ----------------------------------------------------------------------------- sal_Bool OReportController::Construct(Window* pParent) { - ODesignView* pMyOwnView = new ODesignView( pParent, getORB(), *this ); + ODesignView* pMyOwnView = new ODesignView( pParent, m_xContext, *this ); StartListening( *pMyOwnView ); setView( *pMyOwnView ); @@ -2844,11 +2845,11 @@ Reference<XFrame> OReportController::getXFrame() { if ( !m_xFrameLoader.is() ) { - m_xFrameLoader.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))),uno::UNO_QUERY_THROW); + m_xFrameLoader.set( frame::Desktop::create(m_xContext) ); } const sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; const ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); - Reference<XFrame> xFrame = Reference<XFrame>(m_xFrameLoader,uno::UNO_QUERY_THROW)->findFrame(sTarget,nFrameSearchFlag); + Reference<XFrame> xFrame = m_xFrameLoader->findFrame(sTarget,nFrameSearchFlag); return xFrame; } diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 4d63089cc4bb..364ca1b6207e 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -39,6 +39,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/sfxmodelfactory.hxx> #include <svl/intitem.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <basic/sbxdef.hxx> @@ -177,9 +178,7 @@ void ScMacrosTest::setUp() getMultiServiceFactory()->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.SpreadsheetDocument"))); CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); - mxDesktop = Reference<com::sun::star::frame::XDesktop>( getMultiServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - CPPUNIT_ASSERT(mxDesktop.is()); + mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); } void ScMacrosTest::tearDown() diff --git a/sc/qa/extras/regression-test.cxx b/sc/qa/extras/regression-test.cxx index d41755fbc51f..5658618ba0d9 100644 --- a/sc/qa/extras/regression-test.cxx +++ b/sc/qa/extras/regression-test.cxx @@ -40,6 +40,7 @@ #include <sfx2/sfxmodelfactory.hxx> #include <svl/intitem.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/container/XIndexAccess.hpp> @@ -166,9 +167,7 @@ void ScChartRegressionTest::setUp() getMultiServiceFactory()->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.SpreadsheetDocument"))); CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); - mxDesktop = Reference<com::sun::star::frame::XDesktop>( getMultiServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - CPPUNIT_ASSERT(mxDesktop.is()); + mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); } void ScChartRegressionTest::tearDown() diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index b8c9796a4682..dbc470346115 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -20,6 +20,7 @@ #include "xlroot.hxx" #include <rtl/strbuf.hxx> #include <com/sun/star/awt/XDevice.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/i18n/ScriptType.hpp> @@ -141,8 +142,7 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium, // screen pixel size try { - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW ); - Reference< XFramesSupplier > xFramesSupp( xFactory->createInstance( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference< frame::XDesktop2 > xFramesSupp = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); Reference< XFrame > xFrame( xFramesSupp->getActiveFrame(), UNO_SET_THROW ); Reference< XDevice > xDevice( xFrame->getContainerWindow(), UNO_QUERY_THROW ); DeviceInfo aDeviceInfo = xDevice->getInfo(); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 7dba3539522b..df3f2ade6650 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -18,6 +18,7 @@ */ #include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> using namespace ::com::sun::star; @@ -2254,11 +2255,7 @@ uno::Reference< frame::XModel > ScDocShell::LoadSharedDocument() try { SC_MOD()->SetInSharedDocLoading( true ); - uno::Reference< lang::XMultiServiceFactory > xFactory( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XComponentLoader > xLoader( - xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), - uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xLoader = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); uno::Sequence < beans::PropertyValue > aArgs( 1 ); aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Hidden" )); aArgs[0].Value <<= sal_True; diff --git a/sc/source/ui/vba/testvba/testvba.cxx b/sc/source/ui/vba/testvba/testvba.cxx index 8d68d0ddbd23..433dea872408 100644 --- a/sc/source/ui/vba/testvba/testvba.cxx +++ b/sc/source/ui/vba/testvba/testvba.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> @@ -293,8 +294,7 @@ int main( int argv, char** argc ) Reference<XMultiComponentFactory> xFactory = xCC->getServiceManager(); OSL_TRACE("got servicemanager"); std::cout << "got servicemanager" << std::endl; - Reference<XInterface> desktop = xFactory->createInstanceWithContext( - ascii("com.sun.star.frame.Desktop"), xCC); + Reference<XDesktop2> desktop = Desktop::create(xCC); OSL_TRACE("got desktop"); std::cout << "got desktop" << std::endl; Reference<frame::XComponentLoader> xLoader(desktop, UNO_QUERY_THROW); diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx index f8ae29e0ad91..96c1aeb44df0 100644 --- a/sc/source/ui/vba/vbahelper.cxx +++ b/sc/source/ui/vba/vbahelper.cxx @@ -21,7 +21,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/script/Converter.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -270,9 +270,7 @@ getCurrentDocument() throw (uno::RuntimeException) { uno::Reference< uno::XComponentContext > xCtx( comphelper::getProcessComponentContext() ); - uno::Reference<lang::XMultiComponentFactory > xSMgr( - xCtx->getServiceManager() ); - uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(xCtx); xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY ); if ( !xModel.is() ) { diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx index b78d8eb1eff3..56ddccf9e9c0 100644 --- a/sc/source/ui/vba/vbawindows.cxx +++ b/sc/source/ui/vba/vbawindows.cxx @@ -21,7 +21,7 @@ #include <boost/unordered_map.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <cppuhelper/implbase3.hxx> #include "vbawindow.hxx" @@ -66,11 +66,7 @@ public: WindowComponentEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext ) { - uno::Reference< lang::XMultiComponentFactory > xSMgr( - m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XDesktop > xDesktop - (xSMgr->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), m_xContext), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xContext); uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); while( mxComponents->hasMoreElements() ) { diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index fac9a46dcf95..3fdc2c8bab22 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -47,7 +47,7 @@ #include <com/sun/star/sheet/XNamedRanges.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/table/XColumnRowRange.hpp> #include <com/sun/star/table/XTableChartsSupplier.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> @@ -160,13 +160,8 @@ openNewDoc(rtl::OUString aSheetName ) { uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); - uno::Reference<lang::XMultiComponentFactory > xServiceManager( - xContext->getServiceManager() ); - uno::Reference <frame::XComponentLoader > xComponentLoader( - xServiceManager->createInstanceWithContext( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), - xContext ), uno::UNO_QUERY_THROW ); + uno::Reference <frame::XDesktop2 > xComponentLoader = frame::Desktop::create(xContext); uno::Reference<lang::XComponent > xComponent( xComponentLoader->loadComponentFromURL( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/scalc" ) ), diff --git a/scripting/source/basprov/basmethnode.cxx b/scripting/source/basprov/basmethnode.cxx index d81b7133f32f..5b826cd8510f 100644 --- a/scripting/source/basprov/basmethnode.cxx +++ b/scripting/source/basprov/basmethnode.cxx @@ -20,7 +20,7 @@ #include "basmethnode.hxx" #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/frame/DispatchHelper.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/script/browse/BrowseNodeTypes.hpp> @@ -250,35 +250,26 @@ namespace basprov if ( m_xContext.is() ) { - Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); + Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext ); - if ( xSMgr.is() ) - { - Reference< frame::XDesktop > xDesktop( xSMgr->createInstanceWithContext( - ::rtl::OUString( "com.sun.star.frame.Desktop" ), m_xContext ), UNO_QUERY ); - - if ( xDesktop.is() ) - { - Reference < frame::XDispatchProvider > xProv( xDesktop->getCurrentFrame(), UNO_QUERY ); + Reference < frame::XDispatchProvider > xProv( xDesktop->getCurrentFrame(), UNO_QUERY ); - if ( xProv.is() ) - { - Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create( m_xContext ) ); - - Sequence < PropertyValue > aArgs(7); - aArgs[0].Name = ::rtl::OUString("Document"); - aArgs[0].Value <<= sDocURL; - aArgs[1].Name = ::rtl::OUString("LibName"); - aArgs[1].Value <<= sLibName; - aArgs[2].Name = ::rtl::OUString("Name"); - aArgs[2].Value <<= sModName; - aArgs[3].Name = ::rtl::OUString("Type"); - aArgs[3].Value <<= ::rtl::OUString("Module"); - aArgs[4].Name = ::rtl::OUString("Line"); - aArgs[4].Value <<= static_cast< sal_uInt32 >( nLine1 ); - xHelper->executeDispatch( xProv, ::rtl::OUString(".uno:BasicIDEAppear"), ::rtl::OUString(), 0, aArgs ); - } - } + if ( xProv.is() ) + { + Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create( m_xContext ) ); + + Sequence < PropertyValue > aArgs(7); + aArgs[0].Name = ::rtl::OUString("Document"); + aArgs[0].Value <<= sDocURL; + aArgs[1].Name = ::rtl::OUString("LibName"); + aArgs[1].Value <<= sLibName; + aArgs[2].Name = ::rtl::OUString("Name"); + aArgs[2].Value <<= sModName; + aArgs[3].Name = ::rtl::OUString("Type"); + aArgs[3].Value <<= ::rtl::OUString("Module"); + aArgs[4].Name = ::rtl::OUString("Line"); + aArgs[4].Value <<= static_cast< sal_uInt32 >( nLine1 ); + xHelper->executeDispatch( xProv, ::rtl::OUString(".uno:BasicIDEAppear"), ::rtl::OUString(), 0, aArgs ); } } } diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 45155eeae38f..902001c76ecb 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -47,7 +47,7 @@ #include "ViewShellBase.hxx" #include <com/sun/star/embed/XEmbedPersist.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <svtools/embedtransfer.hxx> #include "svtools/treelistentry.hxx" @@ -1383,15 +1383,9 @@ void SdPageObjsTLB::AddShapeToTransferable ( try { // Get a component enumeration from the desktop and search it for documents. - uno::Reference<lang::XMultiServiceFactory> xFactory ( - ::comphelper::getProcessServiceFactory ()); - if ( ! xFactory.is()) - return NULL; + uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext()); - uno::Reference<frame::XDesktop> xDesktop (xFactory->createInstance ( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), uno::UNO_QUERY); - if ( ! xDesktop.is()) - return NULL; + uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext); uno::Reference<frame::XFramesSupplier> xFrameSupplier (xDesktop, uno::UNO_QUERY); if ( ! xFrameSupplier.is()) diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index 8e819662efee..ecb7d9efa5e6 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -24,7 +24,7 @@ #include <com/sun/star/document/PrinterIndependentLayout.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <comphelper/processfactory.hxx> @@ -721,16 +721,10 @@ void SdTpOptionsMisc::UpdateCompatibilityControls (void) try { // Get a component enumeration from the desktop and search it for documents. - Reference<lang::XMultiServiceFactory> xFactory ( - ::comphelper::getProcessServiceFactory ()); + Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext()); do { - if ( ! xFactory.is()) - break; - - Reference<frame::XDesktop> xDesktop (xFactory->createInstance ("com.sun.star.frame.Desktop"), UNO_QUERY); - if ( ! xDesktop.is()) - break; + Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext); Reference<container::XEnumerationAccess> xComponents ( xDesktop->getComponents(), UNO_QUERY); diff --git a/sd/source/ui/remotecontrol/Communicator.cxx b/sd/source/ui/remotecontrol/Communicator.cxx index f567b106ff8d..ebe5627e2442 100644 --- a/sd/source/ui/remotecontrol/Communicator.cxx +++ b/sd/source/ui/remotecontrol/Communicator.cxx @@ -9,6 +9,7 @@ #include <algorithm> #include <vector> +#include <com/sun/star/frame/Desktop.hpp> #include <comphelper/processfactory.hxx> #include "Communicator.hxx" @@ -43,10 +44,7 @@ void Communicator::execute() Transmitter::PRIORITY_HIGH ); Receiver aReceiver( pTransmitter ); try { - uno::Reference< lang::XMultiServiceFactory > xServiceManager( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XFramesSupplier > xFramesSupplier( xServiceManager->createInstance( - "com.sun.star.frame.Desktop" ) , uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); uno::Reference< frame::XFrame > xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_QUERY_THROW ); uno::Reference<presentation::XPresentationSupplier> xPS ( xFrame->getController()->getModel(), uno::UNO_QUERY_THROW); uno::Reference<presentation::XPresentation2> xPresentation( diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx index 968fbb4e4ee7..e0d05b0b09ea 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -11,6 +11,7 @@ #include <com/sun/star/presentation/XSlideShowController.hpp> #include <com/sun/star/presentation/XPresentationSupplier.hpp> #include <com/sun/star/presentation/XPresentation2.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/uno/RuntimeException.hpp> @@ -41,10 +42,7 @@ void Receiver::parseCommand( std::vector<OString> aCommand ) uno::Reference<presentation::XSlideShowController> xSlideShowController; uno::Reference<presentation::XPresentation2> xPresentation; try { - uno::Reference< lang::XMultiServiceFactory > xServiceManager( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XFramesSupplier > xFramesSupplier( xServiceManager->createInstance( - "com.sun.star.frame.Desktop" ) , uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); uno::Reference< frame::XFrame > xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_QUERY_THROW ); uno::Reference<presentation::XPresentationSupplier> xPS ( xFrame->getController()->getModel(), uno::UNO_QUERY_THROW); xPresentation = uno::Reference<presentation::XPresentation2>( diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx index c35e08bc3555..f5bd19d90e52 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx @@ -31,6 +31,7 @@ #include <set> #include "unomodel.hxx" +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/io/XStream.hpp> #include <com/sun/star/io/XInputStream.hpp> @@ -990,11 +991,8 @@ Reference<frame::XModel> MasterPageContainer::Implementation::GetModel (void) if ( ! mxModel.is()) { // Get the desktop a s service factory. - ::rtl::OUString sDesktopServiceName ( "com.sun.star.frame.Desktop"); - uno::Reference<frame::XComponentLoader> xDesktop ( - ::comphelper::getProcessServiceFactory()->createInstance( - sDesktopServiceName), - uno::UNO_QUERY); + uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create( + ::comphelper::getProcessComponentContext() ); // Create a new model. ::rtl::OUString sModelServiceName ( "com.sun.star.presentation.PresentationDocument"); diff --git a/sdext/source/minimizer/graphiccollector.cxx b/sdext/source/minimizer/graphiccollector.cxx index 8c13a1c59ae3..10558e2933e1 100644 --- a/sdext/source/minimizer/graphiccollector.cxx +++ b/sdext/source/minimizer/graphiccollector.cxx @@ -20,6 +20,7 @@ #include "graphiccollector.hxx" #include <com/sun/star/awt/XDevice.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/BitmapMode.hpp> @@ -46,8 +47,7 @@ const DeviceInfo& GraphicCollector::GetDeviceInfo( const Reference< XComponentCo { try { - Reference< XFramesSupplier > xDesktop( rxFact->getServiceManager()->createInstanceWithContext( - OUString( "com.sun.star.frame.Desktop" ), rxFact ), UNO_QUERY_THROW ); + Reference< XDesktop2 > xDesktop = Desktop::create( rxFact ); Reference< XFrame > xFrame( xDesktop->getActiveFrame() ); Reference< XWindow > xWindow( xFrame->getContainerWindow() ); Reference< XDevice > xDevice( xWindow, UNO_QUERY_THROW ); diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index c8882639312e..4a496d57e6f2 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -32,7 +32,7 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> @@ -681,10 +681,8 @@ sal_Bool ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments ) SetStatusValue( TK_Status, Any( TKGet( STR_DUPLICATING_PRESENTATION ) ) ); DispatchStatus(); - Reference< XDesktop > xDesktop( mxMSF->getServiceManager()->createInstanceWithContext( - OUString( "com.sun.star.frame.Desktop" ), mxMSF ), UNO_QUERY ); - Reference< XFrame > xFrame( xDesktop, UNO_QUERY ); - xSelf = xFrame->findFrame( TKGet( TK__blank ), FrameSearchFlag::CREATE ); + Reference< XDesktop2 > xDesktop = Desktop::create( mxMSF ); + xSelf = xDesktop->findFrame( TKGet( TK__blank ), FrameSearchFlag::CREATE ); Reference< XComponentLoader > xComponentLoader( xSelf, UNO_QUERY ); Sequence< PropertyValue > aLoadProps( 1 ); diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 44a665312dce..4a18ab2afa4e 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -15,6 +15,7 @@ #include <vcl/dialog.hxx> #include <vcl/button.hxx> #include <vcl/tabctrl.hxx> +#include <com/sun/star/frame/XDesktop2.hpp> class Edit; class PopupMenu; @@ -143,7 +144,7 @@ private: bool mbIsSaveMode; ///< Flag that indicates if we are in save mode or not. com::sun::star::uno::Reference< com::sun::star::frame::XModel > m_xModel; - com::sun::star::uno::Reference< com::sun::star::frame::XComponentLoader > mxDesktop; + com::sun::star::uno::Reference< com::sun::star::frame::XDesktop2 > mxDesktop; bool mbIsSynced; ///< Tells whether maRepositories is synchronized with the user config std::vector<TemplateRepository*> maRepositories; ///< Stores the remote repositories for templates diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index e4fd8cde0e8f..1e0864f0f694 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/frame/GlobalEventBroadcaster.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <svtools/soerr.hxx> @@ -215,9 +215,7 @@ bool SfxApplication::Initialize_Impl() StgIo::SetErrorLink( LINK( this, SfxStorageErrHdl, Error ) ); #endif - Reference < XDesktop > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - if (!xDesktop.is()) - throw RuntimeException( rtl::OUString( "Couldn't create mandatory desktop service!" ), xDesktop ); + Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() ); xDesktop->addTerminateListener( new SfxTerminateListener_Impl() ); Application::EnableAutoHelpId(); diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 9a295b726c38..f9714d41a636 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/util/URL.hpp> @@ -1147,7 +1147,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } else { - xTargetFrame.set( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.frame.Desktop")), UNO_QUERY ); + xTargetFrame.set( Desktop::create(::comphelper::getProcessComponentContext()), UNO_QUERY ); } } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 4a4fc90f94a5..3d09aece7037 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -20,6 +20,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/DispatchResultEvent.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> #include <com/sun/star/task/XJobExecutor.hpp> @@ -205,7 +206,7 @@ static sal_Bool checkURL( const char *pName, const char *pExt, rtl::OUString &rU static void showDocument( const char* pBaseName ) { try { - Reference < XComponentLoader > xLoader( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); Sequence < com::sun::star::beans::PropertyValue > args(2); args[0].Name = ::rtl::OUString("ViewOnly"); args[0].Value <<= sal_True; @@ -216,7 +217,7 @@ static void showDocument( const char* pBaseName ) if ( checkURL ( pBaseName, ".odt", aURL ) || checkURL ( pBaseName, ".html", aURL ) || checkURL ( pBaseName, "", aURL ) ) { - xLoader->loadComponentFromURL( aURL, ::rtl::OUString("_blank"), 0, args ); + xDesktop->loadComponentFromURL( aURL, ::rtl::OUString("_blank"), 0, args ); } } catch (const ::com::sun::star::uno::Exception &) { } @@ -353,7 +354,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) // block reentrant calls pAppData_Impl->bInQuit = sal_True; - Reference < XDesktop > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() ); rReq.ForgetAllArgs(); @@ -419,7 +420,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) case SID_CLOSEWINS: { - Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY ); if ( !xTasks.is() ) break; @@ -695,10 +696,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) if ( pToolbarName ) { - com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame; - Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - xFrame = xDesktop->getActiveFrame(); + Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() ); + Reference< XFrame > xFrame = xDesktop->getActiveFrame(); Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; @@ -819,7 +818,7 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) case SID_CLOSEDOCS: case SID_CLOSEWINS: { - Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY ); if ( !xTasks.is() || !xTasks->getCount() ) rSet.DisableItem(nWhich); @@ -993,14 +992,14 @@ namespace } return pView; } - Reference< XFrame > lcl_findStartModuleFrame( const ::comphelper::ComponentContext& i_rContext ) + Reference< XFrame > lcl_findStartModuleFrame( const Reference<XComponentContext> & rxContext ) { try { - Reference < XFramesSupplier > xSupplier( i_rContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW ); + Reference < XDesktop2 > xDesktop = Desktop::create( rxContext ); + Reference < XIndexAccess > xContainer( xDesktop->getFrames(), UNO_QUERY_THROW ); - Reference< XModuleManager2 > xCheck( ModuleManager::create(i_rContext.getUNOContext()) ); + Reference< XModuleManager2 > xCheck = ModuleManager::create(rxContext); sal_Int32 nCount = xContainer->getCount(); for ( sal_Int32 i=0; i<nCount; ++i ) @@ -1166,7 +1165,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) aLoadArgs.put( "Model", pBasicIDE->GetModel() ); aLoadArgs.put( "URL", ::rtl::OUString( "private:factory/sbasic" ) ); - Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext ) ); + Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext.getUNOContext() ) ); 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/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index b2be3e3f78de..0adbf1229b34 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -22,6 +22,7 @@ #include <set> #include <algorithm> #include <com/sun/star/uno/Reference.h> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -414,12 +415,10 @@ OUString getDefaultModule_Impl() OUString getCurrentModuleIdentifier_Impl() { OUString sIdentifier; - Reference < XFrame > xCurrentFrame; - Reference < XModuleManager2 > xModuleManager( ModuleManager::create(::comphelper::getProcessComponentContext()) ); - Reference < XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - if ( xDesktop.is() ) - xCurrentFrame = xDesktop->getCurrentFrame(); + Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference < XModuleManager2 > xModuleManager = ModuleManager::create(xContext); + Reference < XDesktop2 > xDesktop = Desktop::create(xContext); + Reference < XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); if ( xCurrentFrame.is() ) { @@ -542,8 +541,7 @@ OUString SfxHelp::CreateHelpURL_Impl( const OUString& aCommandURL, const OUStrin SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , Reference< XFrame >& rHelpContent) { - Reference < XFrame > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); // otherwhise - create new help task Reference< XFrame > xHelpTask = xDesktop->findFrame( @@ -746,8 +744,7 @@ sal_Bool SfxHelp::Start_Impl(const OUString& rURL, const Window* pWindow, const } } - Reference < XFrame > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); // check if help window is still open // If not, create a new one and return access directly to the internal sub frame showing the help content @@ -813,11 +810,8 @@ void SfxHelp::OpenHelpAgent( const OString& sHelpId ) Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict(aURL); - Reference < XFrame > xCurrentFrame; - Reference < XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - if ( xDesktop.is() ) - xCurrentFrame = xDesktop->getCurrentFrame(); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + Reference < XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); Reference< XDispatchProvider > xDispProv( xCurrentFrame, UNO_QUERY ); Reference< XDispatch > xHelpDispatch; diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index f8cf04083351..ba6fd3f307bb 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -24,6 +24,7 @@ #include <svtools/imagemgr.hxx> #include <svtools/miscopt.hxx> #include <com/sun/star/task/InteractionHandler.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/frame/XNotifyingDispatch.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> @@ -100,7 +101,7 @@ void SAL_CALL SfxNotificationListener_Impl::disposing( const EventObject& ) thro { } -SFX_IMPL_XSERVICEINFO( ShutdownIcon, "com.sun.star.office.Quickstart", "com.sun.star.comp.desktop.QuickstartWrapper" ) \ +SFX_IMPL_XSERVICEINFO_CTX( ShutdownIcon, "com.sun.star.office.Quickstart", "com.sun.star.comp.desktop.QuickstartWrapper" ) \ SFX_IMPL_ONEINSTANCEFACTORY( ShutdownIcon ); bool ShutdownIcon::bModalMode = false; @@ -210,9 +211,9 @@ public: class IdleTerminate : Timer { - Reference< XDesktop > m_xDesktop; + Reference< XDesktop2 > m_xDesktop; public: - IdleTerminate (Reference< XDesktop > xDesktop) + IdleTerminate (Reference< XDesktop2 > xDesktop) { m_xDesktop = xDesktop; Start(); @@ -254,14 +255,14 @@ void ShutdownIcon::deInitSystray() } -ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : +ShutdownIcon::ShutdownIcon( const Reference< XComponentContext > & rxContext ) : ShutdownIconServiceBase( m_aMutex ), m_bVeto ( false ), m_bListenForTermination ( false ), m_bSystemDialogs( false ), m_pResMgr( NULL ), m_pFileDlg( NULL ), - m_xServiceManager( aSMgr ), + m_xContext( rxContext ), m_pInitSystray( 0 ), m_pDeInitSystray( 0 ), m_pPlugin( 0 ), @@ -567,7 +568,7 @@ void ShutdownIcon::addTerminateListener() if (pInst->m_bListenForTermination) return; - Reference< XDesktop > xDesktop = pInst->m_xDesktop; + Reference< XDesktop2 > xDesktop = pInst->m_xDesktop; if ( ! xDesktop.is()) return; @@ -583,7 +584,7 @@ void ShutdownIcon::terminateDesktop() if ( ! pInst) return; - Reference< XDesktop > xDesktop = pInst->m_xDesktop; + Reference< XDesktop2 > xDesktop = pInst->m_xDesktop; if ( ! xDesktop.is()) return; @@ -592,13 +593,9 @@ void ShutdownIcon::terminateDesktop() xDesktop->removeTerminateListener( pInst ); // terminate desktop only if no tasks exist - Reference< XFramesSupplier > xSupplier( xDesktop, UNO_QUERY ); - if ( xSupplier.is() ) - { - Reference< XIndexAccess > xTasks ( xSupplier->getFrames(), UNO_QUERY ); - if( xTasks.is() && xTasks->getCount() < 1 ) - new IdleTerminate( xDesktop ); - } + Reference< XIndexAccess > xTasks ( xDesktop->getFrames(), UNO_QUERY ); + if( xTasks.is() && xTasks->getCount() < 1 ) + new IdleTerminate( xDesktop ); // remove the instance pointer ShutdownIcon::pShutdownIcon = 0; @@ -621,8 +618,7 @@ ShutdownIcon* ShutdownIcon::createInstance() ShutdownIcon *pIcon = NULL; try { - Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); - pIcon = new ShutdownIcon( xSMgr ); + pIcon = new ShutdownIcon( comphelper::getProcessComponentContext() ); pIcon->init (); pShutdownIcon = pIcon; } catch (...) { @@ -641,9 +637,7 @@ void ShutdownIcon::init() throw( ::com::sun::star::uno::Exception ) ::osl::ResettableMutexGuard aGuard( m_aMutex ); m_pResMgr = pResMgr; aGuard.clear(); - Reference < XDesktop > xDesktop( m_xServiceManager->createInstance( - DEFINE_CONST_UNICODE( "com.sun.star.frame.Desktop" )), - UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( m_xContext ); aGuard.reset(); m_xDesktop = xDesktop; } @@ -652,8 +646,8 @@ void ShutdownIcon::init() throw( ::com::sun::star::uno::Exception ) void SAL_CALL ShutdownIcon::disposing() { - m_xServiceManager = Reference< XMultiServiceFactory >(); - m_xDesktop = Reference< XDesktop >(); + m_xContext.clear(); + m_xDesktop.clear(); } // --------------------------------------------------------------------------- diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index b8ed97d5d9e2..cfa5e5371409 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -21,7 +21,7 @@ #define __SHUTDOWNICON_HXX__ #include <com/sun/star/frame/XTerminateListener.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -68,7 +68,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase bool m_bSystemDialogs; ResMgr* m_pResMgr; sfx2::FileDialogHelper* m_pFileDlg; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; static ShutdownIcon *pShutdownIcon; // one instance @@ -90,7 +90,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase friend class SfxNotificationListener_Impl; public: - ShutdownIcon( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > aSMgr ); + ShutdownIcon( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext ); virtual ~ShutdownIcon(); @@ -159,7 +159,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2 > m_xDesktop; #ifdef WNT static void EnableAutostartW32( const rtl::OUString &aShortcutName ); diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index aa3c60327b8e..7d258b46ff95 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/document/XTypeDetection.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/DocumentTemplates.hpp> #include <com/sun/star/frame/XDocumentTemplates.hpp> @@ -105,7 +106,6 @@ using ::std::advance; #define COMMAND_TRANSFER "transfer" #define SERVICENAME_DOCINFO "com.sun.star.document.DocumentProperties" -#define SERVICENAME_DESKTOP "com.sun.star.frame.Desktop" //======================================================================== @@ -889,9 +889,7 @@ sal_Bool SfxDocumentTemplates::CopyFrom } else { - OUString aService( SERVICENAME_DESKTOP ); - uno::Reference< XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( aService ), - UNO_QUERY ); + uno::Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );; Sequence< PropertyValue > aArgs( 1 ); aArgs[0].Name = ::rtl::OUString("Hidden"); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 08b2743acc7f..6bc7a7260d9e 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/util/XCloseBroadcaster.hpp> #include <com/sun/star/util/XCloseListener.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> @@ -1100,8 +1101,7 @@ Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const SfxIte xLoader = uno::Reference < frame::XComponentLoader >( pFrame->GetFrameInterface(), uno::UNO_QUERY ); } else - xLoader = uno::Reference < frame::XComponentLoader >( comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString("com.sun.star.frame.Desktop") ), uno::UNO_QUERY ); + xLoader = uno::Reference < frame::XComponentLoader >( frame::Desktop::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY ); Reference <lang::XComponent> xComp; try diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 5dd7d63246c1..d0cb58f35c3b 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/IllegalArgumentIOException.hpp> #include <com/sun/star/frame/XUntitledNumbers.hpp> #include <com/sun/star/frame/UntitledNumbersConst.hpp> @@ -3904,8 +3905,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () { css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - const ::rtl::OUString SERVICENAME_DESKTOP("com.sun.star.frame.Desktop"); - css::uno::Reference< css::frame::XUntitledNumbers > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XUntitledNumbers > xDesktop( css::frame::Desktop::create(xContext), css::uno::UNO_QUERY_THROW); css::uno::Reference< css::frame::XModel > xThis (static_cast< css::frame::XModel* >(this), css::uno::UNO_QUERY_THROW); ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(xContext); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 26cf58bf8f12..48a7cff69ee8 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -107,7 +108,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) maView(new TemplateLocalView(this,SfxResId(TEMPLATE_VIEW))), mpOnlineView(new TemplateRemoteView(this, WB_VSCROLL,false)), mbIsSaveMode(false), - mxDesktop(comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ),uno::UNO_QUERY ), + mxDesktop( Desktop::create(comphelper::getProcessComponentContext()) ), mbIsSynced(false), maRepositories() { diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index 181204607a10..1a70998f1d2c 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -21,6 +21,7 @@ #include "inettbc.hxx" #include <com/sun/star/uno/Any.h> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> #include <svl/eitem.hxx> @@ -182,9 +183,7 @@ IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl) if ( m_xServiceManager.is() ) { - Reference< XFramesSupplier > xDesktop( m_xServiceManager->createInstance( - ::rtl::OUString("com.sun.star.frame.Desktop")), - UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(m_xServiceManager) ); Reference< XFrame > xFrame( xDesktop->getActiveFrame(), UNO_QUERY ); if ( xFrame.is() ) { diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index d056d9cb9ee4..81f186c3e541 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -23,7 +23,7 @@ #include <svtools/imagemgr.hxx> #include <svl/imageitm.hxx> #include <com/sun/star/container/XEnumeration.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <comphelper/processfactory.hxx> #include <toolkit/unohlp.hxx> @@ -842,34 +842,29 @@ IMPL_LINK( SfxVirtualMenu, Activate, Menu *, pMenu ) { // update window list ::std::vector< ::rtl::OUString > aNewWindowListVector; - Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );; sal_uInt16 nActiveItemId = 0; sal_uInt16 nItemId = START_ITEMID_WINDOWLIST; - if ( xDesktop.is() ) + Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); + Reference< XIndexAccess > xList ( xDesktop->getFrames(), UNO_QUERY ); + sal_Int32 nFrameCount = xList->getCount(); + for( sal_Int32 i=0; i<nFrameCount; ++i ) { - Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY ); - Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); - Reference< XIndexAccess > xList ( xTasksSupplier->getFrames(), UNO_QUERY ); - sal_Int32 nFrameCount = xList->getCount(); - for( sal_Int32 i=0; i<nFrameCount; ++i ) - { - Reference< XFrame > xFrame; - Any aVal = xList->getByIndex(i); - if (!(aVal>>=xFrame) || !xFrame.is() ) - continue; + Reference< XFrame > xFrame; + Any aVal = xList->getByIndex(i); + if (!(aVal>>=xFrame) || !xFrame.is() ) + continue; - if ( xFrame == xCurrentFrame ) - nActiveItemId = nItemId; + if ( xFrame == xCurrentFrame ) + nActiveItemId = nItemId; - Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - if ( pWin && pWin->IsVisible() ) - { - aNewWindowListVector.push_back( pWin->GetText() ); - ++nItemId; - } + Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + if ( pWin && pWin->IsVisible() ) + { + aNewWindowListVector.push_back( pWin->GetText() ); + ++nItemId; } } @@ -974,27 +969,23 @@ IMPL_LINK( SfxVirtualMenu, Select, Menu *, pMenu ) if ( nSlotId >= START_ITEMID_WINDOWLIST && nSlotId <= END_ITEMID_WINDOWLIST ) { // window list menu item selected - Reference< XFramesSupplier > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); - if ( xDesktop.is() ) + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; + Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); + sal_Int32 nFrameCount = xList->getCount(); + for ( sal_Int32 i=0; i<nFrameCount; ++i ) { - sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; - Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); - sal_Int32 nFrameCount = xList->getCount(); - for ( sal_Int32 i=0; i<nFrameCount; ++i ) + Any aItem = xList->getByIndex(i); + Reference< XFrame > xFrame; + if (( aItem >>= xFrame ) && xFrame.is() && nTaskId == nSlotId ) { - Any aItem = xList->getByIndex(i); - Reference< XFrame > xFrame; - if (( aItem >>= xFrame ) && xFrame.is() && nTaskId == nSlotId ) - { - Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - pWin->GrabFocus(); - pWin->ToTop( TOTOP_RESTOREWHENMIN ); - break; - } - - nTaskId++; + Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + pWin->GrabFocus(); + pWin->ToTop( TOTOP_RESTOREWHENMIN ); + break; } + + nTaskId++; } return sal_True; diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index 8218d20236f5..81db58e525c6 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/task/JobExecutor.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> @@ -247,12 +248,9 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg } else { - xProv = ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XDispatchProvider > ( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( - "com.sun.star.frame.Desktop" ) ), - UNO_QUERY ); + xProv = css::uno::Reference< css::frame::XDispatchProvider > ( + css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ), + UNO_QUERY ); } ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDisp; diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 64e8901ed514..f88a781da7d4 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -1623,33 +1624,27 @@ long Select_Impl( void* /*pHdl*/, void* pVoid ) if( !aURL.Len() ) return 0; - Reference < ::com::sun::star::frame::XFramesSupplier > xDesktop = - Reference < ::com::sun::star::frame::XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - Reference < ::com::sun::star::frame::XFrame > xFrame( xDesktop, UNO_QUERY ); + Reference < ::com::sun::star::frame::XDesktop2 > xDesktop = + ::com::sun::star::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); URL aTargetURL; aTargetURL.Complete = aURL; Reference < XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); - Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); Reference < XDispatch > xDisp; - if ( xProv.is() ) + if ( aTargetURL.Protocol.compareToAscii("slot:") == COMPARE_EQUAL ) + xDisp = xDesktop->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + else { - if ( aTargetURL.Protocol.compareToAscii("slot:") == COMPARE_EQUAL ) - xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); - else - { - ::rtl::OUString aTargetFrame( ::rtl::OUString("_blank") ); - ::framework::MenuConfiguration::Attributes* pMenuAttributes = - (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() ); + ::rtl::OUString aTargetFrame( ::rtl::OUString("_blank") ); + ::framework::MenuConfiguration::Attributes* pMenuAttributes = + (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() ); - if ( pMenuAttributes ) - aTargetFrame = pMenuAttributes->aTargetFrame; + if ( pMenuAttributes ) + aTargetFrame = pMenuAttributes->aTargetFrame; - xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 ); - } + xDisp = xDesktop->queryDispatch( aTargetURL, aTargetFrame , 0 ); } if ( xDisp.is() ) diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 08dabbbea4c8..3b4c060de69f 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> @@ -227,8 +228,7 @@ Reference < XFrame > SfxFrame::CreateBlankFrame() Reference < XFrame > xFrame; try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); } catch( const Exception& ) @@ -245,7 +245,7 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nV { // create and initialize new top level frame for this window ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference < XFramesSupplier > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XDesktop2 > xDesktop = Desktop::create( aContext.getUNOContext() ); Reference < XFrame > xFrame( aContext.createComponent( "com.sun.star.frame.Frame"), UNO_QUERY_THROW ); Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index b97f7615ecbf..5cdfe81dccbe 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -23,6 +23,7 @@ #include <sfx2/infobar.hxx> #include <sfx2/viewfrm.hxx> #include <com/sun/star/document/MacroExecMode.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/DispatchRecorderSupplier.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> @@ -1869,8 +1870,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell { if ( !xFrame.is() ) { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); if ( !i_bHidden ) { @@ -2321,13 +2321,11 @@ void SfxViewFrame::ExecView_Impl */ sal_Bool impl_maxOpenDocCountReached() { - static ::rtl::OUString SERVICE_DESKTOP("com.sun.star.frame.Desktop"); - try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( - ::comphelper::getProcessComponentContext(), + xContext, ::rtl::OUString("org.openoffice.Office.Common/"), ::rtl::OUString("Misc"), ::rtl::OUString("MaxOpenDocuments"), @@ -2341,7 +2339,7 @@ sal_Bool impl_maxOpenDocCountReached() sal_Int32 nMaxDocs = 0; aVal >>= nMaxDocs; - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICE_DESKTOP), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(xContext); css::uno::Reference< css::container::XIndexAccess > xCont (xDesktop->getFrames() , css::uno::UNO_QUERY_THROW); sal_Int32 c = xCont->getCount(); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 466d8261b595..ee97af94bc56 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1648,7 +1648,7 @@ sal_Bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) { pImp->m_pAccExec.reset( ::svt::AcceleratorExecute::createAcceleratorHelper() ); - pImp->m_pAccExec->init(::comphelper::getProcessServiceFactory(), + pImp->m_pAccExec->init(::comphelper::getProcessComponentContext(), pFrame->GetFrame().GetFrameInterface()); } diff --git a/smoketest/smoketest.cxx b/smoketest/smoketest.cxx index 8b565f091888..36b3585f40a5 100644 --- a/smoketest/smoketest.cxx +++ b/smoketest/smoketest.cxx @@ -24,6 +24,7 @@ #include "com/sun/star/beans/PropertyState.hpp" #include "com/sun/star/beans/PropertyValue.hpp" #include "com/sun/star/document/MacroExecMode.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "com/sun/star/frame/DispatchResultEvent.hpp" #include "com/sun/star/frame/DispatchResultState.hpp" #include "com/sun/star/frame/XComponentLoader.hpp" @@ -155,21 +156,16 @@ void Test::test() { RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:Standard.Global.StartTestWithDefaultOptions?" "language=Basic&location=document")); + + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(connection_.getComponentContext()); + css::uno::Reference< css::frame::XNotifyingDispatch > disp( css::uno::Reference< css::frame::XDispatchProvider >( css::uno::Reference< css::frame::XController >( css::uno::Reference< css::frame::XModel >( - css::uno::Reference< css::frame::XComponentLoader >( - (connection_.getComponentContext()-> - getServiceManager()->createInstanceWithContext( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.Desktop")), - connection_.getComponentContext())), - css::uno::UNO_QUERY_THROW)->loadComponentFromURL( + xDesktop->loadComponentFromURL( test::toAbsoluteFileUrl(doc), - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("_default")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")), 0, args), css::uno::UNO_QUERY_THROW)->getCurrentController(), css::uno::UNO_SET_THROW)->getFrame(), diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 8214774c9216..e006c1ccb016 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/container/XChild.hpp> @@ -812,33 +812,23 @@ IMPL_LINK( SmCmdBoxWindow, InitialFocusTimerHdl, Timer *, EMPTYARG /*pTimer*/ ) try { - uno::Reference< frame::XDesktop > xDesktop; - uno::Reference< lang::XMultiServiceFactory > xSMGR( comphelper::getProcessServiceFactory() ); - if (xSMGR.is()) - { - xDesktop = uno::Reference< frame::XDesktop >( - xSMGR->createInstance( "com.sun.star.frame.Desktop"), uno::UNO_QUERY_THROW ); - } + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( comphelper::getProcessComponentContext() ); aEdit.GrabFocus(); - if (xDesktop.is()) + bool bInPlace = GetView()->GetViewFrame()->GetFrame().IsInPlace(); + uno::Reference< frame::XFrame > xFrame( GetBindings().GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface()); + if ( bInPlace ) { - bool bInPlace = GetView()->GetViewFrame()->GetFrame().IsInPlace(); - uno::Reference< frame::XFrame > xFrame( GetBindings().GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface()); - if ( bInPlace ) - { - uno::Reference< container::XChild > xModel( GetView()->GetDoc()->GetModel(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XModel > xParent( xModel->getParent(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XController > xParentCtrler( xParent->getCurrentController() ); - uno::Reference< frame::XFramesSupplier > xParentFrame( xParentCtrler->getFrame(), uno::UNO_QUERY_THROW ); - xParentFrame->setActiveFrame( xFrame ); - } - else - { - uno::Reference< frame::XFramesSupplier > xFramesSupplier( xDesktop, uno::UNO_QUERY ); - xFramesSupplier->setActiveFrame( xFrame ); - } + uno::Reference< container::XChild > xModel( GetView()->GetDoc()->GetModel(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModel > xParent( xModel->getParent(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XController > xParentCtrler( xParent->getCurrentController() ); + uno::Reference< frame::XFramesSupplier > xParentFrame( xParentCtrler->getFrame(), uno::UNO_QUERY_THROW ); + xParentFrame->setActiveFrame( xFrame ); + } + else + { + xDesktop->setActiveFrame( xFrame ); } } catch (uno::Exception &) diff --git a/svtools/inc/svtools/acceleratorexecute.hxx b/svtools/inc/svtools/acceleratorexecute.hxx index 15a7ae4c4683..a3661adfdcef 100644 --- a/svtools/inc/svtools/acceleratorexecute.hxx +++ b/svtools/inc/svtools/acceleratorexecute.hxx @@ -24,7 +24,6 @@ #include <vector> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -86,7 +85,7 @@ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit private: /** TODO document me */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /** TODO document me */ css::uno::Reference< css::util::XURLTransformer > m_xURLParser; @@ -153,7 +152,7 @@ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit executions will be used inside the old and which one will be used inside the new environment. - @param xSMGR + @param rxContext reference to an uno service manager. @param xEnv @@ -167,7 +166,7 @@ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit is used only. Further the global Desktop instance is used for dispatch. */ - virtual void init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR, + virtual void init(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xEnv ); //--------------------------------------- diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 011dff19961d..676593564425 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XOfficeInstallationDirectories.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/DocumentTemplates.hpp> #include <com/sun/star/frame/XDocumentTemplates.hpp> @@ -717,8 +718,8 @@ void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_B if ( rURL.Match( sServiceScheme ) != sServiceScheme.Len() ) // service URL has no default target aTarget = ASCII_STR("_default"); - xProv = Reference < XDispatchProvider >( ::comphelper::getProcessServiceFactory()-> - createInstance( ASCII_STR("com.sun.star.frame.Desktop") ), UNO_QUERY ); + xProv = Reference < XDispatchProvider >( Desktop::create(::comphelper::getProcessComponentContext() ), + UNO_QUERY_THROW ); } Reference < XDispatch > xDisp = xProv.is() ? @@ -979,8 +980,7 @@ void SvtTemplateWindow::PrintFile( const String& rURL ) aArgs[1].Name = ASCII_STR("Hidden"); aArgs[1].Value <<= sal_True; - Reference < XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()-> - createInstance( ASCII_STR("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); Reference < XModel > xModel( xDesktop->loadComponentFromURL( rURL, ASCII_STR("_blank"), 0, aArgs ), UNO_QUERY ); if ( xModel.is() ) @@ -1617,9 +1617,7 @@ IMPL_LINK_NOARG(SvtDocumentTemplateDialog , OrganizerHdl_Impl) { Window* pOldDefWin = Application::GetDefDialogParent(); Application::SetDefDialogParent( this ); - Reference < XFramesSupplier > xDesktop = Reference < XFramesSupplier >( - ::comphelper::getProcessServiceFactory()-> - createInstance( ASCII_STR("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); Reference < XFrame > xFrame( xDesktop->getActiveFrame() ); if ( !xFrame.is() ) xFrame = Reference < XFrame >( xDesktop, UNO_QUERY ); diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index ea21f8640d9c..d68fc58bfff7 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -20,7 +20,7 @@ #include <svtools/acceleratorexecute.hxx> #include <com/sun/star/frame/ModuleManager.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> @@ -105,27 +105,25 @@ AcceleratorExecute* AcceleratorExecute::createAcceleratorHelper() } //----------------------------------------------- -void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR, +void AcceleratorExecute::init(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xEnv ) { // SAFE -> ---------------------------------- ::osl::ResettableMutexGuard aLock(m_aLock); // take over the uno service manager - m_xSMGR = xSMGR; + m_xContext = rxContext; // specify our internal dispatch provider // frame or desktop?! => document or global config. sal_Bool bDesktopIsUsed = sal_False; - m_xDispatcher = css::uno::Reference< css::frame::XDispatchProvider >(xEnv, css::uno::UNO_QUERY); + m_xDispatcher = css::uno::Reference< css::frame::XDispatchProvider >(xEnv, css::uno::UNO_QUERY); if (!m_xDispatcher.is()) { aLock.clear(); // <- SAFE ------------------------------ - css::uno::Reference< css::frame::XDispatchProvider > xDispatcher( - xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDispatchProvider > xDispatcher(css::frame::Desktop::create(rxContext), css::uno::UNO_QUERY_THROW); // SAFE -> ------------------------------ aLock.reset(); @@ -143,11 +141,11 @@ void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServic css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg ; // global cfg - xGlobalCfg = css::ui::GlobalAcceleratorConfiguration::create(comphelper::getComponentContext(xSMGR)); + xGlobalCfg = css::ui::GlobalAcceleratorConfiguration::create(rxContext); if (!bDesktopIsUsed) { // module cfg - xModuleCfg = AcceleratorExecute::st_openModuleConfig(comphelper::getComponentContext(xSMGR), xEnv); + xModuleCfg = AcceleratorExecute::st_openModuleConfig(rxContext, xEnv); // doc cfg css::uno::Reference< css::frame::XController > xController; @@ -417,13 +415,12 @@ css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_ge if (m_xURLParser.is()) return m_xURLParser; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aLock.clear(); // <- SAFE ---------------------------------- - css::uno::Reference< css::util::XURLTransformer > xParser( - css::util::URLTransformer::create( ::comphelper::getComponentContext(xSMGR) ) ); + css::uno::Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create( xContext ); // SAFE -> ---------------------------------- aLock.reset(); diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 4bed02dae0c2..735b52eefb40 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp> #include <com/sun/star/datatransfer/XMimeContentType.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include "svl/urlbmk.hxx" @@ -527,15 +527,8 @@ void SAL_CALL TransferableHelper::lostOwnership( const Reference< XClipboard >&, { if( mxTerminateListener.is() ) { - Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - - if( xFact.is() ) - { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - - if( xDesktop.is() ) - xDesktop->removeTerminateListener( mxTerminateListener ); - } + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + xDesktop->removeTerminateListener( mxTerminateListener ); mxTerminateListener = Reference< XTerminateListener >(); } @@ -1053,15 +1046,8 @@ void TransferableHelper::CopyToClipboard( Window *pWindow ) const try { TransferableHelper* pThis = const_cast< TransferableHelper* >( this ); - Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - - if( xFact.is() ) - { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - - if( xDesktop.is() ) - xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) ); - } + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) ); mxClipboard->setContents( pThis, pThis ); } @@ -1090,15 +1076,8 @@ void TransferableHelper::CopyToSelection( Window *pWindow ) const try { TransferableHelper* pThis = const_cast< TransferableHelper* >( this ); - Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - - if( xFact.is() ) - { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - - if( xDesktop.is() ) - xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) ); - } + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) ); xSelection->setContents( pThis, pThis ); } diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx index f3e47e0cbc89..e4f7acd6a335 100644 --- a/svx/source/inc/docrecovery.hxx +++ b/svx/source/inc/docrecovery.hxx @@ -51,7 +51,6 @@ #define RECOVERY_CMD_DO_ENTRY_CLEANUP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doEntryCleanUp" )) #define SERVICENAME_PROGRESSFACTORY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.StatusIndicatorFactory")) -#define SERVICENAME_DESKTOP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) #define PROP_PARENTWINDOW rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Window" )) #define PROP_STATUSINDICATOR rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" )) diff --git a/svx/source/inc/recoveryui.hxx b/svx/source/inc/recoveryui.hxx index c94271774b37..33c5e431cc2a 100644 --- a/svx/source/inc/recoveryui.hxx +++ b/svx/source/inc/recoveryui.hxx @@ -20,7 +20,6 @@ #ifndef _RECOVERYUI_HXX #define _RECOVERYUI_HXX -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/frame/XSynchronousDispatch.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> @@ -56,7 +55,7 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo private: /** @short TODO */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /** @short TODO */ Window* m_pParentWindow; @@ -73,7 +72,7 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo //--------------------------------------- /** @short TODO */ - RecoveryUI(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& xContext); //--------------------------------------- /** @short TODO */ diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx index c3e7c45be034..0c6ae0de7c4e 100644 --- a/svx/source/unodraw/recoveryui.cxx +++ b/svx/source/unodraw/recoveryui.cxx @@ -20,6 +20,7 @@ #include "recoveryui.hxx" #include "docrecovery.hxx" #include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <osl/file.hxx> @@ -45,8 +46,8 @@ using namespace ::rtl; using namespace ::osl; //=============================================== -RecoveryUI::RecoveryUI(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) - : m_xSMGR (xSMGR ) +RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& xContext) + : m_xContext (xContext ) , m_pParentWindow(0 ) , m_eJob (RecoveryUI::E_JOB_UNKNOWN) { @@ -164,7 +165,7 @@ css::uno::Sequence< ::rtl::OUString > RecoveryUI::st_getSupportedServiceNames() //=============================================== css::uno::Reference< css::uno::XInterface > SAL_CALL RecoveryUI::st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { - RecoveryUI* pNew = new RecoveryUI(xSMGR); + RecoveryUI* pNew = new RecoveryUI(comphelper::getComponentContext(xSMGR)); return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XServiceInfo* >(pNew)); } @@ -252,7 +253,7 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL) sal_Bool RecoveryUI::impl_doEmergencySave() { // create core service, which implements the real "emergency save" algorithm. - svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(comphelper::getComponentContext(m_xSMGR), sal_True); + svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xContext, sal_True); css::uno::Reference< css::frame::XStatusListener > xCore(pCore); // create all needed dialogs for this operation @@ -281,7 +282,7 @@ void RecoveryUI::impl_doRecovery() sal_Bool bCrashRepEnabled(sal_False); css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( - comphelper::getComponentContext(m_xSMGR), + m_xContext, CFG_PACKAGE_RECOVERY, CFG_PATH_CRASHREPORTER, CFG_ENTRY_ENABLED, @@ -290,7 +291,7 @@ void RecoveryUI::impl_doRecovery() bRecoveryOnly = !bCrashRepEnabled; // create core service, which implements the real "emergency save" algorithm. - svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(comphelper::getComponentContext(m_xSMGR), sal_False); + svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xContext, sal_False); css::uno::Reference< css::frame::XStatusListener > xCore(pCore); // create all needed dialogs for this operation @@ -347,9 +348,7 @@ void RecoveryUI::impl_doCrashReport() //=============================================== void RecoveryUI::impl_showAllRecoveredDocs() { - css::uno::Reference< css::frame::XFramesSupplier > xDesktop( - m_xSMGR->createInstance(SERVICENAME_DESKTOP), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext ); css::uno::Reference< css::container::XIndexAccess > xTaskContainer( xDesktop->getFrames(), diff --git a/sw/CppunitTest_sw_subsequent_odfexport.mk b/sw/CppunitTest_sw_subsequent_odfexport.mk index 64e63184e854..604db89a3d9f 100644 --- a/sw/CppunitTest_sw_subsequent_odfexport.mk +++ b/sw/CppunitTest_sw_subsequent_odfexport.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_odfexport, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_odfexport, \ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/sw/CppunitTest_sw_subsequent_odfimport.mk b/sw/CppunitTest_sw_subsequent_odfimport.mk index f7ad4eb8dadf..e634356025d7 100644 --- a/sw/CppunitTest_sw_subsequent_odfimport.mk +++ b/sw/CppunitTest_sw_subsequent_odfimport.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_odfimport, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_odfimport, \ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk index 576bb5a125b7..ea355bc96074 100644 --- a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk +++ b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_ooxmlexport, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ooxmlexport, \ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/sw/CppunitTest_sw_subsequent_ooxmlimport.mk b/sw/CppunitTest_sw_subsequent_ooxmlimport.mk index 48e08c58b4b2..eefba78146e6 100644 --- a/sw/CppunitTest_sw_subsequent_ooxmlimport.mk +++ b/sw/CppunitTest_sw_subsequent_ooxmlimport.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_ooxmlimport, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ooxmlimport, \ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/sw/CppunitTest_sw_subsequent_rtfexport.mk b/sw/CppunitTest_sw_subsequent_rtfexport.mk index a214830eba2e..9883141845cc 100644 --- a/sw/CppunitTest_sw_subsequent_rtfexport.mk +++ b/sw/CppunitTest_sw_subsequent_rtfexport.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_rtfexport, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_rtfexport, \ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/sw/CppunitTest_sw_subsequent_rtfimport.mk b/sw/CppunitTest_sw_subsequent_rtfimport.mk index ca1c00c8de9b..0f1b2bdeb151 100644 --- a/sw/CppunitTest_sw_subsequent_rtfimport.mk +++ b/sw/CppunitTest_sw_subsequent_rtfimport.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_rtfimport, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_rtfimport, \ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/sw/CppunitTest_sw_subsequent_ww8export.mk b/sw/CppunitTest_sw_subsequent_ww8export.mk index 340afec32602..ebf6d1334a3d 100644 --- a/sw/CppunitTest_sw_subsequent_ww8export.mk +++ b/sw/CppunitTest_sw_subsequent_ww8export.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_ww8export, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ww8export, \ + comphelper \ cppu \ cppuhelper \ emboleobj \ diff --git a/sw/CppunitTest_sw_subsequent_ww8import.mk b/sw/CppunitTest_sw_subsequent_ww8import.mk index b59f32be5b72..39d8e84d7018 100644 --- a/sw/CppunitTest_sw_subsequent_ww8import.mk +++ b/sw/CppunitTest_sw_subsequent_ww8import.mk @@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_ww8import, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ww8import, \ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/sw/inc/dlelstnr.hxx b/sw/inc/dlelstnr.hxx index 88ee1ccaaba8..8ce12ebc54f0 100644 --- a/sw/inc/dlelstnr.hxx +++ b/sw/inc/dlelstnr.hxx @@ -24,7 +24,7 @@ #include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp> #include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <cppuhelper/implbase2.hxx> // helper for implementations @@ -54,7 +54,7 @@ class SwLinguServiceEventListener : > { com::sun::star::uno::Reference< - com::sun::star::frame::XDesktop > xDesktop; + com::sun::star::frame::XDesktop2 > xDesktop; com::sun::star::uno::Reference< com::sun::star::linguistic2::XLinguServiceManager2 > xLngSvcMgr; com::sun::star::uno::Reference< diff --git a/sw/qa/core/layout-test.cxx b/sw/qa/core/layout-test.cxx index 8d6e36b5a6ba..188d5942b9a7 100644 --- a/sw/qa/core/layout-test.cxx +++ b/sw/qa/core/layout-test.cxx @@ -34,7 +34,7 @@ #include <rtl/strbuf.hxx> #include <osl/file.hxx> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> @@ -109,9 +109,7 @@ void SwLayoutTest::setUp() getMultiServiceFactory()->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.TextDocument"))); CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xWriterComponent.is()); - mxDesktop = Reference<com::sun::star::frame::XDesktop>( getMultiServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - CPPUNIT_ASSERT_MESSAGE("", mxDesktop.is()); + mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); } void SwLayoutTest::tearDown() diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index bdd7deea1ab4..1f127d09a8b6 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> @@ -52,6 +53,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/sfxmodelfactory.hxx> #include <svl/intitem.hxx> +#include <comphelper/processfactory.hxx> #include <basic/sbxdef.hxx> @@ -220,9 +222,7 @@ void SwMacrosTest::setUp() getMultiServiceFactory()->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.TextDocument"))); CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xWriterComponent.is()); - mxDesktop = Reference<com::sun::star::frame::XDesktop>( getMultiServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - CPPUNIT_ASSERT_MESSAGE("", mxDesktop.is()); + mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); } void SwMacrosTest::tearDown() diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index ae0af3db2daf..378dc15dd787 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -26,6 +26,7 @@ */ #include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextRange.hpp> @@ -33,6 +34,7 @@ #include <test/bootstrapfixture.hxx> #include <unotest/macros_test.hxx> #include <rtl/ustrbuf.hxx> +#include <comphelper/processfactory.hxx> #include <unotxdoc.hxx> #include <docsh.hxx> @@ -65,8 +67,7 @@ public: { test::BootstrapFixture::setUp(); - mxDesktop.set(getMultiServiceFactory()->createInstance("com.sun.star.frame.Desktop"), uno::UNO_QUERY); - CPPUNIT_ASSERT(mxDesktop.is()); + mxDesktop.set( com::sun::star::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())) ); } virtual void tearDown() diff --git a/sw/source/core/docnode/finalthreadmanager.cxx b/sw/source/core/docnode/finalthreadmanager.cxx index 947596ca5988..6caa65e6c808 100644 --- a/sw/source/core/docnode/finalthreadmanager.cxx +++ b/sw/source/core/docnode/finalthreadmanager.cxx @@ -22,7 +22,7 @@ #include <pausethreadstarting.hxx> #include <swthreadjoiner.hxx> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <rtl/ustring.hxx> #include <com/sun/star/frame/XFramesSupplier.hpp> @@ -205,18 +205,9 @@ void SAL_CALL TerminateOfficeThread::run() void TerminateOfficeThread::PerformOfficeTermination() { - css::uno::Reference< css::frame::XFramesSupplier > xTasksSupplier( - mxContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ), - mxContext ), - css::uno::UNO_QUERY ); - if ( !xTasksSupplier.is() ) - { - OSL_FAIL( "<TerminateOfficeThread::PerformOfficeTermination()> - no XFramesSupplier!" ); - return; - } + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(mxContext); - css::uno::Reference< css::container::XElementAccess > xList( xTasksSupplier->getFrames(), css::uno::UNO_QUERY ); + css::uno::Reference< css::container::XElementAccess > xList( xDesktop->getFrames(), css::uno::UNO_QUERY ); if ( !xList.is() ) { OSL_FAIL( "<TerminateOfficeThread::PerformOfficeTermination()> - no XElementAccess!" ); @@ -225,8 +216,7 @@ void TerminateOfficeThread::PerformOfficeTermination() if ( !xList->hasElements() ) { - css::uno::Reference< css::frame::XDesktop > xDesktop( xTasksSupplier, css::uno::UNO_QUERY ); - if ( xDesktop.is() && !OfficeTerminationStopped() ) + if ( !OfficeTerminationStopped() ) xDesktop->terminate(); } } @@ -256,14 +246,8 @@ FinalThreadManager::FinalThreadManager(css::uno::Reference< css::uno::XComponent void FinalThreadManager::registerAsListenerAtDesktop() { - css::uno::Reference< css::frame::XDesktop > xDesktop( - m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ), - m_xContext ), - css::uno::UNO_QUERY ); - - if ( xDesktop.is() ) - xDesktop->addTerminateListener( css::uno::Reference< css::frame::XTerminateListener >( static_cast< cppu::OWeakObject* >( this ), css::uno::UNO_QUERY ) ); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(m_xContext); + xDesktop->addTerminateListener( css::uno::Reference< css::frame::XTerminateListener >( static_cast< cppu::OWeakObject* >( this ), css::uno::UNO_QUERY ) ); } FinalThreadManager::~FinalThreadManager() diff --git a/sw/source/ui/app/swdll.cxx b/sw/source/ui/app/swdll.cxx index 0890a0558bfa..4ffa8ce72418 100644 --- a/sw/source/ui/app/swdll.cxx +++ b/sw/source/ui/app/swdll.cxx @@ -32,6 +32,7 @@ #include <dobjfac.hxx> #include <cfgid.h> +#include <com/sun/star/frame/Desktop.hpp> #include <unotools/moduleoptions.hxx> #include <comphelper/scoped_disposing_ptr.hxx> #include <comphelper/processfactory.hxx> @@ -44,6 +45,8 @@ #include "swdllimpl.hxx" +using namespace com::sun::star; + namespace { //Holds a SwDLL and release it on exit, or dispose of the @@ -51,7 +54,7 @@ namespace class SwDLLInstance : public comphelper::scoped_disposing_solar_mutex_reset_ptr<SwDLL> { public: - SwDLLInstance() : comphelper::scoped_disposing_solar_mutex_reset_ptr<SwDLL>(::com::sun::star::uno::Reference<com::sun::star::lang::XComponent>(comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), ::com::sun::star::uno::UNO_QUERY_THROW), new SwDLL) + SwDLLInstance() : comphelper::scoped_disposing_solar_mutex_reset_ptr<SwDLL>(uno::Reference<lang::XComponent>( frame::Desktop::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY_THROW), new SwDLL) { } }; diff --git a/sw/source/ui/uno/dlelstnr.cxx b/sw/source/ui/uno/dlelstnr.cxx index 18be1bf1b4d0..31572d9e8c24 100644 --- a/sw/source/ui/uno/dlelstnr.cxx +++ b/sw/source/ui/uno/dlelstnr.cxx @@ -18,6 +18,7 @@ */ +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp> #include <com/sun/star/linguistic2/XDictionaryList.hpp> #include <com/sun/star/linguistic2/LinguServiceManager.hpp> @@ -51,18 +52,15 @@ SwLinguServiceEventListener::SwLinguServiceEventListener() Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); try { - OUString aSvcName( OUString( "com.sun.star.frame.Desktop" ) ); - xDesktop = Reference< frame::XDesktop >( - xMgr->createInstance( aSvcName ), UNO_QUERY ); - if (xDesktop.is()) - xDesktop->addTerminateListener( this ); + xDesktop = frame::Desktop::create(xContext); + xDesktop->addTerminateListener( this ); xLngSvcMgr = LinguServiceManager::create(xContext); xLngSvcMgr->addLinguServiceManagerListener( (XLinguServiceEventListener *) this ); if (SvtLinguConfig().HasGrammarChecker()) { - aSvcName = OUString( "com.sun.star.linguistic2.ProofreadingIterator" ); + OUString aSvcName( "com.sun.star.linguistic2.ProofreadingIterator" ); xGCIterator = Reference< XProofreadingIterator >( xMgr->createInstance( aSvcName ), UNO_QUERY ); Reference< XLinguServiceEventBroadcaster > xBC( xGCIterator, UNO_QUERY ); if (xBC.is()) diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index af1d72414042..386afe304d10 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/util/CloseVetoException.hpp> @@ -153,8 +154,7 @@ static sal_Bool LoadFromURL_impl( aArgs[0].Value <<= bVal; try { - Reference < XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()-> - createInstance( C2U("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); xTmpModel = Reference < XModel >( xDesktop->loadComponentFromURL( rURL, C2U("_blank"), 0, aArgs ), UNO_QUERY ); } diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx index 2d9292a87041..81b961c2cc93 100644 --- a/test/source/unoapi_test.cxx +++ b/test/source/unoapi_test.cxx @@ -29,6 +29,8 @@ #include "test/unoapi_test.hxx" #include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/frame/Desktop.hpp> +#include <comphelper/processfactory.hxx> UnoApiTest::UnoApiTest() : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/extras/testdocuments")) @@ -45,9 +47,7 @@ void UnoApiTest::setUp() getMultiServiceFactory()->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.SpreadsheetDocument"))); CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); - mxDesktop = Reference<com::sun::star::frame::XDesktop>( getMultiServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - CPPUNIT_ASSERT_MESSAGE("", mxDesktop.is()); + mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); } void UnoApiTest::tearDown() diff --git a/touch/source/uno/Document.cxx b/touch/source/uno/Document.cxx index 0acb9031d775..d59e4e1e4af1 100644 --- a/touch/source/uno/Document.cxx +++ b/touch/source/uno/Document.cxx @@ -15,7 +15,7 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/view/XRenderable.hpp> @@ -147,10 +147,7 @@ public: if ( arguments[0] >>= m_sURI ) { // create( [in] string uri ); - uno::Reference< frame::XDesktop > desktop( m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.frame.Desktop", m_rContext ), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XComponentLoader > componentLoader( desktop, uno::UNO_QUERY_THROW ); - - (void) componentLoader; + uno::Reference< frame::XDesktop2 > desktop = frame::Desktop::Create( m_rContext ); beans::PropertyValues loadProps(3); loadProps[0].Name = "Hidden"; @@ -160,7 +157,7 @@ public: loadProps[2].Name = "Preview"; loadProps[2].Value <<= sal_Bool(true); - m_xComponent = componentLoader->loadComponentFromURL( m_sURI, "_blank", 0, loadProps ); + m_xComponent = desktop->loadComponentFromURL( m_sURI, "_blank", 0, loadProps ); m_xToolkit = uno::Reference< awt::XToolkitExperimental >( m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.awt.ToolkitExperimental", m_rContext ), uno::UNO_QUERY_THROW ); diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index b924e8f790df..1a152cec3ae8 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -34,6 +34,7 @@ #include <tubes/file-transfer-helper.h> #include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -269,13 +270,8 @@ void TeleManager_fileReceived( const OUString& rStr, const OString& rUuid ) try { - css::uno::Reference< css::lang::XMultiServiceFactory > rFactory = - comphelper::getProcessServiceFactory(); - - css::uno::Reference < css::frame::XComponentLoader > xLoader( - ::comphelper::getProcessServiceFactory()->createInstance( - "com.sun.star.frame.Desktop" ), - css::uno::UNO_QUERY_THROW ); + css::uno::Reference < css::frame::XDesktop2 > xLoader = css::frame::Desktop::create( + ::comphelper::getProcessComponentContext() ); css::uno::Sequence < css::beans::PropertyValue > args(0); css::uno::Reference < css::util::XCloseable > xDoc( xLoader->loadComponentFromURL( rStr, "_blank", 0, args ), diff --git a/unotest/inc/unotest/macros_test.hxx b/unotest/inc/unotest/macros_test.hxx index a1c750f161d8..1a82b83fc48f 100644 --- a/unotest/inc/unotest/macros_test.hxx +++ b/unotest/inc/unotest/macros_test.hxx @@ -33,7 +33,7 @@ #include "unotest/detail/unotestdllapi.hxx" #include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> struct TestMacroInfo { @@ -49,7 +49,7 @@ public: com::sun::star::uno::Reference< com::sun::star::lang::XComponent > loadFromDesktop(const rtl::OUString& rURL); protected: - com::sun::star::uno::Reference< com::sun::star::frame::XDesktop> mxDesktop; + com::sun::star::uno::Reference< com::sun::star::frame::XDesktop2> mxDesktop; }; } diff --git a/unotest/source/cpp/officeconnection.cxx b/unotest/source/cpp/officeconnection.cxx index 69c28283edcd..4de06f66cc96 100644 --- a/unotest/source/cpp/officeconnection.cxx +++ b/unotest/source/cpp/officeconnection.cxx @@ -20,7 +20,7 @@ #include "com/sun/star/bridge/UnoUrlResolver.hpp" #include "com/sun/star/bridge/XUnoUrlResolver.hpp" #include "com/sun/star/connection/NoConnectException.hpp" -#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "com/sun/star/lang/DisposedException.hpp" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/XComponentContext.hpp" @@ -131,13 +131,7 @@ void OfficeConnection::setUp() { void OfficeConnection::tearDown() { if (process_ != 0) { if (context_.is()) { - css::uno::Reference< css::frame::XDesktop > desktop( - context_->getServiceManager()->createInstanceWithContext( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.Desktop")), - context_), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XDesktop2 > desktop = css::frame::Desktop::create( context_ ); context_.clear(); try { CPPUNIT_ASSERT(desktop->terminate()); diff --git a/unotools/source/misc/desktopterminationobserver.cxx b/unotools/source/misc/desktopterminationobserver.cxx index bacac54dfc37..1aa7b32c0aca 100644 --- a/unotools/source/misc/desktopterminationobserver.cxx +++ b/unotools/source/misc/desktopterminationobserver.cxx @@ -20,7 +20,7 @@ #include <unotools/desktopterminationobserver.hxx> #include <com/sun/star/frame/XTerminateListener.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <cppuhelper/implbase1.hxx> #include <comphelper/processfactory.hxx> @@ -102,11 +102,8 @@ namespace utl try { - Reference< XDesktop > xDesktop; - xDesktop = xDesktop.query( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ) ); - OSL_ENSURE( xDesktop.is(), "OObserverImpl::ensureObservation: could not ensureObservation the desktop!" ); - if ( xDesktop.is() ) - xDesktop->addTerminateListener( new OObserverImpl ); + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + xDesktop->addTerminateListener( new OObserverImpl ); } catch( const Exception& ) { diff --git a/uui/source/newerverwarn.cxx b/uui/source/newerverwarn.cxx index 02a9a3272710..4ddad6110fad 100644 --- a/uui/source/newerverwarn.cxx +++ b/uui/source/newerverwarn.cxx @@ -21,7 +21,7 @@ #include "newerverwarn.hrc" #include "ids.hrc" -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> @@ -127,8 +127,7 @@ IMPL_LINK_NOARG(NewerVersionWarningDialog, UpdateHdl) uno::Reference< util::XURLTransformer > xTransformer( util::URLTransformer::create(aContext.getUNOContext()) ); xTransformer->parseStrict( aURL ); - uno::Reference < frame::XDesktop > xDesktop( - aContext.createComponent( "com.sun.star.frame.Desktop" ), uno::UNO_QUERY_THROW ); + uno::Reference < frame::XDesktop2 > xDesktop = frame::Desktop::create(aContext.getUNOContext()); uno::Reference< frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), uno::UNO_QUERY ); diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index 479074f72a15..36abda68207d 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XTitle.hpp> @@ -80,11 +81,7 @@ public: } DocumentsEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext ) { - uno::Reference< lang::XMultiComponentFactory > xSMgr( - m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XDesktop > xDesktop - (xSMgr->createInstanceWithContext( "com.sun.star.frame.Desktop" , m_xContext), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext ); uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); while( mxComponents->hasMoreElements() ) { @@ -243,11 +240,7 @@ uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException) sal_Bool bScreenUpdating = !xApplication.is() || xApplication->getScreenUpdating(); sal_Bool bInteractive = !xApplication.is() || xApplication->getInteractive(); - uno::Reference< lang::XMultiComponentFactory > xSMgr( - mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XComponentLoader > xLoader( - xSMgr->createInstanceWithContext("com.sun.star.frame.Desktop" , mxContext), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xLoader = frame::Desktop::create(mxContext); OUString sURL; if( meDocType == WORD_DOCUMENT ) sURL = "private:factory/swriter"; @@ -302,11 +295,7 @@ uno::Any VbaDocumentsBase::openDocument( const OUString& rFileName, const uno::A aURL = rFileName; else osl::FileBase::getFileURLFromSystemPath( rFileName, aURL ); - uno::Reference< lang::XMultiComponentFactory > xSMgr( - mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XDesktop > xDesktop(xSMgr->createInstanceWithContext( "com.sun.star.frame.Desktop" , mxContext), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XComponentLoader > xLoader( - xSMgr->createInstanceWithContext( "com.sun.star.frame.Desktop" , mxContext), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( mxContext ); uno::Sequence< beans::PropertyValue > sProps( rProps ); sProps.realloc( sProps.getLength() + 1 ); @@ -324,7 +313,7 @@ uno::Any VbaDocumentsBase::openDocument( const OUString& rFileName, const uno::A } } - uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( aURL, + uno::Reference< lang::XComponent > xComponent = xDesktop->loadComponentFromURL( aURL, "_default" , frame::FrameSearchFlag::CREATE, sProps); diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index f2135b292b9f..4fef497585e4 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -71,6 +71,7 @@ #include "osl/process.h" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/frame/Desktop.hpp" #include "cppuhelper/implbase1.hxx" #include "uno/current_context.hxx" @@ -472,11 +473,8 @@ void DeInitVCL() { try { - uno::Reference<lang::XComponent> const xDesktop( - comphelper::getProcessServiceFactory()->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), - uno::UNO_QUERY_THROW) - ; + uno::Reference<frame::XDesktop2> const xDesktop = frame::Desktop::create( + comphelper::getProcessComponentContext() ); xDesktop->addEventListener(new VCLUnoWrapperDeleter()); } catch (uno::Exception const&) diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 9c11fe0587d2..d4cccb2488bc 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -59,6 +59,7 @@ #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/awt/MouseEvent.hpp> #include <com/sun/star/awt/MouseButton.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <rtl/tencinfo.h> #include <osl/process.h> @@ -3746,13 +3747,9 @@ void SelectionManager::run( void* pThis ) timeval aLast; gettimeofday( &aLast, 0 ); - css::uno::Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - if( xFact.is() ) - { - This->m_xDesktop.set(xFact->createInstance( ::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY); - if (This->m_xDesktop.is()) - This->m_xDesktop->addTerminateListener(This); - } + css::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + This->m_xDesktop.set( Desktop::create(xContext) ); + This->m_xDesktop->addTerminateListener(This); while( osl_scheduleThread(This->m_aThread) ) { diff --git a/vcl/unx/generic/dtrans/X11_selection.hxx b/vcl/unx/generic/dtrans/X11_selection.hxx index 95e9e98813f3..823cd5f259b7 100644 --- a/vcl/unx/generic/dtrans/X11_selection.hxx +++ b/vcl/unx/generic/dtrans/X11_selection.hxx @@ -29,7 +29,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/script/XInvocation.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <osl/thread.h> #include <osl/conditn.hxx> @@ -253,7 +253,7 @@ namespace x11 { oslThread m_aDragExecuteThread; ::osl::Condition m_aDragRunning; XLIB_Window m_aWindow; - com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; + com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2 > m_xDesktop; com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > m_xDisplayConnection; com::sun::star::uno::Reference< com::sun::star::script::XInvocation > diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index b4f1c6a0418b..386395b3bbe8 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -24,6 +24,7 @@ #endif #include <com/sun/star/awt/Toolkit.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> @@ -971,7 +972,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) UNO_QUERY_THROW ); uno::Reference< frame::XDesktop > xDesktop( - createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), + frame::Desktop::create(m_xContext), UNO_QUERY_THROW ); RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop); diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx index 931f197a9242..4da4b1e74040 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx @@ -24,6 +24,7 @@ #endif #include <com/sun/star/awt/Toolkit.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> @@ -140,9 +141,7 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException ) awt::Toolkit::create(m_xContext), uno::UNO_QUERY); - uno::Reference< frame::XDesktop > xDesktop( - createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), - uno::UNO_QUERY); + uno::Reference< frame::XDesktop > xDesktop( frame::Desktop::create(m_xContext), uno::UNO_QUERY); RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop); uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog); diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx index 79a94327589d..e787bae6e96a 100644 --- a/vcl/unx/gtk/gdi/salprn-gtk.cxx +++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx @@ -938,10 +938,7 @@ GtkPrintDialog::run() #if 0 void GtkPrintDialog::ExportAsPDF(const rtl::OUString &rFileURL, GtkPrintSettings *pSettings) const { - uno::Reference < XFramesSupplier > xDesktop = - uno::Reference < XFramesSupplier >( - ::comphelper::getProcessServiceFactory()-> - createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY); + uno::Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); uno::Reference < XFrame > xFrame(xDesktop->getActiveFrame()); if (!xFrame.is()) xFrame = uno::Reference < XFrame >(xDesktop, UNO_QUERY); |