[Libreoffice-commits] core.git: 11 commits - basic/source codemaker/source cui/source dbaccess/source desktop/source extensions/source framework/inc framework/source idlc/source offapi/com offapi/UnoApi_offapi.mk reportdesign/inc reportdesign/source sc/CppunitTest_sc_annotationobj.mk sc/CppunitTest_sc_annotationsobj.mk sc/CppunitTest_sc_cellrangeobj.mk sc/CppunitTest_sc_databaserangeobj.mk sc/CppunitTest_sc_datapilotfieldobj.mk sc/CppunitTest_sc_datapilottableobj.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_modelobj.mk sc/CppunitTest_sc_namedrangeobj.mk sc/CppunitTest_sc_namedrangesobj.mk sc/CppunitTest_sc_outlineobj.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_tablesheetobj.mk sc/CppunitTest_sc_tablesheetsobj.mk scripting/source sfx2/inc sfx2/source svtools/inc svtools/source sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_subsequent_odfexport.mk sw/CppunitTest_sw_subsequent_odfimport.mk sw/CppunitTest_sw_subsequent_ooxml export.mk sw/CppunitTest_sw_subsequent_ooxmlimport.mk sw/CppunitTest_sw_subsequent_rtfexport.mk sw/CppunitTest_sw_subsequent_ww8export.mk sw/source unotools/inc unotools/source

Noel Grandin noel at peralex.com
Wed Mar 6 22:25:21 PST 2013


 basic/source/classes/eventatt.cxx                                      |   45 -
 codemaker/source/cppumaker/cpputype.cxx                                |   10 
 cui/source/customize/acccfg.cxx                                        |   40 -
 dbaccess/source/core/dataaccess/databasedocument.cxx                   |   61 +-
 dbaccess/source/core/dataaccess/databasedocument.hxx                   |   11 
 desktop/source/deployment/registry/sfwk/dp_sfwk.cxx                    |   16 
 desktop/source/migration/migration.cxx                                 |   11 
 extensions/source/abpilot/unodialogabp.cxx                             |   13 
 extensions/source/abpilot/unodialogabp.hxx                             |    3 
 framework/inc/framework/configimporter.hxx                             |    4 
 framework/inc/services.h                                               |    2 
 framework/inc/uiconfiguration/uiconfigurationmanager.hxx               |   12 
 framework/source/fwe/helper/configimporter.cxx                         |    2 
 framework/source/uiconfiguration/uiconfigurationmanager.cxx            |   39 -
 idlc/source/errorhandler.cxx                                           |    2 
 offapi/UnoApi_offapi.mk                                                |    9 
 offapi/com/sun/star/drawing/ModuleDispatcher.idl                       |   38 +
 offapi/com/sun/star/script/provider/MasterScriptProviderFactory.idl    |   19 
 offapi/com/sun/star/script/provider/theMasterScriptProviderFactory.idl |   43 +
 offapi/com/sun/star/text/ModuleDispatcher.idl                          |   38 +
 offapi/com/sun/star/ui/UIConfigurationManager.idl                      |   38 -
 offapi/com/sun/star/ui/XUIConfigurationManager2.idl                    |   70 ++
 offapi/com/sun/star/ui/dialogs/AddressBookSourcePilot.idl              |   43 +
 reportdesign/inc/ReportDefinition.hxx                                  |    3 
 reportdesign/source/core/api/ReportDefinition.cxx                      |   21 
 sc/CppunitTest_sc_annotationobj.mk                                     |    1 
 sc/CppunitTest_sc_annotationsobj.mk                                    |    1 
 sc/CppunitTest_sc_cellrangeobj.mk                                      |    1 
 sc/CppunitTest_sc_databaserangeobj.mk                                  |    1 
 sc/CppunitTest_sc_datapilotfieldobj.mk                                 |    1 
 sc/CppunitTest_sc_datapilottableobj.mk                                 |    1 
 sc/CppunitTest_sc_filters_test.mk                                      |    1 
 sc/CppunitTest_sc_macros_test.mk                                       |    1 
 sc/CppunitTest_sc_modelobj.mk                                          |    1 
 sc/CppunitTest_sc_namedrangeobj.mk                                     |    1 
 sc/CppunitTest_sc_namedrangesobj.mk                                    |    1 
 sc/CppunitTest_sc_outlineobj.mk                                        |    1 
 sc/CppunitTest_sc_subsequent_export_test.mk                            |    1 
 sc/CppunitTest_sc_tablesheetobj.mk                                     |    1 
 sc/CppunitTest_sc_tablesheetsobj.mk                                    |    1 
 scripting/source/dlgprov/dlgevtatt.cxx                                 |   19 
 scripting/source/protocolhandler/scripthandler.cxx                     |   23 
 scripting/source/protocolhandler/scripthandler.hxx                     |    6 
 scripting/source/provider/BrowseNodeFactoryImpl.cxx                    |    9 
 scripting/source/provider/MasterScriptProvider.cxx                     |   12 
 sfx2/inc/guisaveas.hxx                                                 |    5 
 sfx2/inc/sfx2/sfxbasemodel.hxx                                         |    2 
 sfx2/source/appl/appserv.cxx                                           |  106 +---
 sfx2/source/control/request.cxx                                        |    6 
 sfx2/source/dialog/mailmodel.cxx                                       |  236 +++++-----
 sfx2/source/dialog/taskpane.cxx                                        |    9 
 sfx2/source/doc/SfxDocumentMetaData.cxx                                |   70 +-
 sfx2/source/doc/docfile.cxx                                            |   54 --
 sfx2/source/doc/doctempl.cxx                                           |   11 
 sfx2/source/doc/doctemplates.cxx                                       |   48 --
 sfx2/source/doc/guisaveas.cxx                                          |   30 -
 sfx2/source/doc/objmisc.cxx                                            |   21 
 sfx2/source/doc/objserv.cxx                                            |    3 
 sfx2/source/doc/sfxbasemodel.cxx                                       |  155 +++---
 sfx2/source/inc/sfxurlrelocator.hxx                                    |    5 
 sfx2/source/view/ipclient.cxx                                          |    3 
 svtools/inc/svtools/addresstemplate.hxx                                |    7 
 svtools/source/dialogs/addresstemplate.cxx                             |   27 -
 svtools/source/uno/addrtempuno.cxx                                     |    4 
 sw/CppunitTest_sw_filters_test.mk                                      |    1 
 sw/CppunitTest_sw_subsequent_odfexport.mk                              |    1 
 sw/CppunitTest_sw_subsequent_odfimport.mk                              |    1 
 sw/CppunitTest_sw_subsequent_ooxmlexport.mk                            |    1 
 sw/CppunitTest_sw_subsequent_ooxmlimport.mk                            |    1 
 sw/CppunitTest_sw_subsequent_rtfexport.mk                              |    1 
 sw/CppunitTest_sw_subsequent_ww8export.mk                              |    1 
 sw/source/ui/app/docsh2.cxx                                            |   93 +--
 unotools/inc/unotools/confignode.hxx                                   |    2 
 unotools/source/config/confignode.cxx                                  |    8 
 74 files changed, 848 insertions(+), 741 deletions(-)

New commits:
commit 8c31a6baf06e711d5e45d477abedfa6afb7ffe51
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 5 15:51:52 2013 +0200

    fdo#46808 use document::DocumentRevisionListPersistence constructor
    
    Change-Id: I1a591ec4061c73657c26552d41c58b970696038f

diff --git a/sc/CppunitTest_sc_annotationobj.mk b/sc/CppunitTest_sc_annotationobj.mk
index 7f8b933..29fe221 100644
--- a/sc/CppunitTest_sc_annotationobj.mk
+++ b/sc/CppunitTest_sc_annotationobj.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_annotationobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_annotationobj))
diff --git a/sc/CppunitTest_sc_annotationsobj.mk b/sc/CppunitTest_sc_annotationsobj.mk
index 5304cd6..0a77e00 100644
--- a/sc/CppunitTest_sc_annotationsobj.mk
+++ b/sc/CppunitTest_sc_annotationsobj.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_annotationsobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_annotationsobj))
diff --git a/sc/CppunitTest_sc_cellrangeobj.mk b/sc/CppunitTest_sc_cellrangeobj.mk
index 4f1aaf3..4175bb6 100644
--- a/sc/CppunitTest_sc_cellrangeobj.mk
+++ b/sc/CppunitTest_sc_cellrangeobj.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_cellrangesbase,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_cellrangesbase))
diff --git a/sc/CppunitTest_sc_databaserangeobj.mk b/sc/CppunitTest_sc_databaserangeobj.mk
index 7d61673..e08fd4b 100644
--- a/sc/CppunitTest_sc_databaserangeobj.mk
+++ b/sc/CppunitTest_sc_databaserangeobj.mk
@@ -118,6 +118,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_databaserangeobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_databaserangeobj))
diff --git a/sc/CppunitTest_sc_datapilotfieldobj.mk b/sc/CppunitTest_sc_datapilotfieldobj.mk
index 74ced87..453028b 100644
--- a/sc/CppunitTest_sc_datapilotfieldobj.mk
+++ b/sc/CppunitTest_sc_datapilotfieldobj.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_datapilotfieldobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_datapilotfieldobj))
diff --git a/sc/CppunitTest_sc_datapilottableobj.mk b/sc/CppunitTest_sc_datapilottableobj.mk
index ce86c01..fda5431 100644
--- a/sc/CppunitTest_sc_datapilottableobj.mk
+++ b/sc/CppunitTest_sc_datapilottableobj.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_datapilottableobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_datapilottableobj))
diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk
index 59b577a..291262c 100644
--- a/sc/CppunitTest_sc_filters_test.mk
+++ b/sc/CppunitTest_sc_filters_test.mk
@@ -129,6 +129,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_filters_test,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_filters_test))
diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk
index 66dd619..f989dcf 100644
--- a/sc/CppunitTest_sc_macros_test.mk
+++ b/sc/CppunitTest_sc_macros_test.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_macros_test,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_macros_test))
diff --git a/sc/CppunitTest_sc_modelobj.mk b/sc/CppunitTest_sc_modelobj.mk
index 9f8308f..64071ca 100644
--- a/sc/CppunitTest_sc_modelobj.mk
+++ b/sc/CppunitTest_sc_modelobj.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_modelobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_modelobj))
diff --git a/sc/CppunitTest_sc_namedrangeobj.mk b/sc/CppunitTest_sc_namedrangeobj.mk
index b9acb35..33adc3e 100644
--- a/sc/CppunitTest_sc_namedrangeobj.mk
+++ b/sc/CppunitTest_sc_namedrangeobj.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_namedrangeobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_namedrangeobj))
diff --git a/sc/CppunitTest_sc_namedrangesobj.mk b/sc/CppunitTest_sc_namedrangesobj.mk
index 0d80f8d..7650a4c 100644
--- a/sc/CppunitTest_sc_namedrangesobj.mk
+++ b/sc/CppunitTest_sc_namedrangesobj.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_namedrangesobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_namedrangesobj))
diff --git a/sc/CppunitTest_sc_outlineobj.mk b/sc/CppunitTest_sc_outlineobj.mk
index c43dc51..0f18fee 100644
--- a/sc/CppunitTest_sc_outlineobj.mk
+++ b/sc/CppunitTest_sc_outlineobj.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_outlineobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_outlineobj))
diff --git a/sc/CppunitTest_sc_subsequent_export_test.mk b/sc/CppunitTest_sc_subsequent_export_test.mk
index d64832d..23caa57 100644
--- a/sc/CppunitTest_sc_subsequent_export_test.mk
+++ b/sc/CppunitTest_sc_subsequent_export_test.mk
@@ -124,6 +124,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\
     unoxml/source/service/unoxml \
     xmlsecurity/util/xsec_fw \
     xmlsecurity/util/xmlsecurity \
