Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi

I've converted a bunch of stuff, including graphic/GraphicProvider. I'm now getting failures in some of the unit tests.
Are my changes at fault, or is there something else that needs fixing?

Thanks, Noel Grandin

File tested,Test Result,Execution Time (ms)
file:///home/noel/libo/sc/qa/unit/data/xls/pass/CVE-2010-0822-1.xls,##Failure Location unknown## : Error
Test name: ScFiltersTest::testCVEs
An uncaught exception of type com.sun.star.uno.DeploymentException
- component context fails to supply service com.sun.star.graphic.GraphicProvide
r of type com.sun.star.graphic.XGraphicProvider

##Failure Location unknown## : Error
Test name: ScFiltersTest::testContentXLS
An uncaught exception of type com.sun.star.uno.DeploymentException
- component context fails to supply service com.sun.star.graphic.GraphicProvide
r of type com.sun.star.graphic.XGraphicProvider

filters-test.cxx:297:Assertion
Test name: ScFiltersTest::testContentXLSX
assertion failed
- Expression: xDocSh.Is()

Failures !!!
Run: 5   Failure total: 3   Failures: 1   Errors: 2

Error: a unit test failed, please do one of:

export DEBUGCPPUNIT=TRUE            # for exception catching
export GDBCPPUNITTRACE="gdb --args" # for interactive debugging
export VALGRIND=memcheck            # for memory checking
and retry.
make[1]: *** [/home/noel/libo/workdir/unxlngx6.pro/CppunitTest/sc_filters_test.test] Error 1
dmake:  Error code 2, while making 'all'


Disclaimer: http://www.peralex.com/disclaimer.html


diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx 
b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
index d14aeb7..7d92628 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
@@ -39,6 +39,7 @@
 #include <com/sun/star/chart/ChartSymbolType.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
 
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 
 // for UNO_NAME_GRAPHOBJ_URLPREFIX
