From 03a9f139bd9ea1a4f9096fc982e6b326def58532 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Wed, 19 Sep 2012 13:15:15 +0200
Subject: ComponentContext::getUnoContext -> getComponentContext simplification

...and some further clean-up.

Change-Id: If5dce53e382b56390c502d0d0d93fc06cbfe33ea
---
 embeddedobj/source/commonembedding/embedobj.cxx    |  4 ++--
 embeddedobj/source/commonembedding/persistence.cxx |  6 +++---
 embeddedobj/source/general/docholder.cxx           |  5 ++---
 embeddedobj/source/msole/olecomponent.cxx          |  4 ++--
 embeddedobj/source/msole/oleembed.cxx              |  8 ++++----
 embeddedobj/source/msole/olepersist.cxx            | 20 ++++++++++----------
 embeddedobj/source/msole/ownview.cxx               |  6 +++---
 7 files changed, 26 insertions(+), 27 deletions(-)

(limited to 'embeddedobj/source')

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 06ad663ee351..ae8ef08665d6 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -46,7 +46,7 @@
 #include <com/sun/star/lang/DisposedException.hpp>
 
 #include <com/sun/star/embed/EmbedMisc.hpp>
-#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
 
 #include <rtl/logfile.hxx>
 
@@ -323,7 +323,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
                         uno::Reference< embed::XComponentSupplier > xCompSupl( m_xClientSite, uno::UNO_QUERY_THROW );
                         uno::Reference< uno::XInterface > xContDoc( xCompSupl->getComponent(), uno::UNO_QUERY_THROW );
 
-                        uno::Reference< frame::XModuleManager2 > xManager( frame::ModuleManager::create(comphelper::ComponentContext(m_xFactory).getUNOContext()) );
+                        uno::Reference< frame::XModuleManager2 > xManager( frame::ModuleManager::create(comphelper::getComponentContext(m_xFactory)) );
 
                         aModuleName = xManager->identify( xContDoc );
                     }
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 4cd67ef22b18..f881f108f022 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -54,8 +54,8 @@
 #include <com/sun/star/beans/IllegalTypeException.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/fileformat.h>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/mimeconfighelper.hxx>
 #include <comphelper/namedvaluecollection.hxx>
@@ -134,7 +134,7 @@ uno::Reference< io::XInputStream > createTempInpStreamFromStor(
 
     uno::Reference< io::XInputStream > xResult;
 
-    uno::Reference < io::XStream > xTempStream( io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+    uno::Reference < io::XStream > xTempStream( io::TempFile::create(comphelper::getComponentContext(xFactory)),
                                                             uno::UNO_QUERY_THROW );
 
     uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
@@ -585,7 +585,7 @@ uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStr
                                                                             const ::rtl::OUString& aHierarchName )
 {
     uno::Reference < io::XOutputStream > xTempOut(
-                io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+                io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
                 uno::UNO_QUERY_THROW );
     uno::Reference< io::XInputStream > aResult( xTempOut, uno::UNO_QUERY );
 
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index fd073eda383d..2f9e617230e5 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -74,7 +74,6 @@
 #include <osl/diagnose.h>
 #include <rtl/process.h>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/namedvaluecollection.hxx>
 
@@ -576,14 +575,14 @@ uno::Reference< container::XIndexAccess > DocumentHolder::RetrieveOwnMenu_Impl()
     if ( !xResult.is() )
     {
         // no internal document configuration, use the one from the module
-        uno::Reference< frame::XModuleManager2 > xModuleMan( frame::ModuleManager::create(comphelper::ComponentContext(m_xFactory).getUNOContext()) );
+        uno::Reference< frame::XModuleManager2 > xModuleMan( frame::ModuleManager::create(comphelper::getComponentContext(m_xFactory)) );
         ::rtl::OUString aModuleIdent =
             xModuleMan->identify( uno::Reference< uno::XInterface >( m_xComponent, uno::UNO_QUERY ) );
 
         if ( !aModuleIdent.isEmpty() )
         {
             uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModConfSupplier(
-                    ui::ModuleUIConfigurationManagerSupplier::create(comphelper::ComponentContext(m_xFactory).getUNOContext()) );
+                    ui::ModuleUIConfigurationManagerSupplier::create(comphelper::getComponentContext(m_xFactory)) );
             uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > xModUIConfMan(
                     xModConfSupplier->getUIConfigurationManager( aModuleIdent ),
                     uno::UNO_QUERY_THROW );
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index f4fe34691e0f..4389a2cc505d 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -38,8 +38,8 @@
 
 #include <platform.h>
 #include <cppuhelper/interfacecontainer.h>
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/mimeconfighelper.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <osl/file.hxx>
 #include <rtl/ref.hxx>
@@ -1598,7 +1598,7 @@ uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor&
         // allow to retrieve stream-representation of the object persistence
         bSupportedFlavor = sal_True;
         uno::Reference < io::XStream > xTempFileStream(
-            io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+            io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
             uno::UNO_QUERY_THROW );
 
         uno::Reference< io::XOutputStream > xTempOutStream = xTempFileStream->getOutputStream();
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 14db754ff4f9..d829944a6d1d 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -53,8 +53,8 @@
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 
 #include <rtl/logfile.hxx>
-#include <comphelper/componentcontext.hxx>
 #include <cppuhelper/interfacecontainer.h>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/mimeconfighelper.hxx>
 #include <comphelper/storagehelper.hxx>
 
@@ -706,7 +706,7 @@ namespace
         // the solution is only active for Unix systems
 #ifndef WNT
         uno::Reference <beans::XPropertySet> xNativeTempFile(
-            io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+            io::TempFile::create(comphelper::getComponentContext(xFactory)),
             uno::UNO_QUERY_THROW);
         uno::Reference < io::XStream > xStream(xNativeTempFile, uno::UNO_QUERY_THROW);
 
@@ -740,7 +740,7 @@ namespace
             xNativeTempFile = uno::Reference<beans::XPropertySet>();
 
             uno::Reference < ucb::XSimpleFileAccess2 > xSimpleFileAccess(
-                    ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) );
+                    ucb::SimpleFileAccess::create( comphelper::getComponentContext(xFactory) ) );
 
             xSimpleFileAccess->setReadOnly(sUrl, sal_True);
         }
