summaryrefslogtreecommitdiff
path: root/desktop/source/app/cmdlineargs.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/app/cmdlineargs.cxx')
-rwxr-xr-x[-rw-r--r--]desktop/source/app/cmdlineargs.cxx260
1 files changed, 150 insertions, 110 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 6798e8ede85a..998f414c6887 100644..100755
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -146,20 +146,21 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
UNO_QUERY);
// parse command line arguments
- sal_Bool bPrintEvent = sal_False;
- sal_Bool bOpenEvent = sal_True;
- sal_Bool bViewEvent = sal_False;
- sal_Bool bStartEvent = sal_False;
- sal_Bool bPrintToEvent = sal_False;
- sal_Bool bPrinterName = sal_False;
- sal_Bool bForceOpenEvent = sal_False;
- sal_Bool bForceNewEvent = sal_False;
- sal_Bool bDisplaySpec = sal_False;
- sal_Bool bConversionEvent= sal_False;
- sal_Bool bConversionParamsEvent= sal_False;
- sal_Bool bBatchPrintEvent= sal_False;
- sal_Bool bBatchPrinterNameEvent= sal_False;
- sal_Bool bConversionOutEvent = sal_False;
+ bool bOpenEvent(true);
+ bool bPrintEvent(false);
+ bool bViewEvent(false);
+ bool bStartEvent(false);
+ bool bPrintToEvent(false);
+ bool bPrinterName(false);
+ bool bForceOpenEvent(false);
+ bool bForceNewEvent(false);
+ bool bDisplaySpec(false);
+ bool bOpenDoc(false);
+ bool bConversionEvent(false);
+ bool bConversionParamsEvent(false);
+ bool bBatchPrintEvent(false);
+ bool bBatchPrinterNameEvent(false);
+ bool bConversionOutEvent(false);
m_eArgumentCount = NONE;
@@ -191,119 +192,119 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
if ( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("-n")))
{
// force new documents based on the following documents
- bForceNewEvent = sal_True;
- bOpenEvent = sal_False;
- bForceOpenEvent = sal_False;
- bPrintToEvent = sal_False;
- bPrintEvent = sal_False;
- bViewEvent = sal_False;
- bStartEvent = sal_False;
- bDisplaySpec = sal_False;
- }
- else if ( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("-o")))
- {
- // force open documents regards if they are templates or not
- bForceOpenEvent = sal_True;
- bOpenEvent = sal_False;
- bForceNewEvent = sal_False;
- bPrintToEvent = sal_False;
- bPrintEvent = sal_False;
- bViewEvent = sal_False;
- bStartEvent = sal_False;
- bDisplaySpec = sal_False;
- }
- else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("pt")))
+ bForceNewEvent = true;
+ bOpenEvent = false;
+ bForceOpenEvent = false;
+ bPrintToEvent = false;
+ bPrintEvent = false;
+ bViewEvent = false;
+ bStartEvent = false;
+ bDisplaySpec = false;
+ }
+ else if ( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM( "-o" )))
{
- // Print to special printer
- bPrintToEvent = sal_True;
- bPrinterName = sal_True;
- bPrintEvent = sal_False;
- bOpenEvent = sal_False;
- bForceNewEvent = sal_False;
- bViewEvent = sal_False;
- bStartEvent = sal_False;
- bDisplaySpec = sal_False;
- bForceOpenEvent = sal_False;
+ // force open documents regardless if they are templates or not
+ bForceOpenEvent = true;
+ bOpenEvent = false;
+ bForceNewEvent = false;
+ bPrintToEvent = false;
+ bPrintEvent = false;
+ bViewEvent = false;
+ bStartEvent = false;
+ bDisplaySpec = false;
}
- else if ( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("-p")))
+ else if ( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM( "-pt" )))
{
+ // Print to special printer
+ bPrintToEvent = true;
+ bPrinterName = true;
+ bPrintEvent = false;
+ bOpenEvent = false;
+ bForceNewEvent = false;
+ bViewEvent = false;
+ bStartEvent = false;
+ bDisplaySpec = false;
+ bForceOpenEvent = false;
+ }
+ else if ( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM( "-p" )))
+ {
// Print to default printer
- bPrintEvent = sal_True;
- bPrintToEvent = sal_False;
- bOpenEvent = sal_False;
- bForceNewEvent = sal_False;
- bForceOpenEvent = sal_False;
- bViewEvent = sal_False;
- bStartEvent = sal_False;
- bDisplaySpec = sal_False;
- }
- else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("view")))
- {
+ bPrintEvent = true;
+ bPrintToEvent = false;
+ bOpenEvent = false;
+ bForceNewEvent = false;
+ bForceOpenEvent = false;
+ bViewEvent = false;
+ bStartEvent = false;
+ bDisplaySpec = false;
+ }
+ else if ( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM( "-view" )))
+ {
// open in viewmode
- bOpenEvent = sal_False;
- bPrintEvent = sal_False;
- bPrintToEvent = sal_False;
- bForceNewEvent = sal_False;
- bForceOpenEvent = sal_False;
- bViewEvent = sal_True;
- bStartEvent = sal_False;
- bDisplaySpec = sal_False;
- }
- else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("show")))
- {
+ bOpenEvent = false;
+ bPrintEvent = false;
+ bPrintToEvent = false;
+ bForceNewEvent = false;
+ bForceOpenEvent = false;
+ bViewEvent = true;
+ bStartEvent = false;
+ bDisplaySpec = false;
+ }
+ else if ( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM( "-show" )))
+ {
// open in viewmode
- bOpenEvent = sal_False;
- bViewEvent = sal_False;
- bStartEvent = sal_True;
- bPrintEvent = sal_False;
- bPrintToEvent = sal_False;
- bForceNewEvent = sal_False;
- bForceOpenEvent = sal_False;
- bDisplaySpec = sal_False;
+ bOpenEvent = false;
+ bViewEvent = false;
+ bStartEvent = true;
+ bPrintEvent = false;
+ bPrintToEvent = false;
+ bForceNewEvent = false;
+ bForceOpenEvent = false;
+ bDisplaySpec = false;
}
else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("display")))
{
// set display
- bOpenEvent = sal_False;
- bPrintEvent = sal_False;
- bForceOpenEvent = sal_False;
- bPrintToEvent = sal_False;
- bForceNewEvent = sal_False;
- bViewEvent = sal_False;
- bStartEvent = sal_False;
- bDisplaySpec = sal_True;
+ bOpenEvent = false;
+ bPrintEvent = false;
+ bForceOpenEvent = false;
+ bPrintToEvent = false;
+ bForceNewEvent = false;
+ bViewEvent = false;
+ bStartEvent = false;
+ bDisplaySpec = true;
}
else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("language")))
{
- bOpenEvent = sal_False;
- bPrintEvent = sal_False;
- bForceOpenEvent = sal_False;
- bPrintToEvent = sal_False;
- bForceNewEvent = sal_False;
- bViewEvent = sal_False;
- bStartEvent = sal_False;
- bDisplaySpec = sal_False;
+ bOpenEvent = false;
+ bPrintEvent = false;
+ bForceOpenEvent = false;
+ bPrintToEvent = false;
+ bForceNewEvent = false;
+ bViewEvent = false;
+ bStartEvent = false;
+ bDisplaySpec = false;
}
else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("convert-to")))
{
- bOpenEvent = sal_False;
- bConversionEvent = sal_True;
- bConversionParamsEvent = sal_True;
+ bOpenEvent = false;
+ bConversionEvent = true;
+ bConversionParamsEvent = true;
}
else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("print-to-file")))
{
- bOpenEvent = sal_False;
- bBatchPrintEvent = sal_True;
+ bOpenEvent = false;
+ bBatchPrintEvent = true;
}
else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("printer-name")) &&
bBatchPrintEvent )
{
- bBatchPrinterNameEvent = sal_True;
+ bBatchPrinterNameEvent = true;
}
else if ( oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("outdir")) &&
(bConversionEvent || bBatchPrintEvent) )
{
- bConversionOutEvent = sal_True;
+ bConversionOutEvent = true;
}
}
else
@@ -312,24 +313,24 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
{
// first argument after "-pt" this must be the printer name
AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArg );
- bPrinterName = sal_False;
+ bPrinterName = false;
}
else if ( bConversionParamsEvent && bConversionEvent )
{
// first argument must be the the params
AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONPARAMS, aArg );
- bConversionParamsEvent = sal_False;
+ bConversionParamsEvent = false;
}
else if ( bBatchPrinterNameEvent && bBatchPrintEvent )
{
// first argument is the printer name
AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArg );
- bBatchPrinterNameEvent = sal_False;
+ bBatchPrinterNameEvent = false;
}
else if ( (bConversionEvent || bBatchPrintEvent) && bConversionOutEvent )
{
AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONOUT, aArg );
- bConversionOutEvent = sal_False;
+ bConversionOutEvent = false;
}
else
{
@@ -344,23 +345,45 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
}
// handle this argument as a filename
if ( bOpenEvent )
+ {
AddStringListParam_Impl( CMD_STRINGPARAM_OPENLIST, aArg );
+ bOpenDoc = true;
+ }
else if ( bViewEvent )
+ {
AddStringListParam_Impl( CMD_STRINGPARAM_VIEWLIST, aArg );
+ bOpenDoc = true;
+ }
else if ( bStartEvent )
+ {
AddStringListParam_Impl( CMD_STRINGPARAM_STARTLIST, aArg );
+ bOpenDoc = true;
+ }
else if ( bPrintEvent )
+ {
AddStringListParam_Impl( CMD_STRINGPARAM_PRINTLIST, aArg );
+ bOpenDoc = true;
+ }
else if ( bPrintToEvent )
+ {
AddStringListParam_Impl( CMD_STRINGPARAM_PRINTTOLIST, aArg );
+ bOpenDoc = true;
+ }
else if ( bForceNewEvent )
+ {
AddStringListParam_Impl( CMD_STRINGPARAM_FORCENEWLIST, aArg );
+ bOpenDoc = true;
+ }
else if ( bForceOpenEvent )
+ {
AddStringListParam_Impl( CMD_STRINGPARAM_FORCEOPENLIST, aArg );
- else if ( bDisplaySpec ){
+ bOpenDoc = true;
+ }
+ else if ( bDisplaySpec )
+ {
AddStringListParam_Impl( CMD_STRINGPARAM_DISPLAY, aArg );
- bDisplaySpec = sal_False; // only one display, not a list
- bOpenEvent = sal_True; // set back to standard
+ bDisplaySpec = false; // only one display, not a lsit
+ bOpenEvent = true; // set back to standard
}
else if ( bConversionEvent || bBatchPrintEvent )
AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONLIST, aArg );
@@ -369,6 +392,9 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
}
}
}
+
+ if ( bOpenDoc )
+ m_bDocumentArgs = true;
}
void CommandLineArgs::AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam )
@@ -509,7 +535,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
{
AddStringListParam_Impl( CMD_STRINGPARAM_SPLASHPIPE, oArg.copy(RTL_CONSTASCII_LENGTH("splash-pipe=")) );
}
- #ifdef MACOSX
+#ifdef MACOSX
/* #i84053# ignore -psn on Mac
Platform dependent #ifdef here is ugly, however this is currently
the only platform dependent parameter. Should more appear
@@ -520,7 +546,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
SetBoolParam_Impl( CMD_BOOLPARAM_PSN, sal_True );
return sal_True;
}
- #endif
+#endif
else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("infilter=")))
{
AddStringListParam_Impl( CMD_STRINGPARAM_INFILTER, oArg.copy(RTL_CONSTASCII_LENGTH("infilter=")) );
@@ -565,48 +591,56 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WRITER );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_WRITER, sal_True );
+ m_bDocumentArgs = true;
}
else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "calc" )) == sal_True )
{
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_CALC );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_CALC, sal_True );
+ m_bDocumentArgs = true;
}
else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "draw" )) == sal_True )
{
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_DRAW );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_DRAW, sal_True );
+ m_bDocumentArgs = true;
}
else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "impress" )) == sal_True )
{
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_IMPRESS );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_IMPRESS, sal_True );
+ m_bDocumentArgs = true;
}
else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "base" )) == sal_True )
{
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_BASE );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_BASE, sal_True );
+ m_bDocumentArgs = true;
}
else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "global" )) == sal_True )
{
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_GLOBAL );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_GLOBAL, sal_True );
+ m_bDocumentArgs = true;
}
else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "math" )) == sal_True )
{
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_MATH );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_MATH, sal_True );
+ m_bDocumentArgs = true;
}
else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "web" )) == sal_True )
{
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WEB );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_WEB, sal_True );
+ m_bDocumentArgs = true;
}
else
return sal_False;
@@ -635,12 +669,12 @@ sal_Bool CommandLineArgs::CheckGroupMembers( GroupParamId nGroupId, BoolParam nE
void CommandLineArgs::ResetParamValues()
{
int i;
-
for ( i = 0; i < CMD_BOOLPARAM_COUNT; i++ )
m_aBoolParams[i] = sal_False;
for ( i = 0; i < CMD_STRINGPARAM_COUNT; i++ )
m_aStrSetParams[i] = sal_False;
m_eArgumentCount = NONE;
+ m_bDocumentArgs = false;
}
void CommandLineArgs::SetBoolParam( BoolParam eParam, sal_Bool bNewValue )
@@ -963,6 +997,12 @@ sal_Bool CommandLineArgs::IsEmptyOrAcceptOnly() const
( ( m_eArgumentCount == ONE ) && m_aBoolParams[ CMD_BOOLPARAM_PSN ] );
}
+sal_Bool CommandLineArgs::WantsToLoadDocument() const
+{
+ osl::MutexGuard aMutexGuard( m_aMutex );
+ return m_bDocumentArgs;
+}
+
} // namespace desktop
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */