1*2722ceddSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2722ceddSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2722ceddSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2722ceddSAndrew Rist * distributed with this work for additional information 6*2722ceddSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2722ceddSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2722ceddSAndrew Rist * "License"); you may not use this file except in compliance 9*2722ceddSAndrew Rist * with the License. You may obtain a copy of the License at 10*2722ceddSAndrew Rist * 11*2722ceddSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2722ceddSAndrew Rist * 13*2722ceddSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2722ceddSAndrew Rist * software distributed under the License is distributed on an 15*2722ceddSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2722ceddSAndrew Rist * KIND, either express or implied. See the License for the 17*2722ceddSAndrew Rist * specific language governing permissions and limitations 18*2722ceddSAndrew Rist * under the License. 19*2722ceddSAndrew Rist * 20*2722ceddSAndrew Rist *************************************************************/ 21*2722ceddSAndrew Rist 22*2722ceddSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_desktop.hxx" 26cdf0e10cSrcweir #include <cmdlineargs.hxx> 27cdf0e10cSrcweir #include <vcl/svapp.hxx> 28cdf0e10cSrcweir #include <rtl/uri.hxx> 29cdf0e10cSrcweir #include <rtl/ustring.hxx> 30cdf0e10cSrcweir #include "rtl/process.h" 31cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 32cdf0e10cSrcweir #include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 34cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 35cdf0e10cSrcweir #include "tools/getprocessworkingdir.hxx" 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <svl/documentlockfile.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir using namespace rtl; 40cdf0e10cSrcweir using namespace com::sun::star::lang; 41cdf0e10cSrcweir using namespace com::sun::star::uri; 42cdf0e10cSrcweir using namespace com::sun::star::uno; 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace desktop 45cdf0e10cSrcweir { 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace { 48cdf0e10cSrcweir 49cdf0e10cSrcweir class ExtCommandLineSupplier: public CommandLineArgs::Supplier { 50cdf0e10cSrcweir public: 51cdf0e10cSrcweir explicit ExtCommandLineSupplier(): 52cdf0e10cSrcweir m_count(rtl_getAppCommandArgCount()), 53cdf0e10cSrcweir m_index(0) 54cdf0e10cSrcweir { 55cdf0e10cSrcweir rtl::OUString url; 56cdf0e10cSrcweir if (tools::getProcessWorkingDir(&url)) { 57cdf0e10cSrcweir m_cwdUrl.reset(url); 58cdf0e10cSrcweir } 59cdf0e10cSrcweir } 60cdf0e10cSrcweir 61cdf0e10cSrcweir virtual ~ExtCommandLineSupplier() {} 62cdf0e10cSrcweir 63cdf0e10cSrcweir virtual boost::optional< rtl::OUString > getCwdUrl() { return m_cwdUrl; } 64cdf0e10cSrcweir 65cdf0e10cSrcweir virtual bool next(rtl::OUString * argument) { 66cdf0e10cSrcweir OSL_ASSERT(argument != NULL); 67cdf0e10cSrcweir if (m_index < m_count) { 68cdf0e10cSrcweir rtl_getAppCommandArg(m_index++, &argument->pData); 69cdf0e10cSrcweir return true; 70cdf0e10cSrcweir } else { 71cdf0e10cSrcweir return false; 72cdf0e10cSrcweir } 73cdf0e10cSrcweir } 74cdf0e10cSrcweir 75cdf0e10cSrcweir private: 76cdf0e10cSrcweir boost::optional< rtl::OUString > m_cwdUrl; 77cdf0e10cSrcweir sal_uInt32 m_count; 78cdf0e10cSrcweir sal_uInt32 m_index; 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir static CommandLineArgs::BoolParam aModuleGroupDefinition[] = 84cdf0e10cSrcweir { 85cdf0e10cSrcweir CommandLineArgs::CMD_BOOLPARAM_WRITER, 86cdf0e10cSrcweir CommandLineArgs::CMD_BOOLPARAM_CALC, 87cdf0e10cSrcweir CommandLineArgs::CMD_BOOLPARAM_DRAW, 88cdf0e10cSrcweir CommandLineArgs::CMD_BOOLPARAM_IMPRESS, 89cdf0e10cSrcweir CommandLineArgs::CMD_BOOLPARAM_GLOBAL, 90cdf0e10cSrcweir CommandLineArgs::CMD_BOOLPARAM_MATH, 91cdf0e10cSrcweir CommandLineArgs::CMD_BOOLPARAM_WEB, 92cdf0e10cSrcweir CommandLineArgs::CMD_BOOLPARAM_BASE 93cdf0e10cSrcweir }; 94cdf0e10cSrcweir 95cdf0e10cSrcweir CommandLineArgs::GroupDefinition CommandLineArgs::m_pGroupDefinitions[ CommandLineArgs::CMD_GRPID_COUNT ] = 96cdf0e10cSrcweir { 97cdf0e10cSrcweir { 8, aModuleGroupDefinition } 98cdf0e10cSrcweir }; 99cdf0e10cSrcweir 100cdf0e10cSrcweir CommandLineArgs::Supplier::Exception::Exception() {} 101cdf0e10cSrcweir 102cdf0e10cSrcweir CommandLineArgs::Supplier::Exception::Exception(Exception const &) {} 103cdf0e10cSrcweir 104cdf0e10cSrcweir CommandLineArgs::Supplier::Exception::~Exception() {} 105cdf0e10cSrcweir 106cdf0e10cSrcweir CommandLineArgs::Supplier::Exception & 107cdf0e10cSrcweir CommandLineArgs::Supplier::Exception::operator =(Exception const &) 108cdf0e10cSrcweir { return *this; } 109cdf0e10cSrcweir 110cdf0e10cSrcweir CommandLineArgs::Supplier::~Supplier() {} 111cdf0e10cSrcweir 112cdf0e10cSrcweir // intialize class with command line parameters from process environment 113cdf0e10cSrcweir CommandLineArgs::CommandLineArgs() 114cdf0e10cSrcweir { 115cdf0e10cSrcweir ResetParamValues(); 116cdf0e10cSrcweir ExtCommandLineSupplier s; 117cdf0e10cSrcweir ParseCommandLine_Impl( s ); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir 120cdf0e10cSrcweir CommandLineArgs::CommandLineArgs( Supplier& supplier ) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir ResetParamValues(); 123cdf0e10cSrcweir ParseCommandLine_Impl( supplier ); 124cdf0e10cSrcweir } 125cdf0e10cSrcweir 126cdf0e10cSrcweir // ---------------------------------------------------------------------------- 127cdf0e10cSrcweir 128cdf0e10cSrcweir void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir m_cwdUrl = supplier.getCwdUrl(); 131cdf0e10cSrcweir Reference<XMultiServiceFactory> xMS(comphelper::getProcessServiceFactory(), UNO_QUERY); 132cdf0e10cSrcweir OSL_ENSURE(xMS.is(), "CommandLineArgs: no ProcessServiceFactory."); 133cdf0e10cSrcweir 134cdf0e10cSrcweir Reference< XExternalUriReferenceTranslator > xTranslator( 135cdf0e10cSrcweir xMS->createInstance( 136cdf0e10cSrcweir OUString::createFromAscii( 137cdf0e10cSrcweir "com.sun.star.uri.ExternalUriReferenceTranslator")), 138cdf0e10cSrcweir UNO_QUERY); 139cdf0e10cSrcweir 140cdf0e10cSrcweir // parse command line arguments 141cdf0e10cSrcweir bool bOpenEvent(true); 142cdf0e10cSrcweir bool bPrintEvent(false); 143cdf0e10cSrcweir bool bViewEvent(false); 144cdf0e10cSrcweir bool bStartEvent(false); 145cdf0e10cSrcweir bool bPrintToEvent(false); 146cdf0e10cSrcweir bool bPrinterName(false); 147cdf0e10cSrcweir bool bForceOpenEvent(false); 148cdf0e10cSrcweir bool bForceNewEvent(false); 149cdf0e10cSrcweir bool bDisplaySpec(false); 150cdf0e10cSrcweir bool bOpenDoc(false); 151cdf0e10cSrcweir 152cdf0e10cSrcweir m_eArgumentCount = NONE; 153cdf0e10cSrcweir 154cdf0e10cSrcweir for (;;) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir ::rtl::OUString aArg; 157cdf0e10cSrcweir if ( !supplier.next( &aArg ) ) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir break; 160cdf0e10cSrcweir } 161cdf0e10cSrcweir // convert file URLs to internal form #112849# 162cdf0e10cSrcweir if (aArg.indexOf(OUString::createFromAscii("file:"))==0 && 163cdf0e10cSrcweir xTranslator.is()) 164cdf0e10cSrcweir { 165cdf0e10cSrcweir OUString tmp(xTranslator->translateToInternal(aArg)); 166cdf0e10cSrcweir if (tmp.getLength() > 0) 167cdf0e10cSrcweir aArg = tmp; 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir String aArgStr = aArg; 171cdf0e10cSrcweir if ( aArg.getLength() > 0 ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir m_eArgumentCount = m_eArgumentCount == NONE ? ONE : MANY; 174cdf0e10cSrcweir if ( !InterpretCommandLineParameter( aArg )) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir if ( aArgStr.GetChar(0) == '-' ) 177cdf0e10cSrcweir { 178cdf0e10cSrcweir // handle this argument as an option 179cdf0e10cSrcweir if ( aArgStr.EqualsIgnoreCaseAscii( "-n" )) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir // force new documents based on the following documents 182cdf0e10cSrcweir bForceNewEvent = true; 183cdf0e10cSrcweir bOpenEvent = false; 184cdf0e10cSrcweir bForceOpenEvent = false; 185cdf0e10cSrcweir bPrintToEvent = false; 186cdf0e10cSrcweir bPrintEvent = false; 187cdf0e10cSrcweir bViewEvent = false; 188cdf0e10cSrcweir bStartEvent = false; 189cdf0e10cSrcweir bDisplaySpec = false; 190cdf0e10cSrcweir } 191cdf0e10cSrcweir else if ( aArgStr.EqualsIgnoreCaseAscii( "-o" )) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir // force open documents regardless if they are templates or not 194cdf0e10cSrcweir bForceOpenEvent = true; 195cdf0e10cSrcweir bOpenEvent = false; 196cdf0e10cSrcweir bForceNewEvent = false; 197cdf0e10cSrcweir bPrintToEvent = false; 198cdf0e10cSrcweir bPrintEvent = false; 199cdf0e10cSrcweir bViewEvent = false; 200cdf0e10cSrcweir bStartEvent = false; 201cdf0e10cSrcweir bDisplaySpec = false; 202cdf0e10cSrcweir } 203cdf0e10cSrcweir else if ( aArgStr.EqualsIgnoreCaseAscii( "-pt" )) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir // Print to special printer 206cdf0e10cSrcweir bPrintToEvent = true; 207cdf0e10cSrcweir bPrinterName = true; 208cdf0e10cSrcweir bPrintEvent = false; 209cdf0e10cSrcweir bOpenEvent = false; 210cdf0e10cSrcweir bForceNewEvent = false; 211cdf0e10cSrcweir bViewEvent = false; 212cdf0e10cSrcweir bStartEvent = false; 213cdf0e10cSrcweir bDisplaySpec = false; 214cdf0e10cSrcweir bForceOpenEvent = false; 215cdf0e10cSrcweir } 216cdf0e10cSrcweir else if ( aArgStr.EqualsIgnoreCaseAscii( "-p" )) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir // Print to default printer 219cdf0e10cSrcweir bPrintEvent = true; 220cdf0e10cSrcweir bPrintToEvent = false; 221cdf0e10cSrcweir bOpenEvent = false; 222cdf0e10cSrcweir bForceNewEvent = false; 223cdf0e10cSrcweir bForceOpenEvent = false; 224cdf0e10cSrcweir bViewEvent = false; 225cdf0e10cSrcweir bStartEvent = false; 226cdf0e10cSrcweir bDisplaySpec = false; 227cdf0e10cSrcweir } 228cdf0e10cSrcweir else if ( aArgStr.EqualsIgnoreCaseAscii( "-view" )) 229cdf0e10cSrcweir { 230cdf0e10cSrcweir // open in viewmode 231cdf0e10cSrcweir bOpenEvent = false; 232cdf0e10cSrcweir bPrintEvent = false; 233cdf0e10cSrcweir bPrintToEvent = false; 234cdf0e10cSrcweir bForceNewEvent = false; 235cdf0e10cSrcweir bForceOpenEvent = false; 236cdf0e10cSrcweir bViewEvent = true; 237cdf0e10cSrcweir bStartEvent = false; 238cdf0e10cSrcweir bDisplaySpec = false; 239cdf0e10cSrcweir } 240cdf0e10cSrcweir else if ( aArgStr.EqualsIgnoreCaseAscii( "-show" )) 241cdf0e10cSrcweir { 242cdf0e10cSrcweir // open in viewmode 243cdf0e10cSrcweir bOpenEvent = false; 244cdf0e10cSrcweir bViewEvent = false; 245cdf0e10cSrcweir bStartEvent = true; 246cdf0e10cSrcweir bPrintEvent = false; 247cdf0e10cSrcweir bPrintToEvent = false; 248cdf0e10cSrcweir bForceNewEvent = false; 249cdf0e10cSrcweir bForceOpenEvent = false; 250cdf0e10cSrcweir bDisplaySpec = false; 251cdf0e10cSrcweir } 252cdf0e10cSrcweir else if ( aArgStr.EqualsIgnoreCaseAscii( "-display" )) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir // set display 255cdf0e10cSrcweir bOpenEvent = false; 256cdf0e10cSrcweir bPrintEvent = false; 257cdf0e10cSrcweir bForceOpenEvent = false; 258cdf0e10cSrcweir bPrintToEvent = false; 259cdf0e10cSrcweir bForceNewEvent = false; 260cdf0e10cSrcweir bViewEvent = false; 261cdf0e10cSrcweir bStartEvent = false; 262cdf0e10cSrcweir bDisplaySpec = true; 263cdf0e10cSrcweir } 264cdf0e10cSrcweir else if ( aArgStr.EqualsIgnoreCaseAscii( "-language" )) 265cdf0e10cSrcweir { 266cdf0e10cSrcweir bOpenEvent = false; 267cdf0e10cSrcweir bPrintEvent = false; 268cdf0e10cSrcweir bForceOpenEvent = false; 269cdf0e10cSrcweir bPrintToEvent = false; 270cdf0e10cSrcweir bForceNewEvent = false; 271cdf0e10cSrcweir bViewEvent = false; 272cdf0e10cSrcweir bStartEvent = false; 273cdf0e10cSrcweir bDisplaySpec = false; 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir #ifdef MACOSX 277cdf0e10cSrcweir /* #i84053# ignore -psn on Mac 278cdf0e10cSrcweir Platform dependent #ifdef here is ugly, however this is currently 279cdf0e10cSrcweir the only platform dependent parameter. Should more appear 280cdf0e10cSrcweir we should find a better solution 281cdf0e10cSrcweir */ 282cdf0e10cSrcweir else if ( aArgStr.CompareToAscii( "-psn", 4 ) == COMPARE_EQUAL ) 283cdf0e10cSrcweir { 284cdf0e10cSrcweir // finder argument from MacOSX 285cdf0e10cSrcweir bOpenEvent = false; 286cdf0e10cSrcweir bPrintEvent = false; 287cdf0e10cSrcweir bForceOpenEvent = false; 288cdf0e10cSrcweir bPrintToEvent = false; 289cdf0e10cSrcweir bForceNewEvent = false; 290cdf0e10cSrcweir bViewEvent = false; 291cdf0e10cSrcweir bStartEvent = false; 292cdf0e10cSrcweir bDisplaySpec = false; 293cdf0e10cSrcweir } 294cdf0e10cSrcweir #endif 295cdf0e10cSrcweir } 296cdf0e10cSrcweir else 297cdf0e10cSrcweir { 298cdf0e10cSrcweir if ( bPrinterName && bPrintToEvent ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir // first argument after "-pt" this must be the printer name 301cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArgStr ); 302cdf0e10cSrcweir bPrinterName = sal_False; 303cdf0e10cSrcweir } 304cdf0e10cSrcweir else 305cdf0e10cSrcweir { 306cdf0e10cSrcweir // handle this argument as a filename 307cdf0e10cSrcweir if ( bOpenEvent ) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_OPENLIST, aArgStr ); 310cdf0e10cSrcweir bOpenDoc = true; 311cdf0e10cSrcweir } 312cdf0e10cSrcweir else if ( bViewEvent ) 313cdf0e10cSrcweir { 314cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_VIEWLIST, aArgStr ); 315cdf0e10cSrcweir bOpenDoc = true; 316cdf0e10cSrcweir } 317cdf0e10cSrcweir else if ( bStartEvent ) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_STARTLIST, aArgStr ); 320cdf0e10cSrcweir bOpenDoc = true; 321cdf0e10cSrcweir } 322cdf0e10cSrcweir else if ( bPrintEvent ) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_PRINTLIST, aArgStr ); 325cdf0e10cSrcweir bOpenDoc = true; 326cdf0e10cSrcweir } 327cdf0e10cSrcweir else if ( bPrintToEvent ) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_PRINTTOLIST, aArgStr ); 330cdf0e10cSrcweir bOpenDoc = true; 331cdf0e10cSrcweir } 332cdf0e10cSrcweir else if ( bForceNewEvent ) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_FORCENEWLIST, aArgStr ); 335cdf0e10cSrcweir bOpenDoc = true; 336cdf0e10cSrcweir } 337cdf0e10cSrcweir else if ( bForceOpenEvent ) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_FORCEOPENLIST, aArgStr ); 340cdf0e10cSrcweir bOpenDoc = true; 341cdf0e10cSrcweir } 342cdf0e10cSrcweir else if ( bDisplaySpec ) 343cdf0e10cSrcweir { 344cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_DISPLAY, aArgStr ); 345cdf0e10cSrcweir bDisplaySpec = false; // only one display, not a lsit 346cdf0e10cSrcweir bOpenEvent = true; // set back to standard 347cdf0e10cSrcweir } 348cdf0e10cSrcweir } 349cdf0e10cSrcweir } 350cdf0e10cSrcweir } 351cdf0e10cSrcweir } 352cdf0e10cSrcweir } 353cdf0e10cSrcweir 354cdf0e10cSrcweir if ( bOpenDoc ) 355cdf0e10cSrcweir m_bDocumentArgs = true; 356cdf0e10cSrcweir } 357cdf0e10cSrcweir 358cdf0e10cSrcweir void CommandLineArgs::AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam ) 359cdf0e10cSrcweir { 360cdf0e10cSrcweir OSL_ASSERT( eParam >= 0 && eParam < CMD_STRINGPARAM_COUNT ); 361cdf0e10cSrcweir if ( m_aStrParams[eParam].getLength() ) 362cdf0e10cSrcweir m_aStrParams[eParam] += ::rtl::OUString::valueOf( (sal_Unicode)APPEVENT_PARAM_DELIMITER ); 363cdf0e10cSrcweir m_aStrParams[eParam] += aParam; 364cdf0e10cSrcweir m_aStrSetParams[eParam] = sal_True; 365cdf0e10cSrcweir } 366cdf0e10cSrcweir 367cdf0e10cSrcweir void CommandLineArgs::SetBoolParam_Impl( BoolParam eParam, sal_Bool bValue ) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir OSL_ASSERT( eParam >= 0 && eParam < CMD_BOOLPARAM_COUNT ); 370cdf0e10cSrcweir m_aBoolParams[eParam] = bValue; 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& aArg ) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir String aArgStr( aArg ); 376cdf0e10cSrcweir 377cdf0e10cSrcweir if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-minimized" )) == sal_True ) 378cdf0e10cSrcweir { 379cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_MINIMIZED, sal_True ); 380cdf0e10cSrcweir return sal_True; 381cdf0e10cSrcweir } 382cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-invisible" )) == sal_True ) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_INVISIBLE, sal_True ); 385cdf0e10cSrcweir return sal_True; 386cdf0e10cSrcweir } 387cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-norestore" )) == sal_True ) 388cdf0e10cSrcweir { 389cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_NORESTORE, sal_True ); 390cdf0e10cSrcweir return sal_True; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nodefault" )) == sal_True ) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_NODEFAULT, sal_True ); 395cdf0e10cSrcweir return sal_True; 396cdf0e10cSrcweir } 397cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-bean" )) == sal_True ) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_BEAN, sal_True ); 400cdf0e10cSrcweir return sal_True; 401cdf0e10cSrcweir } 402cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-plugin" )) == sal_True ) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_PLUGIN, sal_True ); 405cdf0e10cSrcweir return sal_True; 406cdf0e10cSrcweir } 407cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-server" )) == sal_True ) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_SERVER, sal_True ); 410cdf0e10cSrcweir return sal_True; 411cdf0e10cSrcweir } 412cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-headless" )) == sal_True ) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir // Headless means also invisibile, so set this parameter to true! 415cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HEADLESS, sal_True ); 416cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_INVISIBLE, sal_True ); 417cdf0e10cSrcweir return sal_True; 418cdf0e10cSrcweir } 419cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-quickstart" )) == sal_True ) 420cdf0e10cSrcweir { 4212ad018beSPedro Giffuni #if defined(ENABLE_QUICKSTART_APPLET) 422cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_QUICKSTART, sal_True ); 423cdf0e10cSrcweir #endif 424cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_NOQUICKSTART, sal_False ); 425cdf0e10cSrcweir return sal_True; 426cdf0e10cSrcweir } 427cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-quickstart=no" ))) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_NOQUICKSTART, sal_True ); 430cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_QUICKSTART, sal_False ); 431cdf0e10cSrcweir return sal_True; 432cdf0e10cSrcweir } 433cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-terminate_after_init" )) == sal_True ) 434cdf0e10cSrcweir { 435cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_TERMINATEAFTERINIT, sal_True ); 436cdf0e10cSrcweir return sal_True; 437cdf0e10cSrcweir } 438cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nofirststartwizard" )) == sal_True ) 439cdf0e10cSrcweir { 440cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_NOFIRSTSTARTWIZARD, sal_True ); 441cdf0e10cSrcweir return sal_True; 442cdf0e10cSrcweir } 443cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nologo" )) == sal_True ) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_NOLOGO, sal_True ); 446cdf0e10cSrcweir return sal_True; 447cdf0e10cSrcweir } 448cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nolockcheck" )) == sal_True ) 449cdf0e10cSrcweir { 450cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_NOLOCKCHECK, sal_True ); 451cdf0e10cSrcweir // Workaround for automated testing 452cdf0e10cSrcweir ::svt::DocumentLockFile::AllowInteraction( sal_False ); 453cdf0e10cSrcweir 454cdf0e10cSrcweir return sal_True; 455cdf0e10cSrcweir } 456cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-help" )) 457cdf0e10cSrcweir || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-h" )) 458cdf0e10cSrcweir || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-?" ))) 459cdf0e10cSrcweir { 460cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HELP, sal_True ); 461cdf0e10cSrcweir return sal_True; 462cdf0e10cSrcweir } 463cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpwriter" )) == sal_True ) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HELPWRITER, sal_True ); 466cdf0e10cSrcweir return sal_True; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpcalc" )) == sal_True ) 469cdf0e10cSrcweir { 470cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HELPCALC, sal_True ); 471cdf0e10cSrcweir return sal_True; 472cdf0e10cSrcweir } 473cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpdraw" )) == sal_True ) 474cdf0e10cSrcweir { 475cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HELPDRAW, sal_True ); 476cdf0e10cSrcweir return sal_True; 477cdf0e10cSrcweir } 478cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpimpress" )) == sal_True ) 479cdf0e10cSrcweir { 480cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HELPIMPRESS, sal_True ); 481cdf0e10cSrcweir return sal_True; 482cdf0e10cSrcweir } 483cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpbase" )) == sal_True ) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HELPBASE, sal_True ); 486cdf0e10cSrcweir return sal_True; 487cdf0e10cSrcweir } 488cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpbasic" )) == sal_True ) 489cdf0e10cSrcweir { 490cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HELPBASIC, sal_True ); 491cdf0e10cSrcweir return sal_True; 492cdf0e10cSrcweir } 493cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpmath" )) == sal_True ) 494cdf0e10cSrcweir { 495cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_HELPMATH, sal_True ); 496cdf0e10cSrcweir return sal_True; 497cdf0e10cSrcweir } 498cdf0e10cSrcweir #ifdef MACOSX 499cdf0e10cSrcweir /* #i84053# ignore -psn on Mac 500cdf0e10cSrcweir Platform dependent #ifdef here is ugly, however this is currently 501cdf0e10cSrcweir the only platform dependent parameter. Should more appear 502cdf0e10cSrcweir we should find a better solution 503cdf0e10cSrcweir */ 504cdf0e10cSrcweir else if ( aArg.compareToAscii( "-psn", 4 ) == 0 ) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_PSN, sal_True ); 507cdf0e10cSrcweir return sal_True; 508cdf0e10cSrcweir } 509cdf0e10cSrcweir #endif 510cdf0e10cSrcweir else if ( aArgStr.Copy(0, 8).EqualsIgnoreCaseAscii( "-accept=" )) 511cdf0e10cSrcweir { 512cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_ACCEPT, aArgStr.Copy( 8 ) ); 513cdf0e10cSrcweir return sal_True; 514cdf0e10cSrcweir } 515cdf0e10cSrcweir else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-unaccept=" )) 516cdf0e10cSrcweir { 517cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_UNACCEPT, aArgStr.Copy( 10 ) ); 518cdf0e10cSrcweir return sal_True; 519cdf0e10cSrcweir } 520cdf0e10cSrcweir else if ( aArgStr.CompareIgnoreCaseToAscii( "-portal," , 521cdf0e10cSrcweir RTL_CONSTASCII_LENGTH( "-portal," )) == COMPARE_EQUAL ) 522cdf0e10cSrcweir { 523cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_PORTAL, aArgStr.Copy( RTL_CONSTASCII_LENGTH( "-portal," )) ); 524cdf0e10cSrcweir return sal_True; 525cdf0e10cSrcweir } 526cdf0e10cSrcweir else if ( aArgStr.Copy( 0, 7 ).EqualsIgnoreCaseAscii( "-userid" )) 527cdf0e10cSrcweir { 528cdf0e10cSrcweir if ( aArgStr.Len() > 8 ) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir rtl::OUString aUserDir = aArgStr; 531cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_USERDIR, 532cdf0e10cSrcweir ::rtl::Uri::decode( aUserDir.copy( 8 ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ) ); 533cdf0e10cSrcweir } 534cdf0e10cSrcweir return sal_True; 535cdf0e10cSrcweir } 536cdf0e10cSrcweir else if ( aArgStr.Copy( 0, 15).EqualsIgnoreCaseAscii( "-clientdisplay=" )) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_CLIENTDISPLAY, aArgStr.Copy( 15 ) ); 539cdf0e10cSrcweir return sal_True; 540cdf0e10cSrcweir } 541cdf0e10cSrcweir else if ( aArgStr.Copy(0, 9).EqualsIgnoreCaseAscii( "-version=" )) 542cdf0e10cSrcweir { 543cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_VERSION, aArgStr.Copy( 9 ) ); 544cdf0e10cSrcweir return sal_True; 545cdf0e10cSrcweir } 546cdf0e10cSrcweir else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-language=" )) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir AddStringListParam_Impl( CMD_STRINGPARAM_LANGUAGE, aArgStr.Copy( 10 ) ); 549cdf0e10cSrcweir return sal_True; 550cdf0e10cSrcweir } 551cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-writer" )) == sal_True ) 552cdf0e10cSrcweir { 553cdf0e10cSrcweir sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WRITER ); 554cdf0e10cSrcweir if ( !bAlreadySet ) 555cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_WRITER, sal_True ); 556cdf0e10cSrcweir m_bDocumentArgs = true; 557cdf0e10cSrcweir return sal_True; 558cdf0e10cSrcweir } 559cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-calc" )) == sal_True ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_CALC ); 562cdf0e10cSrcweir if ( !bAlreadySet ) 563cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_CALC, sal_True ); 564cdf0e10cSrcweir m_bDocumentArgs = true; 565cdf0e10cSrcweir return sal_True; 566cdf0e10cSrcweir } 567cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-draw" )) == sal_True ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_DRAW ); 570cdf0e10cSrcweir if ( !bAlreadySet ) 571cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_DRAW, sal_True ); 572cdf0e10cSrcweir m_bDocumentArgs = true; 573cdf0e10cSrcweir return sal_True; 574cdf0e10cSrcweir } 575cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-impress" )) == sal_True ) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_IMPRESS ); 578cdf0e10cSrcweir if ( !bAlreadySet ) 579cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_IMPRESS, sal_True ); 580cdf0e10cSrcweir m_bDocumentArgs = true; 581cdf0e10cSrcweir return sal_True; 582cdf0e10cSrcweir } 583cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-base" )) == sal_True ) 584cdf0e10cSrcweir { 585cdf0e10cSrcweir sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_BASE ); 586cdf0e10cSrcweir if ( !bAlreadySet ) 587cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_BASE, sal_True ); 588cdf0e10cSrcweir m_bDocumentArgs = true; 589cdf0e10cSrcweir return sal_True; 590cdf0e10cSrcweir } 591cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-global" )) == sal_True ) 592cdf0e10cSrcweir { 593cdf0e10cSrcweir sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_GLOBAL ); 594cdf0e10cSrcweir if ( !bAlreadySet ) 595cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_GLOBAL, sal_True ); 596cdf0e10cSrcweir m_bDocumentArgs = true; 597cdf0e10cSrcweir return sal_True; 598cdf0e10cSrcweir } 599cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-math" )) == sal_True ) 600cdf0e10cSrcweir { 601cdf0e10cSrcweir sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_MATH ); 602cdf0e10cSrcweir if ( !bAlreadySet ) 603cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_MATH, sal_True ); 604cdf0e10cSrcweir m_bDocumentArgs = true; 605cdf0e10cSrcweir return sal_True; 606cdf0e10cSrcweir } 607cdf0e10cSrcweir else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-web" )) == sal_True ) 608cdf0e10cSrcweir { 609cdf0e10cSrcweir sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WEB ); 610cdf0e10cSrcweir if ( !bAlreadySet ) 611cdf0e10cSrcweir SetBoolParam_Impl( CMD_BOOLPARAM_WEB, sal_True ); 612cdf0e10cSrcweir m_bDocumentArgs = true; 613cdf0e10cSrcweir return sal_True; 614cdf0e10cSrcweir } 615cdf0e10cSrcweir 616cdf0e10cSrcweir return sal_False; 617cdf0e10cSrcweir } 618cdf0e10cSrcweir 619cdf0e10cSrcweir sal_Bool CommandLineArgs::CheckGroupMembers( GroupParamId nGroupId, BoolParam nExcludeMember ) const 620cdf0e10cSrcweir { 621cdf0e10cSrcweir // Check if at least one bool param out of a group is set. An exclude member can be provided. 622cdf0e10cSrcweir for ( int i = 0; i < m_pGroupDefinitions[nGroupId].nCount; i++ ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir BoolParam nParam = m_pGroupDefinitions[nGroupId].pGroupMembers[i]; 625cdf0e10cSrcweir if ( nParam != nExcludeMember && m_aBoolParams[nParam] ) 626cdf0e10cSrcweir return sal_True; 627cdf0e10cSrcweir } 628cdf0e10cSrcweir 629cdf0e10cSrcweir return sal_False; 630cdf0e10cSrcweir } 631cdf0e10cSrcweir 632cdf0e10cSrcweir void CommandLineArgs::ResetParamValues() 633cdf0e10cSrcweir { 634cdf0e10cSrcweir int i; 635cdf0e10cSrcweir for ( i = 0; i < CMD_BOOLPARAM_COUNT; i++ ) 636cdf0e10cSrcweir m_aBoolParams[i] = sal_False; 637cdf0e10cSrcweir for ( i = 0; i < CMD_STRINGPARAM_COUNT; i++ ) 638cdf0e10cSrcweir m_aStrSetParams[i] = sal_False; 639cdf0e10cSrcweir m_eArgumentCount = NONE; 640cdf0e10cSrcweir m_bDocumentArgs = false; 641cdf0e10cSrcweir } 642cdf0e10cSrcweir 643cdf0e10cSrcweir void CommandLineArgs::SetBoolParam( BoolParam eParam, sal_Bool bNewValue ) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 646cdf0e10cSrcweir 647cdf0e10cSrcweir OSL_ASSERT( ( eParam >= 0 && eParam < CMD_BOOLPARAM_COUNT ) ); 648cdf0e10cSrcweir m_aBoolParams[eParam] = bNewValue; 649cdf0e10cSrcweir } 650cdf0e10cSrcweir 651cdf0e10cSrcweir sal_Bool CommandLineArgs::IsMinimized() const 652cdf0e10cSrcweir { 653cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 654cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_MINIMIZED ]; 655cdf0e10cSrcweir } 656cdf0e10cSrcweir 657cdf0e10cSrcweir sal_Bool CommandLineArgs::IsInvisible() const 658cdf0e10cSrcweir { 659cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 660cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_INVISIBLE ]; 661cdf0e10cSrcweir } 662cdf0e10cSrcweir 663cdf0e10cSrcweir sal_Bool CommandLineArgs::IsNoRestore() const 664cdf0e10cSrcweir { 665cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 666cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_NORESTORE ]; 667cdf0e10cSrcweir } 668cdf0e10cSrcweir 669cdf0e10cSrcweir sal_Bool CommandLineArgs::IsNoDefault() const 670cdf0e10cSrcweir { 671cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 672cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_NODEFAULT ]; 673cdf0e10cSrcweir } 674cdf0e10cSrcweir 675cdf0e10cSrcweir sal_Bool CommandLineArgs::IsBean() const 676cdf0e10cSrcweir { 677cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 678cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_BEAN ]; 679cdf0e10cSrcweir } 680cdf0e10cSrcweir 681cdf0e10cSrcweir sal_Bool CommandLineArgs::IsServer() const 682cdf0e10cSrcweir { 683cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 684cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_SERVER ]; 685cdf0e10cSrcweir } 686cdf0e10cSrcweir 687cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHeadless() const 688cdf0e10cSrcweir { 689cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 690cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HEADLESS ]; 691cdf0e10cSrcweir } 692cdf0e10cSrcweir 693cdf0e10cSrcweir sal_Bool CommandLineArgs::IsQuickstart() const 694cdf0e10cSrcweir { 695cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 696cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_QUICKSTART ]; 697cdf0e10cSrcweir } 698cdf0e10cSrcweir 699cdf0e10cSrcweir sal_Bool CommandLineArgs::IsNoQuickstart() const 700cdf0e10cSrcweir { 701cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 702cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_NOQUICKSTART ]; 703cdf0e10cSrcweir } 704cdf0e10cSrcweir 705cdf0e10cSrcweir sal_Bool CommandLineArgs::IsTerminateAfterInit() const 706cdf0e10cSrcweir { 707cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 708cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_TERMINATEAFTERINIT ]; 709cdf0e10cSrcweir } 710cdf0e10cSrcweir 711cdf0e10cSrcweir sal_Bool CommandLineArgs::IsNoFirstStartWizard() const 712cdf0e10cSrcweir { 713cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 714cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_NOFIRSTSTARTWIZARD ]; 715cdf0e10cSrcweir } 716cdf0e10cSrcweir 717cdf0e10cSrcweir sal_Bool CommandLineArgs::IsNoLogo() const 718cdf0e10cSrcweir { 719cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 720cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_NOLOGO ]; 721cdf0e10cSrcweir } 722cdf0e10cSrcweir 723cdf0e10cSrcweir sal_Bool CommandLineArgs::IsNoLockcheck() const 724cdf0e10cSrcweir { 725cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 726cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_NOLOCKCHECK ]; 727cdf0e10cSrcweir } 728cdf0e10cSrcweir 729cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHelp() const 730cdf0e10cSrcweir { 731cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 732cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HELP ]; 733cdf0e10cSrcweir } 734cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHelpWriter() const 735cdf0e10cSrcweir { 736cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 737cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HELPWRITER ]; 738cdf0e10cSrcweir } 739cdf0e10cSrcweir 740cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHelpCalc() const 741cdf0e10cSrcweir { 742cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 743cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HELPCALC ]; 744cdf0e10cSrcweir } 745cdf0e10cSrcweir 746cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHelpDraw() const 747cdf0e10cSrcweir { 748cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 749cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HELPDRAW ]; 750cdf0e10cSrcweir } 751cdf0e10cSrcweir 752cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHelpImpress() const 753cdf0e10cSrcweir { 754cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 755cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HELPIMPRESS ]; 756cdf0e10cSrcweir } 757cdf0e10cSrcweir 758cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHelpBase() const 759cdf0e10cSrcweir { 760cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 761cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HELPBASE ]; 762cdf0e10cSrcweir } 763cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHelpMath() const 764cdf0e10cSrcweir { 765cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 766cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HELPMATH ]; 767cdf0e10cSrcweir } 768cdf0e10cSrcweir sal_Bool CommandLineArgs::IsHelpBasic() const 769cdf0e10cSrcweir { 770cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 771cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_HELPBASIC ]; 772cdf0e10cSrcweir } 773cdf0e10cSrcweir 774cdf0e10cSrcweir sal_Bool CommandLineArgs::IsWriter() const 775cdf0e10cSrcweir { 776cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 777cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_WRITER ]; 778cdf0e10cSrcweir } 779cdf0e10cSrcweir 780cdf0e10cSrcweir sal_Bool CommandLineArgs::IsCalc() const 781cdf0e10cSrcweir { 782cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 783cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_CALC ]; 784cdf0e10cSrcweir } 785cdf0e10cSrcweir 786cdf0e10cSrcweir sal_Bool CommandLineArgs::IsDraw() const 787cdf0e10cSrcweir { 788cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 789cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_DRAW ]; 790cdf0e10cSrcweir } 791cdf0e10cSrcweir 792cdf0e10cSrcweir sal_Bool CommandLineArgs::IsImpress() const 793cdf0e10cSrcweir { 794cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 795cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_IMPRESS ]; 796cdf0e10cSrcweir } 797cdf0e10cSrcweir 798cdf0e10cSrcweir sal_Bool CommandLineArgs::IsBase() const 799cdf0e10cSrcweir { 800cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 801cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_BASE ]; 802cdf0e10cSrcweir } 803cdf0e10cSrcweir 804cdf0e10cSrcweir sal_Bool CommandLineArgs::IsGlobal() const 805cdf0e10cSrcweir { 806cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 807cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_GLOBAL ]; 808cdf0e10cSrcweir } 809cdf0e10cSrcweir 810cdf0e10cSrcweir sal_Bool CommandLineArgs::IsMath() const 811cdf0e10cSrcweir { 812cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 813cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_MATH ]; 814cdf0e10cSrcweir } 815cdf0e10cSrcweir 816cdf0e10cSrcweir sal_Bool CommandLineArgs::IsWeb() const 817cdf0e10cSrcweir { 818cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 819cdf0e10cSrcweir return m_aBoolParams[ CMD_BOOLPARAM_WEB ]; 820cdf0e10cSrcweir } 821cdf0e10cSrcweir 822cdf0e10cSrcweir sal_Bool CommandLineArgs::HasModuleParam() const 823cdf0e10cSrcweir { 824cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 825cdf0e10cSrcweir return CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_COUNT ); 826cdf0e10cSrcweir } 827cdf0e10cSrcweir 828cdf0e10cSrcweir sal_Bool CommandLineArgs::GetPortalConnectString( ::rtl::OUString& rPara ) const 829cdf0e10cSrcweir { 830cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 831cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_PORTAL ]; 832cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_PORTAL ]; 833cdf0e10cSrcweir } 834cdf0e10cSrcweir 835cdf0e10cSrcweir sal_Bool CommandLineArgs::GetAcceptString( ::rtl::OUString& rPara ) const 836cdf0e10cSrcweir { 837cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 838cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_ACCEPT ]; 839cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_ACCEPT ]; 840cdf0e10cSrcweir } 841cdf0e10cSrcweir 842cdf0e10cSrcweir sal_Bool CommandLineArgs::GetUnAcceptString( ::rtl::OUString& rPara ) const 843cdf0e10cSrcweir { 844cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 845cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_UNACCEPT ]; 846cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_UNACCEPT ]; 847cdf0e10cSrcweir } 848cdf0e10cSrcweir 849cdf0e10cSrcweir sal_Bool CommandLineArgs::GetOpenList( ::rtl::OUString& rPara) const 850cdf0e10cSrcweir { 851cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 852cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_OPENLIST ]; 853cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_OPENLIST ]; 854cdf0e10cSrcweir } 855cdf0e10cSrcweir 856cdf0e10cSrcweir sal_Bool CommandLineArgs::GetViewList( ::rtl::OUString& rPara) const 857cdf0e10cSrcweir { 858cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 859cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_VIEWLIST ]; 860cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_VIEWLIST ]; 861cdf0e10cSrcweir } 862cdf0e10cSrcweir 863cdf0e10cSrcweir sal_Bool CommandLineArgs::GetStartList( ::rtl::OUString& rPara) const 864cdf0e10cSrcweir { 865cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 866cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_STARTLIST ]; 867cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_STARTLIST ]; 868cdf0e10cSrcweir } 869cdf0e10cSrcweir 870cdf0e10cSrcweir sal_Bool CommandLineArgs::GetForceOpenList( ::rtl::OUString& rPara) const 871cdf0e10cSrcweir { 872cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 873cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_FORCEOPENLIST ]; 874cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_FORCEOPENLIST ]; 875cdf0e10cSrcweir } 876cdf0e10cSrcweir 877cdf0e10cSrcweir sal_Bool CommandLineArgs::GetForceNewList( ::rtl::OUString& rPara) const 878cdf0e10cSrcweir { 879cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 880cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_FORCENEWLIST ]; 881cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_FORCENEWLIST ]; 882cdf0e10cSrcweir } 883cdf0e10cSrcweir 884cdf0e10cSrcweir sal_Bool CommandLineArgs::GetPrintList( ::rtl::OUString& rPara) const 885cdf0e10cSrcweir { 886cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 887cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_PRINTLIST ]; 888cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_PRINTLIST ]; 889cdf0e10cSrcweir } 890cdf0e10cSrcweir 891cdf0e10cSrcweir sal_Bool CommandLineArgs::GetPrintToList( ::rtl::OUString& rPara ) const 892cdf0e10cSrcweir { 893cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 894cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_PRINTTOLIST ]; 895cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_PRINTTOLIST ]; 896cdf0e10cSrcweir } 897cdf0e10cSrcweir 898cdf0e10cSrcweir sal_Bool CommandLineArgs::GetPrinterName( ::rtl::OUString& rPara ) const 899cdf0e10cSrcweir { 900cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 901cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_PRINTERNAME ]; 902cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_PRINTERNAME ]; 903cdf0e10cSrcweir } 904cdf0e10cSrcweir 905cdf0e10cSrcweir sal_Bool CommandLineArgs::GetLanguage( ::rtl::OUString& rPara ) const 906cdf0e10cSrcweir { 907cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 908cdf0e10cSrcweir rPara = m_aStrParams[ CMD_STRINGPARAM_LANGUAGE ]; 909cdf0e10cSrcweir return m_aStrSetParams[ CMD_STRINGPARAM_LANGUAGE ]; 910cdf0e10cSrcweir } 911cdf0e10cSrcweir 912cdf0e10cSrcweir sal_Bool CommandLineArgs::IsEmpty() const 913cdf0e10cSrcweir { 914cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 915cdf0e10cSrcweir return m_eArgumentCount == NONE; 916cdf0e10cSrcweir } 917cdf0e10cSrcweir 918cdf0e10cSrcweir sal_Bool CommandLineArgs::IsEmptyOrAcceptOnly() const 919cdf0e10cSrcweir { 920cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 921cdf0e10cSrcweir 922cdf0e10cSrcweir return m_eArgumentCount == NONE || 923cdf0e10cSrcweir ( ( m_eArgumentCount == ONE ) && ( m_aStrParams[ CMD_STRINGPARAM_ACCEPT ].getLength() )) || 924cdf0e10cSrcweir ( ( m_eArgumentCount == ONE ) && m_aBoolParams[ CMD_BOOLPARAM_PSN ] ); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir 927cdf0e10cSrcweir sal_Bool CommandLineArgs::WantsToLoadDocument() const 928cdf0e10cSrcweir { 929cdf0e10cSrcweir osl::MutexGuard aMutexGuard( m_aMutex ); 930cdf0e10cSrcweir return m_bDocumentArgs; 931cdf0e10cSrcweir } 932cdf0e10cSrcweir 933cdf0e10cSrcweir } // namespace desktop 934