Commits

Anonymous committed d2172da Merge

CWS-TOOLING: integrate CWS fwk149

  • Participants
  • Parent commits d5bf141, 23512b1

Comments (0)

Files changed (19)

desktop/source/app/app.cxx

 #include <osl/module.h>
 #include <osl/file.hxx>
 #include <osl/signal.h>
+#include <osl/thread.hxx>
 #include <rtl/uuid.h>
 #include <rtl/uri.hxx>
 #include <unotools/pathoptions.hxx>
     {
         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
         if ( !pArgs )
-	{
             pArgs = new CommandLineArgs;
-	}
     }
 
     return pArgs;
 namespace
 {
     struct BrandName
-    	: public rtl::Static< String, BrandName > {};
+        : public rtl::Static< String, BrandName > {};
     struct Version
-    	: public rtl::Static< String, Version > {};
+        : public rtl::Static< String, Version > {};
     struct AboutBoxVersion
-    	: public rtl::Static< String, AboutBoxVersion > {};
+        : public rtl::Static< String, AboutBoxVersion > {};
     struct OOOVendor
-    	: public rtl::Static< String, OOOVendor > {};
+        : public rtl::Static< String, OOOVendor > {};
     struct Extension
-    	: public rtl::Static< String, Extension > {};
+        : public rtl::Static< String, Extension > {};
     struct XMLFileFormatName
         : public rtl::Static< String, XMLFileFormatName > {};
     struct XMLFileFormatVersion
 {
     static int nAll = 0, nPro = 0;
 
-	nAll++;
+    nAll++;
     if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND )
     {
         String &rBrandName = BrandName::get();
         rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATNAME", rXMLFileFormatName );
         rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATVERSION", rXMLFileFormatVersion );
     }
-	if ( rStr.SearchAscii( "%OOOVENDOR" ) != STRING_NOTFOUND )
+    if ( rStr.SearchAscii( "%OOOVENDOR" ) != STRING_NOTFOUND )
     {
         String &rOOOVendor = OOOVendor::get();
 
         rStr.SearchAndReplaceAllAscii( "%OOOVENDOR" ,rOOOVendor );
     }
 
-	if ( rStr.SearchAscii( "%WRITERCOMPATIBILITYVERSIONOOO11" ) != STRING_NOTFOUND )
+    if ( rStr.SearchAscii( "%WRITERCOMPATIBILITYVERSIONOOO11" ) != STRING_NOTFOUND )
     {
         String &rWriterCompatibilityVersionOOo11 = WriterCompatibilityVersionOOo11::get();
         if ( !rWriterCompatibilityVersionOOo11.Len() )
 
 static const char      pLastSyncFileName[]     = "lastsynchronized";
 static const sal_Int32 nStrLenLastSync         = 16;
-		
+        
 static bool needsSynchronization( 
     ::rtl::OUString const & baseSynchronizedURL, ::rtl::OUString const & userSynchronizedURL )
 {
 
 static ::rtl::OUString getBrandSharePreregBundledPathURL()
 {
-	::rtl::OUString url(
+    ::rtl::OUString url(
         RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/share/prereg/bundled"));
 
     ::rtl::Bootstrap::expandMacros(url);
 
 static ::rtl::OUString getLastSyncFileURLFromUserInstallation()
 {
-	::rtl::OUString aUserBundledPathURL = getUserBundledExtPathURL();
+    ::rtl::OUString aUserBundledPathURL = getUserBundledExtPathURL();
     ::sal_Int32    nLastIndex          = aUserBundledPathURL.lastIndexOf('/');
     
     ::rtl::OUStringBuffer aTmp( aUserBundledPathURL );
 
     // Check for lastsynchronized file for bundled extensions in the user directory
     // and test if synchronzation is necessary!
-	{
+    {
         ::rtl::OUString aUserLastSyncFilePathURL = getLastSyncFileURLFromUserInstallation();
         ::rtl::OUString aPreregSyncFilePathURL = getLastSyncFileURLFromBrandInstallation();
 
             copy_bundled_recursive( aPreregBundledPath, aUserPath, +1 );
         }
     }
-	
-	// create service factory...
+    
+    // create service factory...
     Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager();
     if( rSMgr.is() )
     {
 {
     RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::DeInit" );
 
-	try {
+    try {
         // instead of removing of the configManager just let it commit all the changes
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" );
         utl::ConfigManager::GetConfigManager()->StoreConfigItems();
         FlushConfiguration();
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" );
 
-	    // close splashscreen if it's still open
-	    CloseSplashScreen();
-	    Reference<XMultiServiceFactory> xXMultiServiceFactory(::comphelper::getProcessServiceFactory());
-	    DestroyApplicationServiceManager( xXMultiServiceFactory );
-	    // nobody should get a destroyd service factory...
-	    ::comphelper::setProcessServiceFactory( NULL );
-
-	    // clear lockfile
-	    if (m_pLockfile != NULL)
-        	m_pLockfile->clean();
-
-    	OfficeIPCThread::DisableOfficeIPCThread();
-	    if( pSignalHandler )
-    	    DELETEZ( pSignalHandler );
-	} catch (RuntimeException&) {
-		// someone threw an exception during shutdown
-		// this will leave some garbage behind..
-	}
+        // close splashscreen if it's still open
+        CloseSplashScreen();
+        Reference<XMultiServiceFactory> xXMultiServiceFactory(::comphelper::getProcessServiceFactory());
+        DestroyApplicationServiceManager( xXMultiServiceFactory );
+        // nobody should get a destroyd service factory...
+        ::comphelper::setProcessServiceFactory( NULL );
+
+        // clear lockfile
+        if (m_pLockfile != NULL)
+            m_pLockfile->clean();
+
+        OfficeIPCThread::DisableOfficeIPCThread();
+        if( pSignalHandler )
+            DELETEZ( pSignalHandler );
+    } catch (RuntimeException&) {
+        // someone threw an exception during shutdown
+        // this will leave some garbage behind..
+    }
 
     RTL_LOGFILE_CONTEXT_TRACE( aLog, "FINISHED WITH Destop::DeInit" );
 }
     std::auto_ptr<SvtPathOptions> pPathOptions;
 
     Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
-	sal_Bool bRestartRequested( sal_False );
-	sal_Bool bUseSystemFileDialog(sal_True);
-    int		 nAcquireCount( 0 );
-	Reference < css::document::XEventListener > xGlobalBroadcaster;
+    sal_Bool bRestartRequested( sal_False );
+    sal_Bool bUseSystemFileDialog(sal_True);
+    int         nAcquireCount( 0 );
+    Reference < css::document::XEventListener > xGlobalBroadcaster;
     try
     {
         RegisterServices( xSMgr );
         retrieveCrashReporterState();
         if ( !isCrashReporterEnabled() )
         {
-			osl_setErrorReporting( sal_False );
+            osl_setErrorReporting( sal_False );
             // disable stack trace feature
         }
 
         ::com::sun::star::lang::Locale aLocale;
         String aMgrName = String::CreateFromAscii( "iso" );
         ResMgr* pLabelResMgr = ResMgr::SearchCreateResMgr( U2S( aMgrName ), aLocale );
-	    if ( !pLabelResMgr )
-    	{
-    		// no "iso" resource -> search for "ooo" resource
-    	    aMgrName = String::CreateFromAscii( "ooo" );
-    	    pLabelResMgr = ResMgr::SearchCreateResMgr( U2S( aMgrName ), aLocale);
-    	}
+        if ( !pLabelResMgr )
+        {
+            // no "iso" resource -> search for "ooo" resource
+            aMgrName = String::CreateFromAscii( "ooo" );
+            pLabelResMgr = ResMgr::SearchCreateResMgr( U2S( aMgrName ), aLocale);
+        }
         String aTitle = pLabelResMgr ? String( ResId( RID_APPTITLE, *pLabelResMgr ) ) : String();
         delete pLabelResMgr;
-/*
-		// locale and UI locale in AppSettings are now retrieved from configuration or system directly via SvtSysLocale
-		// no reason to set while starting
-        // set UI language and locale
-        RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ set locale settings" );
-        //LanguageSelection langselect;
-        OUString aUILocaleString = LanguageSelection::getLanguageString();
-        Locale aUILocale = LanguageSelection::IsoStringToLocale(aUILocaleString);
-        LanguageType eLanguage = SvtSysLocale().GetLanguage();
-
-        // #i39040#, do not call anything between GetSettings and SetSettings that might have
-        // a side effect on the settings (like, eg, SvtSysLocaleOptions().GetLocaleLanguageType(),
-        // which changes the MiscSettings !!! )
-        AllSettings aSettings( Application::GetSettings() );
-        aSettings.SetUILocale( aUILocale );
-        aSettings.SetLanguage( eLanguage );
-        Application::SetSettings( aSettings );
-        RTL_LOGFILE_CONTEXT_TRACE( aLog, "} set locale settings" );
-*/
 
         // Check for StarOffice/Suite specific extensions runs also with OpenOffice installation sets
         OUString aTitleString( aTitle );
 #endif
 
         SetDisplayName( aTitle );
-//        SetSplashScreenProgress(30);
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create SvtPathOptions and SvtLanguageOptions" );
         pPathOptions.reset( new SvtPathOptions);
-//        SetSplashScreenProgress(40);
-//        pLanguageOptions = new SvtLanguageOptions(sal_True);
-//        SetSplashScreenProgress(45);
+        SetSplashScreenProgress(40);
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create SvtPathOptions and SvtLanguageOptions" );
 
         // Check special env variable #111015#
             SvtPathOptions().SetWorkPath( aWorkPath );
         }
 
-	    // create service for loadin SFX (still needed in startup)
+        // create service for loadin SFX (still needed in startup)
         xGlobalBroadcaster = Reference < css::document::XEventListener >
-			( xSMgr->createInstance(
+            ( xSMgr->createInstance(
             DEFINE_CONST_UNICODE( "com.sun.star.frame.GlobalEventBroadcaster" ) ), UNO_QUERY );
 
         /* ensure existance of a default window that messages can be dispatched to
             RTL_LOGFILE_CONTEXT_TRACE( aLog, "} FirstStartWizard" );
         }
 
-		// keep a language options instance...
-		pLanguageOptions.reset( new SvtLanguageOptions(sal_True));
+        // keep a language options instance...
+        pLanguageOptions.reset( new SvtLanguageOptions(sal_True));
 
         if (xGlobalBroadcaster.is())
         {
         }
 
         SetSplashScreenProgress(50);
+
         // Backing Component
         sal_Bool bCrashed            = sal_False;
         sal_Bool bExistsRecoveryData = sal_False;
         impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData);
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "} impl_checkRecoveryState" );
 
-		{
-			::comphelper::ComponentContext aContext( xSMgr );
-			xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
-		}
-
-		// check whether the shutdown is caused by restart
-		bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
-
-		if ( pCmdLineArgs->IsHeadless() )
-		{
-			// Ensure that we use not the system file dialogs as
-			// headless mode relies on Application::EnableHeadlessMode()
-			// which does only work for VCL dialogs!!
-			SvtMiscOptions aMiscOptions;
-			bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
-			aMiscOptions.SetUseSystemFileDialog( sal_False );
-		}
+        {
+            ::comphelper::ComponentContext aContext( xSMgr );
+            xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
+        }
+
+        // check whether the shutdown is caused by restart
+        bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+
+        if ( pCmdLineArgs->IsHeadless() )
+        {
+            // Ensure that we use not the system file dialogs as
+            // headless mode relies on Application::EnableHeadlessMode()
+            // which does only work for VCL dialogs!!
+            SvtMiscOptions aMiscOptions;
+            bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
+            aMiscOptions.SetUseSystemFileDialog( sal_False );
+        }
 
         if ( !bRestartRequested )
-		{
-			if (
-				(pCmdLineArgs->IsEmptyOrAcceptOnly()                                   ) &&
-				(SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
-				(!bExistsRecoveryData                                                  ) &&
-				(!bExistsSessionData                                                   ) &&
-				(!Application::AnyInput( INPUT_APPEVENT )                              )
-			   )
-			{
-				RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
-				Reference< XFrame > xDesktopFrame( xSMgr->createInstance(
-					OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
-				if (xDesktopFrame.is())
-				{
-	//                SetSplashScreenProgress(60);
-					Reference< XFrame > xBackingFrame;
-					Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
-
-					xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
-					if (xBackingFrame.is())
-						xContainerWindow = xBackingFrame->getContainerWindow();
-					if (xContainerWindow.is())
-					{
-						// set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank"
-						// frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior,
-						// otherwise documents loaded into this frame will later on miss functionality depending on the style.
-						Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
-						OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
-						pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
-
-						SetSplashScreenProgress(75);
-						Sequence< Any > lArgs(1);
-						lArgs[0] <<= xContainerWindow;
-
-						Reference< XController > xBackingComp(
-							xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
-							UNO_QUERY);
-	//                    SetSplashScreenProgress(80);
-						if (xBackingComp.is())
-						{
-							Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
-							// Attention: You MUST(!) call setComponent() before you call attachFrame().
-							// Because the backing component set the property "IsBackingMode" of the frame
-							// to true inside attachFrame(). But setComponent() reset this state everytimes ...
-							xBackingFrame->setComponent(xBackingWin, xBackingComp);
-							SetSplashScreenProgress(100);
-							xBackingComp->attachFrame(xBackingFrame);
-							CloseSplashScreen();
-							xContainerWindow->setVisible(sal_True);
-						}
-					}
-				}
-				RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
-			}
-		}
+        {
+            if ((!pCmdLineArgs->WantsToLoadDocument()                                  ) &&
+                (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
+                (!bExistsRecoveryData                                                  ) &&
+                (!bExistsSessionData                                                   ) &&
+                (!Application::AnyInput( INPUT_APPEVENT )                              ))
+            {
+                 RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
+                 Reference< XFrame > xDesktopFrame( xSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
+                 if (xDesktopFrame.is())
+                 {
+                   Reference< XFrame > xBackingFrame;
+                   Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
+
+                   xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
+                   if (xBackingFrame.is())
+                       xContainerWindow = xBackingFrame->getContainerWindow();
+                   if (xContainerWindow.is())
+                   {
+                       // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank"
+                       // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior,
+                       // otherwise documents loaded into this frame will later on miss functionality depending on the style.
+                       Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+                       OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
+                       pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
+
+                       SetSplashScreenProgress(75);
+                       Sequence< Any > lArgs(1);
+                       lArgs[0] <<= xContainerWindow;
+
+                       Reference< XController > xBackingComp(
+                           xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), UNO_QUERY);
+                        if (xBackingComp.is())
+                        {
+                            Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
+                            // Attention: You MUST(!) call setComponent() before you call attachFrame().
+                            // Because the backing component set the property "IsBackingMode" of the frame
+                            // to true inside attachFrame(). But setComponent() reset this state everytimes ...
+                            xBackingFrame->setComponent(xBackingWin, xBackingComp);
+                            SetSplashScreenProgress(100);
+                            xBackingComp->attachFrame(xBackingFrame);
+                            CloseSplashScreen();
+                            xContainerWindow->setVisible(sal_True);
+                        }
+                    }
+                }
+                RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
+            }
+        }
     }
     catch ( com::sun::star::lang::WrappedTargetException& wte )
     {
         FatalError( MakeStartupErrorMessage(e.Message) );
         return;
     }
-    /*
-    catch ( ... )
+
+    SvtFontSubstConfig().Apply();
+
+    SvtTabAppearanceCfg aAppearanceCfg;
+    aAppearanceCfg.SetInitialized();
+    aAppearanceCfg.SetApplicationDefaults( this );
+    SvtAccessibilityOptions aOptions;
+    aOptions.SetVCLSettings();
+
+    if ( !bRestartRequested )
     {
-        FatalError( MakeStartupErrorMessage(
-            OUString::createFromAscii(
-            "Unknown error during startup (Office wrapper service).\nInstallation could be damaged.")));
-        return;
-    }
-    */
-//    SetSplashScreenProgress(55);
-
-    SvtFontSubstConfig().Apply();
-
-    SvtTabAppearanceCfg aAppearanceCfg;
-	aAppearanceCfg.SetInitialized();
-	aAppearanceCfg.SetApplicationDefaults( this );
-	SvtAccessibilityOptions aOptions;
-	aOptions.SetVCLSettings();
-//    SetSplashScreenProgress(60);
-
-    if ( !bRestartRequested )
-	{
-		Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) );
-
-		sal_Bool bTerminateRequested = sal_False;
-
-		// Preload function depends on an initialized sfx application!
-		SetSplashScreenProgress(75);
-
-		// use system window dialogs
-		Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
-
-	//    SetSplashScreenProgress(80);
-
-		if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() &&
-			 !pCmdLineArgs->IsNoQuickstart() )
-			InitializeQuickstartMode( xSMgr );
-
-		RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" );
-		try
-		{
-			Reference< XDesktop > xDesktop( xSMgr->createInstance(
-				OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
-			if ( xDesktop.is() )
-				xDesktop->addTerminateListener( new OfficeIPCThreadController );
-			SetSplashScreenProgress(100);
-		}
-		catch ( com::sun::star::uno::Exception& e )
-		{
-			FatalError( MakeStartupErrorMessage(e.Message) );
-			return;
-		}
-		/*
-		catch ( ... )
-		{
-			FatalError( MakeStartupErrorMessage(
-				OUString::createFromAscii(
-				"Unknown error during startup (TD/Desktop service).\nInstallation could be damaged.")));
-			return;
-		}
-		*/
-
-		// Post user event to startup first application component window
-		// We have to send this OpenClients message short before execute() to
-		// minimize the risk that this message overtakes type detection contruction!!
-		Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
-
-		// Post event to enable acceptors
-		Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
-
-		// The configuration error handler currently is only for startup
-		aConfigErrHandler.deactivate();
+        Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) );
+
+        sal_Bool bTerminateRequested = sal_False;
+
+        // Preload function depends on an initialized sfx application!
+        SetSplashScreenProgress(75);
+
+        // use system window dialogs
+        Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
+
+    //    SetSplashScreenProgress(80);
+
+        if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() &&
+             !pCmdLineArgs->IsNoQuickstart() )
+            InitializeQuickstartMode( xSMgr );
+
+        RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" );
+        try
+        {
+            Reference< XDesktop > xDesktop( xSMgr->createInstance(
+                OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
+            if ( xDesktop.is() )
+                xDesktop->addTerminateListener( new OfficeIPCThreadController );
+            SetSplashScreenProgress(100);
+        }
+        catch ( com::sun::star::uno::Exception& e )
+        {
+            FatalError( MakeStartupErrorMessage(e.Message) );
+            return;
+        }
+
+        // Post user event to startup first application component window
+        // We have to send this OpenClients message short before execute() to
+        // minimize the risk that this message overtakes type detection contruction!!
+        Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
+
+        // Post event to enable acceptors
+        Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
+
+        // The configuration error handler currently is only for startup
+        aConfigErrHandler.deactivate();
 
        // Acquire solar mutex just before we enter our message loop
         if ( nAcquireCount )
         // call Application::Execute to process messages in vcl message loop
         RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
 
-		try
-		{
-			// The JavaContext contains an interaction handler which is used when
-			// the creation of a Java Virtual Machine fails
-			com::sun::star::uno::ContextLayer layer2(
-				new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
+        try
+        {
+            // The JavaContext contains an interaction handler which is used when
+            // the creation of a Java Virtual Machine fails
+            com::sun::star::uno::ContextLayer layer2(
+                new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
 
             // check whether the shutdown is caused by restart just before entering the Execute
             bRestartRequested = bRestartRequested || ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
 
                 Execute();
             }
-		}
-		catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
-		{
-			OfficeIPCThread::SetDowning();
-			FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
-		}
-		catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg)
-		{
-			OfficeIPCThread::SetDowning();
-			FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
-		}
-	}
+        }
+        catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
+        {
+            OfficeIPCThread::SetDowning();
+            FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
+        }
+        catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg)
+        {
+            OfficeIPCThread::SetDowning();
+            FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
+        }
+    }
     
     if ( bRestartRequested )
         SetRestartState();
 
-	if (xGlobalBroadcaster.is())
+    if (xGlobalBroadcaster.is())
     {
         css::document::EventObject aEvent;
         aEvent.EventName = ::rtl::OUString::createFromAscii("OnCloseApp");
         xGlobalBroadcaster->notifyEvent(aEvent);
     }
 
-	delete pResMgr;
+    delete pResMgr;
     // Restore old value
     if ( pCmdLineArgs->IsHeadless() )
         SvtMiscOptions().SetUseSystemFileDialog( bUseSystemFileDialog );
 
 IMPL_LINK( Desktop, ImplInitFilterHdl, ConvertData*, pData )
 {
-	return GraphicFilter::GetGraphicFilter()->GetFilterCallback().Call( pData );
+    return GraphicFilter::GetGraphicFilter()->GetFilterCallback().Call( pData );
 }
 
 sal_Bool Desktop::InitializeConfiguration()
 
 void Desktop::SystemSettingsChanging( AllSettings& rSettings, Window* )
 {
-	if ( !SvtTabAppearanceCfg::IsInitialized () )
-		return;
+    if ( !SvtTabAppearanceCfg::IsInitialized () )
+        return;
 
 #   define DRAGFULL_OPTION_ALL \
-	     ( DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE  \
-		 | DRAGFULL_OPTION_OBJECTMOVE  | DRAGFULL_OPTION_OBJECTSIZE \
-		 | DRAGFULL_OPTION_DOCKING     | DRAGFULL_OPTION_SPLIT      \
-		 | DRAGFULL_OPTION_SCROLL )
+         ( DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE  \
+         | DRAGFULL_OPTION_OBJECTMOVE  | DRAGFULL_OPTION_OBJECTSIZE \
+         | DRAGFULL_OPTION_DOCKING     | DRAGFULL_OPTION_SPLIT      \
+         | DRAGFULL_OPTION_SCROLL )
 #   define DRAGFULL_OPTION_NONE ((sal_uInt32)~DRAGFULL_OPTION_ALL)
 
-	StyleSettings hStyleSettings   = rSettings.GetStyleSettings();
-	MouseSettings hMouseSettings = rSettings.GetMouseSettings();
-
-	sal_uInt32 nDragFullOptions = hStyleSettings.GetDragFullOptions();
-
-	SvtTabAppearanceCfg aAppearanceCfg;
-	sal_uInt16 nGet = aAppearanceCfg.GetDragMode();
-	switch ( nGet )
-	{
-	case DragFullWindow:
-		nDragFullOptions |= DRAGFULL_OPTION_ALL;
-		break;
-	case DragFrame:
-		nDragFullOptions &= DRAGFULL_OPTION_NONE;
-		break;
-	case DragSystemDep:
-	default:
-		break;
-	}
+    StyleSettings hStyleSettings   = rSettings.GetStyleSettings();
+    MouseSettings hMouseSettings = rSettings.GetMouseSettings();
+
+    sal_uInt32 nDragFullOptions = hStyleSettings.GetDragFullOptions();
+
+    SvtTabAppearanceCfg aAppearanceCfg;
+    sal_uInt16 nGet = aAppearanceCfg.GetDragMode();
+    switch ( nGet )
+    {
+    case DragFullWindow:
+        nDragFullOptions |= DRAGFULL_OPTION_ALL;
+        break;
+    case DragFrame:
+        nDragFullOptions &= DRAGFULL_OPTION_NONE;
+        break;
+    case DragSystemDep:
+    default:
+        break;
+    }
 
     sal_uInt32 nFollow = hMouseSettings.GetFollow();
     hMouseSettings.SetFollow( aAppearanceCfg.IsMenuMouseFollow() ? (nFollow|MOUSE_FOLLOW_MENU) : (nFollow&~MOUSE_FOLLOW_MENU));
 
     hStyleSettings.SetTabControlStyle(nTabStyle);
 
-	hStyleSettings.SetDragFullOptions( nDragFullOptions );
-	rSettings.SetStyleSettings ( hStyleSettings );
+    hStyleSettings.SetDragFullOptions( nDragFullOptions );
+    rSettings.SetStyleSettings ( hStyleSettings );
 }
 
 // ========================================================================
 
 IMPL_LINK( Desktop, OpenClients_Impl, void*, EMPTYARG )
 {
-	RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "PERFORMANCE - DesktopOpenClients_Impl()" );
+    RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "PERFORMANCE - DesktopOpenClients_Impl()" );
 
     OpenClients();
 
 
     // CloseStartupScreen();
     CloseSplashScreen();
-
     CheckFirstRun( );
-
-    // allow ipc interaction
-//    OfficeIPCThread::SetReady();
-
     EnableOleAutomation();
 
     if (getenv ("OOO_EXIT_POST_STARTUP"))
         } else if (pArgs->IsHelpImpress()) {
             bShowHelp = sal_True;
             aHelpURLBuffer.appendAscii("vnd.sun.star.help://simpress/start");
-		} else if (pArgs->IsHelpBase()) {
+        } else if (pArgs->IsHelpBase()) {
             bShowHelp = sal_True;
             aHelpURLBuffer.appendAscii("vnd.sun.star.help://sdatabase/start");
         } else if (pArgs->IsHelpBasic()) {
 
     if ( ! bAllowRecoveryAndSessionManagement )
     {
-     /*
-        ::comphelper::ConfigurationHelper::writeDirectKey(
-                ::comphelper::getProcessServiceFactory(),
-                ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
-                ::rtl::OUString::createFromAscii("AutoSave"),
-                ::rtl::OUString::createFromAscii("Enabled"),
-                ::com::sun::star::uno::makeAny(sal_False),
-                ::comphelper::ConfigurationHelper::E_STANDARD);
-
-        */
         try
         {
             Reference< XDispatch > xRecovery(
 
     OfficeIPCThread::EnableRequests();
 
-	sal_Bool bShutdown( sal_False );
-	if ( !pArgs->IsServer() )
+    sal_Bool bShutdown( sal_False );
+    if ( !pArgs->IsServer() )
     {
         ProcessDocumentsRequest aRequest(pArgs->getCwdUrl());
-		aRequest.pcProcessed = NULL;
+        aRequest.pcProcessed = NULL;
 
         pArgs->GetOpenList( aRequest.aOpenList );
         pArgs->GetViewList( aRequest.aViewList );
         }
     }
 
-	// Don't do anything if we have successfully called terminate at desktop
-	if ( bShutdown )
-		return;
+    // Don't do anything if we have successfully called terminate at desktop
+    if ( bShutdown )
+        return;
 
     // no default document if a document was loaded by recovery or by command line or if soffice is used as server
     Reference< XFramesSupplier > xTasksSupplier(
             aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_CALC );
         else if ( pArgs->IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
             aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_IMPRESS );
-		else if ( pArgs->IsBase() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
+        else if ( pArgs->IsBase() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
             aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_DATABASE );
         else if ( pArgs->IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
             aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_DRAW );
             aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_CALC );
         else if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
             aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_IMPRESS );
-		else if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
+        else if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
             aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_DATABASE );
         else if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
             aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_DRAW );
     }
 
     ProcessDocumentsRequest aRequest(pArgs->getCwdUrl());
-	aRequest.pcProcessed = NULL;
+    aRequest.pcProcessed = NULL;
     aRequest.aOpenList   = aName;
     OfficeIPCThread::ExecuteCmdLineRequests( aRequest );
 }
 String GetURL_Impl(
     const String& rName, boost::optional< rtl::OUString > const & cwdUrl )
 {
-	// if rName is a vnd.sun.star.script URL do not attempt to parse it
-	// as INetURLObj does not handle handle there URLs
+    // if rName is a vnd.sun.star.script URL do not attempt to parse it
+    // as INetURLObj does not handle handle there URLs
     if (rName.CompareToAscii("vnd.sun.star.script" , 19) == COMPARE_EQUAL)
     {
         return rName;

desktop/source/app/cmdlineargs.cxx

         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;
+    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);
 
     m_eArgumentCount = NONE;
 
             if (tmp.getLength() > 0)
                 aArg = tmp;
         }
-		String			aArgStr = aArg;
 
-		if ( aArg.getLength() > 0 )
-		{
-		    m_eArgumentCount = m_eArgumentCount == NONE ? ONE : MANY;
-			if ( !InterpretCommandLineParameter( aArg ))
-			{
-				if ( aArgStr.GetChar(0) == '-' )
-				{
-					// handle this argument as an option
-					if ( aArgStr.EqualsIgnoreCaseAscii( "-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 ( aArgStr.EqualsIgnoreCaseAscii( "-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 ( aArgStr.EqualsIgnoreCaseAscii( "-pt" ))
-					{
-						// 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;
-					}
-					else if ( aArgStr.EqualsIgnoreCaseAscii( "-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 ( aArgStr.EqualsIgnoreCaseAscii( "-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;
- 				    }
+        String aArgStr = aArg;
+        if ( aArg.getLength() > 0 )
+        {
+            m_eArgumentCount = m_eArgumentCount == NONE ? ONE : MANY;
+            if ( !InterpretCommandLineParameter( aArg ))
+            {
+                if ( aArgStr.GetChar(0) == '-' )
+                {
+                    // handle this argument as an option
+                    if ( aArgStr.EqualsIgnoreCaseAscii( "-n" ))
+                    {
+                        // force new documents based on the following documents
+                        bForceNewEvent  = true;
+                        bOpenEvent      = false;
+                        bForceOpenEvent = false;
+                        bPrintToEvent   = false;
+                        bPrintEvent     = false;
+                        bViewEvent      = false;
+                        bStartEvent     = false;
+                        bDisplaySpec    = false;
+                    }
+                    else if ( aArgStr.EqualsIgnoreCaseAscii( "-o" ))
+                    {
+                        // 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 ( aArgStr.EqualsIgnoreCaseAscii( "-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 ( aArgStr.EqualsIgnoreCaseAscii( "-p" ))
+                   {
+                        // Print to default printer
+                        bPrintEvent     = true;
+                        bPrintToEvent   = false;
+                        bOpenEvent      = false;
+                        bForceNewEvent  = false;
+                        bForceOpenEvent = false;
+                        bViewEvent      = false;
+                        bStartEvent     = false;
+                        bDisplaySpec    = false;
+                   }
+                   else if ( aArgStr.EqualsIgnoreCaseAscii( "-view" ))
+                   {
+                        // open in viewmode
+                        bOpenEvent      = false;
+                        bPrintEvent     = false;
+                        bPrintToEvent   = false;
+                        bForceNewEvent  = false;
+                        bForceOpenEvent = false;
+                        bViewEvent      = true; 
+                        bStartEvent     = false;
+                        bDisplaySpec    = false;
+ 		    }
                     else if ( aArgStr.EqualsIgnoreCaseAscii( "-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 ( aArgStr.EqualsIgnoreCaseAscii( "-display" ))
+                    else if ( aArgStr.EqualsIgnoreCaseAscii( "-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 ( aArgStr.EqualsIgnoreCaseAscii( "-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;
                     }
 
                     #ifdef MACOSX
                        the only platform dependent parameter. Should more appear
                        we should find a better solution
                     */
-					else if ( aArgStr.CompareToAscii( "-psn", 4 ) == COMPARE_EQUAL )
+                    else if ( aArgStr.CompareToAscii( "-psn", 4 ) == COMPARE_EQUAL )
                     {
                         // finder argument from MacOSX
-                        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;
                     }
                     #endif
-				}
-				else
-				{
-					if ( bPrinterName && bPrintToEvent )
-					{
-						// first argument after "-pt" this must be the printer name
-						AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArgStr );
-						bPrinterName = sal_False;
-					}
-					else
-					{
-						// handle this argument as a filename
-						if ( bOpenEvent )
-							AddStringListParam_Impl( CMD_STRINGPARAM_OPENLIST, aArgStr );
-						else if ( bViewEvent )
-							AddStringListParam_Impl( CMD_STRINGPARAM_VIEWLIST, aArgStr );
+                }
+                else
+                {
+                    if ( bPrinterName && bPrintToEvent )
+                    {
+                        // first argument after "-pt" this must be the printer name
+                        AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArgStr );
+                        bPrinterName = sal_False;
+                    }
+                    else
+                    {
+                        // handle this argument as a filename
+                        if ( bOpenEvent )
+                        {
+                            AddStringListParam_Impl( CMD_STRINGPARAM_OPENLIST, aArgStr );
+                            bOpenDoc = true;
+                        }
+                        else if ( bViewEvent )
+	                {
+                            AddStringListParam_Impl( CMD_STRINGPARAM_VIEWLIST, aArgStr );
+                            bOpenDoc = true;
+                        }
                         else if ( bStartEvent )
+                        {
                             AddStringListParam_Impl( CMD_STRINGPARAM_STARTLIST, aArgStr );
-						else if ( bPrintEvent )
-							AddStringListParam_Impl( CMD_STRINGPARAM_PRINTLIST, aArgStr );
-						else if ( bPrintToEvent )
-							AddStringListParam_Impl( CMD_STRINGPARAM_PRINTTOLIST, aArgStr );
-						else if ( bForceNewEvent )
-							AddStringListParam_Impl( CMD_STRINGPARAM_FORCENEWLIST, aArgStr );
-						else if ( bForceOpenEvent )
-							AddStringListParam_Impl( CMD_STRINGPARAM_FORCEOPENLIST, aArgStr );
-						else if ( bDisplaySpec ){
-							AddStringListParam_Impl( CMD_STRINGPARAM_DISPLAY, aArgStr );
-							bDisplaySpec = sal_False; // only one display, not a lsit
-							bOpenEvent = sal_True;    // set back to standard
-						}
-					}
-				}
-			}
-		}
-	}
+                            bOpenDoc = true;
+                        }
+                        else if ( bPrintEvent )
+                        {
+                            AddStringListParam_Impl( CMD_STRINGPARAM_PRINTLIST, aArgStr );
+                            bOpenDoc = true;
+                        }
+                        else if ( bPrintToEvent )
+                        {
+                            AddStringListParam_Impl( CMD_STRINGPARAM_PRINTTOLIST, aArgStr );
+                            bOpenDoc = true;
+                        }
+                        else if ( bForceNewEvent )
+                        {
+                            AddStringListParam_Impl( CMD_STRINGPARAM_FORCENEWLIST, aArgStr );
+                            bOpenDoc = true;
+                        }
+                        else if ( bForceOpenEvent )
+                        {
+                            AddStringListParam_Impl( CMD_STRINGPARAM_FORCEOPENLIST, aArgStr );
+                            bOpenDoc = true;
+                        }
+                        else if ( bDisplaySpec )
+                        {
+                            AddStringListParam_Impl( CMD_STRINGPARAM_DISPLAY, aArgStr );
+                            bDisplaySpec = false; // only one display, not a lsit
+                            bOpenEvent = true;    // set back to standard
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    if ( bOpenDoc )
+        m_bDocumentArgs = true;
 }
 
 void CommandLineArgs::AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam )
 {
     String aArgStr( aArg );
 
-	if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-minimized" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_MINIMIZED, sal_True );
-		return sal_True;
-	}
+    if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-minimized" )) == sal_True )
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_MINIMIZED, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-invisible" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_INVISIBLE, sal_True );
-		return sal_True;
-	}
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_INVISIBLE, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-norestore" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_NORESTORE, sal_True );
-		return sal_True;
-	}
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_NORESTORE, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nodefault" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_NODEFAULT, sal_True );
-		return sal_True;
-	}
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_NODEFAULT, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-bean" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_BEAN, sal_True );
-		return sal_True;
-	}
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_BEAN, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-plugin" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_PLUGIN, sal_True );
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-server" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_SERVER, sal_True );
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-headless" )) == sal_True )
-	{
-		// Headless means also invisibile, so set this parameter to true!
-		SetBoolParam_Impl( CMD_BOOLPARAM_HEADLESS, sal_True );
-		SetBoolParam_Impl( CMD_BOOLPARAM_INVISIBLE, sal_True );
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-quickstart" )) == sal_True )
-	{
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_PLUGIN, sal_True );
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-server" )) == sal_True )
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_SERVER, sal_True );
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-headless" )) == sal_True )
+    {
+        // Headless means also invisibile, so set this parameter to true!
+        SetBoolParam_Impl( CMD_BOOLPARAM_HEADLESS, sal_True );
+        SetBoolParam_Impl( CMD_BOOLPARAM_INVISIBLE, sal_True );
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-quickstart" )) == sal_True )
+    {
 #if defined(WNT) || defined(OS2) || defined(QUARTZ)
-		SetBoolParam_Impl( CMD_BOOLPARAM_QUICKSTART, sal_True );
+        SetBoolParam_Impl( CMD_BOOLPARAM_QUICKSTART, sal_True );
 #endif
         SetBoolParam_Impl( CMD_BOOLPARAM_NOQUICKSTART, sal_False );
-		return sal_True;
-	}
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-quickstart=no" )))
     {
         SetBoolParam_Impl( CMD_BOOLPARAM_NOQUICKSTART, sal_True );
         SetBoolParam_Impl( CMD_BOOLPARAM_QUICKSTART, sal_False );
         return sal_True;
     }
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-terminate_after_init" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_TERMINATEAFTERINIT, sal_True );
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nofirststartwizard" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_NOFIRSTSTARTWIZARD, sal_True );
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nologo" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_NOLOGO, sal_True );
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nolockcheck" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_NOLOCKCHECK, sal_True );
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-terminate_after_init" )) == sal_True )
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_TERMINATEAFTERINIT, sal_True );
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nofirststartwizard" )) == sal_True )
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_NOFIRSTSTARTWIZARD, sal_True );
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nologo" )) == sal_True )
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_NOLOGO, sal_True );
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-nolockcheck" )) == sal_True )
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_NOLOCKCHECK, sal_True );
         // Workaround for automated testing
         ::svt::DocumentLockFile::AllowInteraction( sal_False );
 
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-help" ))
-		|| aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-h" ))
-		|| aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-?" )))
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_HELP, sal_True );
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpwriter" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_HELPWRITER, sal_True );
-		return sal_True;
-	}
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-help" ))
+	      || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-h" ))
+	      || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-?" )))
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_HELP, sal_True );
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpwriter" )) == sal_True )
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_HELPWRITER, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpcalc" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_HELPCALC, sal_True );
-		return sal_True;
-	}
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_HELPCALC, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpdraw" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_HELPDRAW, sal_True );
-		return sal_True;
-	}
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_HELPDRAW, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpimpress" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_HELPIMPRESS, sal_True );
-		return sal_True;
-	}
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpbase" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_HELPBASE, sal_True );
-		return sal_True;
-	}
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_HELPIMPRESS, sal_True );
+        return sal_True;
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpbase" )) == sal_True )
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_HELPBASE, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpbasic" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_HELPBASIC, sal_True );
-		return sal_True;
-	}
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_HELPBASIC, sal_True );
+        return sal_True;
+    }
     else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-helpmath" )) == sal_True )
-	{
-		SetBoolParam_Impl( CMD_BOOLPARAM_HELPMATH, sal_True );
-		return sal_True;
-	}
-    #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
-       we should find a better solution
-    */
+    {
+        SetBoolParam_Impl( CMD_BOOLPARAM_HELPMATH, sal_True );
+        return sal_True;
+    }
+#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
+     we should find a better solution
+  */
     else if ( aArg.compareToAscii( "-psn", 4 ) == 0 )
     {
         SetBoolParam_Impl( CMD_BOOLPARAM_PSN, sal_True );
         return sal_True;
     }
-    #endif
+#endif
     else if ( aArgStr.Copy(0, 8).EqualsIgnoreCaseAscii( "-accept=" ))
     {
-		AddStringListParam_Impl( CMD_STRINGPARAM_ACCEPT, aArgStr.Copy( 8 ) );
-		return sal_True;
-    }
-	else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-unaccept=" ))
-    {
-		AddStringListParam_Impl( CMD_STRINGPARAM_UNACCEPT, aArgStr.Copy( 10 ) );
-		return sal_True;
-    }
-	else if ( aArgStr.CompareIgnoreCaseToAscii( "-portal," ,
-												RTL_CONSTASCII_LENGTH( "-portal," )) == COMPARE_EQUAL )
-	{
-		AddStringListParam_Impl( CMD_STRINGPARAM_PORTAL, aArgStr.Copy( RTL_CONSTASCII_LENGTH( "-portal," )) );
-		return sal_True;
-	}
-	else if ( aArgStr.Copy( 0, 7 ).EqualsIgnoreCaseAscii( "-userid" ))
-	{
-		if ( aArgStr.Len() > 8 )
-		{
-			rtl::OUString aUserDir = aArgStr;
-			AddStringListParam_Impl(
-				CMD_STRINGPARAM_USERDIR,
-				::rtl::Uri::decode( aUserDir.copy( 8 ),
-									rtl_UriDecodeWithCharset,
-									RTL_TEXTENCODING_UTF8 ) );
-        }
-		return sal_True;
-	}
-	else if ( aArgStr.Copy( 0, 15).EqualsIgnoreCaseAscii( "-clientdisplay=" ))
-    {
-		AddStringListParam_Impl( CMD_STRINGPARAM_CLIENTDISPLAY, aArgStr.Copy( 15 ) );
-		return sal_True;
-    }
-	else if ( aArgStr.Copy(0, 9).EqualsIgnoreCaseAscii( "-version=" ))
-    {
-		AddStringListParam_Impl( CMD_STRINGPARAM_VERSION, aArgStr.Copy( 9 ) );
+        AddStringListParam_Impl( CMD_STRINGPARAM_ACCEPT, aArgStr.Copy( 8 ) );
         return sal_True;
     }
