diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-14 12:58:00 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-21 10:57:09 +0200 |
commit | bb121c864cc3c101ef733a4088c7ba3e36eced14 (patch) | |
tree | 2d528ca830aace6e563b7cdc93eb8f8d6c4f70cf /extensions | |
parent | Updated core (diff) | |
download | core-bb121c864cc3c101ef733a4088c7ba3e36eced14.tar.gz core-bb121c864cc3c101ef733a4088c7ba3e36eced14.zip |
fdo#46808, Convert frame::Desktop to new style service.
I had to drop XEventBroadcaster from the merged interface
because it introduced method name conflicts (addEventListener).
Shouldn't be an issue since it was scheduled to be dropped anyhow,
and the service implementation still implements it, so existing clients
will be fine.
I dropped the interface XPropertySet from the combined IDL because nobody
seems to be using it, and it's primary purpose appears to be to set weird
flags.
I dropped the optional interfaces
XStatusIndicatorFactory
XDispatchInformationProvider
from the combined IDL because the service does not implement them, and
nobody seems to be using them. I suspect they were mistakenly copied
from XFrame.
I also did not convert the Title, UserDefinedAttributes and LayoutManager
properties to attributes, again because no-one is using them.
Change-Id: I678a00006ed2cca2d6c37c4e39465811442c33af
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/nsplugin/source/so_instance.cxx | 12 | ||||
-rw-r--r-- | extensions/source/plugin/base/context.cxx | 49 | ||||
-rw-r--r-- | extensions/source/plugin/base/manager.cxx | 13 | ||||
-rw-r--r-- | extensions/source/plugin/inc/plugin/impl.hxx | 4 | ||||
-rw-r--r-- | extensions/source/propctrlr/formstrings.hxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/genericpropertyhandler.cxx | 3 | ||||
-rw-r--r-- | extensions/source/propctrlr/sqlcommanddesign.cxx | 11 | ||||
-rw-r--r-- | extensions/source/scanner/scanwin.cxx | 44 | ||||
-rw-r--r-- | extensions/source/update/check/updatecheck.cxx | 9 | ||||
-rw-r--r-- | extensions/source/update/check/updatecheckjob.cxx | 9 | ||||
-rw-r--r-- | extensions/source/update/check/updatehdl.cxx | 13 |
11 files changed, 60 insertions, 109 deletions
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(); |