+    xmloff/util/xo \
 ))
 
 ifeq ($(OS),WNT)
diff --git a/sc/CppunitTest_sc_tablesheetobj.mk b/sc/CppunitTest_sc_tablesheetobj.mk
index efa20b6..98fc139 100644
--- a/sc/CppunitTest_sc_tablesheetobj.mk
+++ b/sc/CppunitTest_sc_tablesheetobj.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_spreadsheetobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_spreadsheetobj))
diff --git a/sc/CppunitTest_sc_tablesheetsobj.mk b/sc/CppunitTest_sc_tablesheetsobj.mk
index 2244f13..8b472bc 100644
--- a/sc/CppunitTest_sc_tablesheetsobj.mk
+++ b/sc/CppunitTest_sc_tablesheetsobj.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_spreadsheetsobj,\
     unotools/util/utl \
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_spreadsheetsobj))
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 453a87a..9a59673 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -111,6 +111,7 @@ using namespace ::com::sun::star::io;
 #include <sot/stg.hxx>
 #include <unotools/saveopt.hxx>
 #include <svl/documentlockfile.hxx>
+#include <com/sun/star/document/DocumentRevisionListPersistence.hpp>
 
 #include "helper.hxx"
 #include <sfx2/request.hxx>      // SFX_ITEMSET_SET
@@ -3101,17 +3102,14 @@ const uno::Sequence < util::RevisionTag >& SfxMedium::GetVersionList( bool _bNoR
     if ( ( !_bNoReload || !pImp->m_bVersionsAlreadyLoaded ) && !pImp->aVersions.getLength() &&
          ( !pImp->m_aName.isEmpty() || !pImp->m_aLogicName.isEmpty() ) && GetStorage().is() )
     {
-        uno::Reference < document::XDocumentRevisionListPersistence > xReader( comphelper::getProcessServiceFactory()->createInstance(
-                ::rtl::OUString("com.sun.star.document.DocumentRevisionListPersistence") ), uno::UNO_QUERY );
-        if ( xReader.is() )
+        uno::Reference < document::XDocumentRevisionListPersistence > xReader =
+                document::DocumentRevisionListPersistence::create( comphelper::getProcessComponentContext() );
+        try
+        {
+            pImp->aVersions = xReader->load( GetStorage() );
+        }
+        catch ( const uno::Exception& )
         {
-            try
-            {
-                pImp->aVersions = xReader->load( GetStorage() );
-            }
-            catch ( const uno::Exception& )
-            {
-            }
         }
     }
 
@@ -3123,17 +3121,14 @@ const uno::Sequence < util::RevisionTag >& SfxMedium::GetVersionList( bool _bNoR
 
 uno::Sequence < util::RevisionTag > SfxMedium::GetVersionList( const uno::Reference < embed::XStorage >& xStorage )
 {
-    uno::Reference < document::XDocumentRevisionListPersistence > xReader( comphelper::getProcessServiceFactory()->createInstance(
-            ::rtl::OUString("com.sun.star.document.DocumentRevisionListPersistence") ), uno::UNO_QUERY );
-    if ( xReader.is() )
+    uno::Reference < document::XDocumentRevisionListPersistence > xReader =
+        document::DocumentRevisionListPersistence::create( comphelper::getProcessComponentContext() );
+    try
+    {
+        return xReader->load( xStorage );
+    }
+    catch ( const uno::Exception& )
     {
-        try
-        {
-            return xReader->load( xStorage );
-        }
-        catch ( const uno::Exception& )
-        {
-        }
     }
 
     return uno::Sequence < util::RevisionTag >();
@@ -3210,18 +3205,15 @@ sal_Bool SfxMedium::SaveVersionList_Impl( sal_Bool /*bUseXML*/ )
         if ( !pImp->aVersions.getLength() )
             return true;
 
-        uno::Reference < document::XDocumentRevisionListPersistence > xWriter( comphelper::getProcessServiceFactory()->createInstance(
-                ::rtl::OUString("com.sun.star.document.DocumentRevisionListPersistence") ), uno::UNO_QUERY );
-        if ( xWriter.is() )
+        uno::Reference < document::XDocumentRevisionListPersistence > xWriter =
+                 document::DocumentRevisionListPersistence::create( comphelper::getProcessComponentContext() );
+        try
+        {
+            xWriter->store( GetStorage(), pImp->aVersions );
+            return true;
+        }
+        catch ( const uno::Exception& )
         {
-            try
-            {
-                xWriter->store( GetStorage(), pImp->aVersions );
-                return true;
-            }
-            catch ( const uno::Exception& )
-            {
-            }
         }
     }
 
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index ef0dd02..b9f04fa 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -1846,7 +1846,7 @@ sal_Bool getTextProperty_Impl( Content& rContent,
 
         if ( SfxURLRelocator_Impl::propertyCanContainOfficeDir( rPropName ) )
         {
-            SfxURLRelocator_Impl aRelocImpl( ::comphelper::getProcessServiceFactory() );
+            SfxURLRelocator_Impl aRelocImpl( ::comphelper::getProcessComponentContext() );
             aRelocImpl.makeAbsoluteURL( rPropValue );
         }
 
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 9251b5f..b067332 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -176,7 +176,7 @@ public:
 
 class SfxDocTplService_Impl
 {
-    uno::Reference< XMultiServiceFactory >           mxFactory;
+    uno::Reference< XComponentContext >              mxContext;
     uno::Reference< XCommandEnvironment >            maCmdEnv;
     uno::Reference< XDocumentProperties>             m_xDocProps;
     uno::Reference< XTypeDetection >                 mxType;
@@ -268,7 +268,7 @@ class SfxDocTplService_Impl
     void                        updateData( DocTemplates_EntryData_Impl *pData );
 
 public:
-                                 SfxDocTplService_Impl( uno::Reference< XMultiServiceFactory > xFactory );
+                                 SfxDocTplService_Impl( const uno::Reference< XComponentContext > & xContext );
                                 ~SfxDocTplService_Impl();
 
     sal_Bool                    init() { if ( !mbIsInitialized ) init_Impl(); return mbIsInitialized; }
@@ -451,7 +451,7 @@ void SfxDocTplService_Impl::init_Impl()
         }
 
         OUString const aService = OUString( SERVICENAME_TYPEDETECTION  );
-        mxType = uno::Reference< XTypeDetection > ( mxFactory->createInstance( aService ), UNO_QUERY );
+        mxType = uno::Reference< XTypeDetection > ( mxContext->getServiceManager()->createInstanceWithContext(aService, mxContext), UNO_QUERY );
 
         getDirList();
         readFolderList();
@@ -580,9 +580,7 @@ void SfxDocTplService_Impl::getDirList()
 
     maTemplateDirs = Sequence< OUString >( nCount );
 
-    uno::Reference< XComponentContext > xCtx(
-        comphelper::getComponentContext( mxFactory ) );
-    uno::Reference< util::XMacroExpander > xExpander = util::theMacroExpander::get(xCtx);
+    uno::Reference< util::XMacroExpander > xExpander = util::theMacroExpander::get(mxContext);
     const rtl::OUString aPrefix(
         "vnd.sun.star.expand:"  );
 
@@ -1122,10 +1120,10 @@ bool SfxURLRelocator_Impl::propertyCanContainOfficeDir(
 // public SfxDocTplService_Impl
 //-----------------------------------------------------------------------------
 
-SfxDocTplService_Impl::SfxDocTplService_Impl( uno::Reference< XMultiServiceFactory > xFactory )
-: maRelocator( xFactory )
+SfxDocTplService_Impl::SfxDocTplService_Impl( const uno::Reference< XComponentContext > & xContext )
+: maRelocator( xContext )
 {
-    mxFactory       = xFactory;
+    mxContext       = xContext;
     mpUpdater       = NULL;
     mbIsInitialized = sal_False;
     mbLocaleSet     = sal_False;
@@ -1290,7 +1288,7 @@ uno::Sequence< beans::StringPair > SfxDocTplService_Impl::ReadUINamesForTemplate
         {
             uno::Reference< io::XInputStream > xLocStream = aLocContent.openStream();
             if ( xLocStream.is() )
-                aUINames = DocTemplLocaleHelper::ReadGroupLocalizationSequence( xLocStream, comphelper::getComponentContext(mxFactory) );
+                aUINames = DocTemplLocaleHelper::ReadGroupLocalizationSequence( xLocStream, mxContext );
         }
         catch( uno::Exception& )
         {}
@@ -1378,7 +1376,7 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU
     sal_Bool bResult = sal_False;
     try {
         uno::Reference< beans::XPropertySet > xTempFile(
-                io::TempFile::create(comphelper::getComponentContext(mxFactory)),
+                io::TempFile::create(mxContext),
                 uno::UNO_QUERY_THROW );
 
         ::rtl::OUString aTempURL;
@@ -1390,7 +1388,7 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU
         if ( !xOutStream.is() )
             throw uno::RuntimeException();
 
-        DocTemplLocaleHelper::WriteGroupLocalizationSequence( xOutStream, aUINames, comphelper::getComponentContext(mxFactory));
+        DocTemplLocaleHelper::WriteGroupLocalizationSequence( xOutStream, aUINames, mxContext);
         try {
             // the SAX writer might close the stream
             xOutStream->closeOutput();
@@ -2212,7 +2210,7 @@ SFX_IMPL_SINGLEFACTORY( SfxDocTplService )
 //-----------------------------------------------------------------------------
 SfxDocTplService::SfxDocTplService( const uno::Reference< XMultiServiceFactory >& xFactory )
 {
-    pImp = new SfxDocTplService_Impl( xFactory );
+    pImp = new SfxDocTplService_Impl( comphelper::getComponentContext(xFactory) );
 }
 
 //-----------------------------------------------------------------------------
@@ -2806,8 +2804,8 @@ DocTemplates_EntryData_Impl::DocTemplates_EntryData_Impl( const OUString& rTitle
 }
 
 // -----------------------------------------------------------------------
-SfxURLRelocator_Impl::SfxURLRelocator_Impl( uno::Reference< XMultiServiceFactory > xFactory )
-: mxFactory( xFactory )
+SfxURLRelocator_Impl::SfxURLRelocator_Impl( const uno::Reference< XComponentContext > & xContext )
+: mxContext( xContext )
 {
 }
 
@@ -2824,12 +2822,9 @@ void SfxURLRelocator_Impl::initOfficeInstDirs()
         osl::MutexGuard aGuard( maMutex );
         if ( !mxOfficeInstDirs.is() )
         {
-            OSL_ENSURE( mxFactory.is(), "No service manager!" );
+            OSL_ENSURE( mxContext.is(), "No service manager!" );
 
-            uno::Reference< XComponentContext > xCtx(
-                comphelper::getComponentContext( mxFactory ) );
-
-            mxOfficeInstDirs = theOfficeInstallationDirectories::get(xCtx);
+            mxOfficeInstDirs = theOfficeInstallationDirectories::get(mxContext);
         }
     }
 }
@@ -2846,8 +2841,7 @@ void SfxURLRelocator_Impl::implExpandURL( ::rtl::OUString& io_url )
     {
         if ( !mxMacroExpander.is() )
         {
-            ::comphelper::ComponentContext aContext( mxFactory );
-            mxMacroExpander.set( theMacroExpander::get(aContext.getUNOContext()), UNO_QUERY_THROW );
+            mxMacroExpander.set( theMacroExpander::get(mxContext), UNO_QUERY_THROW );
         }
         io_url = mxMacroExpander->expandMacros( io_url );
     }
diff --git a/sfx2/source/inc/sfxurlrelocator.hxx b/sfx2/source/inc/sfxurlrelocator.hxx
index 031ca66..1406d60 100644
--- a/sfx2/source/inc/sfxurlrelocator.hxx
+++ b/sfx2/source/inc/sfxurlrelocator.hxx
@@ -20,7 +20,6 @@
 #ifndef _SFX_SFXURLRELOCATOR_HXX_
 #define _SFX_SFXURLRELOCATOR_HXX_
 
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
 #include <com/sun/star/util/XMacroExpander.hpp>
 
@@ -30,7 +29,7 @@
 class SfxURLRelocator_Impl
 {
     ::osl::Mutex maMutex;
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >           mxFactory;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >               mxContext;
     ::com::sun::star::uno::Reference< ::com::sun::star::util::XOfficeInstallationDirectories > mxOfficeInstDirs;
     ::com::sun::star::uno::Reference< ::com::sun::star::util::XMacroExpander >                 mxMacroExpander;
 
@@ -40,7 +39,7 @@ public:
     void                        makeRelocatableURL( rtl::OUString & rURL );
     void                        makeAbsoluteURL( rtl::OUString & rURL );
 
-    SfxURLRelocator_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory );
+    SfxURLRelocator_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext );
     ~SfxURLRelocator_Impl();
 
 private:
diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk
index 23e8e75..8e482d2 100644
--- a/sw/CppunitTest_sw_filters_test.mk
+++ b/sw/CppunitTest_sw_filters_test.mk
@@ -92,6 +92,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\
     unoxml/source/service/unoxml \
 	$(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
 	xmloff/source/transform/xof \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_filters_test))
diff --git a/sw/CppunitTest_sw_subsequent_odfexport.mk b/sw/CppunitTest_sw_subsequent_odfexport.mk
index 14ebcf1..36fad9b 100644
--- a/sw/CppunitTest_sw_subsequent_odfexport.mk
+++ b/sw/CppunitTest_sw_subsequent_odfexport.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_odfexport,\
     unoxml/source/service/unoxml \
     uui/util/uui \
     $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_subsequent_odfexport))
diff --git a/sw/CppunitTest_sw_subsequent_odfimport.mk b/sw/CppunitTest_sw_subsequent_odfimport.mk
index 5c22725..30c2e47 100644
--- a/sw/CppunitTest_sw_subsequent_odfimport.mk
+++ b/sw/CppunitTest_sw_subsequent_odfimport.mk
@@ -90,6 +90,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_odfimport,\
     unoxml/source/service/unoxml \
     uui/util/uui \
 	$(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_subsequent_odfimport))