-	else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-language=" ))
+    else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-unaccept=" ))
     {
-		AddStringListParam_Impl( CMD_STRINGPARAM_LANGUAGE, aArgStr.Copy( 10 ) );
+        AddStringListParam_Impl( CMD_STRINGPARAM_UNACCEPT, aArgStr.Copy( 10 ) );
         return sal_True;
     }
-	else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-writer" )) == sal_True )
+    else if ( aArgStr.CompareIgnoreCaseToAscii( "-portal," ,
+              RTL_CONSTASCII_LENGTH( "-portal," )) == COMPARE_EQUAL )
+    {
+        AddStringListParam_Impl( CMD_STRINGPARAM_PORTAL, aArgStr.Copy( RTL_CONSTASCII_LENGTH( "-portal," )) );
+        return sal_True;
+    }
+    else if ( aArgStr.Copy( 0, 7 ).EqualsIgnoreCaseAscii( "-userid" ))
+    {
+        if ( aArgStr.Len() > 8 )
 	{
-		sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WRITER );
-		if ( !bAlreadySet )
-			SetBoolParam_Impl( CMD_BOOLPARAM_WRITER, sal_True );
+	    rtl::OUString aUserDir = aArgStr;
+	    AddStringListParam_Impl( CMD_STRINGPARAM_USERDIR,
+				     ::rtl::Uri::decode( aUserDir.copy( 8 ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ) );
+        }
         return sal_True;
-	}
-	else if ( aArg.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 );
+    }
+    else if ( aArgStr.Copy( 0, 15).EqualsIgnoreCaseAscii( "-clientdisplay=" ))
+    {
+        AddStringListParam_Impl( CMD_STRINGPARAM_CLIENTDISPLAY, aArgStr.Copy( 15 ) );
         return sal_True;
-	}
-	else if ( aArg.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 );
+    }
+    else if ( aArgStr.Copy(0, 9).EqualsIgnoreCaseAscii( "-version=" ))
+    {
+        AddStringListParam_Impl( CMD_STRINGPARAM_VERSION, aArgStr.Copy( 9 ) );
         return sal_True;
-	}
-	else if ( aArg.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 );
+    }
+    else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-language=" ))
+    {
+        AddStringListParam_Impl( CMD_STRINGPARAM_LANGUAGE, aArgStr.Copy( 10 ) );
         return sal_True;
-	}
-	else if ( aArg.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 );
+    }
+    else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-writer" )) == sal_True )
+    {
+        sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WRITER );
+        if ( !bAlreadySet )
+	    SetBoolParam_Impl( CMD_BOOLPARAM_WRITER, sal_True );
+        m_bDocumentArgs = true;
         return sal_True;