@@ -389,9 +390,8 @@ void WrappedSymbolBitmapURLProperty::setValueToSeries(
             try
             {
                 // @todo: get factory from some context?
-                Reference< lang::XMultiServiceFactory > xFact( 
comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-                Reference< graphic::XGraphicProvider > xGraphProv(
-                    xFact->createInstance( C2U("com.sun.star.graphic.GraphicProvider")), 
uno::UNO_QUERY_THROW );
+                Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW );
+                Reference< graphic::XGraphicProvider > xGraphProv( 
graphic::GraphicProvider::create(xContext) );
                 Sequence< beans::PropertyValue > aArgs(1);
                 aArgs[0] = beans::PropertyValue(
                     C2U("URL"), -1, uno::makeAny( aNewGraphicURL ),
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx 
b/connectivity/source/drivers/hsqldb/HConnection.cxx
index 2021e79..4627860 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -39,6 +39,7 @@
 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
 #include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/graphic/GraphicColorMode.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
@@ -75,6 +76,7 @@ using ::com::sun::star::lang::ServiceNotRegisteredException;
 using ::com::sun::star::sdbc::XDriver;
 using ::com::sun::star::lang::XMultiServiceFactory;
 using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::GraphicProvider;
 using ::com::sun::star::graphic::XGraphicProvider;
 using ::com::sun::star::uno::XInterface;
 using ::com::sun::star::lang::IllegalArgumentException;
@@ -353,7 +355,7 @@ namespace connectivity { namespace hsqldb
             // create a graphic provider
             Reference< XGraphicProvider > xProvider;
             if ( m_xORB.is() )
-                xProvider.set( m_xORB->createInstance( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
+                xProvider.set( 
GraphicProvider::create(::comphelper::ComponentContext(m_xORB).getUNOContext()) );
 
             // assemble the image URL
             ::rtl::OUStringBuffer aImageURL;
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index a941f4f..4307ec7 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -85,7 +85,9 @@
 #include <com/sun/star/frame/XFramesSupplier.hpp>
 #include <com/sun/star/frame/XFrames.hpp>
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/FileSystemStorageFactory.hpp>
 
 #include "dlgname.hxx"
 
@@ -5064,19 +5066,13 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( Window *pWindow,
 
     uno::Reference< lang::XMultiServiceFactory > xServiceManager =
         ::comphelper::getProcessServiceFactory();
+    uno::Reference< uno::XComponentContext > xComponentContext =
+        ::comphelper::getProcessComponentContext();
 
-    if ( xServiceManager.is() )
-    {
-        m_xGraphProvider = uno::Reference< graphic::XGraphicProvider >(
-            xServiceManager->createInstance(
-                ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider" 
) ) ),
-            uno::UNO_QUERY );
-    }
+    m_xGraphProvider = uno::Reference< graphic::XGraphicProvider >(
+        graphic::GraphicProvider::create( xComponentContext ) );
 
-    if ( !m_xGraphProvider.is() )
-    {
-        aBtnImport.Enable( sal_False );
-    }
+    aBtnImport.Enable( sal_False );
 
     uno::Reference< beans::XPropertySet > xPropSet(
         xServiceManager->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.util.PathSettings" ) ) ),
@@ -5106,9 +5102,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( Window *pWindow,
     aDirectory += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg/import" ) );
 
     uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
-        xServiceManager->createInstance(
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.FileSystemStorageFactory" 
) ) ),
-        uno::UNO_QUERY );
+          ::com::sun::star::embed::FileSystemStorageFactory::create( xComponentContext ) );
 
     uno::Sequence< uno::Any > aArgs( 2 );
     aArgs[ 0 ] <<= aDirectory;
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx 
b/desktop/source/deployment/registry/package/dp_package.cxx
index 997fef4..d6196e5 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -47,6 +47,7 @@
 #include "com/sun/star/lang/XServiceInfo.hpp"
 #include "com/sun/star/beans/UnknownPropertyException.hpp"
 #include "com/sun/star/graphic/XGraphic.hpp"
+#include "com/sun/star/graphic/GraphicProvider.hpp"
 #include "com/sun/star/graphic/XGraphicProvider.hpp"
 #include "com/sun/star/io/XOutputStream.hpp"
 #include "com/sun/star/io/XInputStream.hpp"
@@ -835,18 +836,13 @@ uno::Reference< graphic::XGraphic > BackendImpl::PackageImpl::getIcon( 
sal_Bool
         OUString aFullIconURL = m_url_expanded + OUSTR("/") + aIconURL;
 
         uno::Reference< XComponentContext > xContext( getMyBackend()->getComponentContext() );
-        uno::Reference< graphic::XGraphicProvider > xGraphProvider(
-                        xContext->getServiceManager()->createInstanceWithContext( OUSTR( 
"com.sun.star.graphic.GraphicProvider" ), xContext ),
-                        uno::UNO_QUERY );
+        uno::Reference< graphic::XGraphicProvider > xGraphProvider( 
graphic::GraphicProvider::create(xContext) );
 
-        if ( xGraphProvider.is() )
-        {
-            uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
-            aMediaProps[0].Name = OUSTR( "URL" );
-            aMediaProps[0].Value <<= aFullIconURL;
+        uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
+        aMediaProps[0].Name = OUSTR( "URL" );
+        aMediaProps[0].Value <<= aFullIconURL;
 
-            xGraphic = xGraphProvider->queryGraphic( aMediaProps );
-        }
+        xGraphic = xGraphProvider->queryGraphic( aMediaProps );
     }
 
     return xGraphic;
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 496d239..b4f969b 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -35,6 +35,7 @@
 #include "migration_impl.hxx"
 
 #include <unotools/textsearch.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
 #include <unotools/bootstrap.hxx>
@@ -57,6 +58,7 @@
 #include <com/sun/star/util/XChangesBatch.hpp>
 #include <com/sun/star/util/XStringSubstitution.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/FileSystemStorageFactory.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
 #include <com/sun/star/ui/XUIConfiguration.hpp>
 #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
@@ -272,10 +274,9 @@ sal_Bool MigrationImpl::doMigration()
             lArgs[0] <<= aOldCfgDataPath + vModulesInfo[i].sModuleShortName;
             lArgs[1] <<= embed::ElementModes::READ;
 
-            uno::Reference< lang::XSingleServiceFactory > 
xStorageFactory(m_xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.FileSystemStorageFactory"))),
 uno::UNO_QUERY);
-            uno::Reference< embed::XStorage >             xModules;
-
-            xModules = uno::Reference< embed::XStorage 
(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY);
+            uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
+                     
embed::FileSystemStorageFactory::create(comphelper::ComponentContext(m_xFactory).getUNOContext()));
+            uno::Reference< embed::XStorage >             
xModules(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY);
             uno::Reference< ui::XUIConfigurationManager > xOldCfgManager( 
m_xFactory->createInstance( 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager"))), 
uno::UNO_QUERY );
             uno::Reference< ui::XUIConfigurationStorage > xOldCfgStorage( xOldCfgManager, 
uno::UNO_QUERY );
             uno::Reference< ui::XUIConfigurationPersistence > xOldCfgPersistence( xOldCfgManager, 
uno::UNO_QUERY );
@@ -996,7 +997,8 @@ void MigrationImpl::runServices()
     lArgs[0] <<= m_aInfo.userdata + 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/user/config/soffice.cfg/modules"));
     lArgs[1] <<= embed::ElementModes::READ;
 
-    uno::Reference< lang::XSingleServiceFactory > 
xStorageFactory(m_xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.FileSystemStorageFactory"))),
 uno::UNO_QUERY);
+    uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
+                     
embed::FileSystemStorageFactory::create(comphelper::ComponentContext(m_xFactory).getUNOContext()));
     uno::Reference< embed::XStorage >             xModules;
 
     xModules = uno::Reference< embed::XStorage 
(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY);
diff --git a/embeddedobj/source/msole/graphconvert.cxx b/embeddedobj/source/msole/graphconvert.cxx
index ca83da8..77caf58 100644
--- a/embeddedobj/source/msole/graphconvert.cxx
+++ b/embeddedobj/source/msole/graphconvert.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/embed/Aspects.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
@@ -60,27 +61,24 @@ sal_Bool ConvertBufferToFormat( void* pBuf,
         uno::Reference < io::XInputStream > xIn = new comphelper::SequenceInputStream( aData );
         try
         {
-            uno::Reference < graphic::XGraphicProvider > xGraphicProvider( 
comphelper::getProcessServiceFactory()->createInstance( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")) ), 
uno::UNO_QUERY );
-            if( xGraphicProvider.is() )
+            uno::Reference < graphic::XGraphicProvider > xGraphicProvider( 
graphic::GraphicProvider::create(comphelper::getProcessComponentContext()));
+            uno::Sequence< beans::PropertyValue > aMediaProperties( 1 );
+            aMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "InputStream" 
));
+            aMediaProperties[0].Value <<= xIn;
+            uno::Reference< graphic::XGraphic > xGraphic( xGraphicProvider->queryGraphic( 
aMediaProperties  ) );
+            if( xGraphic.is() )
             {
-                uno::Sequence< beans::PropertyValue > aMediaProperties( 1 );
-                aMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 
"InputStream" ));
-                aMediaProperties[0].Value <<= xIn;
-                uno::Reference< graphic::XGraphic > xGraphic( xGraphicProvider->queryGraphic( 
aMediaProperties  ) );
-                if( xGraphic.is() )
-                {
-                    SvMemoryStream aNewStream( 65535, 65535 );
-                    uno::Reference < io::XStream > xOut = new utl::OStreamWrapper( aNewStream );
-                    uno::Sequence< beans::PropertyValue > aOutMediaProperties( 2 );
-                    aOutMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 
"OutputStream" ));
-                    aOutMediaProperties[0].Value <<= xOut;
-                    aOutMediaProperties[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 
"MimeType" ));
-                    aOutMediaProperties[1].Value <<= aMimeType;
+                SvMemoryStream aNewStream( 65535, 65535 );
+                uno::Reference < io::XStream > xOut = new utl::OStreamWrapper( aNewStream );
+                uno::Sequence< beans::PropertyValue > aOutMediaProperties( 2 );
+                aOutMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 
"OutputStream" ));
+                aOutMediaProperties[0].Value <<= xOut;
+                aOutMediaProperties[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 
"MimeType" ));
+                aOutMediaProperties[1].Value <<= aMimeType;
 
