[Libreoffice-commits] .: desktop/scripts desktop/source desktop/unx vcl/inc
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Sep 26 02:31:57 PDT 2012
desktop/scripts/soffice.sh | 16 -
desktop/source/app/app.cxx | 35 ++-
desktop/source/app/cmdlineargs.cxx | 18 -
desktop/source/app/cmdlineargs.hxx | 6
desktop/source/app/cmdlinehelp.cxx | 7
desktop/source/app/cmdlinehelp.hxx | 2
desktop/source/app/officeipcthread.cxx | 329 ++++++++++++++++-----------------
desktop/source/app/sofficemain.cxx | 15 -
desktop/unx/source/args.c | 39 ++-
desktop/unx/source/args.h | 1
desktop/unx/source/start.c | 26 +-
vcl/inc/vcl/svapp.hxx | 6
12 files changed, 256 insertions(+), 244 deletions(-)
New commits:
commit f4a4ba9ac1b58b4726825400e1edd1bf47d4080a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Sep 25 10:15:15 2012 +0200
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
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh
index a259bf6..7727206 100755
--- a/desktop/scripts/soffice.sh
+++ b/desktop/scripts/soffice.sh
@@ -158,21 +158,5 @@ if [ -n "$VALGRINDCHECK" -a -z "$VALGRIND" ] ; then
exec &>valgrind.log
fi
-# do not pass the request for command line help to oosplash
-for arg in $@ ; do
- case "$arg" in
- -h | --h | --he | --hel | --help)
- "$sd_prog/soffice.bin" --help
- exit 0
- ;;
- -V | --v | --ve | --ver | --vers | --versi | --versio | --version)
- "$sd_prog/soffice.bin" --version
- exit 0
- ;;
- *)
- ;;
- esac
-done
-
# oosplash does the rest: forcing pages in, javaldx etc. are
exec $VALGRINDCHECK $STRACECHECK "$sd_prog/oosplash" "$@"
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 0a13e56..0e6ec43 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 83b728f..01e1f30 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 c6286d2..c857643 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 d09b501..e645803 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 5c92512..86c3c71 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 d90aa27..743f79e 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 9463b51..45342d7 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
diff --git a/desktop/unx/source/args.c b/desktop/unx/source/args.c
index 0e01123..e08d119 100644
--- a/desktop/unx/source/args.c
+++ b/desktop/unx/source/args.c
@@ -48,30 +48,34 @@ static struct {
unsigned int bInhibitSplash : 1;
unsigned int bInhibitPagein : 1;
unsigned int bInhibitJavaLdx : 1;
+ unsigned int bInhibitPipe : 1;
const char *pPageinType;
} pArgDescr[] = {
/* have a trailing argument */
- { "pt", 1, 0, 0, 0, NULL },
- { "display", 1, 0, 0, 0, NULL },
+ { "pt", 1, 0, 0, 0, 0, NULL },
+ { "display", 1, 0, 0, 0, 0, NULL },
/* no splash */
- { "nologo", 0, 1, 0, 0, NULL },
- { "headless", 0, 1, 0, 0, NULL },
- { "invisible", 0, 1, 0, 0, NULL },
- { "quickstart", 0, 1, 0, 0, NULL },
- { "minimized", 0, 1, 0, 0, NULL },
+ { "nologo", 0, 1, 0, 0, 0, NULL },
+ { "headless", 0, 1, 0, 0, 0, NULL },
+ { "invisible", 0, 1, 0, 0, 0, NULL },
+ { "quickstart", 0, 1, 0, 0, 0, NULL },
+ { "minimized", 0, 1, 0, 0, 0, NULL },
/* pagein bits */
- { "writer", 0, 0, 0, 0, "pagein-writer" },
- { "calc", 0, 0, 0, 0, "pagein-calc" },
- { "draw", 0, 0, 0, 0, "pagein-draw" },
- { "impress", 0, 0, 0, 0, "pagein-impress" },
-
- /* nothing much */
- { "version", 0, 1, 1, 1, NULL },
- { "help", 0, 1, 1, 1, NULL },
- { "h", 0, 1, 1, 1, NULL },
- { "?", 0, 1, 1, 1, NULL },
+ { "writer", 0, 0, 0, 0, 0, "pagein-writer" },
+ { "calc", 0, 0, 0, 0, 0, "pagein-calc" },
+ { "draw", 0, 0, 0, 0, 0, "pagein-draw" },
+ { "impress", 0, 0, 0, 0, 0, "pagein-impress" },
+
+ /* Do not send --help/--version over the pipe, as their output shall go to
+ the calling process's stdout (ideally, this would also happen in the
+ presence of unknown options); also prevent splash/pagein/javaldx overhead
+ (as these options will be processed early in soffice_main): */
+ { "version", 0, 1, 1, 1, 1, NULL },
+ { "help", 0, 1, 1, 1, 1, NULL },
+ { "h", 0, 1, 1, 1, 1, NULL },
+ { "?", 0, 1, 1, 1, 1, NULL },
};
Args *args_parse (void)
@@ -133,6 +137,7 @@ Args *args_parse (void)
args->bInhibitSplash |= pArgDescr[j].bInhibitSplash;
args->bInhibitPagein |= pArgDescr[j].bInhibitPagein;
args->bInhibitJavaLdx |= pArgDescr[j].bInhibitJavaLdx;
+ args->bInhibitPipe |= pArgDescr[j].bInhibitPipe;
if (pArgDescr[j].pPageinType)
args->pPageinType = pArgDescr[j].pPageinType;
break;
diff --git a/desktop/unx/source/args.h b/desktop/unx/source/args.h
index 4a0cb55..9176bad 100644
--- a/desktop/unx/source/args.h
+++ b/desktop/unx/source/args.h
@@ -38,6 +38,7 @@ typedef struct {
sal_Bool bInhibitSplash; // should we show a splash screen
sal_Bool bInhibitPagein; // should we run pagein ?
sal_Bool bInhibitJavaLdx; // should we run javaldx ?
+ sal_Bool bInhibitPipe; // for --help and --version
sal_uInt32 nArgsEnv; // number of -env: style args
sal_uInt32 nArgsTotal; // number of -env: as well as -writer style args
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index f1e872e..2800ef3 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -831,21 +831,24 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
if ( pUsePlugin && !strcmp(pUsePlugin, "svp") )
args->bInhibitSplash = sal_True;
- pPipePath = get_pipe_path( args->pAppPath );
-
- if ( ( fd = connect_pipe( pPipePath ) ) >= 0 )
+ if ( !args->bInhibitPipe )
{
- rtl_uString *pCwdPath = NULL;
- osl_getProcessWorkingDir( &pCwdPath );
+ pPipePath = get_pipe_path( args->pAppPath );
+
+ if ( ( fd = connect_pipe( pPipePath ) ) >= 0 )
+ {
+ rtl_uString *pCwdPath = NULL;
+ osl_getProcessWorkingDir( &pCwdPath );
- bSentArgs = send_args( fd, pCwdPath );
+ bSentArgs = send_args( fd, pCwdPath );
- close( fd );
- }
+ close( fd );
+ }
#if OSL_DEBUG_LEVEL > 1
- else
- ustr_debug( "Failed to connect to pipe", pPipePath );
+ else
+ ustr_debug( "Failed to connect to pipe", pPipePath );
#endif
+ }
if ( !bSentArgs )
{
@@ -935,7 +938,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
}
/* cleanup */
- rtl_uString_release( pPipePath );
+ if ( pPipePath )
+ rtl_uString_release( pPipePath );
args_free (args);
return status;
diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx
index 804a3c7..24b22a5 100644
--- a/vcl/inc/vcl/svapp.hxx
+++ b/vcl/inc/vcl/svapp.hxx
@@ -113,9 +113,9 @@ class VCL_DLLPUBLIC ApplicationEvent
{
public:
enum Type {
- TYPE_ACCEPT, TYPE_APPEAR, TYPE_HELP, TYPE_OPEN, TYPE_OPENHELPURL,
- TYPE_PRINT, TYPE_PRIVATE_DOSHUTDOWN, TYPE_QUICKSTART, TYPE_SHOWDIALOG,
- TYPE_UNACCEPT
+ TYPE_ACCEPT, TYPE_APPEAR, TYPE_HELP, TYPE_VERSION, TYPE_OPEN,
+ TYPE_OPENHELPURL, TYPE_PRINT, TYPE_PRIVATE_DOSHUTDOWN, TYPE_QUICKSTART,
+ TYPE_SHOWDIALOG, TYPE_UNACCEPT
};
ApplicationEvent() {}
More information about the Libreoffice-commits
mailing list