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
This commit is contained in:
Stephan Bergmann 2012-10-31 09:22:53 +01:00
parent 6bc62f4f43
commit ced1151a1a
43 changed files with 189 additions and 347 deletions

View File

@ -680,7 +680,7 @@ void DemoApp::Main()
::ucb::UniversalContentBroker::create(
comphelper::getProcessComponentContext() );
InitVCL( xFactory );
InitVCL();
TestWindow pWindow;
pWindow.Execute();
DeInitVCL();

View File

@ -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();

View File

@ -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 );
{

View File

@ -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();

View File

@ -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() )
{

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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 ) );

View File

@ -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 ) );

View File

@ -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 ) );

View File

@ -55,7 +55,7 @@ SAL_IMPLEMENT_MAIN()
comphelper::setProcessServiceFactory(xSFactory);
InitVCL(xSFactory);
InitVCL();
{
SvtLanguageTable aTable;

View File

@ -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() )
{

View File

@ -1119,7 +1119,7 @@ void MSViewerWorkWindow::Resize()
}
comphelper::setProcessServiceFactory( xMSF );
InitVCL( xMSF );
InitVCL();
String aConfigURL;
if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( Application::GetAppFileName(), aConfigURL ) )

View File

@ -83,7 +83,7 @@ void test::BootstrapFixture::setUp()
aLocalOptions.SetLocaleConfigString( aLangISO );
aLocalOptions.SetUILocaleConfigString( aLangISO );
InitVCL(m_xSFactory);
InitVCL();
if (Application::IsHeadlessModeRequested())
Application::EnableHeadlessMode(true);

View File

@ -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

View File

@ -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();
}
}

View File

@ -114,7 +114,7 @@ namespace toolkit
using namespace toolkit;
IMPL_CREATEINSTANCE2( VCLXToolkit )
IMPL_CREATEINSTANCE( VCLXToolkit )
IMPL_CREATEINSTANCE( StdTabController )
IMPL_CREATEINSTANCE( StdTabControllerModel )
IMPL_CREATEINSTANCE2( UnoButtonControl )

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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 );

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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() )
{

View File

@ -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();

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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() );
}

View File

@ -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;
}

View File

@ -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
{

View File

@ -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( "com.sun.star.rendering.CanvasFactory" ),
uno::UNO_QUERY );
if(xCanvasFactory.is())
{
static uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(
xFactory->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star."
"rendering.CanvasFactory") ) ),
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;

View File

@ -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() );

View File

@ -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
{

View File

@ -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();

View File

@ -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");
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() );
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() )
if( mpWindowImpl->mpFrameData->mxClipboard.is() )
{
uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY );
if( xInit.is() )
{
uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY );
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());
if(xCanvasFactory.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());
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()) )
{
#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
{
#endif
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;
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 );
#ifdef WNT
}
#endif
mpWindowImpl->mxCanvas = xCanvas;
}
// no factory??? Empty reference, then.

View File

@ -78,7 +78,9 @@ SAL_IMPLEMENT_MAIN()
rtl::OUString( "applicat.rdb" ),
sal_True );
InitVCL( xMS );
comphelper::setProcessServiceFactory( xMS );
InitVCL();
::Main();
DeInitVCL();

View File

@ -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();

View File

@ -100,7 +100,7 @@ SAL_IMPLEMENT_MAIN()
exit( 1 );
}
InitVCL( xFactory );
InitVCL();
::Main();
DeInitVCL();

View File

@ -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();

View File

@ -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();

View File

@ -96,7 +96,7 @@ void Main();
}
comphelper::setProcessServiceFactory( xMSF );
InitVCL( xMSF );
InitVCL();
::Main();
DeInitVCL();