summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/scripts/soffice.sh9
-rw-r--r--desktop/source/app/app.cxx21
-rw-r--r--desktop/source/inc/exithelper.hxx2
-rwxr-xr-xdesktop/unx/source/officeloader/officeloader.cxx2
-rw-r--r--desktop/win32/source/officeloader/officeloader.cxx3
5 files changed, 32 insertions, 5 deletions
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh
index af6a9df908..1d99b7e031 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 44106dc5af..ab0e42e652 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 682410c6b7..1d3e8a99dc 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 41510c14a0..613eea1ea3 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 40bc7e8784..2940e79f8c 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;