diff options
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/acceleratorexecute.hxx | 7 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 12 | ||||
-rw-r--r-- | svtools/source/misc/acceleratorexecute.cxx | 21 | ||||
-rw-r--r-- | svtools/source/misc/transfer.cxx | 35 |
4 files changed, 24 insertions, 51 deletions
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 ); } |