-                    xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
-                    aResult <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( 
aNewStream.GetData() ), aNewStream.Seek( STREAM_SEEK_TO_END ) );
-                    return sal_True;
-                }
+                xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
+                aResult <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( 
aNewStream.GetData() ), aNewStream.Seek( STREAM_SEEK_TO_END ) );
+                return sal_True;
             }
         }
         catch (const uno::Exception&)
diff --git a/extensions/source/propctrlr/browserline.cxx 
b/extensions/source/propctrlr/browserline.cxx
index 480ac6b..8166123 100644
--- a/extensions/source/propctrlr/browserline.cxx
+++ b/extensions/source/propctrlr/browserline.cxx
@@ -28,7 +28,9 @@
 
 #include "browserline.hxx"
 
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/inspection/PropertyLineElement.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 
 #include <comphelper/componentcontext.hxx>
@@ -46,10 +48,12 @@ namespace pcr
 
     /** === begin UNO using === **/
     using ::com::sun::star::uno::Reference;
+    using ::com::sun::star::uno::XComponentContext;
     using ::com::sun::star::inspection::XPropertyControl;
     using ::com::sun::star::inspection::XPropertyControlContext;
     using ::com::sun::star::uno::UNO_QUERY_THROW;
     using ::com::sun::star::uno::Exception;
+    using ::com::sun::star::graphic::GraphicProvider;
     using ::com::sun::star::graphic::XGraphicProvider;
     using ::com::sun::star::uno::Sequence;
     using ::com::sun::star::beans::PropertyValue;
