diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2010-05-10 17:35:24 +0200 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2010-05-10 17:35:24 +0200 |
commit | c288dd322747e11a5c779f155ba39e799a9920c2 (patch) | |
tree | 27eaf38dae8f52ec2fd8a5ecfc282c729c00b40e | |
parent | be45f3f14b9f103e12ddc343f483086eff10011e (diff) |
jl152: #i108704# allow to restart the office
-rw-r--r-- | desktop/scripts/soffice.sh | 9 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 21 | ||||
-rw-r--r-- | desktop/source/inc/exithelper.hxx | 2 | ||||
-rwxr-xr-x | desktop/unx/source/officeloader/officeloader.cxx | 2 | ||||
-rw-r--r-- | desktop/win32/source/officeloader/officeloader.cxx | 3 |
5 files changed, 32 insertions, 5 deletions
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh index ebbdeb9eabdb..fae9dbe4d695 100644 --- a/desktop/scripts/soffice.sh +++ b/desktop/scripts/soffice.sh @@ -120,9 +120,14 @@ trap 'kill -9 $!' TERM wait $! sd_ret=$? -while [ $sd_ret -eq 79 ] +while [ $sd_ret -eq 79 -o $sd_ret -eq 81 ] do - "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" & + if [ $sd_ret -eq 79 ]; then + "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" & + elif if [ $sd_ret -eq 81 ]; then + "$sd_prog/$sd_binary" "$@" & + fi + wait $! sd_ret=$? done diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 8e610fb0e141..3b0a1ea0dcf8 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -84,6 +84,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/task/XJobExecutor.hpp> +#include <com/sun/star/task/XRestartManager.hpp> #ifndef _COM_SUN_STAR_TASK_XJOBEXECUTOR_HPP_ #include <com/sun/star/task/XJob.hpp> #endif @@ -103,6 +104,7 @@ #include <vos/security.hxx> #include <vos/ref.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/configurationhelper.hxx> #ifndef _UTL__HXX_ #include <unotools/configmgr.hxx> @@ -140,6 +142,7 @@ #include <sfx2/sfx.hrc> #include <ucbhelper/contentbroker.hxx> #include <unotools/bootstrap.hxx> +#include <cppuhelper/bootstrap.hxx> #include "vos/process.hxx" @@ -1615,6 +1618,7 @@ void Desktop::Main() // call Application::Execute to process messages in vcl message loop RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" ); + Reference< ::com::sun::star::task::XRestartManager > xRestartManager; try { // The JavaContext contains an interaction handler which is used when @@ -1622,7 +1626,11 @@ void Desktop::Main() com::sun::star::uno::ContextLayer layer2( new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) ); - Execute(); + ::comphelper::ComponentContext aContext( xSMgr ); + xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY ); + + if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) ) + Execute(); } catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg) { @@ -1635,6 +1643,9 @@ void Desktop::Main() FatalError( MakeStartupErrorMessage(exAnyCfg.Message) ); } + // check whether the shutdown is caused by restart + sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); + if (xGlobalBroadcaster.is()) { css::document::EventObject aEvent; @@ -1671,6 +1682,14 @@ void Desktop::Main() RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- deinit ucb" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "FINISHED WITH Destop::Main" ); + if ( bRestartRequested ) + { +#ifdef MACOSX + DoRestart(); +#endif + // wouldn't the solution be more clean if SalMain returns the exit code to the system? + _exit( ExitHelper::E_NORMAL_RESTART ); + } } IMPL_LINK( Desktop, ImplInitFilterHdl, ConvertData*, pData ) diff --git a/desktop/source/inc/exithelper.hxx b/desktop/source/inc/exithelper.hxx index 2e6d7e774d98..e2604ce49b68 100644 --- a/desktop/source/inc/exithelper.hxx +++ b/desktop/source/inc/exithelper.hxx @@ -58,6 +58,8 @@ class ExitHelper E_FATAL_ERROR = 333, // Only the low 8 bits are significant 333 % 256 = 77 /// user force automatic restart after crash E_CRASH_WITH_RESTART = 79, + /// the office restarts itself + E_NORMAL_RESTART = 81 }; }; diff --git a/desktop/unx/source/officeloader/officeloader.cxx b/desktop/unx/source/officeloader/officeloader.cxx index de84985cdea6..87621960c61a 100755 --- a/desktop/unx/source/officeloader/officeloader.cxx +++ b/desktop/unx/source/officeloader/officeloader.cxx @@ -93,7 +93,7 @@ SAL_IMPLEMENT_MAIN() if ( info.Fields & osl_Process_EXITCODE ) { exitcode = info.Code; - bRestart = (ExitHelper::E_CRASH_WITH_RESTART == exitcode); + bRestart = (ExitHelper::E_CRASH_WITH_RESTART == exitcode || ExitHelper::E_NORMAL_RESTART == exitcode); } else break; diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index f36bfc134ded..2d602a6d6507 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -416,7 +416,8 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) CloseHandle( aProcessInfo.hProcess ); CloseHandle( aProcessInfo.hThread ); } - } while ( fSuccess && ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode ); + } while ( fSuccess + && ( ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode || ::desktop::ExitHelper::E_NORMAL_RESTART == dwExitCode ); delete[] lpCommandLine; return fSuccess ? dwExitCode : -1; |