[Libreoffice-commits] .: 3 commits - basctl/source basic/source comphelper/source connectivity/Library_postgresql-sdbc.mk connectivity/source cui/source desktop/inc desktop/Library_offacc.mk desktop/source embeddedobj/source extensions/Executable_nsplugin.mk extensions/source fileaccess/source filter/source framework/inc framework/source linguistic/source oox/source reportdesign/source scripting/Library_protocolhandler.mk scripting/source sc/source sdext/source sd/source sfx2/source solenv/gbuild svl/source svtools/Library_hatchwindowfactory.mk svtools/source svx/source sw/source ucb/Library_ucphier1.mk ucb/source unotools/source vbahelper/source vcl/aqua xmlhelp/source xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Sep 29 10:25:05 PDT 2012


 basctl/source/basicide/baside3.cxx                          |   17 --
 basctl/source/basicide/basides3.cxx                         |    6 
 basctl/source/basicide/moduldlg.cxx                         |    7 
 basctl/source/basicide/scriptdocument.cxx                   |    5 
 basctl/source/dlged/dlged.cxx                               |   12 -
 basctl/source/dlged/propbrw.cxx                             |    4 
 basic/source/classes/eventatt.cxx                           |   33 +---
 basic/source/classes/sbunoobj.cxx                           |   96 +++---------
 basic/source/classes/sbxmod.cxx                             |   10 -
 basic/source/uno/dlgcont.cxx                                |   28 ---
 basic/source/uno/namecont.cxx                               |   55 ++----
 comphelper/source/misc/componentcontext.cxx                 |   23 --
 connectivity/Library_postgresql-sdbc.mk                     |    1 
 connectivity/source/drivers/postgresql/pq_driver.cxx        |   23 --
 connectivity/source/resource/sharedresources.cxx            |    9 -
 cui/source/customize/cfg.cxx                                |   10 -
 cui/source/customize/cfgutil.cxx                            |    6 
 cui/source/dialogs/scriptdlg.cxx                            |    9 -
 cui/source/options/treeopt.cxx                              |   11 -
 desktop/Library_offacc.mk                                   |    1 
 desktop/inc/app.hxx                                         |    2 
 desktop/source/app/app.cxx                                  |    5 
 desktop/source/app/appinit.cxx                              |   19 --
 desktop/source/offacc/acceptor.cxx                          |   18 --
 embeddedobj/source/general/docholder.cxx                    |   11 -
 extensions/Executable_nsplugin.mk                           |    1 
 extensions/source/nsplugin/source/so_instance.cxx           |    5 
 fileaccess/source/FileAccess.cxx                            |   12 -
 filter/source/xsltfilter/XSLTFilter.cxx                     |    9 -
 framework/inc/macros/xserviceinfo.hxx                       |    8 -
 framework/source/fwe/classes/addonsoptions.cxx              |   11 -
 framework/source/fwe/xml/menudocumenthandler.cxx            |   14 -
 framework/source/layoutmanager/toolbarlayoutmanager.cxx     |    1 
 framework/source/lomenubar/FrameHelper.cxx                  |   10 -
 framework/source/uielement/addonstoolbarmanager.cxx         |   10 -
 framework/source/uielement/imagebuttontoolbarcontroller.cxx |   13 -
 framework/source/uielement/menubarmanager.cxx               |    8 -
 framework/source/uielement/popupmenucontroller.cxx          |    4 
 framework/source/uielement/statusbarmanager.cxx             |    9 -
 framework/source/uielement/toolbarmanager.cxx               |    7 
 linguistic/source/lngsvcmgr.cxx                             |   24 +--
 oox/source/core/xmlfilterbase.cxx                           |   26 ---
 oox/source/export/chartexport.cxx                           |   28 ---
 reportdesign/source/ui/report/propbrw.cxx                   |   10 -
 sc/source/core/data/dpobject.cxx                            |    8 -
 sc/source/core/tool/addincol.cxx                            |   18 --
 sc/source/ui/docshell/docsh.cxx                             |   50 +++---
 sc/source/ui/miscdlgs/solverutil.cxx                        |   33 +---
 sc/source/ui/vba/excelvbahelper.cxx                         |    6 
 sc/source/ui/vba/vbahelper.cxx                              |   15 -
 sc/source/ui/vba/vbaworksheet.cxx                           |    6 
 scripting/Library_protocolhandler.mk                        |    1 
 scripting/source/protocolhandler/scripthandler.cxx          |    9 -
 scripting/source/vbaevents/eventhelper.cxx                  |   12 -
 sd/source/core/CustomAnimationPreset.cxx                    |   20 --
 sd/source/core/TransitionPreset.cxx                         |   22 +-
 sdext/source/pdfimport/misc/pwdinteract.cxx                 |   74 ++++-----
 sfx2/source/dialog/dockwin.cxx                              |   15 -
 sfx2/source/doc/doctemplates.cxx                            |   51 +-----
 solenv/gbuild/gbuild.mk                                     |    2 
 svl/source/misc/urihelper.cxx                               |   13 -
 svtools/Library_hatchwindowfactory.mk                       |    1 
 svtools/source/hatchwindow/documentcloser.cxx               |   17 --
 svtools/source/misc/templatefoldercache.cxx                 |   36 ----
 svx/source/form/fmPropBrw.cxx                               |    4 
 sw/source/filter/ww8/ww8toolbar.cxx                         |    4 
 sw/source/ui/config/mailconfigpage.cxx                      |    5 
 sw/source/ui/dbui/mailmergehelper.cxx                       |   16 --
 sw/source/ui/inc/mailmergehelper.hxx                        |   20 --
 ucb/Library_ucphier1.mk                                     |    1 
 ucb/source/core/ucbcmds.cxx                                 |    9 -
 ucb/source/ucp/hierarchy/hierarchyprovider.cxx              |   28 ---
 ucb/source/ucp/webdav/webdavcontent.cxx                     |    9 -
 unotools/source/config/lingucfg.cxx                         |   13 -
 vbahelper/source/vbahelper/vbahelper.cxx                    |   12 -
 vcl/aqua/source/app/salinst.cxx                             |   22 --
 xmlhelp/source/cxxhelp/provider/databases.cxx               |   25 ---
 xmlhelp/source/cxxhelp/provider/provider.cxx                |   13 -
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx            |   18 --
 xmloff/source/chart/SchXMLExport.cxx                        |   31 ---
 xmloff/source/chart/SchXMLImport.cxx                        |   18 --
 xmloff/source/chart/SchXMLTools.cxx                         |   27 ---
 82 files changed, 375 insertions(+), 940 deletions(-)

New commits:
commit 34061bf6d4fe8b80f46a97b8fbeddc18247e8bf7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Sep 29 18:16:26 2012 +0200

    gb_PYTHON_PRECOMMAND is only defined after gb_PYTHON
    
    ...now that fa140733eeaf59030caa3115be4de11fb210b5b7 "fix dep on internal ucpp"
    moved things around, so use "=" instead of ":=" here.  (And I'm not sure the
    other places need ":=" either.)
    
    Change-Id: Id71570c4a55ab08ca339801dec78ef06cfd80ef0

diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index 4afc095..a8f76bf 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -220,7 +220,7 @@ else ifeq ($(DISABLE_PYTHON),TRUE)
 gb_PYTHON := python
 else
 gb_PYTHONTARGET := $(call gb_Executable_get_target_for_build,python)
-gb_PYTHON := $(gb_PYTHON_PRECOMMAND) $(gb_PYTHONTARGET)
+gb_PYTHON = $(gb_PYTHON_PRECOMMAND) $(gb_PYTHONTARGET)
 endif
 
 ifneq (,$(SYSTEM_UCPP))
commit c2ca6fabd1afc3fc07001721c2069d3c8db7000a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Sep 29 17:20:22 2012 +0200

    Use comphelper::getComponentContext
    
    ...and some further clean up.
    
    Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9

diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 6197043..e5fc1ce 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -724,10 +724,7 @@ bool DialogWindow::SaveDialog()
 
         // export dialog model to xml
         Reference< container::XNameContainer > xDialogModel = GetDialog();
-        Reference< XComponentContext > xContext;
-        Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-        OSL_ASSERT( xProps.is() );
-        OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+        Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
         Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
         Reference< XInputStream > xInput( xISP->createInputStream() );
 
@@ -1002,10 +999,8 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri
             if( xSFI->exists( aCurPath ) )
                 xInput = xSFI->openFileRead( aCurPath );
 
-            Reference< XComponentContext > xContext;
-            Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
-            OSL_ASSERT( xProps.is() );
-            OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+            Reference< XComponentContext > xContext(
+                comphelper::getComponentContext( xMSF ) );
             ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
 
             ::rtl::OUString aXmlDlgName;
@@ -1327,10 +1322,8 @@ void DialogWindow::StoreData()
 
                 if( xDialogModel.is() )
                 {
-                    Reference< XComponentContext > xContext;
-                    Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-                    OSL_ASSERT( xProps.is() );
-                    OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+                    Reference< XComponentContext > xContext(
+                        comphelper::getProcessComponentContext() );
                     Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
                     xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
                 }
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index 5f6d86b..d642a2a 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -81,10 +81,8 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const ::rtl:
                 Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
                     ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
                 Reference< XInputStream > xInput( xISP->createInputStream() );
-                Reference< XComponentContext > xContext;
-                Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
-                OSL_ASSERT( xProps.is() );
-                OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+                Reference< XComponentContext > xContext(
+                    comphelper::getComponentContext( xMSF ) );
                 ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
                 LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
 
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 0d0d867..4a8cdb5 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -28,7 +28,6 @@
 #include "iderdll.hxx"
 
 #include <basic/basmgr.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/script/XLibraryContainerPassword.hpp>
 #include <comphelper/processfactory.hxx>
 #include <sfx2/app.hxx>