@@ -412,8 +416,8 @@ namespace pcr
     {
         try
         {
-            ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-            Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( 
"com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW );
+            Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+            Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create(xContext) );
 
             Sequence< PropertyValue > aMediaProperties(1);
             aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
diff --git a/extensions/source/update/ui/updatecheckui.cxx 
b/extensions/source/update/ui/updatecheckui.cxx
index ceb5691..dcc4bfd 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/document/XEventListener.hpp>
 #include <com/sun/star/document/XEventBroadcaster.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/task/XJob.hpp>
 
@@ -323,30 +324,24 @@ Image UpdateCheckUI::GetBubbleImage( ::rtl::OUString &rURL )
 
     if ( !maBubbleImageURL.isEmpty() )
     {
-        uno::Reference< lang::XMultiServiceFactory > xServiceManager = 
::comphelper::getProcessServiceFactory();
+        uno::Reference< uno::XComponentContext > xContext = 
::comphelper::getProcessComponentContext();
 
-        if( !xServiceManager.is() )
+        if( !xContext.is() )
             throw uno::RuntimeException(
                 UNISTRING( "UpdateCheckUI: unable to obtain service manager from component 
context" ),
                     uno::Reference< uno::XInterface >() );
 
         try
         {
-            uno::Reference< graphic::XGraphicProvider > xGraphProvider(
-                    xServiceManager->createInstance(
-                            
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")) ),
-                    uno::UNO_QUERY );
-            if ( xGraphProvider.is() )
-            {
-                uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
-                aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
-                aMediaProps[0].Value <<= rURL;
+            uno::Reference< graphic::XGraphicProvider > 
xGraphProvider(graphic::GraphicProvider::create(xContext));
+            uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
+            aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
+            aMediaProps[0].Value <<= rURL;
 
-                uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( 
aMediaProps );
-                if ( xGraphic.is() )
-                {
-                    aImage = Image( xGraphic );
-                }
+            uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( 
aMediaProps );
+            if ( xGraphic.is() )
+            {
+                aImage = Image( xGraphic );
             }
         }
         catch( const uno::Exception& )
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 8c61449..e8b1a7c 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -37,6 +37,7 @@
 #include <svtools/imageresourceaccess.hxx>
 #include <unotools/ucblockbytes.hxx>
 #include <sfx2/filedlghelper.hxx>
+#include <com/sun/star/awt/PopupMenu.hpp>
 #include <com/sun/star/awt/XPopupMenu.hpp>
 #include <com/sun/star/awt/PopupMenuDirection.hpp>
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
@@ -911,7 +912,7 @@ void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent&
     // is this a request for a context menu?
     if ( e.PopupTrigger )
     {
-        Reference< XPopupMenu > xMenu( m_aContext.createComponent( "com.sun.star.awt.PopupMenu" ), 
UNO_QUERY );
+        Reference< XPopupMenu > xMenu( awt::PopupMenu::create( m_aContext.getUNOContext() ) );
         DBG_ASSERT( xMenu.is(), "OImageControlControl::mousePressed: could not create a popup 
menu!" );
 
         Reference< XWindowPeer > xWindowPeer = getPeer();
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx 
b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index 902b2bd..a31e6d2 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -40,6 +40,7 @@
 
 #include <com/sun/star/frame/XPopupMenuController.hpp>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/awt/PopupMenu.hpp>
 #include <com/sun/star/awt/PopupMenuDirection.hpp>
 #include <svtools/langtab.hxx>
 #include "sal/types.h"
@@ -58,6 +59,7 @@
 #include <com/sun/star/frame/XDispatchProvider.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
 
 #include <toolkit/unohlp.hxx>
 #include <tools/gen.hxx>
@@ -186,10 +188,9 @@ throw (::com::sun::star::uno::RuntimeException)
         return;
 
     //add context menu
-    const static OUString s_sPopupMenu(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.PopupMenu"));
-    Reference< awt::XPopupMenu > xPopupMenu( m_xServiceManager->createInstance( s_sPopupMenu ), 
UNO_QUERY );
+    Reference< awt::XPopupMenu > xPopupMenu( awt::PopupMenu::create( 
comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
     //sub menu that contains all items except the last two items: Separator + Set Language for 
Paragraph
-    Reference< awt::XPopupMenu > subPopupMenu(m_xServiceManager->createInstance( s_sPopupMenu ), 
UNO_QUERY );
+    Reference< awt::XPopupMenu > subPopupMenu( awt::PopupMenu::create( 
comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
 
     SvtLanguageTable    aLanguageTable;
 
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index 66f6313..02a5562 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/frame/XFramesSupplier.hpp>
 #include <com/sun/star/graphic/GraphicObject.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/util/MeasureUnit.hpp>
 #include <comphelper/seqstream.hxx>
@@ -81,7 +82,7 @@ GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, c
     Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY );
     OSL_ENSURE( xFactory.is(), "GraphicHelper::GraphicHelper - missing service factory" );
     if( xFactory.is() )
-        mxGraphicProvider.set( xFactory->createInstance( CREATE_OUSTRING( 
"com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY );
+        mxGraphicProvider.set( graphic::GraphicProvider::create( mxContext ) );
 
     //! TODO: get colors from system
     maSystemPalette[ XML_3dDkShadow ]               = 0x716F64;
diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
index f4d4d02..1129216 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -30,6 +30,7 @@
 #ifdef _MSC_VER
 #pragma warning (disable:4190)
 #endif
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/graphic/GraphicType.hpp>
 #include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
@@ -382,8 +383,9 @@ void SdGRFFilter::SaveGraphic( const ::com::sun::star::uno::Reference< ::com::su
     try
     {
         Reference< XMultiServiceFactory > xSM( ::comphelper::getProcessServiceFactory(), 
UNO_QUERY_THROW );
+        Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext(), 
UNO_QUERY_THROW );
 
-        Reference< XGraphicProvider > xProvider( xSM->createInstance( OUString( 
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
+        Reference< XGraphicProvider > xProvider( GraphicProvider::create(xContext) );
         Reference< XPropertySet > xShapeSet( xShape, UNO_QUERY_THROW );
 
         // detect mime type of graphic
diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx
index 359eaff..a9fa7ca 100644
--- a/sd/source/filter/html/buttonset.cxx
+++ b/sd/source/filter/html/buttonset.cxx
@@ -28,6 +28,7 @@
 
 
 #include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 
 #include <osl/file.hxx>
@@ -262,14 +263,10 @@ Reference< XGraphicProvider > ButtonSetImpl::getGraphicProvider()
 {
     if( !mxGraphicProvider.is() )
     {
-        Reference< XMultiServiceFactory > xServiceManager( 
::comphelper::getProcessServiceFactory() );
-        if( xServiceManager.is() ) try
+        Reference< XComponentContext > xComponentContext( 
::comphelper::getProcessComponentContext() );
+        if( xComponentContext.is() ) try
         {
-            Reference< XGraphicProvider > xGraphProvider(
-                xServiceManager->createInstance(
-                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
-
-            mxGraphicProvider = xGraphProvider;
+            mxGraphicProvider = GraphicProvider::create(xComponentContext);
         }
         catch( Exception& )
         {
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx
index 20013b0..4ddfaba 100644
--- a/sd/source/ui/dlg/TemplateScanner.cxx
+++ b/sd/source/ui/dlg/TemplateScanner.cxx
@@ -30,6 +30,7 @@
 #include "TemplateScanner.hxx"
 
 #include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/documentconstants.hxx>
 #include <comphelper/string.hxx>
 
@@ -38,6 +39,7 @@
 #include <vcl/svapp.hxx>
 #include <sfx2/doctempl.hxx>
 #include <sfx2/templatelocnames.hrc>
+#include <com/sun/star/frame/DocumentTemplates.hpp>
 #include <com/sun/star/frame/XDocumentTemplates.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
@@ -57,8 +59,6 @@ const ::rtl::OUString TARGET_DIR_URL(RTL_CONSTASCII_USTRINGPARAM ("TargetDirURL"
 const ::rtl::OUString DESCRIPTION(RTL_CONSTASCII_USTRINGPARAM ("TypeDescription"));
 const ::rtl::OUString TARGET_URL(RTL_CONSTASCII_USTRINGPARAM ("TargetURL"));
 
-const ::rtl::OUString DOCTEMPLATES(RTL_CONSTASCII_USTRINGPARAM 
("com.sun.star.frame.DocumentTemplates"));
-
 //  These strings are used to find impress templates in the tree of
 //  template files.  Should probably be determined dynamically.
 const ::rtl::OUString IMPRESS_BIN_TEMPLATE(RTL_CONSTASCII_USTRINGPARAM 
("application/vnd.stardivision.impress"));
@@ -219,13 +219,12 @@ TemplateScanner::State TemplateScanner::GetTemplateRoot (void)
 {
     State eNextState (INITIALIZE_FOLDER_SCANNING);
 
-    Reference<lang::XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory ();
-    DBG_ASSERT (xFactory.is(), "TemplateScanner::GetTemplateRoot: xFactory is NULL");
+    Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+    DBG_ASSERT (xContext.is(), "TemplateScanner::GetTemplateRoot: xContext is NULL");
 
-    if (xFactory.is())
+    if (xContext.is())
     {
-        Reference<frame::XDocumentTemplates> xTemplates (
-            xFactory->createInstance (DOCTEMPLATES), UNO_QUERY);
+        Reference<frame::XDocumentTemplates> xTemplates 
(frame::DocumentTemplates::create(xContext));
         DBG_ASSERT (xTemplates.is(), "TemplateScanner::GetTemplateRoot: xTemplates is NULL");
 
         if (xTemplates.is())
diff --git a/sdext/Library_minimizer.mk b/sdext/Library_minimizer.mk
index f00fc5f..7b94fdc 100644
--- a/sdext/Library_minimizer.mk
+++ b/sdext/Library_minimizer.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_Library_add_api,SunPresentationMinimizer,\
 ))
 
 $(eval $(call gb_Library_add_linked_libs,SunPresentationMinimizer,\
+    comphelper \
     cppu \
     cppuhelper \
     sal \
diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx
index 9ab1d53..6250ee7 100644
--- a/sdext/source/minimizer/impoptimizer.cxx
+++ b/sdext/source/minimizer/impoptimizer.cxx
@@ -47,6 +47,7 @@
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
 #include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <unotools/configmgr.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -69,6 +70,7 @@
 #include <com/sun/star/io/XSeekable.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
 #include <com/sun/star/util/URL.hpp>
+#include <comphelper/componentcontext.hxx>
 
 using namespace ::std;
 using namespace ::rtl;
@@ -350,7 +352,7 @@ Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >&
                             {
                                 Reference< XStream > xTempFile( 
rxMSF->getServiceManager()->createInstanceWithContext( 
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile")), rxMSF ), UNO_QUERY_THROW );
                                 Reference< XOutputStream > xOutputStream( 
xTempFile->getOutputStream() );
-                                Reference< XGraphicProvider > xGraphicProvider( 
rxMSF->getServiceManager()->createInstanceWithContext( 
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")), rxMSF ), 
UNO_QUERY_THROW );
+                                Reference< XGraphicProvider > xGraphicProvider( 
GraphicProvider::create(comphelper::ComponentContext(rxMSF).getUNOContext()) );
 
                                 ImpCompressGraphic( xGraphicProvider, xGraphic, xOutputStream, 
aDestMimeType, aLogicalSize, rGraphicSettings.mnJPEGQuality, rGraphicSettings.mnImageResolution, 
bRemoveCropArea, aGraphicCropLogic );
                                 Reference< XInputStream > xInputStream( 
xTempFile->getInputStream() );
@@ -370,7 +372,7 @@ Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >&
                 rtl::OUString aDestMimeType( aSourceMimeType );
                 Reference< XStream > xTempFile( 
rxMSF->getServiceManager()->createInstanceWithContext( 
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile")), rxMSF ), UNO_QUERY_THROW );
                 Reference< XOutputStream > xOutputStream( xTempFile->getOutputStream() );
-                Reference< XGraphicProvider > xGraphicProvider( 
rxMSF->getServiceManager()->createInstanceWithContext( 
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")), rxMSF ), 
UNO_QUERY_THROW );
+                Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create( 
::comphelper::ComponentContext(rxMSF).getUNOContext() ) );
                 ImpCompressGraphic( xGraphicProvider, xGraphic, xOutputStream, aDestMimeType, 
aLogicalSize, rGraphicSettings.mnJPEGQuality, rGraphicSettings.mnImageResolution, sal_False, 
aGraphicCropLogic );
                 Reference< XInputStream > xInputStream( xTempFile->getInputStream() );
                 Reference< XSeekable > xSeekable( xInputStream, UNO_QUERY_THROW );
diff --git a/sdext/source/minimizer/informationdialog.cxx 
b/sdext/source/minimizer/informationdialog.cxx
index 09db8b2..988f561 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -30,12 +30,14 @@
 #include "informationdialog.hxx"
 #include "optimizationstats.hxx"
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <rtl/ustrbuf.hxx>
 #include <sal/macros.h>
 #include "com/sun/star/util/URL.hpp"
 #include "com/sun/star/util/XURLTransformer.hpp"
+#include <comphelper/componentcontext.hxx>
 
 #define DIALOG_WIDTH    240
 #define DIALOG_HEIGHT   80
@@ -218,8 +220,7 @@ OUString InformationDialog::ImpGetStandardImage( const OUString& sPrivateURL )
         Reference< XOutputStream > xOutputStream( mxTempFile->getOutputStream() );
         if ( xOutputStream.is() && xPropSet.is() )
         {
-            Reference< graphic::XGraphicProvider > xGraphicProvider( 
mxMSF->getServiceManager()->createInstanceWithContext(
-                        
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")), mxMSF ), 
UNO_QUERY_THROW );
+            Reference< graphic::XGraphicProvider > xGraphicProvider( 
graphic::GraphicProvider::create( ::comphelper::ComponentContext(mxMSF).getUNOContext() ) );
             Sequence< PropertyValue > aArgs( 1 );
             aArgs[ 0 ].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
             aArgs[ 0 ].Value <<= sPrivateURL;
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index 7a85eaa..0066939 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
 #include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/accessibility/XAccessible.hpp>
 #include <com/sun/star/awt/XControl.hpp>
@@ -70,6 +71,7 @@ namespace sfx2
 
     /** === begin UNO using === **/
     using ::com::sun::star::uno::Reference;
+    using ::com::sun::star::uno::XComponentContext;
     using ::com::sun::star::uno::XInterface;
     using ::com::sun::star::uno::UNO_QUERY;
     using ::com::sun::star::uno::UNO_QUERY_THROW;
@@ -189,8 +191,8 @@ namespace sfx2
                     }
 
                     // otherwise, delegate to the GraphicProvider
-                    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 Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( 
aMediaProperties.getPropertyValues() ), UNO_SET_THROW );
                     return Image( xGraphic );
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index e2733a6..50b7688 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -51,6 +51,7 @@
 #include <com/sun/star/document/XTypeDetection.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/DocumentTemplates.hpp>
 #include <com/sun/star/frame/XDocumentTemplates.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XPersist.hpp>
@@ -125,7 +126,6 @@ using ::std::advance;
 #define SERVICENAME_TYPEDETECTION       "com.sun.star.document.TypeDetection"
 #define TYPEDETECTION_PARAMETER         "FileName"
 #define SERVICENAME_DOCINFO             "com.sun.star.document.DocumentProperties"
-#define SERVICENAME_DOCTEMPLATES        "com.sun.star.frame.DocumentTemplates"
 #define SERVICENAME_DESKTOP             "com.sun.star.frame.Desktop"
 
 //========================================================================
@@ -2065,22 +2065,16 @@ sal_Bool SfxDocTemplate_Impl::Construct( )
     if ( mbConstructed )
         return sal_True;
 
-    uno::Reference< XMultiServiceFactory >   xFactory;
-    xFactory = ::comphelper::getProcessServiceFactory();
+    uno::Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+    uno::Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
 
     OUString aService( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_DOCINFO ) );
     uno::Reference< XPersist > xInfo( xFactory->createInstance( aService ), UNO_QUERY );
     mxInfo = xInfo;
 
-    aService = OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_DOCTEMPLATES ) );
-    uno::Reference< XDocumentTemplates > xTemplates( xFactory->createInstance( aService ), 
UNO_QUERY );
+    mxTemplates = frame::DocumentTemplates::create(xContext);
 
-    if ( xTemplates.is() )
-        mxTemplates = xTemplates;
-    else
-        return sal_False;
-
-    uno::Reference< XLocalizable > xLocalizable( xTemplates, UNO_QUERY );
+    uno::Reference< XLocalizable > xLocalizable( mxTemplates, UNO_QUERY );
 
     Sequence< Any > aCompareArg(1);
     *(aCompareArg.getArray()) <<= xLocalizable->getLocale();;
@@ -2089,7 +2083,7 @@ sal_Bool SfxDocTemplate_Impl::Construct( )
                                                            aCompareArg ),
                     UNO_QUERY );
 
-    uno::Reference < XContent > aRootContent = xTemplates->getContent();
+    uno::Reference < XContent > aRootContent = mxTemplates->getContent();
     uno::Reference < XCommandEnvironment > aCmdEnv;
 
     if ( ! aRootContent.is() )
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 3b13768..e2f137c 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -56,6 +56,7 @@
 #include <com/sun/star/uno/Exception.hpp>
 #include <com/sun/star/datatransfer/XTransferable.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/io/XStream.hpp>
@@ -455,36 +456,30 @@ sal_Bool GraphicHelper::getThumbnailReplacement_Impl( sal_Int32 nResID, const 
un
     sal_Bool bResult = sal_False;
     if ( nResID && xStream.is() )
     {
-        uno::Reference< lang::XMultiServiceFactory > xServiceManager = 
::comphelper::getProcessServiceFactory();
-        if ( xServiceManager.is() )
+        uno::Reference< uno::XComponentContext > xContext = 
::comphelper::getProcessComponentContext();
+        if ( xContext.is() )
         {
             try
             {
-                uno::Reference< graphic::XGraphicProvider > xGraphProvider(
-                    xServiceManager->createInstance(
-                        
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")) ),
-                    uno::UNO_QUERY );
-                if ( xGraphProvider.is() )
-                {
-                    ::rtl::OUString 
aURL(RTL_CONSTASCII_USTRINGPARAM("private:resource/sfx/bitmapex/"));
-                    aURL += ::rtl::OUString::valueOf( nResID );
+                uno::Reference< graphic::XGraphicProvider > 
xGraphProvider(graphic::GraphicProvider::create(xContext));
+                ::rtl::OUString 
aURL(RTL_CONSTASCII_USTRINGPARAM("private:resource/sfx/bitmapex/"));
+                aURL += ::rtl::OUString::valueOf( nResID );
 
-                    uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
-                    aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
-                    aMediaProps[0].Value <<= aURL;
+                uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
+                aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
+                aMediaProps[0].Value <<= aURL;
 
-                    uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( 
aMediaProps );
-                    if ( xGraphic.is() )
-                    {
-                        uno::Sequence< beans::PropertyValue > aStoreProps( 2 );
-                        aStoreProps[0].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStream"));
-                        aStoreProps[0].Value <<= xStream;
-                        aStoreProps[1].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MimeType"));
-                        aStoreProps[1].Value <<= 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png"));
-
-                        xGraphProvider->storeGraphic( xGraphic, aStoreProps );
-                        bResult = sal_True;
-                    }
+                uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( 
aMediaProps );
+                if ( xGraphic.is() )
+                {
+                    uno::Sequence< beans::PropertyValue > aStoreProps( 2 );
+                    aStoreProps[0].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStream"));
+                    aStoreProps[0].Value <<= xStream;
+                    aStoreProps[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MimeType"));
+                    aStoreProps[1].Value <<= 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png"));
+
+                    xGraphProvider->storeGraphic( xGraphic, aStoreProps );
+                    bResult = sal_True;
                 }
             }
             catch(const uno::Exception&)
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 34565c8..763dcea 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -42,6 +42,7 @@
 #include <com/sun/star/task/XInteractionHandler.hpp>
 #include <com/sun/star/task/XStatusIndicator.hpp>
 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/frame/DocumentTemplates.hpp>
 #include <com/sun/star/frame/XDocumentTemplates.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 #include <comphelper/processfactory.hxx>
@@ -859,12 +860,11 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
             try
             {
                 uno::Reference< frame::XStorable > xStorable( GetModel(), uno::UNO_QUERY_THROW );
-                ::rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.frame.DocumentTemplates" ) );
                 uno::Reference< frame::XDocumentTemplates > xTemplates(
-                                comphelper::getProcessServiceFactory()->createInstance( aService ),
-                                uno::UNO_QUERY_THROW );
+                                
frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) );
 
-                bOk = xTemplates->storeTemplate( aTemplateGroup, aTemplateName, xStorable );
+                if (xTemplates.is())
+                    bOk = xTemplates->storeTemplate( aTemplateGroup, aTemplateName, xStorable );
             }
             catch( uno::Exception& )
             {
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index fa15bf9..925b217 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>
@@ -177,17 +178,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"
@@ -1645,35 +1642,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 7ffbec2..92f08a2 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 67dab97..601c35f 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>
@@ -1479,11 +1480,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< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+        if( xContext.is() )
         {
-            Reference< XInterface > x( xORB->createInstance( aSN ) );
+            Reference< XInterface > x( graphic::GraphicProvider::create(xContext) );
             mxGraphicProvider.query( x );
             mxGraphicProvider = Reference< XGraphicProvider >( x, UNO_QUERY );
         }
diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx
index f1f5541..124dcdb 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 64a4ad8..f699629 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>
@@ -2072,15 +2073,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 01be8cc..c984d89 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( RTL_CONSTASCII_USTRINGPARAM( "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( RTL_CONSTASCII_USTRINGPARAM( "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 fd2f5cb..fa24f4b 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& )
     {
diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx
index a6a6d00..c4167b5 100644
--- a/vcl/source/control/throbber.cxx
+++ b/vcl/source/control/throbber.cxx
@@ -30,6 +30,8 @@
 #include "vcl/throbber.hxx"
 #include "vcl/svapp.hxx"
 
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/awt/ImageScaleMode.hpp>
 
@@ -119,8 +121,8 @@ namespace
         ::std::vector< Image > aImages;
         ENSURE_OR_RETURN( i_imageSet != Throbber::IMAGES_NONE, "lcl_loadImageSet: illegal image 
set", aImages );
 
-        const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-        const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( 
"com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW );
+        const Reference< com::sun::star::uno::XComponentContext > aContext( 
::comphelper::getProcessComponentContext() );
+        const Reference< XGraphicProvider > xGraphicProvider( 
com::sun::star::graphic::GraphicProvider::create(aContext) );
 
         ::std::vector< ::rtl::OUString > aImageURLs( Throbber::getDefaultImageURLs( i_imageSet ) );
         aImages.reserve( aImageURLs.size() );
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 4f02074..50ba4ef 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -36,6 +36,7 @@
 #include <comphelper/processfactory.hxx>
 
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/lang/XTypeProvider.hpp>
@@ -503,24 +504,19 @@ uno::Reference< graphic::XGraphic > Graphic::GetXGraphic() const
 
     if( GetType() != GRAPHIC_NONE )
     {
-        uno::Reference < lang::XMultiServiceFactory > xMSF( 
::comphelper::getProcessServiceFactory() );
+        uno::Reference < uno::XComponentContext > xContext( 
::comphelper::getProcessComponentContext() );
 
-        if( xMSF.is() )
+        if( xContext.is() )
         {
-            uno::Reference< graphic::XGraphicProvider > xProv( xMSF->createInstance(
-                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.graphic.GraphicProvider" ) ) ),
-                uno::UNO_QUERY );
+            uno::Reference< graphic::XGraphicProvider > xProv( graphic::GraphicProvider::create( 
xContext ) );
 
-            if( xProv.is() )
-            {
-                uno::Sequence< beans::PropertyValue >   aLoadProps( 1 );
-                ::rtl::OUString                         aURL( RTL_CONSTASCII_USTRINGPARAM( 
"private:memorygraphic/" ) );
+            uno::Sequence< beans::PropertyValue >   aLoadProps( 1 );
+            ::rtl::OUString                         aURL( RTL_CONSTASCII_USTRINGPARAM( 
"private:memorygraphic/" ) );
 
-                aLoadProps[ 0 ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
-                aLoadProps[ 0 ].Value <<= ( aURL += ::rtl::OUString::valueOf( reinterpret_cast< 
sal_Int64 >( this ) ) );
+            aLoadProps[ 0 ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+            aLoadProps[ 0 ].Value <<= ( aURL += ::rtl::OUString::valueOf( reinterpret_cast< 
sal_Int64 >( this ) ) );
 
-                xRet = xProv->queryGraphic( aLoadProps );
-            }
+            xRet = xProv->queryGraphic( aLoadProps );
         }
     }
 
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 71378a6..858780f 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -42,9 +42,11 @@
 #include "unotools/streamwrap.hxx"
 
 #include "comphelper/processfactory.hxx"
+#include "comphelper/componentcontext.hxx"
 
 #include "com/sun/star/beans/PropertyValue.hpp"
 #include "com/sun/star/io/XSeekable.hpp"
+#include "com/sun/star/graphic/GraphicProvider.hpp"
 #include "com/sun/star/graphic/XGraphicProvider.hpp"
 
 #include "cppuhelper/implbase1.hxx"
@@ -194,47 +196,42 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& 
i_rSiz
                 {
                     uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm );
                     uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW );
-                    uno::Reference< graphic::XGraphicProvider > xGraphicProvider( 
ImplGetSVData()->maAppData.mxMSF->createInstance(
-                        
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")) ), UNO_QUERY );
-                    if ( xGraphicProvider.is() )
+                    uno::Reference< uno::XComponentContext > xContext( 
comphelper::ComponentContext(ImplGetSVData()->maAppData.mxMSF).getUNOContext() );
+                    uno::Reference< graphic::XGraphicProvider > xGraphicProvider( 
graphic::GraphicProvider::create(xContext) );
+                    uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
+                    uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() );
+                    rtl::OUString aMimeType(RTL_CONSTASCII_USTRINGPARAM("image/jpeg"));
+                    uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 );
+                    aOutMediaProperties[0].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStream"));
+                    aOutMediaProperties[0].Value <<= xOut;
+                    aOutMediaProperties[1].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MimeType"));
+                    aOutMediaProperties[1].Value <<= aMimeType;
+                    aOutMediaProperties[2].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterData"));
+                    aOutMediaProperties[2].Value <<= aFilterData;
+                    xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
+                    xOut->flush();
+                    if ( xSeekable->getLength() > nZippedFileSize )
                     {
-                        uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
-                        uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() );
-                        rtl::OUString aMimeType(RTL_CONSTASCII_USTRINGPARAM("image/jpeg"));
-                        uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 );
-                        aOutMediaProperties[0].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStream"));
-                        aOutMediaProperties[0].Value <<= xOut;
-                        aOutMediaProperties[1].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MimeType"));
-                        aOutMediaProperties[1].Value <<= aMimeType;
-                        aOutMediaProperties[2].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterData"));
-                        aOutMediaProperties[2].Value <<= aFilterData;
-                        xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
-                        xOut->flush();
-                        if ( xSeekable->getLength() > nZippedFileSize )
-                        {
-                            bUseJPGCompression = sal_False;
-                        }
-                        else
+                        bUseJPGCompression = sal_False;
+                    }
+                    else
+                    {
+                        aStrm.Seek( STREAM_SEEK_TO_END );
+
+                        xSeekable->seek( 0 );
+                        Sequence< PropertyValue > aArgs( 1 );
+                        aArgs[ 0 ].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream"));
+                        aArgs[ 0 ].Value <<= xStream;
+                        uno::Reference< XPropertySet > xPropSet( 
xGraphicProvider->queryGraphicDescriptor( aArgs ) );
+                        if ( xPropSet.is() )
                         {
-                            aStrm.Seek( STREAM_SEEK_TO_END );
-
-                            xSeekable->seek( 0 );
-                            Sequence< PropertyValue > aArgs( 1 );
-                            aArgs[ 0 ].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream"));
-                            aArgs[ 0 ].Value <<= xStream;
-                            uno::Reference< XPropertySet > xPropSet( 
xGraphicProvider->queryGraphicDescriptor( aArgs ) );
-                            if ( xPropSet.is() )
+                            sal_Int16 nBitsPerPixel = 24;
+                            if ( xPropSet->getPropertyValue( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BitsPerPixel")) ) >>= nBitsPerPixel )
                             {
-                                sal_Int16 nBitsPerPixel = 24;
-                                if ( xPropSet->getPropertyValue( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BitsPerPixel")) ) >>= nBitsPerPixel )
-                                {
-                                    bTrueColorJPG = nBitsPerPixel != 8;
-                                }
+                                bTrueColorJPG = nBitsPerPixel != 8;
                             }
                         }
                     }
-                    else
-                        bUseJPGCompression = sal_False;
                 }
                 catch( uno::Exception& )
                 {
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 959f521..5acf50a 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -1274,12 +1275,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( 
const b
     uno::Reference< text::XTextContent > xGraphicObject;
     try
     {
-        uno::Reference< graphic::XGraphicProvider > xGraphicProvider(
-                            m_xComponentContext->getServiceManager()->createInstanceWithContext(
-                                
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")),
-                                m_xComponentContext),
-                            uno::UNO_QUERY_THROW );
-
+        uno::Reference< graphic::XGraphicProvider > xGraphicProvider( 
graphic::GraphicProvider::create(m_xComponentContext) );
         uno::Reference< graphic::XGraphic > xGraphic = xGraphicProvider->queryGraphic( 
aMediaProperties );
 
         if(xGraphic.is())
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e63c451..9804362 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -27,6 +27,7 @@
 
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/io/UnexpectedEOFException.hpp>
 #include <com/sun/star/text/XTextFrame.hpp>
@@ -642,11 +643,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
         beans::PropertyValues aMediaProperties(1);
         aMediaProperties[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
         aMediaProperties[0].Value <<= aGraphicUrl;
-        uno::Reference<graphic::XGraphicProvider> xGraphicProvider(
-                m_xContext->getServiceManager()->createInstanceWithContext(
-                    OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")),
-                    m_xContext),
-                uno::UNO_QUERY_THROW);
+        uno::Reference<graphic::XGraphicProvider> xGraphicProvider( 
graphic::GraphicProvider::create( m_xContext ) );
         uno::Reference<graphic::XGraphic> xGraphic = 
xGraphicProvider->queryGraphic(aMediaProperties);
         xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Graphic")), 
uno::Any(xGraphic));
 
diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx
index d2eece2..b96e30e 100644
--- a/xmloff/source/draw/shapeexport4.cxx
+++ b/xmloff/source/draw/shapeexport4.cxx
@@ -28,6 +28,7 @@
 
 
 #include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/embed/XTransactedObject.hpp>
@@ -70,6 +71,7 @@
 
 #include "xmloff/xmlnmspe.hxx"
 #include "XMLBase64Export.hxx"
+#include <comphelper/componentcontext.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -1221,7 +1223,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< 
drawing::XShape
                     xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, 
::embed::ElementModes::READWRITE ), UNO_QUERY_THROW );
                 }
 
-                Reference< graphic::XGraphicProvider > xProvider( xSM->createInstance( OUString( 
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
+                Reference< graphic::XGraphicProvider > xProvider( 
graphic::GraphicProvider::create(comphelper::ComponentContext(xSM).getUNOContext()) );
                 Sequence< beans::PropertyValue > aArgs( 2 );
                 aArgs[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MimeType" ) );
                 aArgs[ 0 ].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "image/x-vclgraphic" ) 
);

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.