-	}
-	else if ( aArg.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 );
+    }
+    else if ( aArg.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;
         return sal_True;
-	}
-	else if ( aArg.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 );
+    }
+    else if ( aArg.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;
         return sal_True;
-	}
-	else if ( aArg.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 );
+    }
+    else if ( aArg.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;
         return sal_True;
-	}
+    }
+    else if ( aArg.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;
+        return sal_True;
+    }
+    else if ( aArg.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;
+        return sal_True;
+    }
+    else if ( aArg.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;
+        return sal_True;
+    }
+    else if ( aArg.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;
+        return sal_True;
+    }
 
-	return sal_False;
+    return sal_False;
 }
 
 sal_Bool CommandLineArgs::CheckGroupMembers( GroupParamId nGroupId, BoolParam nExcludeMember ) const
 {
-	// Check if at least one bool param out of a group is set. An exclude member can be provided.
-	for ( int i = 0; i < m_pGroupDefinitions[nGroupId].nCount; i++ )
-	{
-		BoolParam nParam = m_pGroupDefinitions[nGroupId].pGroupMembers[i];
-		if ( nParam != nExcludeMember && m_aBoolParams[nParam] )
-			return sal_True;
-	}
+    // Check if at least one bool param out of a group is set. An exclude member can be provided.
+    for ( int i = 0; i < m_pGroupDefinitions[nGroupId].nCount; i++ )
+    {
+        BoolParam nParam = m_pGroupDefinitions[nGroupId].pGroupMembers[i];
+        if ( nParam != nExcludeMember && m_aBoolParams[nParam] )
+            return sal_True;
+    }
 
-	return sal_False;
+    return sal_False;
 }
 
 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;
