diff options
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 67 | ||||
-rw-r--r-- | svtools/source/misc/imageresourceaccess.cxx | 10 | ||||
-rw-r--r-- | svtools/source/uno/treecontrolpeer.cxx | 13 |
3 files changed, 38 insertions, 52 deletions
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index aed37c9a3fea..a0f5a7b39e89 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -54,6 +54,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XOfficeInstallationDirectories.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/DocumentTemplates.hpp> #include <com/sun/star/frame/XDocumentTemplates.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -176,17 +177,13 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : aIconCtrl.Show(); // detect the root URL of templates - Reference< XDocumentTemplates > xTemplates( ::comphelper::getProcessServiceFactory()-> - createInstance( ASCII_STR("com.sun.star.frame.DocumentTemplates") ), UNO_QUERY ); + Reference< XDocumentTemplates > xTemplates( frame::DocumentTemplates::create(::comphelper::getProcessComponentContext()) ); - if ( xTemplates.is() ) - { - Reference < XContent > aRootContent = xTemplates->getContent(); - Reference < XCommandEnvironment > aCmdEnv; + Reference < XContent > aRootContent = xTemplates->getContent(); + Reference < XCommandEnvironment > aCmdEnv; - if ( aRootContent.is() ) - aTemplateRootURL = aRootContent->getIdentifier()->getContentIdentifier(); - } + if ( aRootContent.is() ) + aTemplateRootURL = aRootContent->getIdentifier()->getContentIdentifier(); // insert the categories // "New Document" @@ -1644,35 +1641,31 @@ IMPL_LINK_NOARG(SvtDocumentTemplateDialog , OrganizerHdl_Impl) IMPL_LINK ( SvtDocumentTemplateDialog, UpdateHdl_Impl, Timer*, _pEventSource ) { pImpl->pWin->SetFocus( sal_False ); - Reference< XDocumentTemplates > xTemplates( ::comphelper::getProcessServiceFactory()-> - createInstance( ASCII_STR("com.sun.star.frame.DocumentTemplates") ), UNO_QUERY ); - if ( xTemplates.is() ) - { - if ( _pEventSource ) - { // it was no direct call, which means it was triggered by the timer, which means we alread checked the necessity - WaitObject aWaitCursor( this ); - xTemplates->update(); - if ( pImpl->pWin->IsTemplateFolderOpen() ) - { - pImpl->pWin->ClearHistory(); - pImpl->pWin->OpenTemplateRoot(); - } - } - else + Reference< XDocumentTemplates > xTemplates( frame::DocumentTemplates::create(::comphelper::getProcessComponentContext()) ); + if ( _pEventSource ) + { // it was no direct call, which means it was triggered by the timer, which means we alread checked the necessity + WaitObject aWaitCursor( this ); + xTemplates->update(); + if ( pImpl->pWin->IsTemplateFolderOpen() ) { - // check if we really need to do the update - ::svt::TemplateFolderCache aCache; - if ( aCache.needsUpdate() ) - { // yes -> do it asynchronous (it will take a noticeable time) - - // (but first store the current state) - aCache.storeState(); - - // start the timer for the async update - pImpl->aUpdateTimer.SetTimeout( 300 ); - pImpl->aUpdateTimer.SetTimeoutHdl( LINK( this, SvtDocumentTemplateDialog, UpdateHdl_Impl ) ); - pImpl->aUpdateTimer.Start(); - } + pImpl->pWin->ClearHistory(); + pImpl->pWin->OpenTemplateRoot(); + } + } + else + { + // check if we really need to do the update + ::svt::TemplateFolderCache aCache; + if ( aCache.needsUpdate() ) + { // yes -> do it asynchronous (it will take a noticeable time) + + // (but first store the current state) + aCache.storeState(); + + // start the timer for the async update + pImpl->aUpdateTimer.SetTimeout( 300 ); + pImpl->aUpdateTimer.SetTimeoutHdl( LINK( this, SvtDocumentTemplateDialog, UpdateHdl_Impl ) ); + pImpl->aUpdateTimer.Start(); } } return 0; diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index 7ffbec2ba90b..92f08a2c42e8 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -32,6 +32,7 @@ /** === begin UNO includes === **/ #include <com/sun/star/io/NotConnectedException.hpp> #include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/io/XStream.hpp> /** === end UNO includes === **/ @@ -39,6 +40,7 @@ #include <tools/stream.hxx> #include <unotools/streamwrap.hxx> #include <cppuhelper/implbase2.hxx> +#include <comphelper/componentcontext.hxx> //........................................................................ namespace svt @@ -154,13 +156,7 @@ namespace svt try { // get a GraphicProvider - Reference< XGraphicProvider > xProvider; - if ( _rxORB.is() ) - xProvider = xProvider.query( _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ) ); - OSL_ENSURE( xProvider.is(), "GraphicAccess::getImageStream: could not create a graphic provider!" ); - - if ( !xProvider.is() ) - return pReturn; + Reference< XGraphicProvider > xProvider = ::com::sun::star::graphic::GraphicProvider::create(comphelper::ComponentContext(_rxORB).getUNOContext()); // let it create a graphic from the given URL Sequence< PropertyValue > aMediaProperties( 1 ); diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index aea3cd62c563..15bb2da3720c 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -28,6 +28,7 @@ #define _SVTREEBX_CXX +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/view/SelectionType.hpp> @@ -1477,14 +1478,10 @@ bool TreeControlPeer::loadImage( const ::rtl::OUString& rURL, Image& rImage ) { if( !mxGraphicProvider.is() ) { - static const OUString aSN( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ); - Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() ); - if( xORB.is() ) - { - Reference< XInterface > x( xORB->createInstance( aSN ) ); - mxGraphicProvider.query( x ); - mxGraphicProvider = Reference< XGraphicProvider >( x, UNO_QUERY ); - } + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XInterface > x( graphic::GraphicProvider::create(xContext) ); + mxGraphicProvider.query( x ); + mxGraphicProvider = Reference< XGraphicProvider >( x, UNO_QUERY ); } if( mxGraphicProvider.is() ) try |