@@ -879,7 +879,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
                 if (!m_aTempDumpURL.isEmpty())
                 {
                     uno::Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
-                        ::com::sun::star::system::SystemShellExecute::create(comphelper::ComponentContext(m_xFactory).getUNOContext()) );
+                        ::com::sun::star::system::SystemShellExecute::create(comphelper::getComponentContext(m_xFactory)) );
                     xSystemShellExecute->execute(m_aTempDumpURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY);
                 }
                 else
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index 7939ad527499..edebfc3e1a3d 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -49,7 +49,7 @@
 
 #include <rtl/logfile.hxx>
 
-#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/mimeconfighelper.hxx>
 #include <comphelper/classids.hxx>
@@ -72,7 +72,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
     try
     {
         uno::Reference < ucb::XSimpleFileAccess2 > xAccess(
-                ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) );
+                ucb::SimpleFileAccess::create( comphelper::getComponentContext(xFactory) ) );
 
         xAccess->kill( aURL );
         bRet = sal_True;
@@ -92,7 +92,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
     ::rtl::OUString aResult;
 
     uno::Reference < beans::XPropertySet > xTempFile(
-            io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+            io::TempFile::create(comphelper::getComponentContext(xFactory)),
             uno::UNO_QUERY_THROW );
 
     try {
@@ -124,7 +124,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
     {
         try {
             uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess(
-                    ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) );
+                    ucb::SimpleFileAccess::create( comphelper::getComponentContext(xFactory) ) );
 
             uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aResult );
             if ( xTempOutStream.is() )
@@ -170,7 +170,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
     try
     {
         uno::Reference < beans::XPropertySet > xTempFile(
-                io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+                io::TempFile::create(comphelper::getComponentContext(xFactory)),
                 uno::UNO_QUERY );
         uno::Reference < io::XStream > xTempStream( xTempFile, uno::UNO_QUERY_THROW );
 
@@ -276,7 +276,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::GetNewFilledTempStream_Impl( co
     OSL_ENSURE( xInStream.is(), "Wrong parameter is provided!\n" );
 
     uno::Reference < io::XStream > xTempFile(
-            io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+            io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
             uno::UNO_QUERY_THROW );
 
     uno::Reference< io::XOutputStream > xTempOutStream = xTempFile->getOutputStream();
@@ -353,7 +353,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToGetAcceptableFormat_Impl(
     {
         // this is either a bitmap or a metafile clipboard format, retrieve the pure stream
         uno::Reference < io::XStream > xResult(
-            io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+            io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
             uno::UNO_QUERY_THROW );
         uno::Reference < io::XSeekable > xResultSeek( xResult, uno::UNO_QUERY_THROW );
         uno::Reference < io::XOutputStream > xResultOut = xResult->getOutputStream();
@@ -401,7 +401,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
         xCachedSeek->seek( 0 );
 
     uno::Reference < io::XStream > xTempFile(
-            io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+            io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
             uno::UNO_QUERY_THROW );
 
     uno::Reference< io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
@@ -587,7 +587,7 @@ sal_Bool OleEmbeddedObject::HasVisReplInStream()
                 {
                     // open temporary file for reading
                     uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess(
-                            ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) );
+                            ucb::SimpleFileAccess::create( comphelper::getComponentContext(m_xFactory) ) );
 
                     xStream = xTempAccess->openFileRead( m_aTempURL );
                 }
@@ -1053,7 +1053,7 @@ void OleEmbeddedObject::StoreObjectToStream( uno::Reference< io::XOutputStream >
 
     // open temporary file for reading
     uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess(
-            ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) );
+            ucb::SimpleFileAccess::create( comphelper::getComponentContext(m_xFactory) ) );
 
     uno::Reference< io::XInputStream > xTempInStream = xTempAccess->openFileRead( m_aTempURL );
     OSL_ENSURE( xTempInStream.is(), "The object's temporary file can not be reopened for reading!\n" );
diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx
index c5bb43ad9b11..a9bec9648a3e 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -47,7 +47,7 @@
 #include <com/sun/star/document/XTypeDetection.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <cppuhelper/implbase1.hxx>
-#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/mimeconfighelper.hxx>
 
@@ -277,7 +277,7 @@ sal_Bool OwnView_Impl::ReadContentsAndGenerateTempFile( const uno::Reference< io
     // create m_aNativeTempURL
     ::rtl::OUString aNativeTempURL;
     uno::Reference < beans::XPropertySet > xNativeTempFile(
-            io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+            io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
             uno::UNO_QUERY_THROW );
     uno::Reference < io::XStream > xNativeTempStream( xNativeTempFile, uno::UNO_QUERY_THROW );
     uno::Reference < io::XOutputStream > xNativeOutTemp = xNativeTempStream->getOutputStream();
@@ -424,7 +424,7 @@ void OwnView_Impl::CreateNative()
     try
     {
         uno::Reference < ucb::XSimpleFileAccess2 > xAccess(
-                ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) );
+                ucb::SimpleFileAccess::create( comphelper::getComponentContext(m_xFactory) ) );
 
         uno::Reference< io::XInputStream > xInStream = xAccess->openFileRead( m_aTempFileURL );
         if ( !xInStream.is() )
-- 
cgit