+    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 )
            ( ( m_eArgumentCount == ONE ) && m_aBoolParams[ CMD_BOOLPARAM_PSN ] );
 }
 
+sal_Bool CommandLineArgs::WantsToLoadDocument() const
+{
+    osl::MutexGuard  aMutexGuard( m_aMutex );
+    return m_bDocumentArgs;
+}
+
 } // namespace desktop

desktop/source/app/cmdlineargs.hxx

 
 class CommandLineArgs
 {
-	public:
-		enum BoolParam	// must be zero based!
-		{
-			CMD_BOOLPARAM_MINIMIZED,
-			CMD_BOOLPARAM_INVISIBLE,
-			CMD_BOOLPARAM_NORESTORE,
-			CMD_BOOLPARAM_BEAN,
-			CMD_BOOLPARAM_PLUGIN,
-			CMD_BOOLPARAM_SERVER,
-			CMD_BOOLPARAM_HEADLESS,
-			CMD_BOOLPARAM_QUICKSTART,
-			CMD_BOOLPARAM_NOQUICKSTART,
-			CMD_BOOLPARAM_TERMINATEAFTERINIT,
+    public:
+        enum BoolParam // must be zero based!
+        {
+            CMD_BOOLPARAM_MINIMIZED,
+            CMD_BOOLPARAM_INVISIBLE,
+            CMD_BOOLPARAM_NORESTORE,
+            CMD_BOOLPARAM_BEAN,
+            CMD_BOOLPARAM_PLUGIN,
+            CMD_BOOLPARAM_SERVER,
+            CMD_BOOLPARAM_HEADLESS,
+            CMD_BOOLPARAM_QUICKSTART,
+            CMD_BOOLPARAM_NOQUICKSTART,
+            CMD_BOOLPARAM_TERMINATEAFTERINIT,
             CMD_BOOLPARAM_NOFIRSTSTARTWIZARD,
-			CMD_BOOLPARAM_NOLOGO,
-			CMD_BOOLPARAM_NOLOCKCHECK,
+            CMD_BOOLPARAM_NOLOGO,
+            CMD_BOOLPARAM_NOLOCKCHECK,
             CMD_BOOLPARAM_NODEFAULT,
-			CMD_BOOLPARAM_HELP,
-			CMD_BOOLPARAM_WRITER,
-			CMD_BOOLPARAM_CALC,
-			CMD_BOOLPARAM_DRAW,
-			CMD_BOOLPARAM_IMPRESS,
-			CMD_BOOLPARAM_GLOBAL,
-			CMD_BOOLPARAM_MATH,
-			CMD_BOOLPARAM_WEB,
-			CMD_BOOLPARAM_BASE,
-			CMD_BOOLPARAM_HELPWRITER,
-			CMD_BOOLPARAM_HELPCALC,
-			CMD_BOOLPARAM_HELPDRAW,
-			CMD_BOOLPARAM_HELPBASIC,
-			CMD_BOOLPARAM_HELPMATH,
-			CMD_BOOLPARAM_HELPIMPRESS,
-			CMD_BOOLPARAM_HELPBASE,
+            CMD_BOOLPARAM_HELP,
+            CMD_BOOLPARAM_WRITER,
+            CMD_BOOLPARAM_CALC,
+            CMD_BOOLPARAM_DRAW,
+            CMD_BOOLPARAM_IMPRESS,
+            CMD_BOOLPARAM_GLOBAL,
+            CMD_BOOLPARAM_MATH,
+            CMD_BOOLPARAM_WEB,
+            CMD_BOOLPARAM_BASE,
+            CMD_BOOLPARAM_HELPWRITER,
+            CMD_BOOLPARAM_HELPCALC,
+            CMD_BOOLPARAM_HELPDRAW,
+            CMD_BOOLPARAM_HELPBASIC,
+            CMD_BOOLPARAM_HELPMATH,
+            CMD_BOOLPARAM_HELPIMPRESS,
+            CMD_BOOLPARAM_HELPBASE,
             CMD_BOOLPARAM_PSN,
-			CMD_BOOLPARAM_COUNT				// must be last element!
-		};
+            CMD_BOOLPARAM_COUNT // must be last element!
+        };
 
-		enum StringParam // must be zero based!
-		{
-			CMD_STRINGPARAM_PORTAL,
-			CMD_STRINGPARAM_ACCEPT,
-			CMD_STRINGPARAM_UNACCEPT,
-			CMD_STRINGPARAM_USERDIR,
-			CMD_STRINGPARAM_CLIENTDISPLAY,
-			CMD_STRINGPARAM_OPENLIST,
-			CMD_STRINGPARAM_VIEWLIST,
+        enum StringParam // must be zero based!
+        {
+            CMD_STRINGPARAM_PORTAL,
+            CMD_STRINGPARAM_ACCEPT,
+            CMD_STRINGPARAM_UNACCEPT,
+            CMD_STRINGPARAM_USERDIR,
+            CMD_STRINGPARAM_CLIENTDISPLAY,
+            CMD_STRINGPARAM_OPENLIST,
+            CMD_STRINGPARAM_VIEWLIST,
             CMD_STRINGPARAM_STARTLIST,
-			CMD_STRINGPARAM_FORCEOPENLIST,
-			CMD_STRINGPARAM_FORCENEWLIST,
-			CMD_STRINGPARAM_PRINTLIST,
-			CMD_STRINGPARAM_VERSION,
-			CMD_STRINGPARAM_PRINTTOLIST,
-			CMD_STRINGPARAM_PRINTERNAME,
-			CMD_STRINGPARAM_DISPLAY,
+            CMD_STRINGPARAM_FORCEOPENLIST,
+            CMD_STRINGPARAM_FORCENEWLIST,
+            CMD_STRINGPARAM_PRINTLIST,
+            CMD_STRINGPARAM_VERSION,
+            CMD_STRINGPARAM_PRINTTOLIST,
+            CMD_STRINGPARAM_PRINTERNAME,
+            CMD_STRINGPARAM_DISPLAY,
             CMD_STRINGPARAM_LANGUAGE,
-			CMD_STRINGPARAM_COUNT			// must be last element!
-		};
+            CMD_STRINGPARAM_COUNT // must be last element!
+        };
 
-		enum GroupParamId
-		{
-			CMD_GRPID_MODULE,
-			CMD_GRPID_COUNT
-		};
+        enum GroupParamId
+        {
+            CMD_GRPID_MODULE,
+            CMD_GRPID_COUNT
+        };
 
-        struct Supplier {
+        struct Supplier
+        {
             // Thrown from constructors and next:
             class Exception {
             public:
             virtual bool next(rtl::OUString * argument) = 0;
         };
 
-		CommandLineArgs();
-		CommandLineArgs( Supplier& supplier );
+        CommandLineArgs();
+        CommandLineArgs( Supplier& supplier );
 
         boost::optional< rtl::OUString > getCwdUrl() const { return m_cwdUrl; }
 
-		// generic methods to access parameter
-		void					SetBoolParam( BoolParam eParam, sal_Bool bNewValue );
+        // generic methods to access parameter
+        void     SetBoolParam( BoolParam eParam, sal_Bool bNewValue );
 
-		// Access to bool parameters
-		sal_Bool				IsMinimized() const;
-        sal_Bool				IsInvisible() const;
-        sal_Bool				IsNoRestore() const;
-        sal_Bool				IsNoDefault() const;
-        sal_Bool				IsBean() const;
-        sal_Bool				IsServer() const;
-        sal_Bool				IsHeadless() const;
-        sal_Bool				IsQuickstart() const;
-        sal_Bool                IsNoQuickstart() const;
-		sal_Bool				IsTerminateAfterInit() const;
-        sal_Bool                IsNoFirstStartWizard() const;
-		sal_Bool				IsNoLogo() const;
-		sal_Bool				IsNoLockcheck() const;
-		sal_Bool				IsHelp() const;
-		sal_Bool				IsHelpWriter() const;
-		sal_Bool				IsHelpCalc() const;
-		sal_Bool				IsHelpDraw() const;
-		sal_Bool				IsHelpImpress() const;
-		sal_Bool				IsHelpBase() const;
-		sal_Bool				IsHelpMath() const;
-		sal_Bool				IsHelpBasic() const;
-		sal_Bool				IsWriter() const;
-		sal_Bool				IsCalc() const;
-		sal_Bool				IsDraw() const;
-		sal_Bool				IsImpress() const;
-		sal_Bool				IsBase() const;
-		sal_Bool				IsGlobal() const;
-		sal_Bool				IsMath() const;
-		sal_Bool				IsWeb() const;
-		sal_Bool				HasModuleParam() const;
+        // Access to bool parameters
+        sal_Bool IsMinimized() const;
+        sal_Bool IsInvisible() const;
+        sal_Bool IsNoRestore() const;
+        sal_Bool IsNoDefault() const;
+        sal_Bool IsBean() const;
+        sal_Bool IsServer() const;
+        sal_Bool IsHeadless() const;
+        sal_Bool IsQuickstart() const;
+        sal_Bool IsNoQuickstart() const;
+        sal_Bool IsTerminateAfterInit() const;
+        sal_Bool IsNoFirstStartWizard() const;
+        sal_Bool IsNoLogo() const;
+        sal_Bool IsNoLockcheck() const;
+        sal_Bool IsHelp() const;
+        sal_Bool IsHelpWriter() const;
+        sal_Bool IsHelpCalc() const;
+        sal_Bool IsHelpDraw() const;
+        sal_Bool IsHelpImpress() const;
+        sal_Bool IsHelpBase() const;
+        sal_Bool IsHelpMath() const;
+        sal_Bool IsHelpBasic() const;
+        sal_Bool IsWriter() const;
+        sal_Bool IsCalc() const;
+        sal_Bool IsDraw() const;
+        sal_Bool IsImpress() const;
+        sal_Bool IsBase() const;
+        sal_Bool IsGlobal() const;
+        sal_Bool IsMath() const;
+        sal_Bool IsWeb() const;
+        sal_Bool HasModuleParam() const;
+        sal_Bool WantsToLoadDocument() const;
 
-		// Access to string parameters
-        sal_Bool				GetPortalConnectString( ::rtl::OUString& rPara) const;
-        sal_Bool				GetAcceptString( ::rtl::OUString& rPara) const;
-		sal_Bool				GetUnAcceptString( ::rtl::OUString& rPara) const;
-        sal_Bool				GetOpenList( ::rtl::OUString& rPara) const;
-		sal_Bool				GetViewList( ::rtl::OUString& rPara) const;
-        sal_Bool                GetStartList( ::rtl::OUString& rPara) const;
-		sal_Bool				GetForceOpenList( ::rtl::OUString& rPara) const;
-		sal_Bool				GetForceNewList( ::rtl::OUString& rPara) const;
-        sal_Bool				GetPrintList( ::rtl::OUString& rPara) const;
-		sal_Bool				GetPrintToList( ::rtl::OUString& rPara ) const;
-		sal_Bool				GetPrinterName( ::rtl::OUString& rPara ) const;
-        sal_Bool                GetLanguage( ::rtl::OUString& rPara ) const;
+        // Access to string parameters
+        sal_Bool GetPortalConnectString( ::rtl::OUString& rPara) const;
+        sal_Bool GetAcceptString( ::rtl::OUString& rPara) const;
+        sal_Bool GetUnAcceptString( ::rtl::OUString& rPara) const;
+        sal_Bool GetOpenList( ::rtl::OUString& rPara) const;
+        sal_Bool GetViewList( ::rtl::OUString& rPara) const;
+        sal_Bool GetStartList( ::rtl::OUString& rPara) const;
+        sal_Bool GetForceOpenList( ::rtl::OUString& rPara) const;
+        sal_Bool GetForceNewList( ::rtl::OUString& rPara) const;
+        sal_Bool GetPrintList( ::rtl::OUString& rPara) const;
+        sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const;
+        sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const;
+        sal_Bool GetLanguage( ::rtl::OUString& rPara ) const;
 
         // Special analyzed states (does not match directly to a command line parameter!)
-        sal_Bool                IsPrinting() const;
-        sal_Bool                IsEmpty() const;
-        sal_Bool                IsEmptyOrAcceptOnly() const;
+        sal_Bool IsPrinting() const;
+        sal_Bool IsEmpty() const;
+        sal_Bool IsEmptyOrAcceptOnly() const;
 
-	private:
+    private:
         enum Count { NONE, ONE, MANY };
 
-		struct GroupDefinition
-		{
-			sal_Int32	nCount;
-			BoolParam*	pGroupMembers;
-		};
+        struct GroupDefinition
+        {
+            sal_Int32  nCount;
+            BoolParam* pGroupMembers;
+        };
 
-		// no copy and operator=
-		CommandLineArgs( const CommandLineArgs& );
-		CommandLineArgs operator=( const CommandLineArgs& );
+        // no copy and operator=
+        CommandLineArgs( const CommandLineArgs& );
+        CommandLineArgs operator=( const CommandLineArgs& );
 
-		sal_Bool				InterpretCommandLineParameter( const ::rtl::OUString& );
-		void					ParseCommandLine_Impl( Supplier& supplier );
-		void					ResetParamValues();
-		sal_Bool				CheckGroupMembers( GroupParamId nGroup, BoolParam nExcludeMember ) const;
+        sal_Bool InterpretCommandLineParameter( const ::rtl::OUString& );
+        void     ParseCommandLine_Impl( Supplier& supplier );
+        void     ResetParamValues();
+        sal_Bool CheckGroupMembers( GroupParamId nGroup, BoolParam nExcludeMember ) const;
 
-		void					AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam );
-		void					SetBoolParam_Impl( BoolParam eParam, sal_Bool bValue );
+        void     AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam );
+        void     SetBoolParam_Impl( BoolParam eParam, sal_Bool bValue );
 
         boost::optional< rtl::OUString > m_cwdUrl;
-		sal_Bool				m_aBoolParams[ CMD_BOOLPARAM_COUNT ];		// Stores boolean parameters
-		rtl::OUString			m_aStrParams[ CMD_STRINGPARAM_COUNT ];		// Stores string parameters
-		sal_Bool				m_aStrSetParams[ CMD_STRINGPARAM_COUNT ];	// Stores if string parameters are provided on cmdline
-        Count                   m_eArgumentCount;                           // Number of Args
-		mutable ::osl::Mutex	m_aMutex;
+        sal_Bool                         m_aBoolParams[ CMD_BOOLPARAM_COUNT ];     // Stores boolean parameters
+        rtl::OUString                    m_aStrParams[ CMD_STRINGPARAM_COUNT ];    // Stores string parameters
+        sal_Bool                         m_aStrSetParams[ CMD_STRINGPARAM_COUNT ]; // Stores if string parameters are provided on cmdline
+        Count                            m_eArgumentCount;                         // Number of Args
+        bool                             m_bDocumentArgs;                          // A document creation/open/load arg is used
+        mutable ::osl::Mutex             m_aMutex;
 
-		// static definition for groups where only one member can be true
-		static GroupDefinition	m_pGroupDefinitions[ CMD_GRPID_COUNT ];
+        // static definition for groups where only one member can be true
+        static GroupDefinition  m_pGroupDefinitions[ CMD_GRPID_COUNT ];
 };
 
 }

