diff options
43 files changed, 187 insertions, 345 deletions
diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx index be08bad94b17..dfb57ce59452 100644 --- a/canvas/workben/canvasdemo.cxx +++ b/canvas/workben/canvasdemo.cxx @@ -680,7 +680,7 @@ void DemoApp::Main() ::ucb::UniversalContentBroker::create( comphelper::getProcessComponentContext() ); - InitVCL( xFactory ); + InitVCL(); TestWindow pWindow; pWindow.Execute(); DeInitVCL(); diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 7c83aabac00e..6f067b9ba829 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -244,9 +244,7 @@ void ServiceImpl::startExecuteModal( if (! bOfficePipePresent) { OSL_ASSERT( ! bAppUp ); app.reset( new MyApp ); - if (! InitVCL( Reference<lang::XMultiServiceFactory>( - m_xComponentContext->getServiceManager(), - UNO_QUERY_THROW ) )) + if (! InitVCL() ) throw RuntimeException( OUSTR("Cannot initialize VCL!"), static_cast<OWeakObject *>(this) ); AllSettings as = app->GetSettings(); diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 932d1cd00259..7a6c899c6ed2 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -490,9 +490,7 @@ Reference<XComponentContext> getUNO( { //We show a message box or print to the console that there //is another instance already running - if ( ! InitVCL( Reference<lang::XMultiServiceFactory>( - xComponentContext->getServiceManager(), - UNO_QUERY_THROW ) )) + if ( ! InitVCL() ) throw RuntimeException( OUSTR("Cannot initialize VCL!"), NULL ); { diff --git a/fpicker/test/svdem.cxx b/fpicker/test/svdem.cxx index eea40b7d76cd..e6627187b60f 100644 --- a/fpicker/test/svdem.cxx +++ b/fpicker/test/svdem.cxx @@ -79,9 +79,9 @@ SAL_IMPLEMENT_MAIN() xMSch.set(xComponentContext->getServiceManager(), com::sun::star::uno::UNO_QUERY); comphelper::setProcessServiceFactory(xMSch); -// comphelper::setProcessServiceFactory( xMS); + comphelper::setProcessServiceFactory(xMS); - InitVCL( xMS ); + InitVCL(); ::Main(); DeInitVCL(); diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx index 2be65266d5a8..db79ef0788e9 100644 --- a/padmin/source/helper.cxx +++ b/padmin/source/helper.cxx @@ -31,9 +31,9 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <comphelper/processfactory.hxx> #include <tools/urlobj.hxx> #include <unotools/confignode.hxx> -#include <vcl/unohelp.hxx> #include <i18npool/mslangid.hxx> #include <rtl/ustrbuf.hxx> @@ -62,7 +62,7 @@ ResId padmin::PaResId( sal_uInt32 nId ) utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( - vcl::unohelper::GetMultiServiceFactory(), + comphelper::getProcessServiceFactory(), OUString("org.openoffice.Setup/L10N") ); if ( aNode.isValid() ) { diff --git a/sd/qa/unit/uimpress.cxx b/sd/qa/unit/uimpress.cxx index b34e241d615f..91adf35f2ba8 100644 --- a/sd/qa/unit/uimpress.cxx +++ b/sd/qa/unit/uimpress.cxx @@ -80,7 +80,7 @@ Test::Test() //of retaining references to the root ServiceFactory as its passed around comphelper::setProcessServiceFactory(xSM); - InitVCL(xSM); + InitVCL(); SdDLL::Init(); } diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index c98afaeb9da5..375b73300b2c 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -145,7 +145,7 @@ Test::Test() //of retaining references to the root ServiceFactory as its passed around comphelper::setProcessServiceFactory(xSM); - InitVCL(xSM); + InitVCL(); SmGlobals::ensure(); } diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index a7490ef3b4ff..3e39f5d42123 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -115,7 +115,7 @@ Test::Test() //of retaining references to the root ServiceFactory as its passed around comphelper::setProcessServiceFactory(xSM); - InitVCL(xSM); + InitVCL(); SmGlobals::ensure(); } diff --git a/svtools/bmpmaker/bmp.cxx b/svtools/bmpmaker/bmp.cxx index 0dcce2c0e2c0..fc5a80d0c776 100644 --- a/svtools/bmpmaker/bmp.cxx +++ b/svtools/bmpmaker/bmp.cxx @@ -235,7 +235,7 @@ int main( int nArgCount, char* ppArgs[] ) ::std::vector< String > aArgs; BmpApp aBmpApp; - InitVCL( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >() ); + InitVCL(); for( int i = 1; i < nArgCount; i++ ) aArgs.push_back( String( ppArgs[ i ], RTL_TEXTENCODING_ASCII_US ) ); diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx index a840ff4ba707..f5fbe4675829 100644 --- a/svtools/bmpmaker/bmpsum.cxx +++ b/svtools/bmpmaker/bmpsum.cxx @@ -468,7 +468,7 @@ int main( int nArgCount, char* ppArgs[] ) ::std::vector< String > aArgs; BmpSum aBmpSum; - InitVCL( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >() ); + InitVCL(); for( int i = 1; i < nArgCount; i++ ) aArgs.push_back( String( ppArgs[ i ], RTL_TEXTENCODING_ASCII_US ) ); diff --git a/svtools/bmpmaker/g2g.cxx b/svtools/bmpmaker/g2g.cxx index ed0333f592c0..bb09e4a780bc 100644 --- a/svtools/bmpmaker/g2g.cxx +++ b/svtools/bmpmaker/g2g.cxx @@ -239,7 +239,7 @@ int main( int nArgCount, char* ppArgs[] ) ::std::vector< String > aArgs; G2GApp aG2GApp; - InitVCL( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >() ); + InitVCL(); for( int i = 1; i < nArgCount; i++ ) aArgs.push_back( String( ppArgs[ i ], RTL_TEXTENCODING_ASCII_US ) ); diff --git a/svtools/langsupport/langsupport.cxx b/svtools/langsupport/langsupport.cxx index 12855da0a3ba..3a05c9aa8576 100644 --- a/svtools/langsupport/langsupport.cxx +++ b/svtools/langsupport/langsupport.cxx @@ -55,7 +55,7 @@ SAL_IMPLEMENT_MAIN() comphelper::setProcessServiceFactory(xSFactory); - InitVCL(xSFactory); + InitVCL(); { SvtLanguageTable aTable; diff --git a/svtools/source/control/filectrl2.cxx b/svtools/source/control/filectrl2.cxx index 197cb70c0c67..5d9bb8e96347 100644 --- a/svtools/source/control/filectrl2.cxx +++ b/svtools/source/control/filectrl2.cxx @@ -31,7 +31,7 @@ #include <svtools/filectrl.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/dialogs/XFilePicker.hpp> -#include <vcl/unohelp.hxx> +#include <comphelper/processfactory.hxx> #include <tools/urlobj.hxx> #include <osl/file.h> #include <vcl/stdtext.hxx> @@ -48,7 +48,7 @@ void FileControl::ImplBrowseFile( ) const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" )); - Reference< XMultiServiceFactory > xMSF = vcl::unohelper::GetMultiServiceFactory(); + Reference< XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory(); Reference < dialogs::XFilePicker > xFilePicker( xMSF->createInstance( sServiceName ), UNO_QUERY ); if ( xFilePicker.is() ) { diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx index 657f78e493d4..5c80b04780ee 100644 --- a/svx/workben/msview/msview.cxx +++ b/svx/workben/msview/msview.cxx @@ -1119,7 +1119,7 @@ void MSViewerWorkWindow::Resize() } comphelper::setProcessServiceFactory( xMSF ); - InitVCL( xMSF ); + InitVCL(); String aConfigURL; if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( Application::GetAppFileName(), aConfigURL ) ) diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx index 41fca3d3f92d..a5ce0f0b3068 100644 --- a/test/source/bootstrapfixture.cxx +++ b/test/source/bootstrapfixture.cxx @@ -83,7 +83,7 @@ void test::BootstrapFixture::setUp() aLocalOptions.SetLocaleConfigString( aLangISO ); aLocalOptions.SetUILocaleConfigString( aLangISO ); - InitVCL(m_xSFactory); + InitVCL(); if (Application::IsHeadlessModeRequested()) Application::EnableHeadlessMode(true); diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx index 32a401682ecd..7b00b6e283bc 100644 --- a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx +++ b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx @@ -106,7 +106,7 @@ protected: public: - VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); + VCLXToolkit(); ~VCLXToolkit(); // ::com::sun::star::awt::XToolkitExperimental diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index f320d19b9dac..f54f8b97b1f0 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -414,27 +414,15 @@ static osl::Condition & getInitCondition() return *pC; } -struct ToolkitThreadData -{ - VCLXToolkit * pTk; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - - ToolkitThreadData( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, VCLXToolkit * pTk_ ) - : pTk( pTk_ ) - , xSMgr( rSMgr ) - { - } -}; - extern "C" { static void SAL_CALL ToolkitWorkerFunction( void* pArgs ) { - ToolkitThreadData * pTTD = (ToolkitThreadData *)pArgs; - bInitedByVCLToolkit = InitVCL( pTTD->xSMgr ); + VCLXToolkit * pTk = (VCLXToolkit *)pArgs; + bInitedByVCLToolkit = InitVCL(); if( bInitedByVCLToolkit ) { - UnoWrapper* pUnoWrapper = new UnoWrapper( pTTD->pTk ); + UnoWrapper* pUnoWrapper = new UnoWrapper( pTk ); Application::SetUnoWrapper( pUnoWrapper ); } getInitCondition().set(); @@ -446,7 +434,7 @@ static void SAL_CALL ToolkitWorkerFunction( void* pArgs ) } try { - pTTD->pTk->dispose(); + pTk->dispose(); } catch( com::sun::star::uno::Exception & ) { @@ -457,12 +445,11 @@ static void SAL_CALL ToolkitWorkerFunction( void* pArgs ) { JoinMainLoopThread(); } - delete pTTD; } } // contructor, which might initialize VCL -VCLXToolkit::VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ): +VCLXToolkit::VCLXToolkit(): cppu::WeakComponentImplHelper2< ::com::sun::star::awt::XToolkitExperimental, ::com::sun::star::lang::XServiceInfo>( GetMutex() ), @@ -482,7 +469,7 @@ VCLXToolkit::VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::st if( ( nVCLToolkitInstanceCount == 1 ) && ( !Application::IsInMain() ) ) { // setup execute thread - CreateMainLoopThread( ToolkitWorkerFunction, new ToolkitThreadData( rSMgr, this ) ); + CreateMainLoopThread( ToolkitWorkerFunction, this ); getInitCondition().wait(); } } diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index 7100f20db65a..bbf7089e636e 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -114,7 +114,7 @@ namespace toolkit using namespace toolkit; -IMPL_CREATEINSTANCE2( VCLXToolkit ) +IMPL_CREATEINSTANCE( VCLXToolkit ) IMPL_CREATEINSTANCE( StdTabController ) IMPL_CREATEINSTANCE( StdTabControllerModel ) IMPL_CREATEINSTANCE2( UnoButtonControl ) diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index ee9a02016e61..4ad67404bd4a 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -26,7 +26,6 @@ * ************************************************************************/ -#include "vcl/unohelp.hxx" #include <DataFlavorMapping.hxx> #include "HtmlFmtFlt.hxx" #include "PictToBmpFlt.hxx" @@ -34,6 +33,7 @@ #include "com/sun/star/datatransfer/XMimeContentType.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/uno/Sequence.hxx" +#include "comphelper/processfactory.hxx" #include <rtl/ustring.hxx> #include <osl/endian.h> @@ -510,7 +510,7 @@ Any FileListDataProvider::getOOoData() DataFlavorMapper::DataFlavorMapper() { - Reference<XMultiServiceFactory> mrServiceManager = vcl::unohelper::GetMultiServiceFactory(); + Reference<XMultiServiceFactory> mrServiceManager = comphelper::getProcessServiceFactory(); mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceManager->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY); diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx index a33e1564d51c..2fa1ddfd3eda 100644 --- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx @@ -31,9 +31,8 @@ #include "DataFlavorMapping.hxx" #include "OSXTransferable.hxx" -#include "vcl/unohelp.hxx" - #include "comphelper/makesequence.hxx" +#include "comphelper/processfactory.hxx" #include <boost/assert.hpp> @@ -95,7 +94,7 @@ AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard WeakComponentImplHelper4<XClipboardEx, XClipboardNotifier, XFlushableClipboard, XServiceInfo>(m_aMutex), mIsSystemPasteboard(bUseSystemPasteboard) { - Reference<XMultiServiceFactory> mrServiceMgr = vcl::unohelper::GetMultiServiceFactory(); + Reference<XMultiServiceFactory> mrServiceMgr = comphelper::getProcessServiceFactory(); mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY); diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 76c465021234..015e44545a59 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -53,10 +53,6 @@ #include <boost/unordered_map.hpp> -namespace com { namespace sun { namespace star { namespace lang { - class XMultiServiceFactory; -} } } } - struct ImplTimerData; struct ImplConfigData; class ImplDirectFontSubstitution; @@ -124,8 +120,6 @@ struct ImplSVAppData ImeStatusWindowMode_SHOW }; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; - String* mpMSFTempFileName; AllSettings* mpSettings; // Application settings LocaleConfigurationListener* mpCfgListener; VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index 2083250b9757..9f1c7aa19f6e 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -551,7 +551,7 @@ public: VCL_DLLPUBLIC Application* GetpApp(); -VCL_DLLPUBLIC sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); +VCL_DLLPUBLIC sal_Bool InitVCL(); VCL_DLLPUBLIC void DeInitVCL(); VCL_DLLPUBLIC bool InitAccessBridge( bool bAllowCancel, bool &rCancelled ); diff --git a/vcl/inc/vcl/unohelp.hxx b/vcl/inc/vcl/unohelp.hxx index 823ee477355a..f95e1d9d9b63 100644 --- a/vcl/inc/vcl/unohelp.hxx +++ b/vcl/inc/vcl/unohelp.hxx @@ -40,11 +40,7 @@ namespace i18n { class XBreakIterator; class XCharacterClassification; class XCollator; -} -namespace lang { - class XMultiServiceFactory; -} -}}} +}}}} namespace com { namespace sun { @@ -63,7 +59,6 @@ namespace vcl { namespace unohelper { -VCL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetMultiServiceFactory(); VCL_DLLPUBLIC ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > CreateBreakIterator(); VCL_DLLPUBLIC ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification> CreateCharacterClassification(); //Get access to singleton Natural String Sorter collating for Application::GetLocale diff --git a/vcl/ios/source/dtrans/ios_clipboard.cxx b/vcl/ios/source/dtrans/ios_clipboard.cxx index b82e67fd4eb2..90c0990e8412 100644 --- a/vcl/ios/source/dtrans/ios_clipboard.cxx +++ b/vcl/ios/source/dtrans/ios_clipboard.cxx @@ -30,9 +30,8 @@ #include "iOSTransferable.hxx" -#include "vcl/unohelp.hxx" - #include "comphelper/makesequence.hxx" +#include "comphelper/processfactory.hxx" #include <boost/assert.hpp> @@ -94,7 +93,7 @@ IosClipboard::IosClipboard(UIPasteboard* pasteboard, bool bUseSystemPasteboard) WeakComponentImplHelper4<XClipboardEx, XClipboardNotifier, XFlushableClipboard, XServiceInfo>(m_aMutex), mIsSystemPasteboard(bUseSystemPasteboard) { - Reference<XMultiServiceFactory> mrServiceMgr = vcl::unohelper::GetMultiServiceFactory(); + Reference<XMultiServiceFactory> mrServiceMgr = comphelper::getProcessServiceFactory(); mrXMimeCntFactory = Reference<XMimeContentTypeFactory>(mrServiceMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.MimeContentTypeFactory"))), UNO_QUERY); 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; } diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 93c3a1c2c098..f74e84e4bdee 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -26,7 +26,9 @@ * ************************************************************************/ +#include "sal/config.h" +#include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include "tools/debug.hxx" @@ -37,7 +39,6 @@ #include "vcl/field.hxx" #include "vcl/event.hxx" #include "vcl/svapp.hxx" -#include "vcl/unohelp.hxx" #include "svids.hrc" #include "svdata.hxx" @@ -317,7 +318,7 @@ LocaleDataWrapper& FormatterBase::ImplGetLocaleDataWrapper() const { if ( !mpLocaleDataWrapper ) { - ((FormatterBase*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetLocale() ); + ((FormatterBase*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessServiceFactory(), GetLocale() ); } return *mpLocaleDataWrapper; } diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index be162a457548..9cc4c96308c6 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -1580,7 +1580,7 @@ CalendarWrapper& DateFormatter::GetCalendarWrapper() const { if ( !mpCalendarWrapper ) { - ((DateFormatter*)this)->mpCalendarWrapper = new CalendarWrapper( comphelper::getComponentContext( vcl::unohelper::GetMultiServiceFactory() ) ); + ((DateFormatter*)this)->mpCalendarWrapper = new CalendarWrapper( comphelper::getComponentContext( comphelper::getProcessServiceFactory() ) ); mpCalendarWrapper->loadDefaultCalendar( GetLocale() ); } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index bd6d1791bd3a..4d4299f1ba60 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -2979,7 +2979,7 @@ void TextEngine::SetLocale( const ::com::sun::star::lang::Locale& rLocale ) LocaleDataWrapper* TextEngine::ImpGetLocaleDataWrapper() { if ( !mpLocaleDataWrapper ) - mpLocaleDataWrapper = new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetLocale() ); + mpLocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessServiceFactory(), GetLocale() ); return mpLocaleDataWrapper; } diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 627cd7d1d778..eda6570a75a4 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -39,7 +39,6 @@ #include <vcl/gdimtf.hxx> #include <vcl/graphictools.hxx> #include <vcl/canvastools.hxx> -#include <vcl/unohelp.hxx> #include <salbmp.hxx> #include <salinst.hxx> @@ -55,6 +54,7 @@ #include <com/sun/star/awt/XGraphics.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/graphic/XGraphicRenderer.hpp> +#include <comphelper/processfactory.hxx> using namespace com::sun::star; @@ -462,8 +462,8 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S Size aSize (rDestSize.Width () + 1, rDestSize.Height () + 1); uno::Reference<rendering::XBitmap> xBitmap = xCanvas->getDevice ()->createCompatibleAlphaBitmap (vcl::unotools::integerSize2DFromSize( aSize)); - uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); - if( xFactory.is() && xBitmap.is () ) + uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + if( xBitmap.is () ) { uno::Reference< rendering::XMtfRenderer > xMtfRenderer; uno::Sequence< uno::Any > args (1); @@ -553,8 +553,8 @@ void GDIMetaFile::ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, const ::rtl::OUString aGraphicServiceName=aBuffer.makeStringAndClear(); ++pData; - uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); - if( pData<pEndData && xFactory.is() ) + uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + if( pData<pEndData ) { try { diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index c8a03459c837..0c66aeab5dde 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -68,7 +68,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <vcl/unohelp.hxx> +#include <comphelper/processfactory.hxx> #include <numeric> @@ -2677,29 +2677,21 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const aArg[ 3 ] = uno::makeAny( sal_False ); aArg[ 5 ] = GetSystemGfxDataAny(); - uno::Reference<lang::XMultiServiceFactory> xFactory = vcl::unohelper::GetMultiServiceFactory(); + uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory(); uno::Reference<rendering::XCanvas> xCanvas; // Create canvas instance with window handle // ========================================= - if ( xFactory.is() ) - { - static uno::Reference<lang::XMultiServiceFactory> xCanvasFactory( - xFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star." - "rendering.CanvasFactory") ) ), + static uno::Reference<lang::XMultiServiceFactory> xCanvasFactory( + xFactory->createInstance( "com.sun.star.rendering.CanvasFactory" ), + uno::UNO_QUERY ); + if(xCanvasFactory.is()) + { + xCanvas.set( + xCanvasFactory->createInstanceWithArguments( + "com.sun.star.rendering.Canvas", aArg ), uno::UNO_QUERY ); - if(xCanvasFactory.is()) - { - xCanvas.set( - xCanvasFactory->createInstanceWithArguments( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.rendering.Canvas" )), - aArg ), - uno::UNO_QUERY ); - } } return xCanvas; diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index f167c044522c..97480d6c4e34 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -195,7 +195,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz { uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm ); uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW ); - uno::Reference< uno::XComponentContext > xContext( comphelper::getComponentContext(ImplGetSVData()->maAppData.mxMSF) ); + uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); uno::Reference< graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(xContext) ); uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() ); uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() ); diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 4022f2cefd7f..c941e2c1e084 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -39,7 +39,6 @@ #include <vcl/sysdata.hxx> #include <vcl/svapp.hxx> #include <vcl/syschild.hxx> -#include <vcl/unohelp.hxx> #include <window.h> #include <salinst.hxx> @@ -245,9 +244,9 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) #ifdef SOLAR_JAVA else { - uno::Reference< lang::XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() ); - if( xFactory.is() && ( GetSystemData()->aWindow > 0 ) ) + if( GetSystemData()->aWindow > 0 ) { try { diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index d7920cfe4ab7..73c1fbc4b495 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -26,7 +26,9 @@ * ************************************************************************/ +#include "sal/config.h" +#include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <tools/debug.hxx> #include <tools/rc.h> @@ -37,7 +39,6 @@ #include <vcl/toolbox.hxx> #include <vcl/mnemonic.hxx> #include <vcl/menu.hxx> -#include <vcl/unohelp.hxx> #include <vcl/ImageListProvider.hxx> #include <svdata.hxx> @@ -2139,7 +2140,7 @@ sal_Bool ToolBox::AlwaysLocked() nAlwaysLocked = 0; // ask configuration only once utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( - vcl::unohelper::GetMultiServiceFactory(), + comphelper::getProcessServiceFactory(), OUString("/org.openoffice.Office.UI.GlobalSettings/Toolbars") ); // note: case sensitive ! if ( aNode.isValid() ) { @@ -2152,7 +2153,7 @@ sal_Bool ToolBox::AlwaysLocked() { // now read the locking state utl::OConfigurationNode aNode2 = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( - vcl::unohelper::GetMultiServiceFactory(), + comphelper::getProcessServiceFactory(), OUString("/org.openoffice.Office.UI.GlobalSettings/Toolbars/States") ); // note: case sensitive ! sal_Bool bLocked = sal_Bool(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index b154eab540a7..2663644579c0 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -36,7 +36,6 @@ #include "unotools/confignode.hxx" #include "vcl/layout.hxx" -#include "vcl/unohelp.hxx" #include "vcl/salgtype.hxx" #include "vcl/event.hxx" #include "vcl/help.hxx" @@ -486,7 +485,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl { sal_Bool bTmp = sal_False, bAutoHCMode = sal_True; utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( - vcl::unohelper::GetMultiServiceFactory(), + comphelper::getProcessServiceFactory(), OUString("org.openoffice.Office.Common/Accessibility") ); // note: case sensitive ! if ( aNode.isValid() ) { @@ -8355,55 +8354,52 @@ uno::Reference< XDragSource > Window::GetDragSource() { try { - uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); - if ( xFactory.is() ) - { - const SystemEnvData * pEnvData = GetSystemData(); + uno::Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + const SystemEnvData * pEnvData = GetSystemData(); - if( pEnvData ) - { - Sequence< Any > aDragSourceAL( 2 ), aDropTargetAL( 2 ); - OUString aDragSourceSN, aDropTargetSN; + if( pEnvData ) + { + Sequence< Any > aDragSourceAL( 2 ), aDropTargetAL( 2 ); + OUString aDragSourceSN, aDropTargetSN; #if defined WNT - aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource"); - aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget"); - aDragSourceAL[ 1 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); - aDropTargetAL[ 0 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); + aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource"); + aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget"); + aDragSourceAL[ 1 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); + aDropTargetAL[ 0 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); #elif defined QUARTZ /* FIXME: Mac OS X specific dnd interface does not exist! * * Using Windows based dnd as a temporary solution */ - aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource"); - aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget"); - aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); - aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); + aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource"); + aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget"); + aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); + aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); #elif defined IOS /* What does LibreOffice's use of DND concepts mean on * iOS, huh, is this both inter-app DND (which clearly is * meaningless), or intra-app? Anyway, use the same code * as for MacOSX for now, even if meaningless... */ - aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource"); - aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget"); - aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); - aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); + aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource"); + aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget"); + aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); + aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) ); #elif defined UNX - aDropTargetAL.realloc( 3 ); - aDragSourceAL.realloc( 3 ); - aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.X11DragSource"); - aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.X11DropTarget"); - - aDragSourceAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); - aDragSourceAL[ 2 ] = makeAny( vcl::createBmpConverter() ); - aDropTargetAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); - aDropTargetAL[ 1 ] = makeAny( (sal_Size)(pEnvData->aShellWindow) ); - aDropTargetAL[ 2 ] = makeAny( vcl::createBmpConverter() ); + aDropTargetAL.realloc( 3 ); + aDragSourceAL.realloc( 3 ); + aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.X11DragSource"); + aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.X11DropTarget"); + + aDragSourceAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); + aDragSourceAL[ 2 ] = makeAny( vcl::createBmpConverter() ); + aDropTargetAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); + aDropTargetAL[ 1 ] = makeAny( (sal_Size)(pEnvData->aShellWindow) ); + aDropTargetAL[ 2 ] = makeAny( vcl::createBmpConverter() ); #endif - if( !aDragSourceSN.isEmpty() ) - mpWindowImpl->mpFrameData->mxDragSource = uno::Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY ); + if( !aDragSourceSN.isEmpty() ) + mpWindowImpl->mpFrameData->mxDragSource = uno::Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY ); - if( !aDropTargetSN.isEmpty() ) - mpWindowImpl->mpFrameData->mxDropTarget = uno::Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY ); - } + if( !aDropTargetSN.isEmpty() ) + mpWindowImpl->mpFrameData->mxDropTarget = uno::Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY ); } } @@ -8441,32 +8437,29 @@ uno::Reference< XClipboard > Window::GetClipboard() { try { - uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); + uno::Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.SystemClipboardExt") ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.SystemClipboardExt") ), UNO_QUERY ); - if( !mpWindowImpl->mpFrameData->mxClipboard.is() ) - mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.SystemClipboard") ), UNO_QUERY ); + if( !mpWindowImpl->mpFrameData->mxClipboard.is() ) + mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.SystemClipboard") ), UNO_QUERY ); #if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized - if( mpWindowImpl->mpFrameData->mxClipboard.is() ) - { - uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY ); + if( mpWindowImpl->mpFrameData->mxClipboard.is() ) + { + uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY ); - if( xInit.is() ) - { - Sequence< Any > aArgumentList( 3 ); - aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() ); - aArgumentList[ 1 ] = makeAny( OUString("CLIPBOARD") ); - aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); + if( xInit.is() ) + { + Sequence< Any > aArgumentList( 3 ); + aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() ); + aArgumentList[ 1 ] = makeAny( OUString("CLIPBOARD") ); + aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); - xInit->initialize( aArgumentList ); - } + xInit->initialize( aArgumentList ); } -#endif } +#endif } // createInstance can throw any exception @@ -8495,30 +8488,27 @@ uno::Reference< XClipboard > Window::GetPrimarySelection() { try { - uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); + uno::Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { #if defined(UNX) && !defined(QUARTZ) - Sequence< Any > aArgumentList( 3 ); - aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() ); - aArgumentList[ 1 ] = makeAny( OUString("PRIMARY") ); - aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); + Sequence< Any > aArgumentList( 3 ); + aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() ); + aArgumentList[ 1 ] = makeAny( OUString("PRIMARY") ); + aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); - mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments( - OUString("com.sun.star.datatransfer.clipboard.SystemClipboard"), aArgumentList ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments( + OUString("com.sun.star.datatransfer.clipboard.SystemClipboard"), aArgumentList ), UNO_QUERY ); # else - static uno::Reference< XClipboard > s_xSelection; + static uno::Reference< XClipboard > s_xSelection; - if ( !s_xSelection.is() ) - s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.GenericClipboardExt") ), UNO_QUERY ); + if ( !s_xSelection.is() ) + s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.GenericClipboardExt") ), UNO_QUERY ); - if ( !s_xSelection.is() ) - s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.GenericClipboard") ), UNO_QUERY ); + if ( !s_xSelection.is() ) + s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.GenericClipboard") ), UNO_QUERY ); - mpWindowImpl->mpFrameData->mxSelection = s_xSelection; + mpWindowImpl->mpFrameData->mxSelection = s_xSelection; # endif - } } // createInstance can throw any exception @@ -9451,54 +9441,50 @@ uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr const_cast<Window*>(this)->GetComponentInterface(), uno::UNO_QUERY )); - uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); + uno::Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); // Create canvas instance with window handle // ========================================= - if ( xFactory.is() ) - { - static ::vcl::DeleteUnoReferenceOnDeinit<lang::XMultiServiceFactory> xStaticCanvasFactory( - uno::Reference<lang::XMultiServiceFactory>( - xFactory->createInstance( - OUString( "com.sun.star.rendering.CanvasFactory" ) ), - UNO_QUERY )); - uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get()); + static ::vcl::DeleteUnoReferenceOnDeinit<lang::XMultiServiceFactory> xStaticCanvasFactory( + uno::Reference<lang::XMultiServiceFactory>( + xFactory->createInstance( + OUString( "com.sun.star.rendering.CanvasFactory" ) ), + UNO_QUERY )); + uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get()); - if(xCanvasFactory.is()) - { + if(xCanvasFactory.is()) + { #ifdef WNT - // see #140456# - if we're running on a multiscreen setup, - // request special, multi-screen safe sprite canvas - // implementation (not DX5 canvas, as it cannot cope with - // surfaces spanning multiple displays). Note: canvas - // (without sprite) stays the same) - const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mpWindowImpl->mpFrame )->mnDisplay; - if( (nDisplay >= Application::GetScreenCount()) ) - { - xCanvas.set( xCanvasFactory->createInstanceWithArguments( - bSpriteCanvas ? - OUString( "com.sun.star.rendering.SpriteCanvas.MultiScreen" ) : - OUString( "com.sun.star.rendering.Canvas" ), - aArg ), - UNO_QUERY ); - - } - else - { + // see #140456# - if we're running on a multiscreen setup, + // request special, multi-screen safe sprite canvas + // implementation (not DX5 canvas, as it cannot cope with + // surfaces spanning multiple displays). Note: canvas + // (without sprite) stays the same) + const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mpWindowImpl->mpFrame )->mnDisplay; + if( (nDisplay >= Application::GetScreenCount()) ) + { + xCanvas.set( xCanvasFactory->createInstanceWithArguments( + bSpriteCanvas ? + OUString( "com.sun.star.rendering.SpriteCanvas.MultiScreen" ) : + OUString( "com.sun.star.rendering.Canvas" ), + aArg ), + UNO_QUERY ); + } + else + { #endif - xCanvas.set( xCanvasFactory->createInstanceWithArguments( - bSpriteCanvas ? - OUString( "com.sun.star.rendering.SpriteCanvas" ) : - OUString( "com.sun.star.rendering.Canvas" ), - aArg ), - UNO_QUERY ); + xCanvas.set( xCanvasFactory->createInstanceWithArguments( + bSpriteCanvas ? + OUString( "com.sun.star.rendering.SpriteCanvas" ) : + OUString( "com.sun.star.rendering.Canvas" ), + aArg ), + UNO_QUERY ); #ifdef WNT - } + } #endif - mpWindowImpl->mxCanvas = xCanvas; - } + mpWindowImpl->mxCanvas = xCanvas; } // no factory??? Empty reference, then. diff --git a/vcl/test/canvasbitmaptest.cxx b/vcl/test/canvasbitmaptest.cxx index 98a7d2471221..b49659032ab4 100644 --- a/vcl/test/canvasbitmaptest.cxx +++ b/vcl/test/canvasbitmaptest.cxx @@ -78,7 +78,9 @@ SAL_IMPLEMENT_MAIN() rtl::OUString( "applicat.rdb" ), sal_True ); - InitVCL( xMS ); + comphelper::setProcessServiceFactory( xMS ); + + InitVCL(); ::Main(); DeInitVCL(); diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx index cbdea98c5f98..42ecc9cdd042 100644 --- a/vcl/workben/svdem.cxx +++ b/vcl/workben/svdem.cxx @@ -47,7 +47,9 @@ SAL_IMPLEMENT_MAIN() Reference< XMultiServiceFactory > xMS; xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); - InitVCL( xMS ); + comphelper::setProcessServiceFactory( xMS ); + + InitVCL(); ::Main(); DeInitVCL(); diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 2f8c8561a948..a07bec606728 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -100,7 +100,7 @@ SAL_IMPLEMENT_MAIN() exit( 1 ); } - InitVCL( xFactory ); + InitVCL(); ::Main(); DeInitVCL(); diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index 6e08dc1e2831..996d6fc1093a 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -66,7 +66,9 @@ SAL_IMPLEMENT_MAIN() Reference< XMultiServiceFactory > xMS; xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); - InitVCL( xMS ); + comphelper::setProcessServiceFactory( xMS ); + + InitVCL(); ::Main(); DeInitVCL(); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index b5fbb89089b0..448b5c30b721 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -59,7 +59,9 @@ SAL_IMPLEMENT_MAIN() Reference< XMultiServiceFactory > xMS; xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); - InitVCL( xMS ); + comphelper::setProcessServiceFactory( xMS ); + + InitVCL(); ::Main(); DeInitVCL(); diff --git a/xmlsecurity/workben/signaturetest.cxx b/xmlsecurity/workben/signaturetest.cxx index 1653b8fbadbc..59f7f3b29efd 100644 --- a/xmlsecurity/workben/signaturetest.cxx +++ b/xmlsecurity/workben/signaturetest.cxx @@ -96,7 +96,7 @@ void Main(); } comphelper::setProcessServiceFactory( xMSF ); - InitVCL( xMSF ); + InitVCL(); ::Main(); DeInitVCL(); |