fdo#54385: Displaying help/version early on UNX requires service manager

This regression was introduced with 6c6358a682
"Related fdo#53006: Do not instantiate service manager too early."

Change-Id: If22ea3ac6474188bf0792246620e5c705a813445
This commit is contained in:
Stephan Bergmann
2012-09-24 17:41:51 +02:00
parent 7528e11e37
commit 2f14e2e67c
4 changed files with 11 additions and 8 deletions

View File

@@ -136,11 +136,11 @@ class Desktop : public Application
void SetSplashScreenText( const ::rtl::OUString& rText );
void SetSplashScreenProgress( sal_Int32 );
private:
// Bootstrap methods
static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > CreateApplicationServiceManager();
// returns a non-null reference or throws an exception
static void InitApplicationServiceManager();
// throws an exception upon failure
private:
void RegisterServices();
void DeregisterServices();

View File

@@ -600,7 +600,7 @@ void Desktop::Init()
// something to enforce this gotcha
try
{
comphelper::setProcessServiceFactory(CreateApplicationServiceManager());
InitApplicationServiceManager();
}
catch (css::uno::Exception & e)
{

View File

@@ -111,20 +111,21 @@ static void configureUcb()
#endif // GNOME_VFS_ENABLED
}
Reference< XMultiServiceFactory > Desktop::CreateApplicationServiceManager()
void Desktop::InitApplicationServiceManager()
{
RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::createApplicationServiceManager" );
Reference<XMultiServiceFactory> sm;
#ifdef ANDROID
rtl::OUString aUnoRc( OUString( "file:///assets/program/unorc" ) );
return Reference<XMultiServiceFactory>(
sm.set(
cppu::defaultBootstrap_InitialComponentContext( aUnoRc )->getServiceManager(),
UNO_QUERY_THROW);
#else
return Reference<XMultiServiceFactory>(
sm.set(
cppu::defaultBootstrap_InitialComponentContext()->getServiceManager(),
UNO_QUERY_THROW);
#endif
comphelper::setProcessServiceFactory(sm);
}
void Desktop::DestroyApplicationServiceManager( Reference< XMultiServiceFactory >& xSMgr )

View File

@@ -62,11 +62,13 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
const desktop::CommandLineArgs& rCmdLineArgs = aDesktop.GetCommandLineArgs();
if ( rCmdLineArgs.IsHelp() )
{
desktop::Desktop::InitApplicationServiceManager();
desktop::displayCmdlineHelp();
return EXIT_SUCCESS;
}
else if ( rCmdLineArgs.IsVersion() )
{
desktop::Desktop::InitApplicationServiceManager();
desktop::displayVersion();
return EXIT_SUCCESS;
}