diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-26 13:53:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-04 16:57:55 +0200 |
commit | b3c76dee6d44d07eae404b8d7341e6c88e6c4429 (patch) | |
tree | c747dd5bddf94c3b4312c7b1861a5087e76e71d6 /toolkit | |
parent | Improve error reporting (diff) | |
download | core-b3c76dee6d44d07eae404b8d7341e6c88e6c4429.tar.gz core-b3c76dee6d44d07eae404b8d7341e6c88e6c4429.zip |
fdo#46808, Adapt UNO services to new style, Part 7, updating ::create
Update calls to factories to use new ::create methods
Change-Id: I01d4417820f52718836c92faf3c2fae0dc96b30d
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/animatedimagespeer.cxx | 6 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 16 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrols.cxx | 16 | ||||
-rw-r--r-- | toolkit/source/helper/tkresmgr.cxx | 16 |
4 files changed, 25 insertions, 29 deletions
diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx index f1f5541a96cb..124dcdb88646 100644 --- a/toolkit/source/awt/animatedimagespeer.cxx +++ b/toolkit/source/awt/animatedimagespeer.cxx @@ -32,6 +32,7 @@ /** === begin UNO includes === **/ #include <com/sun/star/awt/XAnimatedImages.hpp> #include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/graphic/XGraphic.hpp> @@ -55,6 +56,7 @@ namespace toolkit //...................................................................................................................... /** === begin UNO using === **/ + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::UNO_QUERY; @@ -198,8 +200,8 @@ namespace toolkit try { // collect the image sizes of the different image sets - const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); + const Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XGraphicProvider > xGraphicProvider( com::sun::star::graphic::GraphicProvider::create(xContext) ); const bool isHighContrast = pThrobber->GetSettings().GetStyleSettings().GetHighContrastMode(); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 4ae8be922f8c..58107894d93b 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -28,6 +28,7 @@ #include <toolkit/awt/vclxwindows.hxx> #include <com/sun/star/awt/ScrollBarOrientation.hpp> +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/macros.hxx> @@ -2065,15 +2066,12 @@ namespace try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XGraphicProvider > xProvider; - if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) ) - { - ::comphelper::NamedValueCollection aMediaProperties; - aMediaProperties.put( "URL", i_rImageURL ); - Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); - return Image( xGraphic ); - } + Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XGraphicProvider > xProvider(graphic::GraphicProvider::create(xContext)); + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put( "URL", i_rImageURL ); + Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); + return Image( xGraphic ); } catch( const uno::Exception& ) { diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index f9925632d9a7..3da984802618 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/awt/VisualEffect.hpp> #include <com/sun/star/awt/LineEndFormat.hpp> +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/graphic/GraphicObject.hpp> #include <com/sun/star/util/Date.hpp> @@ -112,15 +113,12 @@ ImageHelper::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) try { - uno::Reference< graphic::XGraphicProvider > xProvider; - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) ) - { - uno::Sequence< beans::PropertyValue > aMediaProperties(1); - aMediaProperties[0].Name = ::rtl::OUString( "URL" ); - aMediaProperties[0].Value <<= _rURL; - xGraphic = xProvider->queryGraphic( aMediaProperties ); - } + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) ); + uno::Sequence< beans::PropertyValue > aMediaProperties(1); + aMediaProperties[0].Name = ::rtl::OUString( "URL" ); + aMediaProperties[0].Value <<= _rURL; + xGraphic = xProvider->queryGraphic( aMediaProperties ); } catch (const Exception&) { diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx index fd2f5cb0e356..fa24f4bc8cc8 100644 --- a/toolkit/source/helper/tkresmgr.cxx +++ b/toolkit/source/helper/tkresmgr.cxx @@ -31,6 +31,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/componentcontext.hxx> #include <comphelper/namedvaluecollection.hxx> +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <tools/resmgr.hxx> #include <tools/diagnose_ex.h> @@ -107,15 +108,12 @@ Image TkResMgr::getImageFromURL( const ::rtl::OUString& i_rImageURL ) try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XGraphicProvider > xProvider; - if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) ) - { - ::comphelper::NamedValueCollection aMediaProperties; - aMediaProperties.put( "URL", i_rImageURL ); - Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); - return Image( xGraphic ); - } + Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) ); + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put( "URL", i_rImageURL ); + Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); + return Image( xGraphic ); } catch( const uno::Exception& ) { |