diff --git a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk
index 868001a..bc58ee9 100644
--- a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk
+++ b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk
@@ -95,6 +95,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ooxmlexport,\
     unotools/util/utl \
     unoxml/source/service/unoxml \
     writerfilter/util/writerfilter \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_subsequent_ooxmlexport))
diff --git a/sw/CppunitTest_sw_subsequent_ooxmlimport.mk b/sw/CppunitTest_sw_subsequent_ooxmlimport.mk
index 567e8c7..016aba3 100644
--- a/sw/CppunitTest_sw_subsequent_ooxmlimport.mk
+++ b/sw/CppunitTest_sw_subsequent_ooxmlimport.mk
@@ -92,6 +92,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ooxmlimport,\
     unotools/util/utl \
     unoxml/source/service/unoxml \
     writerfilter/util/writerfilter \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_subsequent_ooxmlimport))
diff --git a/sw/CppunitTest_sw_subsequent_rtfexport.mk b/sw/CppunitTest_sw_subsequent_rtfexport.mk
index 94c9445..6017d14 100644
--- a/sw/CppunitTest_sw_subsequent_rtfexport.mk
+++ b/sw/CppunitTest_sw_subsequent_rtfexport.mk
@@ -92,6 +92,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_rtfexport,\
     unotools/util/utl \
     unoxml/source/service/unoxml \
     writerfilter/util/writerfilter \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_subsequent_rtfexport))
diff --git a/sw/CppunitTest_sw_subsequent_ww8export.mk b/sw/CppunitTest_sw_subsequent_ww8export.mk
index 5575c50..9513b8f 100644
--- a/sw/CppunitTest_sw_subsequent_ww8export.mk
+++ b/sw/CppunitTest_sw_subsequent_ww8export.mk
@@ -94,6 +94,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ww8export,\
     unotools/util/utl \
     unoxml/source/service/unoxml \
     $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
+    xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_subsequent_ww8export))
commit f084fc5c80ad8b57f7a22a2a5fc506f90e0e24b8
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 5 15:44:41 2013 +0200

    fdo#46808, simplify OConfigurationTreeRoot constructor
    
    .. doesn't need to take comphelper::ComponentContext as a param
    anymore, can now use Reference<XComponentContext>
    
    Change-Id: Ie5fbe0c9e8459cc612426ffa9474f955b28593e3

diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx
index 184250c..08e8642 100644
--- a/unotools/inc/unotools/confignode.hxx
+++ b/unotools/inc/unotools/confignode.hxx
@@ -249,7 +249,7 @@ namespace utl
         /** creates a configuration tree for the given path in the given mode
         */
         OConfigurationTreeRoot(
-            const ::comphelper::ComponentContext& i_rContext,
+            const css::uno::Reference<css::uno::XComponentContext> & i_rContext,
             const ::rtl::OUString& i_rNodePath,
             const bool i_bUpdatable
         );
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx
index 08cc4e1..9692bb0 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -482,11 +482,11 @@ namespace utl
     namespace
     {
         //--------------------------------------------------------------------
-        Reference< XMultiServiceFactory > lcl_getConfigProvider( const ::comphelper::ComponentContext& i_rContext )
+        Reference< XMultiServiceFactory > lcl_getConfigProvider( const Reference<XComponentContext> & i_rContext )
         {
             try
             {
-                Reference< XMultiServiceFactory > xProvider = theDefaultProvider::get( i_rContext.getUNOContext() );
+                Reference< XMultiServiceFactory > xProvider = theDefaultProvider::get( i_rContext );
                 return xProvider;
             }
             catch ( const Exception& )
@@ -534,8 +534,8 @@ namespace utl
     }
 
     //------------------------------------------------------------------------
-    OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable )
-        :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
+    OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference<XComponentContext> & i_rContext, const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable )
+        :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext ),
             i_rNodePath, i_bUpdatable, -1, false ).get() )
         ,m_xCommitter()
     {
commit e721452988b54eb2e02c3885fde288be70bcf1f1
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 5 15:08:38 2013 +0200

    fdo#46808, small cleanups
    
    Change-Id: I8d34bfca5009a4a44444b19a39c6f8338614e4c4

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 1fb305a..bd813e0 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -1102,8 +1102,6 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
         {
             try
             {
-                uno::Reference< lang::XMultiServiceFactory > xSMGR =
-                    ::comphelper::getProcessServiceFactory();
                 uno::Reference< uno::XComponentContext > xContext =
                     ::comphelper::getProcessComponentContext();
                 uno::Reference< css::system::XSystemShellExecute > xSystemShell(
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index 3525f22..8170a04 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -359,11 +359,9 @@ void SfxRequest_Impl::Record
             }
         }
 
-        com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xFactory(
-                ::comphelper::getProcessServiceFactory(),
-                com::sun::star::uno::UNO_QUERY);
+        uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
 
-        uno::Reference< util::XURLTransformer > xTransform( util::URLTransformer::create( ::comphelper::getComponentContext(xFactory) ) );
+        uno::Reference< util::XURLTransformer > xTransform = util::URLTransformer::create( xContext );
 
         com::sun::star::util::URL aURL;
         aURL.Complete = aCmd;
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 6ce7a22..8522a2e 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -19,32 +19,34 @@
 
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertyAccess.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/CommandAbortedException.hpp>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/util/URLTransformer.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/system/XSimpleMailClientSupplier.hpp>
-#include <com/sun/star/system/SimpleMailClientFlags.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/document/XExporter.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/container/XContainerQuery.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/security/CertificateValidity.hpp>
 #include <com/sun/star/security/DocumentSignatureInformation.hpp>
 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/system/SimpleSystemMail.hpp>
+#include <com/sun/star/system/SimpleCommandMail.hpp>
+#include <com/sun/star/system/XSimpleMailClientSupplier.hpp>
+#include <com/sun/star/system/SimpleMailClientFlags.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/util/URLTransformer.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
 #include <rtl/textenc.h>
 #include <rtl/uri.h>
 #include <rtl/uri.hxx>
@@ -546,7 +548,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat(
             css::util::URL aPrepareURL;
             css::uno::Reference< css::frame::XDispatch > xPrepareDispatch;
             css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( xFrame, css::uno::UNO_QUERY );
-            css::uno::Reference< css::util::XURLTransformer > xURLTransformer( css::util::URLTransformer::create( ::comphelper::getComponentContext(xSMGR) ) );
+            css::uno::Reference< css::util::XURLTransformer > xURLTransformer( css::util::URLTransformer::create( xContext ) );
             if( !bSendAsPDF )
             {
                 try
@@ -768,133 +770,135 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
     SendMailResult  eResult = SEND_MAIL_ERROR;
     if ( !maAttachedDocuments.empty() )
     {
-        css::uno::Reference < XMultiServiceFactory > xMgr = ::comphelper::getProcessServiceFactory();
-        if ( xMgr.is() )
+        css::uno::Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+
+        css::uno::Reference< XSimpleMailClientSupplier >    xSimpleMailClientSupplier;
+
+        // Prefer the SimpleSystemMail service if available
+        try {
+            xSimpleMailClientSupplier = SimpleSystemMail::create( xContext );
+        }
+        catch ( const uno::Exception & )
+        {}
+
+        if ( ! xSimpleMailClientSupplier.is() )
         {
-            css::uno::Reference< XSimpleMailClientSupplier >    xSimpleMailClientSupplier;
+            try {
+                xSimpleMailClientSupplier = SimpleCommandMail::create( xContext );
+            }
+            catch ( const uno::Exception & )
+            {}
+        }
 
-            // Prefer the SimpleSystemMail service if available
-            xSimpleMailClientSupplier = css::uno::Reference< XSimpleMailClientSupplier >(
-                xMgr->createInstance( OUString( "com.sun.star.system.SimpleSystemMail" )),
-                UNO_QUERY );
+        if ( xSimpleMailClientSupplier.is() )
+        {
+            css::uno::Reference< XSimpleMailClient > xSimpleMailClient = xSimpleMailClientSupplier->querySimpleMailClient();
 
-            if ( ! xSimpleMailClientSupplier.is() )
+            if ( !xSimpleMailClient.is() )
             {
-                xSimpleMailClientSupplier = css::uno::Reference< XSimpleMailClientSupplier >(
-                    xMgr->createInstance( OUString( "com.sun.star.system.SimpleCommandMail" )),
-                    UNO_QUERY );
+                // no mail client support => message box!
+                return SEND_MAIL_ERROR;
             }
 
-            if ( xSimpleMailClientSupplier.is() )
+            // we have a simple mail client
+            css::uno::Reference< XSimpleMailMessage > xSimpleMailMessage = xSimpleMailClient->createSimpleMailMessage();
+            if ( xSimpleMailMessage.is() )
             {
-                css::uno::Reference< XSimpleMailClient > xSimpleMailClient = xSimpleMailClientSupplier->querySimpleMailClient();
-
-                if ( !xSimpleMailClient.is() )
+                sal_Int32 nSendFlags = SimpleMailClientFlags::DEFAULTS;
+                if ( maFromAddress.Len() == 0 )
                 {
-                    // no mail client support => message box!
-                    return SEND_MAIL_ERROR;
+                    // from address not set, try figure out users e-mail address
+                    CreateFromAddress_Impl( maFromAddress );
                 }
+                xSimpleMailMessage->setOriginator( maFromAddress );
 
-                // we have a simple mail client
-                css::uno::Reference< XSimpleMailMessage > xSimpleMailMessage = xSimpleMailClient->createSimpleMailMessage();
-                if ( xSimpleMailMessage.is() )
-                {
-                    sal_Int32 nSendFlags = SimpleMailClientFlags::DEFAULTS;
-                    if ( maFromAddress.Len() == 0 )
-                    {
-                        // from address not set, try figure out users e-mail address
-                        CreateFromAddress_Impl( maFromAddress );
-                    }
-                    xSimpleMailMessage->setOriginator( maFromAddress );
+                size_t nToCount     = mpToList ? mpToList->size() : 0;
+                size_t nCcCount     = mpCcList ? mpCcList->size() : 0;
+                size_t nCcSeqCount  = nCcCount;
 
-                    size_t nToCount     = mpToList ? mpToList->size() : 0;
-                    size_t nCcCount     = mpCcList ? mpCcList->size() : 0;
-                    size_t nCcSeqCount  = nCcCount;
+                // set recipient (only one) for this simple mail server!!
+                if ( nToCount > 1 )
+                {
+                    nCcSeqCount = nToCount - 1 + nCcCount;
+                    xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) );
+                    nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
+                }
+                else if ( nToCount == 1 )
+                {
+                    xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) );
+                    nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
+                }
 
-                    // set recipient (only one) for this simple mail server!!
-                    if ( nToCount > 1 )
-                    {
-                        nCcSeqCount = nToCount - 1 + nCcCount;
-                        xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) );
-                        nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
-                    }
-                    else if ( nToCount == 1 )
-                    {
-                        xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) );
-                        nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
-                    }
+                // all other recipient must be handled with CC recipients!
+                if ( nCcSeqCount > 0 )
+                {
+                    size_t                  nIndex = 0;
+                    Sequence< OUString >    aCcRecipientSeq;
 
-                    // all other recipient must be handled with CC recipients!
-                    if ( nCcSeqCount > 0 )
+                    aCcRecipientSeq.realloc( nCcSeqCount );
+                    if ( nCcSeqCount > nCcCount )
                     {
-                        size_t                  nIndex = 0;
-                        Sequence< OUString >    aCcRecipientSeq;
-
-                        aCcRecipientSeq.realloc( nCcSeqCount );
-                        if ( nCcSeqCount > nCcCount )
+                        for ( size_t i = 1; i < nToCount; ++i )
                         {
-                            for ( size_t i = 1; i < nToCount; ++i )
-                            {
-                                aCcRecipientSeq[nIndex++] = *mpToList->at(i);
-                            }
+                            aCcRecipientSeq[nIndex++] = *mpToList->at(i);
                         }
+                    }
 
-                        for ( size_t i = 0; i < nCcCount; i++ )
-                        {
-                            aCcRecipientSeq[nIndex++] = *mpCcList->at(i);
-                        }
-                        xSimpleMailMessage->setCcRecipient( aCcRecipientSeq );
+                    for ( size_t i = 0; i < nCcCount; i++ )
+                    {
+                        aCcRecipientSeq[nIndex++] = *mpCcList->at(i);
                     }
+                    xSimpleMailMessage->setCcRecipient( aCcRecipientSeq );
+                }
 
-                    size_t nBccCount = mpBccList ? mpBccList->size() : 0;
-                    if ( nBccCount > 0 )
+                size_t nBccCount = mpBccList ? mpBccList->size() : 0;
+                if ( nBccCount > 0 )
+                {
+                    Sequence< OUString > aBccRecipientSeq( nBccCount );
+                    for ( size_t i = 0; i < nBccCount; ++i )
                     {
-                        Sequence< OUString > aBccRecipientSeq( nBccCount );
-                        for ( size_t i = 0; i < nBccCount; ++i )
-                        {
-                            aBccRecipientSeq[i] = *mpBccList->at(i);
-                        }
-                        xSimpleMailMessage->setBccRecipient( aBccRecipientSeq );
+                        aBccRecipientSeq[i] = *mpBccList->at(i);
                     }
+                    xSimpleMailMessage->setBccRecipient( aBccRecipientSeq );
+                }
 
-                    Sequence< OUString > aAttachmentSeq(&(maAttachedDocuments[0]),maAttachedDocuments.size());
+                Sequence< OUString > aAttachmentSeq(&(maAttachedDocuments[0]),maAttachedDocuments.size());
 
-                    if ( xSimpleMailMessage->getSubject().isEmpty() ) {
-                        OUString baseName( maAttachedDocuments[0].copy( maAttachedDocuments[0].lastIndexOf( '/' ) + 1 ) );
-                        OUString subject( baseName );
-                        if ( maAttachedDocuments.size() > 1 )
-                            subject += OUString(", ...");
-                        xSimpleMailMessage->setSubject( subject );
-                    }
-                    xSimpleMailMessage->setAttachement( aAttachmentSeq );
+                if ( xSimpleMailMessage->getSubject().isEmpty() ) {
+                    OUString baseName( maAttachedDocuments[0].copy( maAttachedDocuments[0].lastIndexOf( '/' ) + 1 ) );
+                    OUString subject( baseName );
+                    if ( maAttachedDocuments.size() > 1 )
+                        subject += OUString(", ...");
+                    xSimpleMailMessage->setSubject( subject );
+                }
+                xSimpleMailMessage->setAttachement( aAttachmentSeq );
 
-                    sal_Bool bSend( sal_False );
-                    try
-                    {
-                        xSimpleMailClient->sendSimpleMailMessage( xSimpleMailMessage, nSendFlags );
-                        bSend = sal_True;
-                    }
-                    catch ( IllegalArgumentException& )
-                    {
-                    }
-                    catch ( Exception& )
-                    {
-                    }
+                sal_Bool bSend( sal_False );
+                try
+                {
+                    xSimpleMailClient->sendSimpleMailMessage( xSimpleMailMessage, nSendFlags );
+                    bSend = sal_True;
+                }
+                catch ( IllegalArgumentException& )
+                {
+                }
+                catch ( Exception& )
+                {
+                }
 
-                    if ( bSend == sal_False )
-                    {
-                        css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow();
+                if ( bSend == sal_False )
+                {
+                    css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow();
 
-                        SolarMutexGuard aGuard;
-                        Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+                    SolarMutexGuard aGuard;
+                    Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
 
-                        ErrorBox aBox( pParentWindow, SfxResId( RID_ERRBOX_MAIL_CONFIG ));
-                        aBox.Execute();
-                        eResult = SEND_MAIL_CANCELLED;
-                    }
-                    else
-                        eResult = SEND_MAIL_OK;
+                    ErrorBox aBox( pParentWindow, SfxResId( RID_ERRBOX_MAIL_CONFIG ));
+                    aBox.Execute();
+                    eResult = SEND_MAIL_CANCELLED;
                 }