@@ -288,10 +287,8 @@ void Shell::CopyDialogResources(
     Reference< container::XNameContainer > xDialogModel = Reference< container::XNameContainer >( xMSF->createInstance
         ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
     Reference< io::XInputStream > xInput( io_xISP->createInputStream() );
-    Reference< XComponentContext > xContext;
-    Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
-    OSL_ASSERT( xProps.is() );
-    OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+    Reference< XComponentContext > xContext(
+        comphelper::getComponentContext( xMSF ) );
     ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.isDocument() ? rSourceDoc.getDocument() : Reference< frame::XModel >() );
 
     if( xDialogModel.is() )
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index dfede33..cdf91fb 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -960,9 +960,8 @@ namespace basctl
                 {
                     ::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) );
                     aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
-                    Reference< XComponentContext > xContext;
-                    Reference< XPropertySet > xProps( xMSF, UNO_QUERY_THROW );
-                    xContext.set( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW );
+                    Reference< XComponentContext > xContext(
+                        comphelper::getComponentContext( xMSF ) );
                     Reference< XMacroExpander > xMacroExpander(
                         xContext->getValueByName(
                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" )) ),
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 9dfb431..422a9d8 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -742,10 +742,8 @@ void DlgEditor::Copy()
     }
 
     // export clipboard dialog model to xml
-    Reference< XComponentContext > xContext;
-    Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-    OSL_ASSERT( xProps.is() );
-    OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+    Reference< XComponentContext > xContext(
+        comphelper::getProcessComponentContext() );
     Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
     Reference< XInputStream > xStream( xISP->createInputStream() );
     Sequence< sal_Int8 > DialogModelBytes;
@@ -920,10 +918,8 @@ void DlgEditor::Paste()
 
                 if ( xClipDialogModel.is() )
                 {
-                    Reference< XComponentContext > xContext;
-                    Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
-                    OSL_ASSERT( xProps.is() );
-                    OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+                    Reference< XComponentContext > xContext(
+                        comphelper::getComponentContext( xMSF ) );
                     ::xmlscript::importDialogModel( ::xmlscript::createInputStream( rtl::ByteSequence(DialogModelBytes.getArray(), DialogModelBytes.getLength()) ) , xClipDialogModel, xContext, m_xDocument );
                 }
 
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
index 11529c2..986a69b 100644
--- a/basctl/source/dlged/propbrw.cxx
+++ b/basctl/source/dlged/propbrw.cxx
@@ -127,10 +127,8 @@ void PropBrw::ImplReCreateController()
 
     try
     {
-        Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW );
         Reference< XComponentContext > xOwnContext(
-            xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
-            UNO_QUERY_THROW );
+            comphelper::getComponentContext( m_xORB ) );
 
         // a ComponentContext for the
         ::cppu::ContextEntry_Init aHandlerContextInfo[] =
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 1c111e2..79e2c3b 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -94,23 +94,18 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere
             }
             else
             {
-                Reference< XComponentContext > xContext;
-                Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-                OSL_ASSERT( xProps.is() );
-                OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-                if ( xContext.is() )
-                {
-                    Reference< provider::XScriptProviderFactory > xFactory(
-                        xContext->getValueByName(
+                Reference< XComponentContext > xContext(
+                    comphelper::getProcessComponentContext() );
+                Reference< provider::XScriptProviderFactory > xFactory(
+                    xContext->getValueByName(
                         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory")) ),
-                        UNO_QUERY );
-                    OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
-                    if ( xFactory.is() )
-                    {
-                        Any aCtx;
-                        aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"));
-                        xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
-                    }
+                    UNO_QUERY );
+                OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
+                if ( xFactory.is() )
+                {
+                    Any aCtx;
+                    aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"));
+                    xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
                 }
             }
 
@@ -469,10 +464,8 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
     if( !xISP.is() )
         return;
 
-    Reference< XComponentContext > xContext;
-    Reference< XPropertySet > xProps( xMSF, UNO_QUERY );
-    OSL_ASSERT( xProps.is() );
-    OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+    Reference< XComponentContext > xContext(
+        comphelper::getComponentContext( xMSF ) );
 
     // Import the DialogModel
     Reference< XInputStream > xInput( xISP->createInputStream() );
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index c792634..6735dfe 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -162,26 +162,6 @@ void SetSbUnoObjectDfltPropName( SbxObject* pObj )
     }
 }
 
-Reference< XComponentContext > getComponentContext_Impl( void )
-{
-    static Reference< XComponentContext > xContext;
-
-    // Do we have already CoreReflection; if not obtain it
-    if( !xContext.is() )
-    {
-        Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
-        Reference< XPropertySet > xProps( xFactory, UNO_QUERY );
-        OSL_ASSERT( xProps.is() );
-        if (xProps.is())
-        {
-            xProps->getPropertyValue(
-                ::rtl::OUString( "DefaultContext" ) ) >>= xContext;
-            OSL_ASSERT( xContext.is() );
-        }
-    }
-    return xContext;
-}
-
 // save CoreReflection statically
 Reference< XIdlReflection > getCoreReflection_Impl( void )
 {
@@ -190,7 +170,8 @@ Reference< XIdlReflection > getCoreReflection_Impl( void )
     // Do we have already CoreReflection; if not obtain it
     if( !xCoreReflection.is() )
     {
-        Reference< XComponentContext > xContext = getComponentContext_Impl();
+        Reference< XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
         if( xContext.is() )
         {
             xContext->getValueByName(
@@ -233,7 +214,8 @@ Reference< XHierarchicalNameAccess > getTypeProvider_Impl( void )
     // Do we have already CoreReflection; if not obtain it
     if( !xAccess.is() )
     {
-        Reference< XComponentContext > xContext = getComponentContext_Impl();
+        Reference< XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
         if( xContext.is() )
         {
             xContext->getValueByName(
@@ -260,7 +242,8 @@ Reference< XTypeConverter > getTypeConverter_Impl( void )
     // Do we have already CoreReflection; if not obtain it
     if( !xTypeConverter.is() )
     {
-        Reference< XComponentContext > xContext = getComponentContext_Impl();
+        Reference< XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
         if( xContext.is() )
         {
             xTypeConverter = Converter::create(xContext);
@@ -287,7 +270,8 @@ SbUnoObject* createOLEObject_Impl( const ::rtl::OUString& aType )
     {
         bNeedsInit = false;
 
-        Reference< XComponentContext > xContext = getComponentContext_Impl();
+        Reference< XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
         if( xContext.is() )
         {
             Reference<XMultiComponentFactory> xSMgr = xContext->getServiceManager();
@@ -3694,33 +3678,24 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
                 }
 
                 // "Call" ctor using createInstanceWithArgumentsAndContext
-                Reference < XComponentContext > xContext;
-                if( xFirstParamContext.is() )
-                {
-                    xContext = xFirstParamContext;
-                }
-                else
-                {
-                    Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-                    xContext.set( xProps->getPropertyValue( rtl::OUString( "DefaultContext" ) ), UNO_QUERY_THROW );
-                }
+                Reference < XComponentContext > xContext(
+                    xFirstParamContext.is()
+                    ? xFirstParamContext
+                    : comphelper::getProcessComponentContext() );
                 Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
 
                 Any aRetAny;
-                if( xServiceMgr.is() )
+                ::rtl::OUString aServiceName = GetName();
+                Reference < XInterface > xRet;
+                try
                 {
-                    ::rtl::OUString aServiceName = GetName();
-                    Reference < XInterface > xRet;
-                    try
-                    {
-                        xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext );
-                    }
-                    catch( const Exception& )
-                    {
-                        implHandleAnyException( ::cppu::getCaughtException() );
-                    }
-                    aRetAny <<= xRet;
+                    xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext );
+                }
+                catch( const Exception& )
+                {
+                    implHandleAnyException( ::cppu::getCaughtException() );
                 }
+                aRetAny <<= xRet;
                 unoToSbxValue( pVar, aRetAny );
 
                 // Copy back out parameters?
@@ -3835,8 +3810,7 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
 
         if( !xContextToUse.is() )
         {
-            Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-            xContextToUse.set( xProps->getPropertyValue( rtl::OUString( "DefaultContext" ) ), UNO_QUERY_THROW );
+            xContextToUse = comphelper::getProcessComponentContext();
             --nAllowedParamCount;
         }
 
@@ -4205,22 +4179,12 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWr
 
     SbxVariableRef refVar = rPar.Get(0);
 
-    Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
-    Reference< XPropertySet> xPSMPropertySet( xFactory, UNO_QUERY );
-    if( xPSMPropertySet.is() )
-    {
-        Any aContextAny = xPSMPropertySet->getPropertyValue(
-            ::rtl::OUString( "DefaultContext" ) );
+    Any aContextAny( comphelper::getProcessComponentContext() );
 
-        SbUnoObjectRef xUnoObj = new SbUnoObject
-            ( ::rtl::OUString( "DefaultContext" ),
-              aContextAny );
-        refVar->PutObject( (SbUnoObject*)xUnoObj );
-    }
-    else
-    {
-        refVar->PutObject( NULL );
-    }
+    SbUnoObjectRef xUnoObj = new SbUnoObject
+        ( ::rtl::OUString( "DefaultContext" ),
+          aContextAny );
+    refVar->PutObject( (SbUnoObject*)xUnoObj );
 }
 
 //========================================================================
@@ -4544,7 +4508,8 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
 {
     Reference< XInterface > xRet;
 
-    Reference< XComponentContext > xContext = getComponentContext_Impl();
+    Reference< XComponentContext > xContext(
+        comphelper::getProcessComponentContext() );
     Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
 
     Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPrefix, xScopeObj );
@@ -4665,7 +4630,8 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
     // For now: Take first interface that allows to instantiate COM wrapper
     // TODO: Check if support for multiple interfaces is needed
 
-    Reference< XComponentContext > xContext = getComponentContext_Impl();
+    Reference< XComponentContext > xContext(
+        comphelper::getProcessComponentContext() );
     Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
     Reference< XSingleServiceFactory > xComImplementsFactory
     (
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 3257a4a..759b9b2 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -139,7 +139,6 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
     {
         if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
         {
-            Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
             // Use proxy factory service to create aggregatable proxy.
             SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pMod->GetObject() );
             Reference< XInterface > xIf;
@@ -157,11 +156,10 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
             {
                 try
                 {
-                    Reference< XMultiComponentFactory > xMFac( xFactory, UNO_QUERY_THROW );
-                    Reference< XPropertySet> xPSMPropertySet( xMFac, UNO_QUERY_THROW );
-                    Reference< XComponentContext >  xCtx;
-                    xPSMPropertySet->getPropertyValue(
-                    String( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xCtx;
+                    Reference< XComponentContext > xCtx(
+                        comphelper::getProcessComponentContext() );
+                    Reference< XMultiComponentFactory > xMFac(
+                        xCtx->getServiceManager() );
                     Reference< XProxyFactory > xProxyFac( xMFac->createInstanceWithContext( rtl::OUString( "com.sun.star.reflection.ProxyFactory"  ), xCtx  ), UNO_QUERY_THROW );
                     m_xAggProxy = xProxyFac->createProxy( xIf );
                 }
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 3f1101c..2cfe035 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -24,7 +24,6 @@
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
@@ -117,23 +116,12 @@ bool SAL_CALL SfxDialogLibraryContainer::isLibraryElementValid( Any aElement ) c
 bool writeOasis2OOoLibraryElement(
     Reference< XInputStream > xInput, Reference< XOutputStream > xOutput )
 {
-    Reference< XMultiServiceFactory > xMSF(
-        comphelper::getProcessServiceFactory() );
-
-    Reference< XComponentContext > xContext;
-    Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
-    OSL_ASSERT( xProps.is() );
-    OSL_VERIFY( xProps->getPropertyValue(
-        OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+    Reference< XComponentContext > xContext(
+        comphelper::getProcessComponentContext() );
 
     Reference< lang::XMultiComponentFactory > xSMgr(
         xContext->getServiceManager() );
 
-    if (! xSMgr.is())
-    {
-        return sal_False;
-    }
-
     Reference< xml::sax::XParser > xParser(
         xSMgr->createInstanceWithContext(
             OUString( RTL_CONSTASCII_USTRINGPARAM(
@@ -267,10 +255,8 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
                     Reference< io::XInputStream > xInput( xISP->createInputStream() );
                     Reference< XNameContainer > xDialogModel( mxMSF->createInstance
                         ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
-                    Reference< XComponentContext > xContext;
-                    Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY );
-                    OSL_ASSERT( xProps.is() );
-                    OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+                    Reference< XComponentContext > xContext(
+                        comphelper::getComponentContext( mxMSF ) );
                     ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
                     std::vector< rtl::OUString > vEmbeddedImageURLs;
                     GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ),  vEmbeddedImageURLs );
@@ -351,10 +337,8 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
     if( !xInput.is() )
         return aRetAny;
 
-    Reference< XComponentContext > xContext;
-    Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY );
-    OSL_ASSERT( xProps.is() );
-    OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+    Reference< XComponentContext > xContext(
+        comphelper::getComponentContext( mxMSF ) );
 
     InputSource source;
     source.aInputStream = xInput;
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index f8d946e..77ced57 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2725,29 +2725,20 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
     {
         if( !mxMacroExpander.is() )
         {
-            Reference< XPropertySet > xProps( mxMSF, UNO_QUERY_THROW );
-            if( xProps.is() )
+            Reference< XComponentContext > xContext(
+                comphelper::getComponentContext( mxMSF ) );
+            Reference< util::XMacroExpander > xExpander;
+            xContext->getValueByName(
+                OUSTR("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander;
+            if(! xExpander.is())
             {
-                Reference< XComponentContext > xContext;
-                xProps->getPropertyValue(
-                    OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext;
-                SAL_WARN_IF(!xContext.is(), "basic", "no DefaultContext");
-                if( xContext.is() )
-                {
-                    Reference< util::XMacroExpander > xExpander;
-                    xContext->getValueByName(
-                        OUSTR("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander;
-                    if(! xExpander.is())
-                    {
-                        throw uno::DeploymentException(
-                            OUSTR("no macro expander singleton available!"), Reference< XInterface >() );
-                    }
-                    MutexGuard guard( Mutex::getGlobalMutex() );
-                    if( !mxMacroExpander.is() )
-                    {
-                        mxMacroExpander = xExpander;
-                    }
-                }
+                throw uno::DeploymentException(
+                    OUSTR("no macro expander singleton available!"), Reference< XInterface >() );
+            }
+            MutexGuard guard( Mutex::getGlobalMutex() );
+            if( !mxMacroExpander.is() )
+            {
+                mxMacroExpander = xExpander;
             }
         }
 
@@ -3172,7 +3163,8 @@ void SAL_CALL SfxLibrary::removeChangesListener( const Reference< XChangesListen
 #define sDialogLibMediaType "application/vnd.sun.star.dialog-library"
 
 ScriptExtensionIterator::ScriptExtensionIterator( void )
-    : m_eState( USER_EXTENSIONS )
+    : m_xContext( comphelper::getProcessComponentContext() )
+    , m_eState( USER_EXTENSIONS )
     , m_bUserPackagesLoaded( false )
     , m_bSharedPackagesLoaded( false )
     , m_bBundledPackagesLoaded( false )
@@ -3180,22 +3172,7 @@ ScriptExtensionIterator::ScriptExtensionIterator( void )
     , m_iSharedPackage( 0 )
        , m_iBundledPackage( 0 )
     , m_pScriptSubPackageIterator( NULL )
-{
-    Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
-    Reference< XPropertySet > xProps( xFactory, UNO_QUERY_THROW );
-    if (xProps.is())
-    {
-        xProps->getPropertyValue(
-            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= m_xContext;
-        SAL_WARN_IF(!m_xContext.is(), "basic", "no DefaultContext");
-    }
-    if( !m_xContext.is() )
-    {
-        throw RuntimeException(
-            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptExtensionIterator::init(), no XComponentContext")),
-            Reference< XInterface >() );
-    }
-}
+{}
 
 rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDialogLib )
 {
diff --git a/comphelper/source/misc/componentcontext.cxx b/comphelper/source/misc/componentcontext.cxx
index df7db6a..8ec65d3 100644
--- a/comphelper/source/misc/componentcontext.cxx
+++ b/comphelper/source/misc/componentcontext.cxx
@@ -18,7 +18,7 @@
  */
 
 #include <comphelper/componentcontext.hxx>
-
+#include <comphelper/processfactory.hxx>
 #include <com/sun/star/lang/NullPointerException.hpp>
 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -53,8 +53,6 @@ namespace comphelper
     {
         if ( m_xContext.is() )
             m_xORB = m_xContext->getServiceManager();
-        if ( !m_xORB.is() )
-            throw NullPointerException();
     }
 
     //------------------------------------------------------------------------
@@ -63,23 +61,8 @@ namespace comphelper
         if ( !_rxLegacyFactory.is() )
             throw NullPointerException();
 
-        try
-        {
-            Reference< XPropertySet > xFactoryProperties( _rxLegacyFactory, UNO_QUERY_THROW );
-            m_xContext = Reference< XComponentContext >(
-                xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
-                UNO_QUERY );
-        }
-        catch( const RuntimeException& ) { throw; }
-        catch( const Exception& )
-        {
-            throw RuntimeException();
-        }
-
-        if ( m_xContext.is() )
-            m_xORB = m_xContext->getServiceManager();
-        if ( !m_xORB.is() )
-            throw NullPointerException();
+        m_xContext = comphelper::getComponentContext( _rxLegacyFactory );
+        m_xORB = m_xContext->getServiceManager();
     }
 
     //------------------------------------------------------------------------
diff --git a/connectivity/Library_postgresql-sdbc.mk b/connectivity/Library_postgresql-sdbc.mk
index 1a9f8eb..4ce53d8 100644
--- a/connectivity/Library_postgresql-sdbc.mk
+++ b/connectivity/Library_postgresql-sdbc.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Library_add_defs,postgresql-sdbc,\
 $(eval $(call gb_Library_use_sdk_api,postgresql-sdbc))
 
 $(eval $(call gb_Library_use_libraries,postgresql-sdbc,\
+	comphelper \
 	cppu \
 	cppuhelper \
 	sal \
diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx
index ed8480c..5a8dd9c 100644
--- a/connectivity/source/drivers/postgresql/pq_driver.cxx
+++ b/connectivity/source/drivers/postgresql/pq_driver.cxx
@@ -57,13 +57,12 @@
 
 #include <stdio.h>
 
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/compbase1.hxx>
 #include <cppuhelper/compbase2.hxx>
 #include <cppuhelper/implementationentry.hxx>
 
-#include <com/sun/star/beans/XPropertySet.hpp>
-
 #include "pq_driver.hxx"
 
 using rtl::OUString;
@@ -86,7 +85,6 @@ using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::Any;
 
 using com::sun::star::beans::PropertyValue;
-using com::sun::star::beans::XPropertySet;
 
 using com::sun::star::sdbc::XConnection;
 using com::sun::star::sdbc::SQLException;
@@ -352,26 +350,17 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
     // XSingleComponentFactory interface ...
     void * pRet = 0;
     Reference< XSingleComponentFactory > xFactory;
-    Reference< XInterface > xSmgr( (XInterface * ) pServiceManager );
+    Reference< com::sun::star::lang::XMultiServiceFactory > xSmgr(
+        static_cast< XInterface * >(pServiceManager),
+        com::sun::star::uno::UNO_QUERY_THROW );
 
     for( sal_Int32 i = 0 ; g_entries[i].create ; i ++ )
     {
         OUString implName = g_entries[i].getImplementationName();
         if( 0 == implName.compareToAscii( pImplName ) )
         {
-            Reference< XComponentContext > defaultContext;
-            Reference< XPropertySet > propSet( xSmgr, UNO_QUERY );
-            if( propSet.is() )
-            {
-                try
-                {
-                    propSet->getPropertyValue( ASCII_STR( "DefaultContext" ) ) >>= defaultContext;
-                }
-                catch( com::sun::star::uno::Exception & )
-                {
-                    // if there is no default context, ignore it
-                }
-            }
+            Reference< XComponentContext > defaultContext(
+                comphelper::getComponentContext( xSmgr ) );
             xFactory = new pq_sdbc_driver::OOneInstanceComponentFactory(
                 implName,
                 g_entries[i].create,
diff --git a/connectivity/source/resource/sharedresources.cxx b/connectivity/source/resource/sharedresources.cxx
index 2465910..9028078 100644
--- a/connectivity/source/resource/sharedresources.cxx
+++ b/connectivity/source/resource/sharedresources.cxx
@@ -22,7 +22,6 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/officeresourcebundle.hxx>
 
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <tools/diagnose_ex.h>
@@ -35,8 +34,6 @@ namespace connectivity
 
     /** === begin UNO using === **/
     using ::com::sun::star::uno::Reference;
-    using ::com::sun::star::beans::XPropertySet;
-    using ::com::sun::star::uno::UNO_QUERY_THROW;
     using ::com::sun::star::uno::XComponentContext;
     using ::com::sun::star::uno::Exception;
     /** === end UNO using === **/
@@ -82,12 +79,8 @@ namespace connectivity
     {
         try
         {
-            Reference< XPropertySet > xFactoryProps(
-                ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
             Reference< XComponentContext > xContext(
-                xFactoryProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
-                UNO_QUERY_THROW
-            );
+                comphelper::getProcessComponentContext() );
             m_pResourceBundle.reset( new ::comphelper::OfficeResourceBundle( xContext, "cnr" ) );
         }
         catch( const Exception& )
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index f7dc04e..5b9b317 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -888,15 +888,9 @@ SaveInData::SaveInData(
             bDocConfig( isDocConfig ),
             bReadOnly( sal_False ),
             m_xCfgMgr( xCfgMgr ),
-            m_xParentCfgMgr( xParentCfgMgr )
+            m_xParentCfgMgr( xParentCfgMgr ),
+            m_xComponentContext( comphelper::getProcessComponentContext() )
 {
-    uno::Reference< beans::XPropertySet > xProps(
-        ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-
-    xProps->getPropertyValue(
-        OUString("DefaultContext" ))
-            >>= m_xComponentContext;
-
     m_aSeparatorSeq.realloc( 1 );
     m_aSeparatorSeq[0].Name  = OUString( ITEM_DESCRIPTOR_TYPE  );
     m_aSeparatorSeq[0].Value <<= css::ui::ItemType::SEPARATOR_LINE;
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 405c6fa..4d2be18 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -596,12 +596,10 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
     OSL_TRACE("** ** About to initialise SF Scripts");
     // Add Scripting Framework entries
     Reference< browse::XBrowseNode > rootNode;
-    Reference< XComponentContext > xCtx;
+    Reference< XComponentContext > xCtx(
+        comphelper::getProcessComponentContext() );
     try
     {
-        Reference < beans::XPropertySet > xProps(
-            ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-        xCtx.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
         Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName(
            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory") ) ), UNO_QUERY_THROW );
         rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 2c7b154..e91e53f 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -164,7 +164,8 @@ void SFTreeListBox::Init( const ::rtl::OUString& language  )
     deleteAllTree();
 
     Reference< browse::XBrowseNode > rootNode;
-    Reference< XComponentContext > xCtx;
+    Reference< XComponentContext > xCtx(
+        comphelper::getProcessComponentContext() );
 
     Sequence< Reference< browse::XBrowseNode > > children;
 
@@ -175,12 +176,6 @@ void SFTreeListBox::Init( const ::rtl::OUString& language  )
 
     try
     {
-        Reference < beans::XPropertySet > xProps(
-            ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-
-        xCtx.set( xProps->getPropertyValue( rtl::OUString(
-            RTL_CONSTASCII_USTRINGPARAM("DefaultContext" ))), UNO_QUERY_THROW );
-
         Reference< browse::XBrowseNodeFactory > xFac(
             xCtx->getValueByName( singleton ), UNO_QUERY_THROW );
 
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 19c6a50..5718959 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -835,13 +835,10 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
 
         if ( bMustExpand )
         {
-            Reference< XComponentContext > xContext;
-            Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-            xProps->getPropertyValue(
-                ::rtl::OUString( "DefaultContext"  ) ) >>= xContext;
-            if ( xContext.is() )
-                m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >(
-                    xContext->getValueByName( ::rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander"  ) ), UNO_QUERY );
+            Reference< XComponentContext > xContext(
+                comphelper::getProcessComponentContext() );
+            m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >(
+                xContext->getValueByName( ::rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander"  ) ), UNO_QUERY );
         }
 
         SvLBoxEntry* pTemp = aTreeLB.First();
diff --git a/desktop/Library_offacc.mk b/desktop/Library_offacc.mk
index 8272b4d..6e3c845 100644
--- a/desktop/Library_offacc.mk
+++ b/desktop/Library_offacc.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_Library_set_include,offacc,\
 $(eval $(call gb_Library_use_sdk_api,offacc))
 
 $(eval $(call gb_Library_use_libraries,offacc,\
+    comphelper \
     cppu \
     cppuhelper \
     sal \
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 7b8359d..4f56c32 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -144,8 +144,6 @@ class Desktop : public Application
         void                    RegisterServices();
         void                    DeregisterServices();
 
-        void                    DestroyApplicationServiceManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr );
-
         void                    CreateTemporaryDirectory();
         void                    RemoveTemporaryDirectory();
 
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 4741ce6..cff9f8e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -665,8 +665,9 @@ void Desktop::DeInit()
 
         // close splashscreen if it's still open
         CloseSplashScreen();
-        Reference<XMultiServiceFactory> xXMultiServiceFactory(::comphelper::getProcessServiceFactory());
-        DestroyApplicationServiceManager( xXMultiServiceFactory );
+        Reference< XComponent >(
+            comphelper::getProcessComponentContext(), UNO_QUERY_THROW )->
+            dispose();
         // nobody should get a destroyd service factory...
         ::comphelper::setProcessServiceFactory( NULL );
 
diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx
index 367b77a..157621a 100644
--- a/desktop/source/app/appinit.cxx
+++ b/desktop/source/app/appinit.cxx
@@ -128,25 +128,6 @@ void Desktop::InitApplicationServiceManager()
     comphelper::setProcessServiceFactory(sm);
 }
 
-void Desktop::DestroyApplicationServiceManager( Reference< XMultiServiceFactory >& xSMgr )
-{
-    Reference< XPropertySet > xProps( xSMgr, UNO_QUERY );
-    if ( xProps.is() )
-    {
-        try
-        {
-            Reference< XComponent > xComp;
-            if (xProps->getPropertyValue( OUString( "DefaultContext" )) >>= xComp )
-            {
-                xComp->dispose();
-            }
-        }
-        catch (const UnknownPropertyException&)
-        {
-        }
-    }
-}
-
 void Desktop::RegisterServices()
 {
     if( !m_bServicesRegistered )
diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx
index 2fd0da3..4510f65 100644
--- a/desktop/source/offacc/acceptor.cxx
+++ b/desktop/source/offacc/acceptor.cxx
@@ -31,10 +31,9 @@
 #include <unotools/bootstrap.hxx>
 #include <tools/stream.hxx>
 #include <vcl/svapp.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/bridge/BridgeFactory.hpp>
 #include <com/sun/star/uno/XNamingService.hpp>
-
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/factory.hxx>
 
 namespace desktop
@@ -45,15 +44,6 @@ extern "C" void workerfunc (void * acc)
     ((Acceptor*)acc)->run();
 }
 
-static Reference<XComponentContext> getComponentContext( const Reference<XMultiServiceFactory>& rFactory)
-{
-    Reference<XComponentContext> rContext;
-    Reference< XPropertySet > rPropSet( rFactory, UNO_QUERY );
-    Any a = rPropSet->getPropertyValue( ::rtl::OUString( "DefaultContext"  ) );
-    a >>= rContext;
-    return rContext;
-}
-
 Mutex Acceptor::m_aMutex;
 
 Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
@@ -66,7 +56,7 @@ Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
 {
     m_rSMgr = rFactory;
     // get component context
-    m_rContext = getComponentContext(m_rSMgr);
+    m_rContext = comphelper::getComponentContext(m_rSMgr);
     m_rAcceptor = Reference< XAcceptor > (m_rSMgr->createInstance(
         rtl::OUString("com.sun.star.connection.Acceptor" )),
         UNO_QUERY );
@@ -266,7 +256,7 @@ Reference<XInterface> SAL_CALL AccInstanceProvider::getInstance (const OUString&
     }
     else if(aName.compareToAscii( "StarOffice.ComponentContext" ) == 0 )
     {
-        rInstance = getComponentContext( m_rSMgr );
+        rInstance = comphelper::getComponentContext( m_rSMgr );
     }
     else if ( aName.compareToAscii("StarOffice.NamingService" ) == 0 )
     {
@@ -278,7 +268,7 @@ Reference<XInterface> SAL_CALL AccInstanceProvider::getInstance (const OUString&
             rNamingService->registerObject(
                 OUString("StarOffice.ServiceManager" ), m_rSMgr );
             rNamingService->registerObject(
-                OUString("StarOffice.ComponentContext" ), getComponentContext( m_rSMgr ));
+                OUString("StarOffice.ComponentContext" ), comphelper::getComponentContext( m_rSMgr ));
             rInstance = rNamingService;
         }
     }
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 65235d0..75643c9 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
 #include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -635,15 +634,9 @@ uno::Reference< container::XIndexAccess > DocumentHolder::MergeMenuesForInplace(
 
     uno::Reference< lang::XSingleComponentFactory > xIndAccessFact( xContMenu, uno::UNO_QUERY_THROW );
 
-    uno::Reference< uno::XComponentContext > xComponentContext;
-
-    uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-    if ( xProps.is() )
-        xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>=
-            xComponentContext;
-
     uno::Reference< container::XIndexContainer > xMergedMenu(
-            xIndAccessFact->createInstanceWithContext( xComponentContext ),
+            xIndAccessFact->createInstanceWithContext(
+                comphelper::getProcessComponentContext() ),
             uno::UNO_QUERY_THROW );
 
     FindConnectPoints( xContMenu, nContPoints );
diff --git a/extensions/Executable_nsplugin.mk b/extensions/Executable_nsplugin.mk
index 05bf003..0f6af60 100644
--- a/extensions/Executable_nsplugin.mk
+++ b/extensions/Executable_nsplugin.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_Executable_add_libs,nsplugin,\
 ))
 
 $(eval $(call gb_Executable_use_libraries,nsplugin,\
+	comphelper \
 	cppu \
 	cppuhelper \
 	sal \
diff --git a/extensions/source/nsplugin/source/so_instance.cxx b/extensions/source/nsplugin/source/so_instance.cxx
index b70a3e6..c9b6ee9 100644
--- a/extensions/source/nsplugin/source/so_instance.cxx
+++ b/extensions/source/nsplugin/source/so_instance.cxx
@@ -38,6 +38,7 @@
 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
 #include <com/sun/star/presentation/XPresentation.hpp>
 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <comphelper/processfactory.hxx>
 #include <vcl/window.hxx>
 #include <rtl/textenc.h>
 #include <rtl/locale.h>
@@ -239,8 +240,8 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent)
         }
 
         //create stream for the document
-        Reference< beans::XPropertySet > xFactoryProperties( mxRemoteMSF, uno::UNO_QUERY );
-        Reference< uno::XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY );
+        Reference< uno::XComponentContext > xContext(
+            comphelper::getComponentContext( mxRemoteMSF ) );
         Reference< ucb::XSimpleFileAccess2 > xSimpleFileAccess( ucb::SimpleFileAccess::create(xContext) );
         Reference<io::XInputStream> xInputStream = xSimpleFileAccess->openFileRead( m_sURL );
 
diff --git a/fileaccess/source/FileAccess.cxx b/fileaccess/source/FileAccess.cxx
index 478a340..b4c45db 100644
--- a/fileaccess/source/FileAccess.cxx
+++ b/fileaccess/source/FileAccess.cxx
@@ -31,7 +31,6 @@
 #include <tools/stream.hxx>
 
 #include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/io/XActiveDataSink.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
@@ -253,15 +252,8 @@ void OFileAccess::transferImpl( const rtl::OUString& rSource,
 
             try
             {
-                Reference< XComponentContext > xCtx;
-                Reference< XPropertySet > xPropSet( mxSMgr, UNO_QUERY_THROW );
-                if ( xPropSet.is() )
-                {
-                    xPropSet->getPropertyValue(
-                        rtl::OUString(
-                            "DefaultContext"  ) )
-                                >>= xCtx;
-                }
+                Reference< XComponentContext > xCtx(
+                    comphelper::getComponentContext( mxSMgr ) );
 
                 Reference< XMacroExpander > xExpander;
 
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index a5b28d5..ba8503f 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -58,7 +58,6 @@
 #include <com/sun/star/xml/sax/SAXException.hpp>
 #include <com/sun/star/xml/XImportFilter.hpp>
 #include <com/sun/star/xml/XExportFilter.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 
 #include <com/sun/star/util/XMacroExpander.hpp>
 
@@ -190,12 +189,8 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
         ::rtl::OUString sExpandedUrl;
         try
             {
-                css::uno::Reference<XComponentContext> xContext;
-                css::uno::Reference<XPropertySet> xProps(m_rServiceFactory,
-                        UNO_QUERY_THROW);
-                xContext.set(xProps->getPropertyValue(::rtl::OUString(
-                         "DefaultContext" )),
-                        UNO_QUERY_THROW);
+                css::uno::Reference<XComponentContext> xContext(
+                    comphelper::getComponentContext(m_rServiceFactory));
                 css::uno::Reference<XMacroExpander>
                         xMacroExpander(
                                 xContext->getValueByName(
diff --git a/framework/inc/macros/xserviceinfo.hxx b/framework/inc/macros/xserviceinfo.hxx
index 7d9fa13..bcca5c2 100644
--- a/framework/inc/macros/xserviceinfo.hxx
+++ b/framework/inc/macros/xserviceinfo.hxx
@@ -41,8 +41,8 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/Type.hxx>
 #include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <cppuhelper/factory.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
 #include <rtl/ustring.hxx>
 #include <rtl/logfile.hxx>
@@ -143,10 +143,8 @@ ________________________________________________________________________________
         throw( css::uno::Exception )                                                                                                                                \
     {                                                                                                                                                               \
         /* retrieve component context from the given service manager */                                                                                             \
-        static const ::rtl::OUString PROP_DEFAULTCONTEXT("DefaultContext");                                                        \
-        css::uno::Reference< css::beans::XPropertySet >    xSMGRProps(xServiceManager, css::uno::UNO_QUERY_THROW);                                                  \
-        css::uno::Reference< css::uno::XComponentContext > xComponentContext;                                                                                       \
-        xSMGRProps->getPropertyValue( PROP_DEFAULTCONTEXT ) >>= xComponentContext;                                                                                  \
+        css::uno::Reference< css::uno::XComponentContext > xComponentContext(                                                                                       \
+            comphelper::getComponentContext( xServiceManager ) );                                                                                                   \
         /* create new instance of service */                                                                                                                        \
         CLASS* pClass = new CLASS( xComponentContext );                                                                                                             \
         /* hold it alive by increasing his ref count!!! */                                                                                                          \
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index c1789c8..06dbc83 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -35,7 +35,6 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include "com/sun/star/util/XMacroExpander.hpp"
 #include "com/sun/star/uno/XComponentContext.hpp"
-#include "com/sun/star/beans/XPropertySet.hpp"
 #include <rtl/ustrbuf.hxx>
 #include <rtl/uri.hxx>
 #include <comphelper/processfactory.hxx>
@@ -415,15 +414,11 @@ AddonsOptions_Impl::AddonsOptions_Impl()
     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT          ] = PROPERTYNAME_MERGETOOLBAR_MERGECONTEXT;
     m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBARITEMS          ] = PROPERTYNAME_MERGETOOLBAR_TOOLBARITEMS;
 
-    Reference< XComponentContext > xContext;
-    Reference< com::sun::star::beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-    xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
-    if ( xContext.is() )
-    {
-        m_xMacroExpander =  Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
+    Reference< XComponentContext > xContext(
+        comphelper::getProcessComponentContext() );
+    m_xMacroExpander =  Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
                                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
                                 UNO_QUERY );
-    }
 
     ReadConfigurationData();
 
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx
index 680835d..24a1331 100644
--- a/framework/source/fwe/xml/menudocumenthandler.cxx
+++ b/framework/source/fwe/xml/menudocumenthandler.cxx
@@ -39,7 +39,6 @@
 #include <com/sun/star/ui/ItemType.hpp>
 #include <com/sun/star/ui/ItemStyle.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 
 #include <comphelper/processfactory.hxx>
 #include <rtl/logfile.hxx>
@@ -376,10 +375,8 @@ throw( SAXException, RuntimeException )
         m_bMenuMode = sal_True;
 
         // Container must be factory to create sub container
-        Reference< XComponentContext > xComponentContext;
-        Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-        xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>=
-            xComponentContext;
+        Reference< XComponentContext > xComponentContext(
+            comphelper::getProcessComponentContext() );
 
         Reference< XIndexContainer > xSubItemContainer;
         if ( m_xContainerFactory.is() )
@@ -573,6 +570,7 @@ OReadMenuPopupHandler::OReadMenuPopupHandler(
     m_bMenuMode( sal_False ),
     m_xMenuContainer( rMenuContainer ),
     m_xContainerFactory( rFactory ),
+    m_xComponentContext( comphelper::getProcessComponentContext() ),
     m_nNextElementExpected( ELEM_CLOSE_NONE )
 {
 }
@@ -612,12 +610,6 @@ throw( SAXException, RuntimeException )
         m_bMenuMode = sal_True;
 
         // Container must be factory to create sub container
-        if ( !m_xComponentContext.is() )
-        {
-            const Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-            m_xComponentContext.set(xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
-        }
-
         Reference< XIndexContainer > xSubItemContainer;
         if ( m_xContainerFactory.is() )
             xSubItemContainer = Reference< XIndexContainer >( m_xContainerFactory->createInstanceWithContext( m_xComponentContext ), UNO_QUERY );
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 0fbd031..3a490d4 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -34,6 +34,7 @@
 #include <uiconfiguration/windowstateconfiguration.hxx>
 
 #include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
 #include <com/sun/star/container/XNameReplace.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
diff --git a/framework/source/lomenubar/FrameHelper.cxx b/framework/source/lomenubar/FrameHelper.cxx
index f7e0ba6..bc90eba 100644
--- a/framework/source/lomenubar/FrameHelper.cxx
+++ b/framework/source/lomenubar/FrameHelper.cxx
@@ -591,9 +591,8 @@ FrameHelper::rebuildMenu (Reference < XMenu >  xMenu,
         //we need to access that info through a special XPopupMenuController
         if (isSpecialSubmenu (oUCommand))
         {
-            Reference < XPropertySet > xMSFProps (m_xMSF, UNO_QUERY);
-            Reference <XComponentContext> xContext (xMSFProps->getPropertyValue (OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))),
-                                                    UNO_QUERY);
+            Reference <XComponentContext> xContext(
+                comphelper::getComponentContext(m_xMSF));
 
             Reference < XPopupMenuController > xRFC (m_xPCF->createInstanceWithArgumentsAndContext(oUCommand,
                                                                                                  m_args,
@@ -736,9 +735,8 @@ FrameHelper::dispatchCommand (OUString command)
     {
         target = OUString(RTL_CONSTASCII_USTRINGPARAM("_default"));
 
-        Reference < XPropertySet > xMSFProps (m_xMSF, UNO_QUERY);
-        Reference <XComponentContext> xContext (xMSFProps->getPropertyValue (OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))),
-                                                UNO_QUERY);
+        Reference <XComponentContext> xContext(
+            comphelper::getComponentContext(m_xMSF));
         Reference < XPopupMenuController > xRFC (m_xPCF->createInstanceWithArgumentsAndContext(OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:RecentFileList")),
                                                                                              m_args,
                                                                                              xContext),
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx
index ad1ddc4..1bc24dd 100644
--- a/framework/source/uielement/addonstoolbarmanager.cxx
+++ b/framework/source/uielement/addonstoolbarmanager.cxx
@@ -50,12 +50,11 @@
 #include <com/sun/star/ui/ItemType.hpp>
 #include <com/sun/star/frame/XToolbarController.hpp>
 #include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/ui/DockingArea.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
-
+#include <comphelper/processfactory.hxx>
 #include <svtools/imgdef.hxx>
 #include <svtools/toolboxcontroller.hxx>
 #include <toolkit/unohlp.hxx>
@@ -235,11 +234,8 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
     }
 
     Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY );
-    Reference< XComponentContext > xComponentContext;
-    Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY );
-
-    if ( xProps.is() )
-        xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext;
+    Reference< XComponentContext > xComponentContext(
+        comphelper::getComponentContext( m_xServiceManager ) );
 
     sal_uInt32  nElements( 0 );
     sal_Bool    bAppendSeparator( sal_False );
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index f7d3923..4fd83d4 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
@@ -38,7 +38,6 @@
 #include <com/sun/star/frame/XControlNotificationListener.hpp>
 #include "com/sun/star/util/XMacroExpander.hpp"
 #include "com/sun/star/uno/XComponentContext.hpp"
-#include "com/sun/star/beans/XPropertySet.hpp"
 
 #include <rtl/uri.hxx>
 #include <osl/mutex.hxx>
@@ -81,16 +80,12 @@ uno::Reference< util::XMacroExpander > GetMacroExpander()
 
         if ( !xMacroExpander.is() )
         {
-            uno::Reference< uno::XComponentContext > xContext;
-            uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-            xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
-            if ( xContext.is() )
-            {
-                m_xMacroExpander =  Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
+            uno::Reference< uno::XComponentContext > xContext(
+                comphelper::getProcessComponentContext() );
+            m_xMacroExpander =  Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
                                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
                                         UNO_QUERY );
-                xMacroExpander = m_xMacroExpander;
-            }
+            xMacroExpander = m_xMacroExpander;
         }
     }
 
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index c7b9d7c..b79f179 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -43,7 +43,6 @@
 #include <com/sun/star/frame/XDispatch.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/frame/XFramesSupplier.hpp>
 #include <com/sun/star/frame/XDesktop.hpp>
 #include <com/sun/star/container/XEnumeration.hpp>
@@ -1217,11 +1216,8 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa
         aPropValue.Value      <<= m_xFrame;
         aSeq[1] <<= aPropValue;
 
-        Reference< XComponentContext > xComponentContext;
-        Reference< XPropertySet >      xProps( getServiceFactory(), UNO_QUERY );
-
-        xProps->getPropertyValue( rtl::OUString( "DefaultContext" )) >>=
-            xComponentContext;
+        Reference< XComponentContext > xComponentContext(
+            comphelper::getComponentContext( getServiceFactory() ) );
 
         Reference< XPopupMenuController > xPopupMenuController(
                                                 xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext(
diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx
index c1afcd4..47e1a9c 100644
--- a/framework/source/uielement/popupmenucontroller.cxx
+++ b/framework/source/uielement/popupmenucontroller.cxx
@@ -177,8 +177,8 @@ bool PopupMenuController::CreatePopupMenuController() throw (Exception)
     aPropValue.Value <<= m_xFrame;
     aSeq[1] <<= aPropValue;
 
-    Reference< XPropertySet >      xProps( getServiceManager(), UNO_QUERY_THROW );
-    Reference< XComponentContext > xComponentContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
+    Reference< XComponentContext > xComponentContext(
+        comphelper::getComponentContext( getServiceManager() ) );
 
     Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, xComponentContext ), UNO_QUERY );
     if ( xPopupMenuController.is() )
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 692c81d..7766746 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -50,7 +50,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/awt/Command.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
-
+#include <comphelper/processfactory.hxx>
 #include <toolkit/unohlp.hxx>
 #include <svtools/statusbarcontroller.hxx>
 
@@ -335,13 +335,10 @@ void StatusBarManager::CreateControllers()
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen at sun.com", "StatusBarManager::CreateControllers" );
     uno::Reference< lang::XMultiComponentFactory > xStatusbarControllerFactory( m_xStatusbarControllerRegistration, uno::UNO_QUERY );
-    uno::Reference< uno::XComponentContext > xComponentContext;
-    uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY );
+    uno::Reference< uno::XComponentContext > xComponentContext(
+        comphelper::getComponentContext( m_xServiceManager ) );
     uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar );
 
-    if ( xProps.is() )
-        xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext;
-
     for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ )
     {
         sal_uInt16 nId = m_pStatusBar->GetItemId( i );
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index bf39ac0..208fe1d 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -897,17 +897,14 @@ void ToolBarManager::CreateControllers()
     RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::CreateControllers" );
 
     Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY );
-    Reference< XComponentContext > xComponentContext;
-    Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY );
+    Reference< XComponentContext > xComponentContext(
+        comphelper::getComponentContext( m_xServiceManager ) );
     Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar );
 
     css::util::URL      aURL;
     sal_Bool            bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED );
     SvtCommandOptions   aCmdOptions;
 
-    if ( xProps.is() )
-        xProps->getPropertyValue( rtl::OUString( "DefaultContext" )) >>= xComponentContext;
-
     for ( sal_uInt16 i = 0; i < m_pToolBar->GetItemCount(); i++ )
     {
         sal_uInt16 nId = m_pToolBar->GetItemId( i );
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 0a5de43..acb0378 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1088,10 +1088,8 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
                     {
                         try
                         {
-                            uno::Reference < uno::XComponentContext > xContext;
-                            uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
-
-                            xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
+                            uno::Reference < uno::XComponentContext > xContext(
+                                comphelper::getComponentContext( xFac ) );
                             xSvc = uno::Reference< linguistic2::XSpellChecker >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
                         }
                         catch (const uno::Exception &)
@@ -1152,10 +1150,8 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
                     {
                         try
                         {
-                            uno::Reference < uno::XComponentContext > xContext;
-                            uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
-
-                            xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
+                            uno::Reference < uno::XComponentContext > xContext(
+                                comphelper::getComponentContext( xFac ) );
                             xSvc = uno::Reference< linguistic2::XProofreader >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
                         }
                         catch (const uno::Exception &)
@@ -1215,10 +1211,8 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
                     {
                         try
                         {
-                            uno::Reference < uno::XComponentContext > xContext;
-                            uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
-
-                            xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
+                            uno::Reference < uno::XComponentContext > xContext(
+                                comphelper::getComponentContext( xFac ) );
                             xSvc = uno::Reference< linguistic2::XHyphenator >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
 
                         }
@@ -1281,10 +1275,8 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
                     {
                         try
                         {
-                            uno::Reference < uno::XComponentContext > xContext;
-                            uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
-
-                            xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
+                            uno::Reference < uno::XComponentContext > xContext(
+                                comphelper::getComponentContext( xFac ) );
                             xSvc = uno::Reference< linguistic2::XThesaurus >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
                         }
                         catch (const uno::Exception &)
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 06773dc..70b3936 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -44,7 +44,6 @@
 #include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
 #include <com/sun/star/xml/dom/XDocument.hpp>
 #include <com/sun/star/xml/dom/DocumentBuilder.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <oox/core/filterdetect.hxx>
@@ -56,7 +55,6 @@ using ::com::sun::star::xml::dom::DocumentBuilder;
 using ::com::sun::star::xml::dom::XDocument;
 using ::com::sun::star::xml::dom::XDocumentBuilder;
 using ::com::sun::star::xml::sax::XFastSAXSerializable;
-using ::com::sun::star::beans::XPropertySet;
 using ::com::sun::star::lang::XComponent;
 
 namespace oox {
@@ -194,26 +192,6 @@ XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxCo
         maFastParser.registerNamespace( ids[i].Second );
 }
 
-
-static Reference< XComponentContext > lcl_getComponentContext(Reference< XMultiServiceFactory > aFactory)
-{
-    Reference< XComponentContext > xContext;
-    try
-    {
-        Reference< XPropertySet > xFactProp( aFactory, UNO_QUERY );
-        if( xFactProp.is() )
-            xFactProp->getPropertyValue( "DefaultContext")  >>= xContext;
-    }
-    catch( Exception& )
-    {}
-
-    return xContext;
-}
-
-// ============================================================================
-
-// ============================================================================
-
 XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
     FilterBase( rxContext ),
     mxImpl( new XmlFilterBaseImpl( rxContext ) ),
@@ -233,7 +211,7 @@ void XmlFilterBase::importDocumentProperties() throw()
     Reference< XMultiServiceFactory > xFactory( getServiceFactory(), UNO_QUERY );
     MediaDescriptor aMediaDesc( getMediaDescriptor() );
     Reference< XInputStream > xInputStream;
-    Reference< XComponentContext > xContext = lcl_getComponentContext(getServiceFactory());
+    Reference< XComponentContext > xContext = comphelper::getComponentContext(getServiceFactory());
     ::oox::core::FilterDetect aDetector( xContext );
     xInputStream = aDetector.extractUnencryptedPackage( aMediaDesc );
     Reference< XComponent > xModel( getModel(), UNO_QUERY );
@@ -357,7 +335,7 @@ Reference<XDocument> XmlFilterBase::importFragment( const ::rtl::OUString& aFrag
     {
         // create the dom parser
         Reference< XComponentContext > xContext =
-            lcl_getComponentContext(getServiceFactory());
+            comphelper::getComponentContext(getServiceFactory());
         Reference<XDocumentBuilder> xDomBuilder( DocumentBuilder::create(xContext) );
 
         // create DOM from fragment
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 6519543..08cc68c 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -121,21 +121,6 @@ namespace oox { namespace drawingml {
     if ( GETA(propName) ) \
         mAny >>= variable;
 
-Reference< uno::XComponentContext > lcl_getComponentContext()
-{
-    Reference< uno::XComponentContext > xContext;
-    try
-    {
-        Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-        if( xFactProp.is())
-            xFactProp->getPropertyValue(OUString("DefaultContext")) >>= xContext;
-    }
-    catch( uno::Exception& )
-    {}
-
-    return xContext;
-}
-
 class lcl_MatchesRole : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
 {
 public:
@@ -217,13 +202,12 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Referen
 Reference< chart2::data::XDataSource > lcl_createDataSource(
     const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aData )
 {
-    Reference< chart2::data::XDataSink > xSink;
-    Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
-    if( xContext.is() )
-        xSink.set(
-            xContext->getServiceManager()->createInstanceWithContext(
-                OUString("com.sun.star.chart2.data.DataSource"),
-                xContext ), uno::UNO_QUERY_THROW );
+    Reference< uno::XComponentContext > xContext(
+        comphelper::getProcessComponentContext() );
+    Reference< chart2::data::XDataSink > xSink(
+        xContext->getServiceManager()->createInstanceWithContext(
+            "com.sun.star.chart2.data.DataSource", xContext ),
+        uno::UNO_QUERY_THROW );
     if( xSink.is())
         xSink->setData( aData );
 
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index 3ad3355..42a195c 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -132,16 +132,10 @@ PropBrw::PropBrw(const Reference< XMultiServiceFactory >&   _xORB,Window* pParen
 
     if (m_xMeAsFrame.is())
     {
-        Reference< XComponentContext > xOwnContext;
+        Reference< XComponentContext > xOwnContext(
+            comphelper::getComponentContext( m_xORB ) );
         try
         {
-            // our own component context
-            Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW );
-            xOwnContext.set(
-                xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
-                UNO_QUERY_THROW );
-
-            // a ComponentContext for the
             ::cppu::ContextEntry_Init aHandlerContextInfo[] =
             {
                 ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_pDesignView->getController().getModel() )),
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index a9462b6..8c5e0c4 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2628,9 +2628,6 @@ uno::Sequence<rtl::OUString> ScDPObject::GetRegisteredSources()
     return aSeq;
 }
 
-// use getContext from addincol.cxx
-uno::Reference<uno::XComponentContext> getContext(uno::Reference<lang::XMultiServiceFactory> xMSF);
-
 uno::Reference<sheet::XDimensionsSupplier> ScDPObject::CreateSource( const ScDPServiceDesc& rDesc )
 {
     rtl::OUString aImplName = rDesc.aServiceName;
@@ -2664,9 +2661,10 @@ uno::Reference<sheet::XDimensionsSupplier> ScDPObject::CreateSource( const ScDPS
             // passing the context to the component (see ScUnoAddInCollection::Initialize)
 
             uno::Reference<uno::XInterface> xInterface;
-            uno::Reference<uno::XComponentContext> xCtx = getContext(xManager);
+            uno::Reference<uno::XComponentContext> xCtx(
+                comphelper::getComponentContext(xManager));
             uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
-            if (xCtx.is() && xCFac.is())
+            if (xCFac.is())
                 xInterface = xCFac->createInstanceWithContext(xCtx);
 
             if (!xInterface.is())
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index 33c9232..ac3b812 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -281,19 +281,6 @@ void ScUnoAddInCollection::Clear()
     bInitialized = false;
 }
 
-uno::Reference<uno::XComponentContext> getContext(uno::Reference<lang::XMultiServiceFactory> xMSF)
-{
-    uno::Reference<uno::XComponentContext> xCtx;
-    try {
-        uno::Reference<beans::XPropertySet> xPropset(xMSF, uno::UNO_QUERY);
-        xPropset->getPropertyValue(
-            ::rtl::OUString("DefaultContext")) >>= xCtx;
-    }
-    catch ( uno::Exception & ) {
-    }
-    return xCtx;
-}
-
 void ScUnoAddInCollection::Initialize()
 {
     OSL_ENSURE( !bInitialized, "Initialize twice?" );
@@ -321,9 +308,10 @@ void ScUnoAddInCollection::Initialize()
                         // passing the context to the component
 
                         uno::Reference<uno::XInterface> xInterface;
-                        uno::Reference<uno::XComponentContext> xCtx = getContext(xManager);
+                        uno::Reference<uno::XComponentContext> xCtx(
+                            comphelper::getComponentContext(xManager));
                         uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
-                        if (xCtx.is() && xCFac.is())
+                        if (xCFac.is())
                         {
                             xInterface = xCFac->createInstanceWithContext(xCtx);
                             if (xInterface.is())
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 2114731..645911d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -683,36 +683,34 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
 
                     try
                     {
-                        uno::Reference< uno::XComponentContext > xContext;
-                        uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
-                        uno::Reference< beans::XPropertySet > xProp( xServiceManager, uno::UNO_QUERY_THROW );
-                        xProp->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) >>= xContext;
-                        if ( xContext.is() )
+                        uno::Reference< uno::XComponentContext > xContext(
+                            comphelper::getProcessComponentContext() );
+                        uno::Reference< lang::XMultiServiceFactory > xServiceManager(
+                            xContext->getServiceManager(),
+                            uno::UNO_QUERY_THROW );
+                        uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xServiceManager, uno::UNO_QUERY_THROW );
+                        uno::Reference< container::XEnumeration> xEnum = xEnumAccess->createContentEnumeration(
+                            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocumentJob" ) ) );
+                        if ( xEnum.is() )
                         {
-                            uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xServiceManager, uno::UNO_QUERY_THROW );
-                            uno::Reference< container::XEnumeration> xEnum = xEnumAccess->createContentEnumeration(
-                                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocumentJob" ) ) );
-                            if ( xEnum.is() )
+                            while ( xEnum->hasMoreElements() )
                             {
-                                while ( xEnum->hasMoreElements() )
+                                uno::Any aAny = xEnum->nextElement();
+                                uno::Reference< lang::XSingleComponentFactory > xFactory;
+                                aAny >>= xFactory;
+                                if ( xFactory.is() )
                                 {
-                                    uno::Any aAny = xEnum->nextElement();
-                                    uno::Reference< lang::XSingleComponentFactory > xFactory;
-                                    aAny >>= xFactory;
-                                    if ( xFactory.is() )
-                                    {
-                                        uno::Reference< task::XJob > xJob( xFactory->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
-                                        uno::Sequence< beans::NamedValue > aArgsForJob(1);
-                                        ScViewData* pViewData = GetViewData();
-                                        SfxViewShell* pViewShell = ( pViewData ? pViewData->GetViewShell() : NULL );
-                                        SfxViewFrame* pViewFrame = ( pViewShell ? pViewShell->GetViewFrame() : NULL );
-                                        SfxFrame* pFrame = ( pViewFrame ? &pViewFrame->GetFrame() : NULL );
-                                        uno::Reference< frame::XController > xController = ( pFrame ? pFrame->GetController() : 0 );
-                                        uno::Reference< sheet::XSpreadsheetView > xSpreadsheetView( xController, uno::UNO_QUERY_THROW );
-                                        aArgsForJob[0] = beans::NamedValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SpreadsheetView" )),
+                                    uno::Reference< task::XJob > xJob( xFactory->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
+                                    uno::Sequence< beans::NamedValue > aArgsForJob(1);
+                                    ScViewData* pViewData = GetViewData();
+                                    SfxViewShell* pViewShell = ( pViewData ? pViewData->GetViewShell() : NULL );
+                                    SfxViewFrame* pViewFrame = ( pViewShell ? pViewShell->GetViewFrame() : NULL );
+                                    SfxFrame* pFrame = ( pViewFrame ? &pViewFrame->GetFrame() : NULL );
+                                    uno::Reference< frame::XController > xController = ( pFrame ? pFrame->GetController() : 0 );
+                                    uno::Reference< sheet::XSpreadsheetView > xSpreadsheetView( xController, uno::UNO_QUERY_THROW );
+                                    aArgsForJob[0] = beans::NamedValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SpreadsheetView" )),
                                             uno::makeAny( xSpreadsheetView ) );
-                                        xJob->execute( aArgsForJob );
-                                    }
+                                    xJob->execute( aArgsForJob );
                                 }
                             }
                         }
diff --git a/sc/source/ui/miscdlgs/solverutil.cxx b/sc/source/ui/miscdlgs/solverutil.cxx
index 356eef7..8ed768e 100644
--- a/sc/source/ui/miscdlgs/solverutil.cxx
+++ b/sc/source/ui/miscdlgs/solverutil.cxx
@@ -29,6 +29,7 @@
 #include "solverutil.hxx"
 
 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
@@ -84,19 +85,13 @@ void ScSolverUtil::GetImplementations( uno::Sequence<rtl::OUString>& rImplNames,
     rImplNames.realloc(0);      // clear
     rDescriptions.realloc(0);
 
-    uno::Reference<uno::XComponentContext> xCtx;
-    uno::Reference<lang::XMultiServiceFactory> xMSF = comphelper::getProcessServiceFactory();
-    uno::Reference<beans::XPropertySet> xPropset(xMSF, uno::UNO_QUERY);
-    try
-    {
-        xPropset->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xCtx;
-    }
-    catch ( uno::Exception & )
-    {
-    }
+    uno::Reference<uno::XComponentContext> xCtx(
+        comphelper::getProcessComponentContext() );
+    uno::Reference<lang::XMultiServiceFactory> xMSF(
+        xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
 
     uno::Reference<container::XContentEnumerationAccess> xEnAc( xMSF, uno::UNO_QUERY );
-    if ( xCtx.is() && xEnAc.is() )
+    if ( xEnAc.is() )
     {
         uno::Reference<container::XEnumeration> xEnum =
                         xEnAc->createContentEnumeration( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SCSOLVER_SERVICE)) );
@@ -140,19 +135,13 @@ uno::Reference<sheet::XSolver> ScSolverUtil::GetSolver( const rtl::OUString& rIm
 {
     uno::Reference<sheet::XSolver> xSolver;
 
-    uno::Reference<uno::XComponentContext> xCtx;
-    uno::Reference<lang::XMultiServiceFactory> xMSF = comphelper::getProcessServiceFactory();
-    uno::Reference<beans::XPropertySet> xPropset(xMSF, uno::UNO_QUERY);
-    try
-    {
-        xPropset->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xCtx;
-    }
-    catch ( uno::Exception & )
-    {
-    }
+    uno::Reference<uno::XComponentContext> xCtx(
+        comphelper::getProcessComponentContext() );
+    uno::Reference<lang::XMultiServiceFactory> xMSF(
+        xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
 
     uno::Reference<container::XContentEnumerationAccess> xEnAc( xMSF, uno::UNO_QUERY );
-    if ( xCtx.is() && xEnAc.is() )
+    if ( xEnAc.is() )
     {
         uno::Reference<container::XEnumeration> xEnum =
                         xEnAc->createContentEnumeration( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SCSOLVER_SERVICE)) );
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index cfbb7e7..ec54e24 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -118,10 +118,10 @@ private:
     bool bInitialWarningState;
     static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
     {
-        static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-        static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
+        static uno::Reference<uno::XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
         static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-                xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+                xContext->getServiceManager() );
         static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
         return xProps;
     }
diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx
index a2a2217..ce5e680 100644
--- a/sc/source/ui/vba/vbahelper.cxx
+++ b/sc/source/ui/vba/vbahelper.cxx
@@ -124,10 +124,10 @@ private:
     bool bInitialWarningState;
     static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
     {
-        static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-        static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString(  "DefaultContext" )), uno::UNO_QUERY_THROW );
+        static uno::Reference<uno::XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
         static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-                xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+            xContext->getServiceManager() );
         static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString(  "com.sun.star.sheet.GlobalSheetSettings"  ) ,xContext ), uno::UNO_QUERY_THROW );
         return xProps;
     }
@@ -279,11 +279,10 @@ getCurrentDocument() throw (uno::RuntimeException)
         if ( false == ( aModel >>= xModel ) ||
             !xModel.is() )
         {
-            // trying last gasp try the current component
-            uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-            // test if vba service is present
-            uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString(  "DefaultContext" )), uno::UNO_QUERY_THROW );
-            uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
+            uno::Reference< uno::XComponentContext > xCtx(
+                comphelper::getProcessComponentContext() );
+            uno::Reference<lang::XMultiComponentFactory > xSMgr(
+                xCtx->getServiceManager() );
             uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
             xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
             if ( !xModel.is() )
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index 528941b..d5fe171 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -167,10 +167,10 @@ openNewDoc(rtl::OUString aSheetName )
     uno::Reference<frame::XModel> xModel;
     try
     {
-        uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-        uno::Reference< uno::XComponentContext > xContext(  xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
+        uno::Reference< uno::XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
         uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-                                        xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+            xContext->getServiceManager() );
 
         uno::Reference <frame::XComponentLoader > xComponentLoader(
                         xServiceManager->createInstanceWithContext(
diff --git a/scripting/Library_protocolhandler.mk b/scripting/Library_protocolhandler.mk
index 291b1ec..d2a684a 100644
--- a/scripting/Library_protocolhandler.mk
+++ b/scripting/Library_protocolhandler.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_set_include,protocolhandler,\
 $(eval $(call gb_Library_use_sdk_api,protocolhandler))
 
 $(eval $(call gb_Library_use_libraries,protocolhandler,\
+	comphelper \
 	cppu \
 	cppuhelper \
 	fwe \
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index ed41ebc..1881c91 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -41,6 +41,7 @@
 #include <vcl/abstdlg.hxx>
 #include <tools/diagnose_ex.h>
 
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <util/util.hxx>
@@ -50,7 +51,6 @@
 #include "com/sun/star/uri/XUriReference.hpp"
 #include "com/sun/star/uri/XUriReferenceFactory.hpp"
 #include "com/sun/star/uri/XVndSunStarScriptUrl.hpp"
-#include "com/sun/star/beans/XPropertySet.hpp"
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -383,13 +383,8 @@ void ScriptProtocolHandler::createScriptProvider()
         // if nothing of this is successful, use the master script provider
         if ( !m_xScriptProvider.is() )
         {
-            Reference< XPropertySet > xProps( m_xFactory, UNO_QUERY_THROW );
-
-            ::rtl::OUString dc(
-                "DefaultContext"  );
-
             Reference< XComponentContext > xCtx(
-                xProps->getPropertyValue( dc ), UNO_QUERY_THROW );
+                comphelper::getComponentContext( m_xFactory ) );
 
             ::rtl::OUString tmspf(
                 "/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory");
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 00981f0..7249d14 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -368,14 +368,10 @@ eventMethodToDescriptor( const ::rtl::OUString& rEventMethod, ScriptEventDescrip
 
 }
 
-ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ) : m_xControl( xControl )
-{
-    Reference < beans::XPropertySet > xProps(
-        ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-    m_xCtx.set( xProps->getPropertyValue( rtl::OUString(
-        "DefaultContext" )),
-        uno::UNO_QUERY_THROW );
-}
+ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ):
+    m_xCtx( comphelper::getProcessComponentContext() ),
+    m_xControl( xControl )
+{}
 
 Sequence< rtl::OUString >
 ScriptEventHelper::getEventListeners()
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index bf8fd50..8eb74ee 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -34,7 +34,6 @@
 #include <com/sun/star/xml/sax/XParser.hpp>
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/presentation/EffectPresetClass.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <unotools/streamwrap.hxx>
@@ -316,19 +315,14 @@ void CustomAnimationPresets::importEffects()
 {
     try
     {
-        // Get service factory
-        Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
-        DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
-        if( !xServiceFactory.is() )
-            return;
-
-        uno::Reference< beans::XPropertySet > xProps( xServiceFactory, UNO_QUERY );
-        uno::Reference< uno::XComponentContext > xContext;
-        xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
+        uno::Reference< uno::XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
+        Reference< XMultiServiceFactory > xServiceFactory(
+            xContext->getServiceManager(), UNO_QUERY_THROW );
 
-        uno::Reference< util::XMacroExpander > xMacroExpander;
-        if( xContext.is() )
-            xMacroExpander.set( xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"), UNO_QUERY );
+        uno::Reference< util::XMacroExpander > xMacroExpander(
+            xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
+            UNO_QUERY );
 
         Reference< XMultiServiceFactory > xConfigProvider(
             xServiceFactory->createInstance("com.sun.star.configuration.ConfigurationProvider" ),
diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx
index dd03514..3c77ead 100644
--- a/sd/source/core/TransitionPreset.cxx
+++ b/sd/source/core/TransitionPreset.cxx
@@ -31,7 +31,6 @@
 #include <com/sun/star/container/XEnumerationAccess.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/util/XMacroExpander.hpp>
 #include <com/sun/star/animations/AnimationNodeType.hpp>
 #include <vcl/svapp.hxx>
@@ -152,19 +151,14 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
 
     try
     {
-        // Get service factory
-        Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
-        DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
-        if( !xServiceFactory.is() )
-            return false;
-
-        uno::Reference< beans::XPropertySet > xProps( xServiceFactory, UNO_QUERY );
-        uno::Reference< uno::XComponentContext > xContext;
-        xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
-
-        uno::Reference< util::XMacroExpander > xMacroExpander;
-        if( xContext.is() )
-            xMacroExpander.set( xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"), UNO_QUERY );
+        uno::Reference< uno::XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
+        Reference< XMultiServiceFactory > xServiceFactory(
+            xContext->getServiceManager(), UNO_QUERY_THROW );
+
+        uno::Reference< util::XMacroExpander > xMacroExpander(
+            xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
+            UNO_QUERY );
 
         // import ui strings
         Reference< XMultiServiceFactory > xConfigProvider(
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 7106771..d95318b 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -163,17 +163,12 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
         uno::Reference< awt::XWindow > xWindow;
         try
         {
-            uno::Reference< beans::XPropertySet >    xProps( xServiceManager, uno::UNO_QUERY );
-            uno::Reference< uno::XComponentContext > xContext;
+            uno::Reference< uno::XComponentContext > xContext(
+                comphelper::getComponentContext( xServiceManager ) );
 
-            if ( xProps.is() )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list