filter/source/config/fragments/filters/MS_PowerPoint_97.xcu

 	<node oor:name="MS PowerPoint 97" oor:op="replace">
-		<prop oor:name="Flags"><value>IMPORT EXPORT ALIEN ENCRYPTION PASSWORDTOMODIFY</value></prop>
+		<prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
 		<prop oor:name="UIComponent"/>
 		<prop oor:name="FilterService"/>
 		<prop oor:name="UserData"><value>sdfilt</value></prop>

filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu

 	<node oor:name="MS PowerPoint 97 Vorlage" oor:op="replace">
-		<prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH ALIEN ENCRYPTION PASSWORDTOMODIFY</value></prop>
+		<prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH ALIEN</value></prop>
 		<prop oor:name="UIComponent"/>
 		<prop oor:name="FilterService"/>
 		<prop oor:name="UserData"><value>sdfilt</value></prop>

framework/source/uielement/comboboxtoolbarcontroller.cxx

 
 long ComboboxToolbarController::PreNotify( NotifyEvent& rNEvt )
 {
-    if( rNEvt.GetType() == EVENT_KEYINPUT )
+    switch ( rNEvt.GetType() )
     {
-        const ::KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
-        const KeyCode& rKeyCode = pKeyEvent->GetKeyCode();
-        if(( rKeyCode.GetModifier() | rKeyCode.GetCode()) == KEY_RETURN )
-        {
-            // Call execute only with non-empty text
-            if ( m_pComboBox->GetText().Len() > 0 )
-                execute( rKeyCode.GetModifier() );
-            return 1;
-        }
+        case EVENT_KEYINPUT :
+            {
+                const ::KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
+                const KeyCode& rKeyCode = pKeyEvent->GetKeyCode();
+                if(( rKeyCode.GetModifier() | rKeyCode.GetCode()) == KEY_RETURN )
+                {
+                    // Call execute only with non-empty text
+                    if ( m_pComboBox->GetText().Len() > 0 )
+                        execute( rKeyCode.GetModifier() );
+                    return 1;
+                }
+            }
+            break;
+