diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-10-31 09:22:53 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-31 09:22:53 +0100 |
commit | ced1151a1ad00fb2913a4c0f54e4544f4e566c05 (patch) | |
tree | 416403e0c91acc4cbfe6219f1930ea0273a856e0 /vcl/source/app/unohelp.cxx | |
parent | 6bc62f4f43c7458399169ddb2cba30ae4188b1bd (diff) |
Get rid of vcl::unohelper::GetMultiServiceFactory
...which effectively is just a glorious wrapper around
comphelper::getProcessServiceFactory.
In turn gets also rid of ImplSVAppData's mxMSF and mpMSFTempFileName and the
rSMgr parameter to InitVCL.
All the VCL users "soffice", "spadmin", and "unopkg gui" appear to still work
fine.
Change-Id: I797d48f7d0d8c35bb82124c9ab0ee63850c4d863
Diffstat (limited to 'vcl/source/app/unohelp.cxx')
-rw-r--r-- | vcl/source/app/unohelp.cxx | 102 |
1 files changed, 6 insertions, 96 deletions
diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx index a7ba55577b07..b0a30b188e38 100644 --- a/vcl/source/app/unohelp.cxx +++ b/vcl/source/app/unohelp.cxx @@ -27,18 +27,11 @@ ************************************************************************/ -#include <tools/tempfile.hxx> - -#include <osl/file.hxx> - -#include <cppuhelper/servicefactory.hxx> - #include <vcl/svapp.hxx> #include <vcl/unohelp.hxx> #include <svdata.hxx> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> @@ -47,8 +40,6 @@ #include <com/sun/star/awt/XExtendedToolkit.hpp> #include <com/sun/star/accessibility/AccessibleEventObject.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> -#include <com/sun/star/registry/ImplementationRegistration.hpp> - using namespace ::com::sun::star; using namespace ::rtl; @@ -56,102 +47,21 @@ using namespace ::rtl; #define DOSTRING( x ) #x #define STRING( x ) DOSTRING( x ) -struct VCLRegServiceInfo -{ - const sal_Char* pLibName; - sal_Bool bHasSUPD; -}; - -static VCLRegServiceInfo aVCLComponentsArray[] = -{ - {"i18n", sal_True}, - {"i18npool", sal_True}, -#ifdef UNX -#ifdef MACOSX - {"dtransaqua", sal_True}, -#else - {"dtransX11", sal_True}, -#endif -#endif -#if defined(WNT) - {"sysdtrans", sal_False}, -#endif - {"dtrans", sal_False}, - {"mcnttype", sal_False}, - {"ftransl", sal_False}, - {"dnd", sal_False}, - {NULL, sal_False} -}; - -uno::Reference< lang::XMultiServiceFactory > vcl::unohelper::GetMultiServiceFactory() -{ - ImplSVData* pSVData = ImplGetSVData(); - if ( !pSVData->maAppData.mxMSF.is() ) - { - pSVData->maAppData.mxMSF = ::comphelper::getProcessServiceFactory(); - } - if ( !pSVData->maAppData.mxMSF.is() ) - { - TempFile aTempFile; - OUString aTempFileName; - osl::FileBase::getSystemPathFromFileURL( aTempFile.GetName(), aTempFileName ); - pSVData->maAppData.mpMSFTempFileName = new String(aTempFileName); - - try - { - pSVData->maAppData.mxMSF = ::cppu::createRegistryServiceFactory( aTempFileName, rtl::OUString(), sal_False ); - uno::Reference < registry::XImplementationRegistration > xReg( - registry::ImplementationRegistration::create( comphelper::getComponentContext(pSVData->maAppData.mxMSF) ) ); - - if( xReg.is() ) - { - sal_Int32 nCompCount = 0; - while ( aVCLComponentsArray[ nCompCount ].pLibName ) - { - OUString aComponentPathString = CreateLibraryName( aVCLComponentsArray[ nCompCount ].pLibName, aVCLComponentsArray[ nCompCount ].bHasSUPD ); - if (!aComponentPathString.isEmpty() ) - { - try - { - xReg->registerImplementation( - OUString("com.sun.star.loader.SharedLibrary"),aComponentPathString, NULL ); - } - catch( ::com::sun::star::uno::Exception & ) - { - } - } - nCompCount++; - } - } - } - catch( ::com::sun::star::uno::Exception & ) - { - delete pSVData->maAppData.mpMSFTempFileName; - pSVData->maAppData.mpMSFTempFileName = NULL; - } - } - return pSVData->maAppData.mxMSF; -} - - uno::Reference < i18n::XBreakIterator > vcl::unohelper::CreateBreakIterator() { - uno::Reference< uno::XComponentContext > xContext = comphelper::getComponentContext(GetMultiServiceFactory()); + uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); return i18n::BreakIterator::create(xContext); } uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacterClassification() { uno::Reference < i18n::XCharacterClassification > xB; - uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory(); - if ( xMSF.is() ) + uno::Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory(); + uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString("com.sun.star.i18n.CharacterClassification") ); + if ( xI.is() ) { - uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString("com.sun.star.i18n.CharacterClassification") ); - if ( xI.is() ) - { - uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XCharacterClassification >*)0) ); - x >>= xB; - } + uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XCharacterClassification >*)0) ); + x >>= xB; } return xB; } |