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 | |
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')
-rw-r--r-- | vcl/source/app/settings.cxx | 12 | ||||
-rw-r--r-- | vcl/source/app/svdata.cxx | 22 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 13 | ||||
-rw-r--r-- | vcl/source/app/unohelp.cxx | 102 |
4 files changed, 17 insertions, 132 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index a18a9dabd425..487ad67ca16a 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include <svsys.h> +#include "comphelper/processfactory.hxx" #include "tools/debug.hxx" #include "i18npool/mslangid.hxx" @@ -37,7 +38,6 @@ #include "vcl/i18nhelp.hxx" #include "vcl/configsettings.hxx" #include "vcl/gradient.hxx" -#include "vcl/unohelp.hxx" #include "vcl/bitmapex.hxx" #include "unotools/fontcfg.hxx" @@ -1512,7 +1512,7 @@ bool AllSettings::GetLayoutRTL() const { nUIMirroring = 0; // ask configuration only once utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( - vcl::unohelper::GetMultiServiceFactory(), + comphelper::getProcessServiceFactory(), OUString("org.openoffice.Office.Common/I18N/CTL") ); // note: case sensitive ! if ( aNode.isValid() ) { @@ -1585,7 +1585,7 @@ LanguageType AllSettings::GetUILanguage() const const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const { if ( !mpData->mpLocaleDataWrapper ) - ((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetLocale() ); + ((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessServiceFactory(), GetLocale() ); return *mpData->mpLocaleDataWrapper; } @@ -1594,7 +1594,7 @@ const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const { if ( !mpData->mpUILocaleDataWrapper ) - ((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetUILocale() ); + ((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessServiceFactory(), GetUILocale() ); return *mpData->mpUILocaleDataWrapper; } @@ -1603,7 +1603,7 @@ const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const { if ( !mpData->mpI18nHelper ) { - ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(vcl::unohelper::GetMultiServiceFactory()); + ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(comphelper::getProcessServiceFactory()); ((AllSettings*)this)->mpData->mpI18nHelper = new vcl::I18nHelper( aFactory, GetLocale() ); } return *mpData->mpI18nHelper; @@ -1614,7 +1614,7 @@ const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const { if ( !mpData->mpUII18nHelper ) { - ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(vcl::unohelper::GetMultiServiceFactory()); + ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(comphelper::getProcessServiceFactory()); ((AllSettings*)this)->mpData->mpUII18nHelper = new vcl::I18nHelper( aFactory, GetUILocale() ); } return *mpData->mpUII18nHelper; diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index a3851c7999e4..5874943d4edd 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -31,9 +31,9 @@ #include <boost/ptr_container/ptr_vector.hpp> +#include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> -#include <osl/file.hxx> #include <osl/mutex.hxx> #include <rtl/process.h> #include "tools/debug.hxx" @@ -49,7 +49,6 @@ #include "vcl/svapp.hxx" #include "vcl/wrkwin.hxx" #include "vcl/msgbox.hxx" -#include "vcl/unohelp.hxx" #include "vcl/button.hxx" // for Button::GetStandardText #include "vcl/dockwin.hxx" // for DockingManager #include "salinst.hxx" @@ -61,7 +60,6 @@ #include "svids.hrc" #include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/lang/XComponent.hpp" #include "com/sun/star/awt/XExtendedToolkit.hpp" #include "com/sun/star/java/JavaNotConfiguredException.hpp" #include "com/sun/star/java/JavaVMCreationFailureException.hpp" @@ -141,22 +139,6 @@ void ImplDeInitSVData() if( pSVData->maGDIData.mpFontSubstConfiguration ) delete pSVData->maGDIData.mpFontSubstConfiguration; - if ( pSVData->maAppData.mpMSFTempFileName ) - { - if ( pSVData->maAppData.mxMSF.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pSVData->maAppData.mxMSF, ::com::sun::star::uno::UNO_QUERY ); - xComp->dispose(); - pSVData->maAppData.mxMSF = NULL; - } - - ::rtl::OUString aFileUrl; - ::osl::File::getFileURLFromSystemPath( *pSVData->maAppData.mpMSFTempFileName, aFileUrl ); - osl::File::remove( aFileUrl ); - delete pSVData->maAppData.mpMSFTempFileName; - pSVData->maAppData.mpMSFTempFileName = NULL; - } - if( pSVData->maCtrlData.mpFieldUnitStrings ) delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL; if( pSVData->maCtrlData.mpCleanUnitStrings ) @@ -353,7 +335,7 @@ bool ImplInitAccessBridge(bool bAllowCancel, bool &rCancelled) ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->mxAccessBridge.is() ) { - css::uno::Reference< XMultiServiceFactory > xFactory(vcl::unohelper::GetMultiServiceFactory()); + css::uno::Reference< XMultiServiceFactory > xFactory(comphelper::getProcessServiceFactory()); if( xFactory.is() ) { diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 285f7137ccd4..dc2d46360138 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -160,11 +160,9 @@ int ImplSVMain() DBG_ASSERT( pSVData->mpApp, "no instance of class Application" ); - uno::Reference<lang::XMultiServiceFactory> xMS; - int nReturn = EXIT_FAILURE; - sal_Bool bInit = InitVCL( xMS ); + sal_Bool bInit = InitVCL(); if( bInit ) { @@ -251,7 +249,7 @@ uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString return retVal; } -sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) +sal_Bool InitVCL() { RTL_LOGFILE_CONTEXT( aLog, "vcl (ss112471) ::InitVCL" ); @@ -277,9 +275,6 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang // SV bei den Tools anmelden InitTools(); - DBG_ASSERT( !pSVData->maAppData.mxMSF.is(), "VCL service factory already set" ); - pSVData->maAppData.mxMSF = rSMgr; - // Main-Thread-Id merken pSVData->mnMainThreadId = ::osl::Thread::getCurrentIdentifier(); @@ -335,7 +330,7 @@ InitVCLWrapper() comphelper::setProcessServiceFactory( xSM ); - InitVCL( xSM ); + InitVCL(); } #endif @@ -499,8 +494,6 @@ void DeInitVCL() } } - pSVData->maAppData.mxMSF.clear(); - if( pSVData->mpApp ) { sal_uLong nCount = Application::ReleaseSolarMutex(); 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; } |