From 5375ab2bc92c77a84fb663eb2c1d440147c24ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Timm?= Date: Tue, 7 Nov 2006 14:30:15 +0000 Subject: [PATCH] #i71280# Forward successfull terminate call to OpenClients to prevent opening default document (fix by CD). --- desktop/source/app/app.cxx | 11 ++++++++--- desktop/source/app/dispatchwatcher.cxx | 10 ++++++---- desktop/source/app/dispatchwatcher.hxx | 6 +++--- desktop/source/app/officeipcthread.cxx | 11 +++++++---- desktop/source/app/officeipcthread.hxx | 6 +++--- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index af9cd6bf01d9..c8928d699838 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -4,9 +4,9 @@ * * $RCSfile: app.cxx,v $ * - * $Revision: 1.198 $ + * $Revision: 1.199 $ * - * last change: $Author: kz $ $Date: 2006-11-07 14:54:44 $ + * last change: $Author: rt $ $Date: 2006-11-07 15:29:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -2636,6 +2636,7 @@ void Desktop::OpenClients() } } + sal_Bool bShutdown( sal_False ); if ( !pArgs->IsServer() ) { ProcessDocumentsRequest aRequest; @@ -2690,10 +2691,14 @@ void Desktop::OpenClients() } // Process request - OfficeIPCThread::ExecuteCmdLineRequests( aRequest ); + bShutdown = OfficeIPCThread::ExecuteCmdLineRequests( aRequest ); } } + // 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( ::comphelper::getProcessServiceFactory()->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 6f832094c9d3..b9f7379fb8e1 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -4,9 +4,9 @@ * * $RCSfile: dispatchwatcher.cxx,v $ * - * $Revision: 1.26 $ + * $Revision: 1.27 $ * - * last change: $Author: obo $ $Date: 2006-10-12 14:06:07 $ + * last change: $Author: rt $ $Date: 2006-11-07 15:29:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -172,7 +172,7 @@ DispatchWatcher::~DispatchWatcher() } -void DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequestsList ) +sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequestsList ) { Reference< XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), @@ -494,9 +494,11 @@ void DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ // We don't have any task open so we have to shutdown ourself!! Reference< XDesktop > xDesktop2( xTasksSupplier, UNO_QUERY ); if ( xDesktop2.is() ) - xDesktop2->terminate(); + return xDesktop2->terminate(); } } + + return sal_False; } diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index f266c04d4824..829884c86f87 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -4,9 +4,9 @@ * * $RCSfile: dispatchwatcher.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: rt $ $Date: 2005-09-08 17:08:33 $ + * last change: $Author: rt $ $Date: 2006-11-07 15:30:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -120,7 +120,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame: static DispatchWatcher* GetDispatchWatcher(); // execute new dispatch request - void executeDispatchRequests( const DispatchList& aDispatches ); + sal_Bool executeDispatchRequests( const DispatchList& aDispatches ); private: DispatchWatcher(); diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 5012ccadd4db..82fc524a1774 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -4,9 +4,9 @@ * * $RCSfile: officeipcthread.cxx,v $ * - * $Revision: 1.54 $ + * $Revision: 1.55 $ * - * last change: $Author: kz $ $Date: 2006-11-07 14:55:11 $ + * last change: $Author: rt $ $Date: 2006-11-07 15:30:00 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -845,7 +845,7 @@ static void AddToDispatchList( } } -void OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest ) +sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest ) { ::rtl::OUString aEmpty; DispatchWatcher::DispatchList aDispatchList; @@ -860,6 +860,7 @@ void OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest AddToDispatchList( aDispatchList, aRequest.aForceNewList, DispatchWatcher::REQUEST_FORCENEW, aEmpty, aRequest.aModule ); osl::ClearableMutexGuard aGuard( GetMutex() ); + sal_Bool bShutdown( sal_False ); if ( pGlobalOfficeIPCThread ) { @@ -873,12 +874,14 @@ void OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest aGuard.clear(); // Execute dispatch requests - pGlobalOfficeIPCThread->mpDispatchWatcher->executeDispatchRequests( aDispatchList ); + bShutdown = pGlobalOfficeIPCThread->mpDispatchWatcher->executeDispatchRequests( aDispatchList ); // set processed flag if (aRequest.pcProcessed != NULL) aRequest.pcProcessed->set(); } + + return bShutdown; } } diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx index aba63ae45547..1bc06a8e2b45 100644 --- a/desktop/source/app/officeipcthread.hxx +++ b/desktop/source/app/officeipcthread.hxx @@ -4,9 +4,9 @@ * * $RCSfile: officeipcthread.hxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: rt $ $Date: 2005-09-08 17:12:08 $ + * last change: $Author: rt $ $Date: 2006-11-07 15:30:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -140,7 +140,7 @@ class OfficeIPCThread : public vos::OThread static void BlockAllRequests(); static sal_Bool AreRequestsPending(); static void RequestsCompleted( int n = 1 ); - static void ExecuteCmdLineRequests( ProcessDocumentsRequest& ); + static sal_Bool ExecuteCmdLineRequests( ProcessDocumentsRequest& ); // return FALSE if second office static Status EnableOfficeIPCThread();