+                else
+                    eResult = SEND_MAIL_OK;
             }
         }
     }
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index cdc6f22..4f44b69 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -99,11 +99,11 @@ namespace sfx2
         ::utl::OConfigurationTreeRoot lcl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier,
             const ::rtl::OUString& i_rResourceURL = ::rtl::OUString() )
         {
-            const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+            const Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
             ::rtl::OUStringBuffer aPathComposer;
             try
             {
-                const Reference< XModuleManager2 > xModuleAccess( ModuleManager::create(aContext.getUNOContext()) );
+                const Reference< XModuleManager2 > xModuleAccess( ModuleManager::create(xContext) );
                 const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) );
 
                 const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) );
@@ -121,7 +121,7 @@ namespace sfx2
             {
                 DBG_UNHANDLED_EXCEPTION();
             }
-            return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false );
+            return ::utl::OConfigurationTreeRoot( xContext, aPathComposer.makeStringAndClear(), false );
         }
 
         //--------------------------------------------------------------------------------------------------------------
@@ -382,8 +382,7 @@ namespace sfx2
     //------------------------------------------------------------------------------------------------------------------
     void CustomToolPanel::impl_updatePanelConfig( const bool i_bVisible ) const
     {
-        ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-        ::utl::OConfigurationTreeRoot aConfig( aContext, m_sPanelConfigPath, true );
+        ::utl::OConfigurationTreeRoot aConfig( ::comphelper::getProcessComponentContext(), m_sPanelConfigPath, true );
 
         aConfig.setNodeValue( "Visible", makeAny( i_bVisible ) );
         aConfig.commit();
commit e70c068ba413564067f17107b0773910ced760d1
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 5 14:58:29 2013 +0200

    fdo#46808, Convert text:: and drawing:: ModuleDispatcher service to new style
    
    The services already existing, just needed to create the IDL files
    
    Change-Id: Ifedd46722ba0bae2985e82d18827c61c1d12cd62

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3007e98..1c631a3 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -111,6 +111,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\
 	XMLOasisBasicImporter \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing,\
+	ModuleDispatcher \
 	ShapeCollection \
 	SlideRenderer \
 	SlideSorter \
@@ -3614,6 +3615,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/text,\
 	LabelFollow \
 	MailMergeEvent \
 	MailMergeType \
+	ModuleDispatcher \
 	NotePrintMode \
 	PageNumberType \
 	ParagraphVertAlign \
diff --git a/offapi/com/sun/star/drawing/ModuleDispatcher.idl b/offapi/com/sun/star/drawing/ModuleDispatcher.idl
new file mode 100644
index 0000000..454262e
--- /dev/null
+++ b/offapi/com/sun/star/drawing/ModuleDispatcher.idl
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_drawing_ModuleDispatcher_idl__
+#define __com_sun_star_drawing_ModuleDispatcher_idl__
+
+#include <com/sun/star/frame/XDispatchProvider.idl>
+
+
+ module com {  module sun {  module star {  module drawing {
+
+
+/**
+    @since LibreOffice 4.1
+ */
+service ModuleDispatcher : com::sun::star::frame::XDispatchProvider;
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/text/ModuleDispatcher.idl b/offapi/com/sun/star/text/ModuleDispatcher.idl
new file mode 100644
index 0000000..eec8b4a
--- /dev/null
+++ b/offapi/com/sun/star/text/ModuleDispatcher.idl
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_text_ModuleDispatcher_idl__
+#define __com_sun_star_text_ModuleDispatcher_idl__
+
+#include <com/sun/star/frame/XDispatchProvider.idl>
+
+
+ module com {  module sun {  module star {  module text {
+
+
+/**
+    @since LibreOffice 4.1
+ */
+service ModuleDispatcher : com::sun::star::frame::XDispatchProvider;
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 55d74f3..1fb305a 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/drawing/ModuleDispatcher.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
@@ -34,6 +35,7 @@
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 #include <com/sun/star/system/SystemShellExecuteException.hpp>
 #include <com/sun/star/task/XJobExecutor.hpp>
+#include <com/sun/star/text/ModuleDispatcher.hpp>
 #include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp>
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/util/XCloseable.hpp>
@@ -1376,26 +1378,19 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
                 return;
             }
 
-            Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
             Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-            Reference< com::sun::star::frame::XDispatchProvider > xProv(
-                xORB->createInstance( ::rtl::OUString("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY );
-
-            if ( xProv.is() )
-            {
-                ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
-                Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
-                Sequence < com::sun::star::beans::PropertyValue > aSeq;
-                if ( rReq.GetArgs() )
-                    TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
-                Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
-                ::com::sun::star::frame::DispatchResultEvent aEvent;
-                sal_Bool bSuccess = (
-                                     (aResult >>= aEvent) &&
-                                     (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS)
-                                    );
-                rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
-            }
+            Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
+
+            ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
+            Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
+            Sequence < beans::PropertyValue > aSeq;
+            if ( rReq.GetArgs() )
+                TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
+            Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
+            frame::DispatchResultEvent aEvent;
+            sal_Bool bSuccess = (aResult >>= aEvent) &&
+                                (aEvent.State == frame::DispatchResultState::SUCCESS);
+            rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
         }
         break;
 
@@ -1403,26 +1398,19 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
         case FN_BUSINESS_CARD :
         case FN_XFORMS_INIT :
         {
-            Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
             Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-            Reference< com::sun::star::frame::XDispatchProvider > xProv(
-                xORB->createInstance( ::rtl::OUString("com.sun.star.text.ModuleDispatcher")), UNO_QUERY );
-
-            if ( xProv.is() )
-            {
-                ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
-                Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
-                Sequence < com::sun::star::beans::PropertyValue > aSeq;
-                if ( rReq.GetArgs() )
-                    TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
-                Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
-                ::com::sun::star::frame::DispatchResultEvent aEvent;
-                sal_Bool bSuccess = (
-                                     (aResult >>= aEvent) &&
-                                     (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS)
-                                    );
-                rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
-            }
+            Reference< frame::XDispatchProvider > xProv = text::ModuleDispatcher::create( xContext );
+
+            ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
+            Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
+            Sequence < beans::PropertyValue > aSeq;
+            if ( rReq.GetArgs() )
+                TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
+            Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
+            frame::DispatchResultEvent aEvent;
+            sal_Bool bSuccess = (aResult >>= aEvent) &&
+                                (aEvent.State == frame::DispatchResultState::SUCCESS);
+            rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
         }
         break;
 
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index fda720c..b10260b 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -18,6 +18,7 @@
  */
 
 
+#include <com/sun/star/drawing/ModuleDispatcher.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/frame/DispatchHelper.hpp>
 
@@ -998,33 +999,29 @@ void SwDocShell::Execute(SfxRequest& rReq)
                     ErrCode eErr = aWrt.Write( xWrt );
                     if( !ERRCODE_TOERROR( eErr ) )
                     {
-                        uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
                         uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-                        uno::Reference< frame::XDispatchProvider > xProv(
-                            xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ModuleDispatcher"))), UNO_QUERY );
-                        if ( xProv.is() )
+                        uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
+
+                        ::rtl::OUString aCmd(RTL_CONSTASCII_USTRINGPARAM("SendOutlineToImpress"));
+                        uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
+                        pStrm->Seek( STREAM_SEEK_TO_END );
+                        *pStrm << '\0';
+                        pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+
+                        // Transfer ownership of stream to a lockbytes object
+                        SvLockBytes aLockBytes( pStrm, sal_True );
+                        SvLockBytesStat aStat;
+                        if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
                         {
-                            ::rtl::OUString aCmd(RTL_CONSTASCII_USTRINGPARAM("SendOutlineToImpress"));
-                            uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
-                            pStrm->Seek( STREAM_SEEK_TO_END );
-                            *pStrm << '\0';
-                            pStrm->Seek( STREAM_SEEK_TO_BEGIN );
-
-                            // Transfer ownership of stream to a lockbytes object
-                            SvLockBytes aLockBytes( pStrm, sal_True );
-                            SvLockBytesStat aStat;
-                            if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
-                            {
-                                sal_uInt32 nLen = aStat.nSize;
-                                sal_uLong nRead = 0;
-                                uno::Sequence< sal_Int8 > aSeq( nLen );
-                                aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
-
-                                uno::Sequence< beans::PropertyValue > aArgs(1);
-                                aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RtfOutline"));
-                                aArgs[0].Value <<= aSeq;
-                                xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs );
-                            }
+                            sal_uInt32 nLen = aStat.nSize;
+                            sal_uLong nRead = 0;
+                            uno::Sequence< sal_Int8 > aSeq( nLen );
+                            aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
+
+                            uno::Sequence< beans::PropertyValue > aArgs(1);
+                            aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RtfOutline"));
+                            aArgs[0].Value <<= aSeq;
+                            xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs );
                         }
                     }
                     else
@@ -1069,33 +1066,29 @@ void SwDocShell::Execute(SfxRequest& rReq)
                     pStrm->Seek( STREAM_SEEK_TO_BEGIN );
                     if ( nWhich == FN_OUTLINE_TO_IMPRESS )
                     {
-                        uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
                         uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-                        uno::Reference< frame::XDispatchProvider > xProv(
-                            xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ModuleDispatcher"))), UNO_QUERY );
-                        if ( xProv.is() )
+                        uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
+
+                        ::rtl::OUString aCmd(RTL_CONSTASCII_USTRINGPARAM("SendOutlineToImpress"));
+                        uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
+                        pStrm->Seek( STREAM_SEEK_TO_END );
+                        *pStrm << '\0';
+                        pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+
+                        // Transfer ownership of stream to a lockbytes object
+                        SvLockBytes aLockBytes( pStrm, sal_True );
+                        SvLockBytesStat aStat;
+                        if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
                         {
-                            ::rtl::OUString aCmd(RTL_CONSTASCII_USTRINGPARAM("SendOutlineToImpress"));
-                            uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
-                            pStrm->Seek( STREAM_SEEK_TO_END );
-                            *pStrm << '\0';
-                            pStrm->Seek( STREAM_SEEK_TO_BEGIN );
-
-                            // Transfer ownership of stream to a lockbytes object
-                            SvLockBytes aLockBytes( pStrm, sal_True );
-                            SvLockBytesStat aStat;
-                            if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
-                            {
-                                sal_uInt32 nLen = aStat.nSize;
-                                sal_uLong nRead = 0;
-                                uno::Sequence< sal_Int8 > aSeq( nLen );
-                                aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
-
-                                uno::Sequence< beans::PropertyValue > aArgs(1);
-                                aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RtfOutline"));
-                                aArgs[0].Value <<= aSeq;
-                                xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs );
-                            }
+                            sal_uInt32 nLen = aStat.nSize;
+                            sal_uLong nRead = 0;
+                            uno::Sequence< sal_Int8 > aSeq( nLen );
+                            aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
+
+                            uno::Sequence< beans::PropertyValue > aArgs(1);
+                            aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RtfOutline"));
+                            aArgs[0].Value <<= aSeq;
+                            xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs );
                         }
                     }
                     else
commit 30caf94d816dfcf9a5bc8cb5198c977d7021c369
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 5 14:17:14 2013 +0200

    fdo#46808, Convert ui::dialogs::AddressBookSourceDialog to new style
    
    The service already existed, it just needed an IDL file.
    
    Change-Id: I6b9a5a5fd02985bfdd29bb42f032265d0b5498c7

diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx
index 1626d39..797bae2 100644
--- a/extensions/source/abpilot/unodialogabp.cxx
+++ b/extensions/source/abpilot/unodialogabp.cxx
@@ -34,6 +34,7 @@ namespace abp
 {
 //.........................................................................
 
+    using namespace ::com::sun::star;
     using namespace ::com::sun::star::uno;
     using namespace ::com::sun::star::lang;
     using namespace ::com::sun::star::beans;
@@ -147,6 +148,18 @@ namespace abp
         return new ::cppu::OPropertyArrayHelper(aProps);
     }
 
+    void SAL_CALL OABSPilotUno::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException)
+    {
+        Reference<awt::XWindow> xParentWindow;
+        if (aArguments.getLength() == 1 && (aArguments[0] >>= xParentWindow) ) {
+            Sequence< Any > aNewArgs(1);
+            aNewArgs[0] <<= PropertyValue( ::rtl::OUString("ParentWindow"), 0, makeAny(xParentWindow), PropertyState_DIRECT_VALUE );
+            OGenericUnoDialog::initialize(aNewArgs);
+        } else {
+            OGenericUnoDialog::initialize(aArguments);
+        }
+    }
+
     //--------------------------------------------------------------------------
     Dialog* OABSPilotUno::createDialog(Window* _pParent)
     {
diff --git a/extensions/source/abpilot/unodialogabp.hxx b/extensions/source/abpilot/unodialogabp.hxx
index 189e986..ccfcb4e 100644
--- a/extensions/source/abpilot/unodialogabp.hxx
+++ b/extensions/source/abpilot/unodialogabp.hxx
@@ -78,6 +78,9 @@ namespace abp
         // XJob
         virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
 
+        // XInitialisation
+        virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
         using OABSPilotUno_DBase::execute;
     protected:
     // OGenericUnoDialog overridables
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 99f19c4..3007e98 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -357,6 +357,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\
 	WindowStateConfiguration \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui/dialogs,\
+	AddressBookSourcePilot \
 	FilePicker \
 	FolderPicker \
 	Wizard \
diff --git a/offapi/com/sun/star/ui/dialogs/AddressBookSourcePilot.idl b/offapi/com/sun/star/ui/dialogs/AddressBookSourcePilot.idl
new file mode 100644
index 0000000..6e3668c
--- /dev/null
+++ b/offapi/com/sun/star/ui/dialogs/AddressBookSourcePilot.idl
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __com_sun_star_ui_dialogs_AddressBookSourcePilot_idl__
+#define __com_sun_star_ui_dialogs_AddressBookSourcePilot_idl__
+
+#include <com/sun/star/awt/XWindow.idl>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.idl>
+
+
+module com { module sun { module star { module ui { module dialogs {
+
+/**
+    @since LibreOffice 4.1
+*/
+service AddressBookSourcePilot : XExecutableDialog
+{
+    createWithParent([in] com::sun::star::awt::XWindow ParentWindow);
+};
+
+
+}; }; }; }; };
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 97ebdc4..55d74f3 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -17,27 +17,27 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/DispatchResultEvent.hpp>
 #include <com/sun/star/frame/DispatchResultState.hpp>
-#include <com/sun/star/task/XJobExecutor.hpp>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 #include <com/sun/star/frame/DispatchHelper.hpp>
 #include <com/sun/star/frame/XDesktop.hpp>
 #include <com/sun/star/frame/XFramesSupplier.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/util/CloseVetoException.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
-#include <com/sun/star/document/XEmbeddedScripts.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
 #include <com/sun/star/system/SystemShellExecute.hpp>
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 #include <com/sun/star/system/SystemShellExecuteException.hpp>
-#include <com/sun/star/sdbc/DriverManager.hpp>
+#include <com/sun/star/task/XJobExecutor.hpp>
+#include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/util/CloseVetoException.hpp>
 #include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
 
 #include <com/sun/star/frame/XComponentLoader.hpp>
@@ -602,7 +602,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 
         case SID_TEMPLATE_ADDRESSBOKSOURCE:
         {
-            svt::AddressBookSourceDialog aDialog(GetTopWindow(), ::comphelper::getProcessServiceFactory());
+            svt::AddressBookSourceDialog aDialog(GetTopWindow(), ::comphelper::getProcessComponentContext());
             aDialog.Execute();
             bDone = true;
             break;
@@ -1428,20 +1428,16 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
 
         case SID_ADDRESS_DATA_SOURCE:
         {
-            ::rtl::OUString sDialogServiceName( "com.sun.star.ui.dialogs.AddressBookSourcePilot"  );
             try
             {
-                Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
-                Reference< com::sun::star::ui::dialogs::XExecutableDialog > xDialog;
-                if (xORB.is())
-                    xDialog = Reference< com::sun::star::ui::dialogs::XExecutableDialog >(xORB->createInstance(sDialogServiceName), UNO_QUERY);
-                if (xDialog.is())
-                    xDialog->execute();
-                else
-                    ShowServiceNotAvailableError(NULL, sDialogServiceName, sal_True);
+                Reference< uno::XComponentContext > xORB = ::comphelper::getProcessComponentContext();
+                Reference< ui::dialogs::XExecutableDialog > xDialog;
+                xDialog = ui::dialogs::AddressBookSourcePilot::createWithParent(xORB, 0);
+                xDialog->execute();
             }
-            catch(::com::sun::star::uno::Exception&)
+            catch(const ::com::sun::star::uno::Exception&)
             {
+                DBG_UNHANDLED_EXCEPTION();
             }
         }
         break;
diff --git a/svtools/inc/svtools/addresstemplate.hxx b/svtools/inc/svtools/addresstemplate.hxx
index 7d716f6..c5e93c1 100644
--- a/svtools/inc/svtools/addresstemplate.hxx
+++ b/svtools/inc/svtools/addresstemplate.hxx
@@ -29,7 +29,6 @@
 #include <vcl/lstbox.hxx>
 #include <vcl/scrbar.hxx>
 #include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/util/AliasProgrammaticPair.hpp>
 #include <com/sun/star/sdb/XDatabaseContext.hpp>
 #include <com/sun/star/sdbc/XDataSource.hpp>
@@ -70,7 +69,7 @@ namespace svt
         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
                         m_xDatabaseContext;
         // the ORB for creating objects
-        ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
                         m_xORB;
         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
                         m_xCurrentDatasourceTables;
@@ -80,7 +79,7 @@ namespace svt
 
     public:
         AddressBookSourceDialog( Window* _pParent,
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
+            const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB );
 
         /** if you use this ctor, the dialog
             <ul><li>will not store it's data in the configuration (nor initially retrieve it from there)</li>
@@ -102,7 +101,7 @@ namespace svt
                 obtained from <arg>_rxTransientDS</arg>
         */
         AddressBookSourceDialog( Window* _pParent,
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+            const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB,
             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _rxTransientDS,
             const ::rtl::OUString& _rDataSourceName,
             const ::rtl::OUString& _rTable,
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index c0c8471..2865e99 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -34,7 +34,7 @@
 #include <vcl/waitobj.hxx>
 #include <vcl/msgbox.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -562,7 +562,7 @@ void AssignmentPersistentData::Commit()
 
     // -------------------------------------------------------------------
     AddressBookSourceDialog::AddressBookSourceDialog(Window* _pParent,
-            const Reference< XMultiServiceFactory >& _rxORB )
+            const Reference< XComponentContext >& _rxORB )
         :INIT_FIELDS()
         ,m_pImpl( new AddressBookSourceDialogData )
     {
@@ -570,7 +570,7 @@ void AssignmentPersistentData::Commit()
     }
 
     // -------------------------------------------------------------------
-    AddressBookSourceDialog::AddressBookSourceDialog( Window* _pParent, const Reference< XMultiServiceFactory >& _rxORB,
+    AddressBookSourceDialog::AddressBookSourceDialog( Window* _pParent, const Reference< XComponentContext >& _rxORB,
         const Reference< XDataSource >& _rxTransientDS, const ::rtl::OUString& _rDataSourceName,
         const ::rtl::OUString& _rTable, const Sequence< AliasProgrammaticPair >& _rMapping )
         :INIT_FIELDS()
@@ -791,9 +791,9 @@ void AssignmentPersistentData::Commit()
 
             try
             {
-                m_xDatabaseContext = DatabaseContext::create(comphelper::getComponentContext(m_xORB));
+                m_xDatabaseContext = DatabaseContext::create(m_xORB);
             }
-            catch(Exception&) { }
+            catch(const Exception&) { }
             if (!m_xDatabaseContext.is())
             {
                 const rtl::OUString sContextServiceName("com.sun.star.sdb.DatabaseContext");
@@ -842,10 +842,10 @@ void AssignmentPersistentData::Commit()
         try
         {
             xHandler.set(
-                InteractionHandler::createWithParent(comphelper::getComponentContext(m_xORB), 0),
+                InteractionHandler::createWithParent(m_xORB, 0),
                 UNO_QUERY_THROW );
         }
-        catch(Exception&) { }
+        catch(const Exception&) { }
         if (!xHandler.is())
         {
             const rtl::OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler");
@@ -1212,21 +1212,16 @@ void AssignmentPersistentData::Commit()
     // -------------------------------------------------------------------
     IMPL_LINK_NOARG(AddressBookSourceDialog, OnAdministrateDatasources)
     {
-        // collect some initial arguments for the dialog
-        Sequence< Any > aArgs(1);
-        aArgs[0] <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")), 0, makeAny(VCLUnoHelper::GetInterface(this)), PropertyState_DIRECT_VALUE);
-
         // create the dialog object
-        const rtl::OUString sDialogServiceName("com.sun.star.ui.dialogs.AddressBookSourcePilot");
         Reference< XExecutableDialog > xAdminDialog;
         try
         {
-            xAdminDialog = Reference< XExecutableDialog >(m_xORB->createInstanceWithArguments(sDialogServiceName, aArgs), UNO_QUERY);
+            xAdminDialog = AddressBookSourcePilot::createWithParent( m_xORB, VCLUnoHelper::GetInterface(this) );
         }
-        catch(Exception&) { }
+        catch(const Exception&) { }
         if (!xAdminDialog.is())
         {
-            ShowServiceNotAvailableError(this, sDialogServiceName, sal_True);
+            ShowServiceNotAvailableError(this, rtl::OUString("com.sun.star.ui.dialogs.AddressBookSourcePilot"), sal_True);
             return 1L;
         }
 
@@ -1256,7 +1251,7 @@ void AssignmentPersistentData::Commit()
                 }
             }
         }
-        catch(Exception&)
+        catch(const Exception&)
         {
             OSL_FAIL("AddressBookSourceDialog::OnAdministrateDatasources: an error occurred while executing the administration dialog!");
         }
diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx
index da4fa51..ca255fa 100644
--- a/svtools/source/uno/addrtempuno.cxx
+++ b/svtools/source/uno/addrtempuno.cxx
@@ -252,9 +252,9 @@ namespace svt
     Dialog* OAddressBookSourceDialogUno::createDialog(Window* _pParent)
     {
         if ( m_xDataSource.is() && !m_sTable.isEmpty() )
-            return new AddressBookSourceDialog(_pParent, m_aContext.getLegacyServiceFactory(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases );
+            return new AddressBookSourceDialog(_pParent, m_aContext.getUNOContext(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases );
         else
-            return new AddressBookSourceDialog( _pParent, m_aContext.getLegacyServiceFactory() );
+            return new AddressBookSourceDialog( _pParent, m_aContext.getUNOContext() );
     }
 
 // .......................................................................
commit c98a1fa04884c7fa34dfeb5e2eae706e57c09123
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 5 11:48:58 2013 +0200

    make the UNO generated catch clauses use const modifier
    
    Change-Id: I2c9cdff2aeb97c8b9740aba91990e27315d5c85b

diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 641408e..29516c8 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -3979,12 +3979,12 @@ sal_Bool ServiceType::dumpHxxFile(
                   << "\" ), the_context), ::com::sun::star::uno::UNO_QUERY);\n";
                 dec();
                 o << indent()
-                  << "} catch (::com::sun::star::uno::RuntimeException &) {\n";
+                  << "} catch (const ::com::sun::star::uno::RuntimeException &) {\n";
                 inc();
                 o << indent() << "throw;\n";
                 dec();
                 o << indent()
-                  << ("} catch (::com::sun::star::uno::Exception &"
+                  << ("} catch (const ::com::sun::star::uno::Exception &"
                       " the_exception) {\n");
                 inc();
                 o << indent()
@@ -4121,14 +4121,14 @@ sal_Bool ServiceType::dumpHxxFile(
                 if (!tree.getRoot()->present) {
                     dec();
                     o << indent()
-                      << ("} catch (::com::sun::star::uno::RuntimeException &)"
+                      << ("} catch (const ::com::sun::star::uno::RuntimeException &)"
                           " {\n");
                     inc();
                     o << indent() << "throw;\n";
                     dec();
                     dumpCatchClauses(o, tree.getRoot());
                     o << indent()
-                      << ("} catch (::com::sun::star::uno::Exception &"
+                      << ("} catch (const ::com::sun::star::uno::Exception &"
                           " the_exception) {\n");
                     inc();
                     o << indent()
@@ -4192,7 +4192,7 @@ void ServiceType::dumpCatchClauses(
     FileStream & out, codemaker::ExceptionTreeNode const * node)
 {
     if (node->present) {
-        out << indent() << "} catch (";
+        out << indent() << "} catch (const ";
         dumpType(out, node->name);
         out << " &) {\n";
         inc();
commit 68a5b26425ce97f099fdd002c358acf4aba86a97
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Mar 4 17:21:22 2013 +0200

    fdo#46808, Use service constructor for document::DocumentProperties
    
    Change-Id: I4be6985d5f1c7729f74b8a5ddc41024a407e770c

diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 8e0d05b..4d830dc 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -648,10 +648,8 @@ SfxDocumentMetaData::getURLProperties(
                 "com.sun.star.beans.PropertyBag"), m_xContext),
         css::uno::UNO_QUERY_THROW);
     try {
-        OUString dburl =
-            OUString("DocumentBaseURL");
-        OUString hdn =
-            OUString("HierarchicalDocumentName");
+        OUString dburl("DocumentBaseURL");
+        OUString hdn("HierarchicalDocumentName");
         for (sal_Int32 i = 0; i < i_rMedium.getLength(); ++i) {
             if (i_rMedium[i].Name.equals(dburl)) {
                 xPropArg->addProperty(
@@ -682,8 +680,7 @@ getNodeText(css::uno::Reference<css::xml::dom::XNode> i_xNode)
         throw (css::uno::RuntimeException)
 {
     if (!i_xNode.is()) throw css::uno::RuntimeException(
-        OUString(
-                "SfxDocumentMetaData::getNodeText: argument is null"), i_xNode);
+        OUString("SfxDocumentMetaData::getNodeText: argument is null"), i_xNode);
     for (css::uno::Reference<css::xml::dom::XNode> c = i_xNode->getFirstChild();
             c.is();
             c = c->getNextSibling()) {
@@ -762,8 +759,7 @@ SfxDocumentMetaData::setMetaText(const char* i_name,
     } catch (const css::xml::dom::DOMException & e) {
         css::uno::Any a(e);
         throw css::lang::WrappedTargetRuntimeException(
-                OUString(
-                        "SfxDocumentMetaData::setMetaText: DOM exception"),
+                OUString("SfxDocumentMetaData::setMetaText: DOM exception"),
                 css::uno::Reference<css::uno::XInterface>(*this), a);
     }
 }
@@ -899,8 +895,7 @@ SfxDocumentMetaData::setMetaList(const char* i_name,
     } catch (const css::xml::dom::DOMException & e) {
         css::uno::Any a(e);
         throw css::lang::WrappedTargetRuntimeException(
-                OUString(
-                        "SfxDocumentMetaData::setMetaList: DOM exception"),
+                OUString("SfxDocumentMetaData::setMetaList: DOM exception"),
                 css::uno::Reference<css::uno::XInterface>(*this), a);
     }
 }
@@ -1040,8 +1035,7 @@ SfxDocumentMetaData::updateElement(const char *i_name,
     } catch (const css::xml::dom::DOMException & e) {
         css::uno::Any a(e);
         throw css::lang::WrappedTargetRuntimeException(
-                OUString(
-                    "SfxDocumentMetaData::updateElement: DOM exception"),
+                OUString("SfxDocumentMetaData::updateElement: DOM exception"),
                 css::uno::Reference<css::uno::XInterface>(*this), a);
     }
 }
@@ -1141,8 +1135,7 @@ void SAL_CALL SfxDocumentMetaData::init(
         css::uno::Reference<css::xml::dom::XDocument> i_xDoc)
 {
     if (!i_xDoc.is()) throw css::uno::RuntimeException(
-        OUString(
-                "SfxDocumentMetaData::init: no DOM tree given"), *this);
+        OUString("SfxDocumentMetaData::init: no DOM tree given"), *this);
 
     css::uno::Reference<css::xml::xpath::XXPathAPI> xPath = css::xml::xpath::XPathAPI::create(m_xContext);
 
@@ -1220,8 +1213,7 @@ void SAL_CALL SfxDocumentMetaData::init(
         } catch (const css::xml::dom::DOMException & e) {
             css::uno::Any a(e);
             throw css::lang::WrappedTargetRuntimeException(
-                    OUString(
-                            "SfxDocumentMetaData::init: DOM exception"),
+                    OUString("SfxDocumentMetaData::init: DOM exception"),
                     css::uno::Reference<css::uno::XInterface>(*this), a);
         }
     }
@@ -1703,9 +1695,8 @@ SfxDocumentMetaData::setAutoloadSecs(::sal_Int32 the_value)
         throw (css::uno::RuntimeException, css::lang::IllegalArgumentException)
 {
     if (the_value < 0) throw css::lang::IllegalArgumentException(
-        OUString(
-            "SfxDocumentMetaData::setAutoloadSecs: argument is negative"),
-            *this, 0);
+        OUString("SfxDocumentMetaData::setAutoloadSecs: argument is negative"),
+        *this, 0);
     ::osl::ClearableMutexGuard g(m_aMutex);
     checkInit();
     if (m_AutoloadSecs != the_value) {
@@ -1817,9 +1808,8 @@ SfxDocumentMetaData::setEditingCycles(::sal_Int16 the_value)
         throw (css::uno::RuntimeException, css::lang::IllegalArgumentException)
 {
     if (the_value < 0) throw css::lang::IllegalArgumentException(
-        OUString(
-                "SfxDocumentMetaData::setEditingCycles: argument is negative"),
-                *this, 0);
+        OUString("SfxDocumentMetaData::setEditingCycles: argument is negative"),
+        *this, 0);
     OUStringBuffer buf;
     ::sax::Converter::convertNumber(buf, the_value);
     setMetaTextAndNotify("meta:editing-cycles", buf.makeStringAndClear());
@@ -1837,9 +1827,8 @@ SfxDocumentMetaData::setEditingDuration(::sal_Int32 the_value)
         throw (css::uno::RuntimeException, css::lang::IllegalArgumentException)
 {
     if (the_value < 0) throw css::lang::IllegalArgumentException(
-        OUString(
-            "SfxDocumentMetaData::setEditingDuration: argument is negative"),
-            *this, 0);
+        OUString("SfxDocumentMetaData::setEditingDuration: argument is negative"),
+        *this, 0);
     setMetaTextAndNotify("meta:editing-duration", durationToText(the_value));
 }
 
@@ -1891,8 +1880,7 @@ SfxDocumentMetaData::loadFromStorage(
            css::lang::WrappedTargetException, css::io::IOException)
 {
     if (!xStorage.is()) throw css::lang::IllegalArgumentException(
-        OUString("SfxDocumentMetaData::loadFromStorage:"
-                " argument is null"), *this, 0);
+        OUString("SfxDocumentMetaData::loadFromStorage: argument is null"), *this, 0);
     ::osl::MutexGuard g(m_aMutex);
 
     // open meta data file
@@ -2060,8 +2048,7 @@ SfxDocumentMetaData::loadFromMedium(const OUString & URL,
         throw;
     } catch (const css::uno::Exception & e) {
         throw css::lang::WrappedTargetException(
-                OUString(
-                    "SfxDocumentMetaData::loadFromMedium: exception"),
+                OUString("SfxDocumentMetaData::loadFromMedium: exception"),
                 css::uno::Reference<css::uno::XInterface>(*this),
                 css::uno::makeAny(e));
     }
@@ -2185,8 +2172,7 @@ SfxDocumentMetaData::createClone()
     } catch (const css::uno::Exception & e) {
         css::uno::Any a(e);
         throw css::lang::WrappedTargetRuntimeException(
-                OUString(
-                    "SfxDocumentMetaData::createClone: exception"),
+                OUString("SfxDocumentMetaData::createClone: exception"),
                 css::uno::Reference<css::uno::XInterface>(*this), a);
     }
     return css::uno::Reference<css::util::XCloneable> (pNew);
@@ -2314,8 +2300,7 @@ void SfxDocumentMetaData::createUserDefined()
                 m_xContext->getServiceManager());
         m_xUserDefined.set(
             xMsf->createInstanceWithContext(
-                OUString(
-                    "com.sun.star.beans.PropertyBag"), m_xContext),
+                OUString("com.sun.star.beans.PropertyBag"), m_xContext),
             css::uno::UNO_QUERY_THROW);
         const css::uno::Reference<css::lang::XInitialization> xInit(
             m_xUserDefined, css::uno::UNO_QUERY);
@@ -2347,16 +2332,16 @@ void SfxDocumentMetaData::createUserDefined()
 namespace comp_CompatWriterDocProps {
 
     OUString SAL_CALL _getImplementationName() {
-        return OUString(
-            "CompatWriterDocPropsImpl");
-}
+        return OUString("CompatWriterDocPropsImpl");
+    }
 
-   css::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames()
-   {
+    css::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames()
+    {
         css::uno::Sequence< rtl::OUString > aServiceNames(1);
         aServiceNames[ 0 ] = rtl::OUString( "com.sun.star.writer.DocumentProperties"  );
         return aServiceNames;
-   }
+    }
+
     css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
         const css::uno::Reference< css::uno::XComponentContext > & context)
             SAL_THROW((css::uno::Exception))
@@ -2366,18 +2351,17 @@ namespace comp_CompatWriterDocProps {
     }
 
 }
+
 namespace comp_SfxDocumentMetaData {
 
 OUString SAL_CALL _getImplementationName() {
-    return OUString(
-        "SfxDocumentMetaData");
+    return OUString("SfxDocumentMetaData");
 }
 
 css::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames()
 {
     css::uno::Sequence< OUString > s(1);
-    s[0] = OUString(
-        "com.sun.star.document.DocumentProperties");
+    s[0] = OUString("com.sun.star.document.DocumentProperties");
     return s;
 }
 
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index 4d8ea07..ef0dd02 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -40,6 +40,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/XPropertySetInfo.hpp>
 #include <com/sun/star/document/XTypeDetection.hpp>
+#include <com/sun/star/document/DocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
@@ -105,8 +106,6 @@ using ::std::advance;
 #define TARGET_DIR_URL          "TargetDirURL"
 #define COMMAND_TRANSFER        "transfer"
 
-#define SERVICENAME_DOCINFO             "com.sun.star.document.DocumentProperties"
-
 //========================================================================
 
 class RegionData_Impl;
@@ -1668,11 +1667,9 @@ sal_Bool SfxDocTemplate_Impl::Construct( )
     if ( mbConstructed )
         return sal_True;
 
-    uno::Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
     uno::Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
 
-    OUString aService( SERVICENAME_DOCINFO  );
-    uno::Reference< XPersist > xInfo( xFactory->createInstance( aService ), UNO_QUERY );
+    uno::Reference< XPersist > xInfo( document::DocumentProperties::create(xContext), UNO_QUERY );
     mxInfo = xInfo;
 
     mxTemplates = frame::DocumentTemplates::create(xContext);
@@ -1695,7 +1692,7 @@ sal_Bool SfxDocTemplate_Impl::Construct( )
     if ( aLongNames.Count() )
         maStandardGroup = aLongNames.GetString( 0 );
 
-    Content aTemplRoot( aRootContent, aCmdEnv, comphelper::getProcessComponentContext() );
+    Content aTemplRoot( aRootContent, aCmdEnv, xContext );
     CreateFromHierarchy( aTemplRoot );
 
     return sal_True;
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index c25faa6..9251b5f 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -178,7 +178,7 @@ class SfxDocTplService_Impl
 {
     uno::Reference< XMultiServiceFactory >           mxFactory;
     uno::Reference< XCommandEnvironment >            maCmdEnv;
-    uno::Reference<XDocumentProperties>  m_xDocProps;
+    uno::Reference< XDocumentProperties>             m_xDocProps;
     uno::Reference< XTypeDetection >                 mxType;
 
     ::osl::Mutex                maMutex;
@@ -1809,12 +1809,10 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,
     try
     {
         uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        if ( !xFactory.is() )
-            throw uno::RuntimeException();
+        uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
 
         // get document service name
-        uno::Reference< frame::XModuleManager2 > xModuleManager(
-            frame::ModuleManager::create(comphelper::getComponentContext(xFactory)) );
+        uno::Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xContext) );
         sDocServiceName = xModuleManager->identify( uno::Reference< uno::XInterface >( rStorable, uno::UNO_QUERY ) );
         if ( sDocServiceName.isEmpty() )
             throw uno::RuntimeException();
@@ -1823,7 +1821,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,
         ::rtl::OUString aFilterName;
 
         uno::Reference< lang::XMultiServiceFactory > xConfigProvider =
-                configuration::theDefaultProvider::get( comphelper::getComponentContext(xFactory) );
+                configuration::theDefaultProvider::get( xContext );
 
         uno::Sequence< uno::Any > aArgs( 1 );
         beans::PropertyValue aPathProp;
commit b70c3ec8f7575ed39e180854f8a7de91b9f05d49
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Feb 28 07:55:26 2013 +0200

    fdo#46808, remove unnecessary XMultiServiceFactory usage
    
    No-one was calling the constructor with anything other than an
    empty reference.
    
    Change-Id: If1948ff236f6fdb3579e472d66c5f9c04879bc4e

diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx
index 5145087..9d63290 100644
--- a/sfx2/inc/guisaveas.hxx
+++ b/sfx2/inc/guisaveas.hxx
@@ -21,7 +21,6 @@
 #define _SFX_GUISAVEAS_HXX_
 
 #include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
@@ -47,18 +46,16 @@ class SfxStoringHelper
     friend class ModelData_Impl;
 
 private:
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xFilterCFG;
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > m_xFilterQuery;
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager;
 
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceFactory();
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetFilterConfiguration();
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > GetFilterQuery();
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > GetModuleManager();
 
 public:
-    SfxStoringHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+    SfxStoringHelper();
 
     sal_Bool GUIStoreModel(
                     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel,
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index bc2fb54..ecf930b 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -446,7 +446,7 @@ void ModelData_Impl::CheckInteractionHandler()
     {
         try {
             m_aMediaDescrHM[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) ]
-                <<= task::InteractionHandler::createWithParent(comphelper::getComponentContext(m_pOwner->GetServiceFactory()), 0);
+                <<= task::InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), 0);
         }
         catch( const uno::Exception& )
         {
@@ -554,7 +554,7 @@ sal_Bool ModelData_Impl::ExecuteFilterDialog_Impl( const ::rtl::OUString& aFilte
                     if( !aServiceName.isEmpty() )
                     {
                         uno::Reference< ui::dialogs::XExecutableDialog > xFilterDialog(
-                                                    m_pOwner->GetServiceFactory()->createInstance( aServiceName ), uno::UNO_QUERY );
+                                                    comphelper::getProcessServiceFactory()->createInstance( aServiceName ), uno::UNO_QUERY );
                         uno::Reference< beans::XPropertyAccess > xFilterProperties( xFilterDialog, uno::UNO_QUERY );
 
                         if( xFilterDialog.is() && xFilterProperties.is() )
@@ -619,7 +619,7 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
         // check whether save is acceptable by the configuration
         // it is done only for documents that have persistence already
         uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
-                            comphelper::getComponentContext(m_pOwner->GetServiceFactory()),
+                            comphelper::getProcessComponentContext(),
                             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
                             ::comphelper::ConfigurationHelper::E_STANDARD );
         if ( !xCommonConfig.is() )
@@ -1164,7 +1164,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog()
                 util::URL aURL;
                 aURL.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SetDocumentProperties"));
 
-                uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create( ::comphelper::getComponentContext(m_pOwner->GetServiceFactory()) ) );
+                uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create( comphelper::getProcessComponentContext() ) );
                 if ( xTransformer->parseStrict( aURL ) )
                 {
                     uno::Reference< frame::XDispatch > xDispatch = xFrameDispatch->queryDispatch(
@@ -1248,7 +1248,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog()
         {
             // adjust the extension to the type
             uno::Reference< container::XNameAccess > xTypeDetection = uno::Reference< container::XNameAccess >(
-                m_pOwner->GetServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")) ),
+                comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")) ),
                 uno::UNO_QUERY );
             if ( xTypeDetection.is() )
             {
@@ -1278,31 +1278,17 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog()
 // class SfxStoringHelper
 //=========================================================================
 //-------------------------------------------------------------------------
-SfxStoringHelper::SfxStoringHelper( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
-: m_xFactory( xFactory )
+SfxStoringHelper::SfxStoringHelper()
 {
 }
 
 //-------------------------------------------------------------------------
-uno::Reference< lang::XMultiServiceFactory > SfxStoringHelper::GetServiceFactory()
-{
-    if ( !m_xFactory.is() )
-    {
-        m_xFactory = ::comphelper::getProcessServiceFactory();
-        if( !m_xFactory.is() )
-            throw uno::RuntimeException(); // TODO:
-    }
-
-    return m_xFactory;
-}
-
-//-------------------------------------------------------------------------
 uno::Reference< container::XNameAccess > SfxStoringHelper::GetFilterConfiguration()
 {
     if ( !m_xFilterCFG.is() )
     {
         m_xFilterCFG = uno::Reference< container::XNameAccess >(
-            GetServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ),
+            comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ),
             uno::UNO_QUERY );
 
         if ( !m_xFilterCFG.is() )
@@ -1331,7 +1317,7 @@ uno::Reference< ::com::sun::star::frame::XModuleManager2 > SfxStoringHelper::Get
     if ( !m_xModuleManager.is() )
     {
         m_xModuleManager = frame::ModuleManager::create(
-            comphelper::getComponentContext(GetServiceFactory()));

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list