summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-25 10:15:15 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-26 11:30:35 +0200
commitf4a4ba9ac1b58b4726825400e1edd1bf47d4080a (patch)
treebac77ca71f40262110433cb4e53fbcb5dc54a42c /desktop/source
parent4972652eeba3ffa4d5055493d9275cfdc27b247c (diff)
Clean up option processing
* Support --version on non-UNX, too. * Consistently show the first unknown option and the help blob in the presence of any unknown options. * There is no need to tunnel --help/--version past oosplash in the soffice script, as oosplash is prepared to treat them adequately (esp. not pass them over any pipe); this only added unnecessary variance to what spellings exactly are supported and how mixtures of --help, --version, and unknown options are handled. Change-Id: I617f2e727e2f0eafd34a2de3b85d441c6783ec4f
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/app/app.cxx35
-rw-r--r--desktop/source/app/cmdlineargs.cxx18
-rw-r--r--desktop/source/app/cmdlineargs.hxx6
-rw-r--r--desktop/source/app/cmdlinehelp.cxx7
-rw-r--r--desktop/source/app/cmdlinehelp.hxx2
-rw-r--r--desktop/source/app/officeipcthread.cxx329
-rwxr-xr-xdesktop/source/app/sofficemain.cxx15
7 files changed, 215 insertions, 197 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 0a13e567b7c2..0e6ec43d0787 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -634,7 +634,8 @@ void Desktop::Init()
// 2nd office startup should terminate after sending cmdlineargs through pipe
SetBootstrapStatus(BS_TERMINATE);
}
- else if ( rCmdLineArgs.IsHelp() )
+ else if ( !rCmdLineArgs.GetUnknown().isEmpty()
+ || rCmdLineArgs.IsHelp() || rCmdLineArgs.IsVersion() )
{
// disable IPC thread in an instance that is just showing a help message
OfficeIPCThread::DisableOfficeIPCThread();
@@ -1388,6 +1389,22 @@ int Desktop::Main()
new DesktopContext( com::sun::star::uno::getCurrentContext() ) );
CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
+ OUString aUnknown( rCmdLineArgs.GetUnknown() );
+ if ( !aUnknown.isEmpty() )
+ {
+ displayCmdlineHelp( aUnknown );
+ return EXIT_FAILURE;
+ }
+ if ( rCmdLineArgs.IsHelp() )
+ {
+ displayCmdlineHelp( OUString() );
+ return EXIT_SUCCESS;
+ }
+ if ( rCmdLineArgs.IsVersion() )
+ {
+ displayVersion();
+ return EXIT_SUCCESS;
+ }
// setup configuration error handling
ConfigurationErrorHandler aConfigErrHandler;
@@ -1431,14 +1448,6 @@ int Desktop::Main()
SetSplashScreenProgress(25);
-#ifndef UNX
- if ( rCmdLineArgs.IsHelp() )
- {
- displayCmdlineHelp();
- return EXIT_SUCCESS;
- }
-#endif
-
// check user installation directory for lockfile so we can be sure
// there is no other instance using our data files from a remote host
RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main -> Lockfile" );
@@ -2696,10 +2705,10 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
}
break;
case ApplicationEvent::TYPE_HELP:
-#ifndef UNX
- // in non unix version allow showing of cmdline help window
- displayCmdlineHelp();
-#endif
+ displayCmdlineHelp(rAppEvent.GetData());
+ break;
+ case ApplicationEvent::TYPE_VERSION:
+ displayVersion();
break;
case ApplicationEvent::TYPE_OPEN:
{
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 83b728fd4ff6..01e1f30eae62 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -287,26 +287,25 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
{
bConversionOutEvent = true;
}
-#if defined UNX
else
// because it's impossible to filter these options that
// are handled in the soffice shell script with the
// primitive tools that /bin/sh offers, ignore them here
- if (!oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("backtrace")) &&
+ if (
+#if defined UNX
+ !oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("backtrace")) &&
!oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("strace")) &&
!oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("valgrind")) &&
// for X Session Management, handled in
// vcl/unx/generic/app/sm.cxx:
!oArg.match("session=") &&
+#endif
//ignore additional legacy options that don't do anything anymore
- !oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("nocrashreport")))
+ !oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("nocrashreport")) &&
+ m_unknown.isEmpty())
{
- fprintf(stderr, "Unknown option %s\n",
- rtl::OUStringToOString(aArg, osl_getThreadTextEncoding()).getStr());
- fprintf(stderr, "Run 'soffice --help' to see a full list of available command line options.\n");
- m_unknown = true;
+ m_unknown = aArg;
}
-#endif
}
else
{
@@ -624,7 +623,6 @@ void CommandLineArgs::InitParamValues()
m_helpbase = false;
m_psn = false;
m_version = false;
- m_unknown = false;
m_splashpipe = false;
m_bEmpty = true;
m_bDocumentArgs = false;
@@ -762,7 +760,7 @@ bool CommandLineArgs::IsVersion() const
return m_version;
}
-bool CommandLineArgs::HasUnknown() const
+OUString CommandLineArgs::GetUnknown() const
{
return m_unknown;
}
diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx
index c6286d2ba895..c8576435187c 100644
--- a/desktop/source/app/cmdlineargs.hxx
+++ b/desktop/source/app/cmdlineargs.hxx
@@ -93,9 +93,10 @@ class CommandLineArgs: private boost::noncopyable
bool IsWeb() const;
bool IsVersion() const;
bool HasModuleParam() const;
- bool HasUnknown() const;
bool WantsToLoadDocument() const;
+ OUString GetUnknown() const;
+
// Access to string parameters
bool HasSplashPipe() const;
std::vector< rtl::OUString > const & GetAccept() const;
@@ -153,9 +154,10 @@ class CommandLineArgs: private boost::noncopyable
bool m_helpbase;
bool m_psn;
bool m_version;
- bool m_unknown;
bool m_splashpipe;
+ OUString m_unknown;
+
bool m_bEmpty; // No Args at all
bool m_bDocumentArgs; // A document creation/open/load arg is used
std::vector< rtl::OUString > m_accept;
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index d09b5012f0ba..e6458036243e 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -136,7 +136,7 @@ namespace desktop
rtl::OUString ReplaceStringHookProc(const rtl::OUString& rStr);
- void displayCmdlineHelp()
+ void displayCmdlineHelp(OUString const & unknown)
{
// if you put variables in other chunks don't forget to call the replace routines
// for those chunks...
@@ -147,6 +147,11 @@ namespace desktop
String aHelpMessage_bottom(aCmdLineHelp_bottom, RTL_TEXTENCODING_ASCII_US);
aHelpMessage_version = ReplaceStringHookProc(aHelpMessage_version);
aHelpMessage_head.SearchAndReplaceAscii( "%CMDNAME", String( "soffice", RTL_TEXTENCODING_ASCII_US) );
+ if (!unknown.isEmpty())
+ {
+ aHelpMessage_head = "Unknown option: " + unknown + "\n\n"
+ + aHelpMessage_head;
+ }
#ifdef UNX
// on unix use console for output
fprintf(stdout, "%s%s",
diff --git a/desktop/source/app/cmdlinehelp.hxx b/desktop/source/app/cmdlinehelp.hxx
index 5c92512ea1e9..86c3c7162c98 100644
--- a/desktop/source/app/cmdlinehelp.hxx
+++ b/desktop/source/app/cmdlinehelp.hxx
@@ -5,7 +5,7 @@
namespace desktop
{
- void displayCmdlineHelp( void );
+ void displayCmdlineHelp( OUString const & unknown );
void displayVersion();
#ifndef UNX
class CmdlineHelpDialog : public ModalDialog
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index d90aa27a771b..743f79eb1474 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -703,192 +703,193 @@ void OfficeIPCThread::execute()
continue;
}
-#ifdef UNX
- if (aCmdLineArgs->HasUnknown() || aCmdLineArgs->IsVersion() || aCmdLineArgs->IsHelp())
- continue;
-#endif
-
- const CommandLineArgs &rCurrentCmdLineArgs = Desktop::GetCommandLineArgs();
+ sal_Bool bDocRequestSent = sal_False;
- if ( aCmdLineArgs->IsQuickstart() )
+ OUString aUnknown( aCmdLineArgs->GetUnknown() );
+ if ( !aUnknown.isEmpty() || aCmdLineArgs->IsHelp() )
{
- // we have to use application event, because we have to start quickstart service in main thread!!
ApplicationEvent* pAppEvent =
- new ApplicationEvent(ApplicationEvent::TYPE_QUICKSTART);
+ new ApplicationEvent(ApplicationEvent::TYPE_HELP, aUnknown);
ImplPostForeignAppEvent( pAppEvent );
}
-
- // handle request for acceptor
- std::vector< rtl::OUString > const & accept = aCmdLineArgs->
- GetAccept();
- for (std::vector< rtl::OUString >::const_iterator i(accept.begin());
- i != accept.end(); ++i)
+ else if ( aCmdLineArgs->IsVersion() )
{
- ApplicationEvent* pAppEvent = new ApplicationEvent(
- ApplicationEvent::TYPE_ACCEPT, *i);
- ImplPostForeignAppEvent( pAppEvent );
- }
- // handle acceptor removal
- std::vector< rtl::OUString > const & unaccept = aCmdLineArgs->
- GetUnaccept();
- for (std::vector< rtl::OUString >::const_iterator i(
- unaccept.begin());
- i != unaccept.end(); ++i)
- {
- ApplicationEvent* pAppEvent = new ApplicationEvent(
- ApplicationEvent::TYPE_UNACCEPT, *i);
- ImplPostForeignAppEvent( pAppEvent );
- }
-
-#ifndef UNX
- // only in non-unix version, we need to handle a -help request
- // in a running instance in order to display the command line help
- if ( aCmdLineArgs->IsHelp() ) {
ApplicationEvent* pAppEvent =
- new ApplicationEvent(ApplicationEvent::TYPE_HELP);
+ new ApplicationEvent(ApplicationEvent::TYPE_VERSION);
ImplPostForeignAppEvent( pAppEvent );
}
-#endif
-
- sal_Bool bDocRequestSent = sal_False;
- ProcessDocumentsRequest* pRequest = new ProcessDocumentsRequest(
- aCmdLineArgs->getCwdUrl());
- cProcessed.reset();
- pRequest->pcProcessed = &cProcessed;
-
- // Print requests are not dependent on the --invisible cmdline argument as they are
- // loaded with the "hidden" flag! So they are always checked.
- pRequest->aPrintList = aCmdLineArgs->GetPrintList();
- bDocRequestSent |= !pRequest->aPrintList.empty();
- pRequest->aPrintToList = aCmdLineArgs->GetPrintToList();
- pRequest->aPrinterName = aCmdLineArgs->GetPrinterName();
- bDocRequestSent |= !( pRequest->aPrintToList.empty() || pRequest->aPrinterName.isEmpty() );
-
- if ( !rCurrentCmdLineArgs.IsInvisible() )
+ else
{
- // Read cmdline args that can open/create documents. As they would open a window
- // they are only allowed if the "--invisible" is currently not used!
- pRequest->aOpenList = aCmdLineArgs->GetOpenList();
- bDocRequestSent |= !pRequest->aOpenList.empty();
- pRequest->aViewList = aCmdLineArgs->GetViewList();
- bDocRequestSent |= !pRequest->aViewList.empty();
- pRequest->aStartList = aCmdLineArgs->GetStartList();
- bDocRequestSent |= !pRequest->aStartList.empty();
- pRequest->aForceOpenList = aCmdLineArgs->GetForceOpenList();
- bDocRequestSent |= !pRequest->aForceOpenList.empty();
- pRequest->aForceNewList = aCmdLineArgs->GetForceNewList();
- bDocRequestSent |= !pRequest->aForceNewList.empty();
-
- // Special command line args to create an empty document for a given module
-
- // #i18338# (lo)
- // we only do this if no document was specified on the command line,
- // since this would be inconsistent with the the behaviour of
- // the first process, see OpenClients() (call to OpenDefault()) in app.cxx
- if ( aCmdLineArgs->HasModuleParam() && (!bDocRequestSent) )
+ const CommandLineArgs &rCurrentCmdLineArgs = Desktop::GetCommandLineArgs();
+
+ if ( aCmdLineArgs->IsQuickstart() )
{
- SvtModuleOptions aOpt;
- SvtModuleOptions::EFactory eFactory = SvtModuleOptions::E_WRITER;
- if ( aCmdLineArgs->IsWriter() )
- eFactory = SvtModuleOptions::E_WRITER;
- else if ( aCmdLineArgs->IsCalc() )
- eFactory = SvtModuleOptions::E_CALC;
- else if ( aCmdLineArgs->IsDraw() )
- eFactory = SvtModuleOptions::E_DRAW;
- else if ( aCmdLineArgs->IsImpress() )
- eFactory = SvtModuleOptions::E_IMPRESS;
- else if ( aCmdLineArgs->IsBase() )
- eFactory = SvtModuleOptions::E_DATABASE;
- else if ( aCmdLineArgs->IsMath() )
- eFactory = SvtModuleOptions::E_MATH;
- else if ( aCmdLineArgs->IsGlobal() )
- eFactory = SvtModuleOptions::E_WRITERGLOBAL;
- else if ( aCmdLineArgs->IsWeb() )
- eFactory = SvtModuleOptions::E_WRITERWEB;
-
- if ( !pRequest->aOpenList.empty() )
- pRequest->aModule = aOpt.GetFactoryName( eFactory );
- else
- pRequest->aOpenList.push_back( aOpt.GetFactoryEmptyDocumentURL( eFactory ) );
- bDocRequestSent = sal_True;
+ // we have to use application event, because we have to start quickstart service in main thread!!
+ ApplicationEvent* pAppEvent =
+ new ApplicationEvent(ApplicationEvent::TYPE_QUICKSTART);
+ ImplPostForeignAppEvent( pAppEvent );
}
- }
- if ( !aCmdLineArgs->IsQuickstart() ) {
- sal_Bool bShowHelp = sal_False;
- rtl::OUStringBuffer aHelpURLBuffer;
- if (aCmdLineArgs->IsHelpWriter()) {
- bShowHelp = sal_True;
- aHelpURLBuffer.appendAscii("vnd.sun.star.help://swriter/start");
- } else if (aCmdLineArgs->IsHelpCalc()) {
- bShowHelp = sal_True;
- aHelpURLBuffer.appendAscii("vnd.sun.star.help://scalc/start");
- } else if (aCmdLineArgs->IsHelpDraw()) {
- bShowHelp = sal_True;
- aHelpURLBuffer.appendAscii("vnd.sun.star.help://sdraw/start");
- } else if (aCmdLineArgs->IsHelpImpress()) {
- bShowHelp = sal_True;
- aHelpURLBuffer.appendAscii("vnd.sun.star.help://simpress/start");
- } else if (aCmdLineArgs->IsHelpBase()) {
- bShowHelp = sal_True;
- aHelpURLBuffer.appendAscii("vnd.sun.star.help://sdatabase/start");
- } else if (aCmdLineArgs->IsHelpBasic()) {
- bShowHelp = sal_True;
- aHelpURLBuffer.appendAscii("vnd.sun.star.help://sbasic/start");
- } else if (aCmdLineArgs->IsHelpMath()) {
- bShowHelp = sal_True;
- aHelpURLBuffer.appendAscii("vnd.sun.star.help://smath/start");
+ // handle request for acceptor
+ std::vector< rtl::OUString > const & accept = aCmdLineArgs->
+ GetAccept();
+ for (std::vector< rtl::OUString >::const_iterator i(accept.begin());
+ i != accept.end(); ++i)
+ {
+ ApplicationEvent* pAppEvent = new ApplicationEvent(
+ ApplicationEvent::TYPE_ACCEPT, *i);
+ ImplPostForeignAppEvent( pAppEvent );
}
- if (bShowHelp) {
- aHelpURLBuffer.appendAscii("?Language=");
- aHelpURLBuffer.append(utl::ConfigManager::getLocale());
-#if defined UNX
- aHelpURLBuffer.appendAscii("&System=UNX");
-#elif defined WNT
- aHelpURLBuffer.appendAscii("&System=WIN");
-#endif
+ // handle acceptor removal
+ std::vector< rtl::OUString > const & unaccept = aCmdLineArgs->
+ GetUnaccept();
+ for (std::vector< rtl::OUString >::const_iterator i(
+ unaccept.begin());
+ i != unaccept.end(); ++i)
+ {
ApplicationEvent* pAppEvent = new ApplicationEvent(
- ApplicationEvent::TYPE_OPENHELPURL,
- aHelpURLBuffer.makeStringAndClear());
+ ApplicationEvent::TYPE_UNACCEPT, *i);
ImplPostForeignAppEvent( pAppEvent );
}
- }
- if ( bDocRequestSent )
- {
- // Send requests to dispatch watcher if we have at least one. The receiver
- // is responsible to delete the request after processing it.
- if ( aCmdLineArgs->HasModuleParam() )
+ ProcessDocumentsRequest* pRequest = new ProcessDocumentsRequest(
+ aCmdLineArgs->getCwdUrl());
+ cProcessed.reset();
+ pRequest->pcProcessed = &cProcessed;
+
+ // Print requests are not dependent on the --invisible cmdline argument as they are
+ // loaded with the "hidden" flag! So they are always checked.
+ pRequest->aPrintList = aCmdLineArgs->GetPrintList();
+ bDocRequestSent |= !pRequest->aPrintList.empty();
+ pRequest->aPrintToList = aCmdLineArgs->GetPrintToList();
+ pRequest->aPrinterName = aCmdLineArgs->GetPrinterName();
+ bDocRequestSent |= !( pRequest->aPrintToList.empty() || pRequest->aPrinterName.isEmpty() );
+
+ if ( !rCurrentCmdLineArgs.IsInvisible() )
{
- SvtModuleOptions aOpt;
-
- // Support command line parameters to start a module (as preselection)
- if ( aCmdLineArgs->IsWriter() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
- pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::E_WRITER );
- else if ( aCmdLineArgs->IsCalc() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
- pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::E_CALC );
- else if ( aCmdLineArgs->IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
- pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::E_IMPRESS );
- else if ( aCmdLineArgs->IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
- pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::E_DRAW );
+ // Read cmdline args that can open/create documents. As they would open a window
+ // they are only allowed if the "--invisible" is currently not used!
+ pRequest->aOpenList = aCmdLineArgs->GetOpenList();
+ bDocRequestSent |= !pRequest->aOpenList.empty();
+ pRequest->aViewList = aCmdLineArgs->GetViewList();
+ bDocRequestSent |= !pRequest->aViewList.empty();
+ pRequest->aStartList = aCmdLineArgs->GetStartList();
+ bDocRequestSent |= !pRequest->aStartList.empty();
+ pRequest->aForceOpenList = aCmdLineArgs->GetForceOpenList();
+ bDocRequestSent |= !pRequest->aForceOpenList.empty();
+ pRequest->aForceNewList = aCmdLineArgs->GetForceNewList();
+ bDocRequestSent |= !pRequest->aForceNewList.empty();
+
+ // Special command line args to create an empty document for a given module
+
+ // #i18338# (lo)
+ // we only do this if no document was specified on the command line,
+ // since this would be inconsistent with the the behaviour of
+ // the first process, see OpenClients() (call to OpenDefault()) in app.cxx
+ if ( aCmdLineArgs->HasModuleParam() && (!bDocRequestSent) )
+ {
+ SvtModuleOptions aOpt;
+ SvtModuleOptions::EFactory eFactory = SvtModuleOptions::E_WRITER;
+ if ( aCmdLineArgs->IsWriter() )
+ eFactory = SvtModuleOptions::E_WRITER;
+ else if ( aCmdLineArgs->IsCalc() )
+ eFactory = SvtModuleOptions::E_CALC;
+ else if ( aCmdLineArgs->IsDraw() )
+ eFactory = SvtModuleOptions::E_DRAW;
+ else if ( aCmdLineArgs->IsImpress() )
+ eFactory = SvtModuleOptions::E_IMPRESS;
+ else if ( aCmdLineArgs->IsBase() )
+ eFactory = SvtModuleOptions::E_DATABASE;
+ else if ( aCmdLineArgs->IsMath() )
+ eFactory = SvtModuleOptions::E_MATH;
+ else if ( aCmdLineArgs->IsGlobal() )
+ eFactory = SvtModuleOptions::E_WRITERGLOBAL;
+ else if ( aCmdLineArgs->IsWeb() )
+ eFactory = SvtModuleOptions::E_WRITERWEB;
+
+ if ( !pRequest->aOpenList.empty() )
+ pRequest->aModule = aOpt.GetFactoryName( eFactory );
+ else
+ pRequest->aOpenList.push_back( aOpt.GetFactoryEmptyDocumentURL( eFactory ) );
+ bDocRequestSent = sal_True;
+ }
}
+ if ( !aCmdLineArgs->IsQuickstart() ) {
+ sal_Bool bShowHelp = sal_False;
+ rtl::OUStringBuffer aHelpURLBuffer;
+ if (aCmdLineArgs->IsHelpWriter()) {
+ bShowHelp = sal_True;
+ aHelpURLBuffer.appendAscii("vnd.sun.star.help://swriter/start");
+ } else if (aCmdLineArgs->IsHelpCalc()) {
+ bShowHelp = sal_True;
+ aHelpURLBuffer.appendAscii("vnd.sun.star.help://scalc/start");
+ } else if (aCmdLineArgs->IsHelpDraw()) {
+ bShowHelp = sal_True;
+ aHelpURLBuffer.appendAscii("vnd.sun.star.help://sdraw/start");
+ } else if (aCmdLineArgs->IsHelpImpress()) {
+ bShowHelp = sal_True;
+ aHelpURLBuffer.appendAscii("vnd.sun.star.help://simpress/start");
+ } else if (aCmdLineArgs->IsHelpBase()) {
+ bShowHelp = sal_True;
+ aHelpURLBuffer.appendAscii("vnd.sun.star.help://sdatabase/start");
+ } else if (aCmdLineArgs->IsHelpBasic()) {
+ bShowHelp = sal_True;
+ aHelpURLBuffer.appendAscii("vnd.sun.star.help://sbasic/start");
+ } else if (aCmdLineArgs->IsHelpMath()) {
+ bShowHelp = sal_True;
+ aHelpURLBuffer.appendAscii("vnd.sun.star.help://smath/start");
+ }
+ if (bShowHelp) {
+ aHelpURLBuffer.appendAscii("?Language=");
+ aHelpURLBuffer.append(utl::ConfigManager::getLocale());
+#if defined UNX
+ aHelpURLBuffer.appendAscii("&System=UNX");
+#elif defined WNT
+ aHelpURLBuffer.appendAscii("&System=WIN");
+#endif
+ ApplicationEvent* pAppEvent = new ApplicationEvent(
+ ApplicationEvent::TYPE_OPENHELPURL,
+ aHelpURLBuffer.makeStringAndClear());
+ ImplPostForeignAppEvent( pAppEvent );
+ }
+ }
- ImplPostProcessDocumentsEvent( pRequest );
- }
- else
- {
- // delete not used request again
- delete pRequest;
- pRequest = NULL;
- }
- if (aArguments.equalsL(sc_aShowSequence, sc_nShSeqLength) ||
- aCmdLineArgs->IsEmpty())
- {
- // no document was sent, just bring Office to front
- ApplicationEvent* pAppEvent =
- new ApplicationEvent(ApplicationEvent::TYPE_APPEAR);
- ImplPostForeignAppEvent( pAppEvent );
+ if ( bDocRequestSent )
+ {
+ // Send requests to dispatch watcher if we have at least one. The receiver
+ // is responsible to delete the request after processing it.
+ if ( aCmdLineArgs->HasModuleParam() )
+ {
+ SvtModuleOptions aOpt;
+
+ // Support command line parameters to start a module (as preselection)
+ if ( aCmdLineArgs->IsWriter() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::E_WRITER );
+ else if ( aCmdLineArgs->IsCalc() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
+ pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::E_CALC );
+ else if ( aCmdLineArgs->IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
+ pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::E_IMPRESS );
+ else if ( aCmdLineArgs->IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
+ pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::E_DRAW );
+ }
+
+ ImplPostProcessDocumentsEvent( pRequest );
+ }
+ else
+ {
+ // delete not used request again
+ delete pRequest;
+ pRequest = NULL;
+ }
+ if (aArguments.equalsL(sc_aShowSequence, sc_nShSeqLength) ||
+ aCmdLineArgs->IsEmpty())
+ {
+ // no document was sent, just bring Office to front
+ ApplicationEvent* pAppEvent =
+ new ApplicationEvent(ApplicationEvent::TYPE_APPEAR);
+ ImplPostForeignAppEvent( pAppEvent );
+ }
}
// we don't need the mutex any longer...
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index 9463b51c9fb1..45342d7c26f2 100755
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -60,22 +60,25 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
// handle --version and --help already here, otherwise they would be handled
// after VCL initialization that might fail if $DISPLAY is not set
const desktop::CommandLineArgs& rCmdLineArgs = aDesktop.GetCommandLineArgs();
+ OUString aUnknown( rCmdLineArgs.GetUnknown() );
+ if ( !aUnknown.isEmpty() )
+ {
+ desktop::Desktop::InitApplicationServiceManager();
+ desktop::displayCmdlineHelp( aUnknown );
+ return EXIT_FAILURE;
+ }
if ( rCmdLineArgs.IsHelp() )
{
desktop::Desktop::InitApplicationServiceManager();
- desktop::displayCmdlineHelp();
+ desktop::displayCmdlineHelp( OUString() );
return EXIT_SUCCESS;
}
- else if ( rCmdLineArgs.IsVersion() )
+ if ( rCmdLineArgs.IsVersion() )
{
desktop::Desktop::InitApplicationServiceManager();
desktop::displayVersion();
return EXIT_SUCCESS;
}
- else if ( rCmdLineArgs.HasUnknown() )
- {
- return EXIT_FAILURE;
- }
#endif
return SVMain();
#if defined ANDROID