summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/app/app.cxx3
-rw-r--r--desktop/source/app/appinit.cxx4
-rw-r--r--include/vcl/svapp.hxx6
-rw-r--r--vcl/source/app/svapp.cxx12
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx4
5 files changed, 28 insertions, 1 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 6396a239f3cb..eb48be03baaa 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2088,8 +2088,9 @@ void Desktop::OpenClients()
bool bAllowRecoveryAndSessionManagement = ( !rArgs.IsNoRestore() ) && ( !rArgs.IsHeadless() );
// Enter safe mode if requested
- if (rArgs.IsSafeMode() || sfx2::SafeMode::hasFlag())
+ if (Application::IsSafeModeEnabled()) {
handleSafeMode();
+ }
#if HAVE_FEATURE_BREAKPAD
diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx
index 105ade387159..3ea24827907d 100644
--- a/desktop/source/app/appinit.cxx
+++ b/desktop/source/app/appinit.cxx
@@ -53,6 +53,7 @@
#include <unotools/tempfile.hxx>
#include <vcl/svapp.hxx>
#include <unotools/pathoptions.hxx>
+#include <sfx2/safemode.hxx>
#include <map>
using namespace desktop;
@@ -96,6 +97,9 @@ void Desktop::RegisterServices(Reference< XComponentContext > const & context)
// interpret command line arguments
CommandLineArgs& rCmdLine = GetCommandLineArgs();
+ if (rCmdLine.IsSafeMode() || sfx2::SafeMode::hasFlag())
+ Application::EnableSafeMode();
+
// Headless mode for FAT Office, auto cancels any dialogs that popup
if (rCmdLine.IsEventTesting())
Application::EnableEventTestingMode();
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 4ac5084bb2fe..2886cb580710 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1282,6 +1282,12 @@ public:
*/
static bool IsEventTestingModeEnabled();
+ /** Set safe mode to enabled */
+ static void EnableSafeMode();
+
+ /** Determines if safe mode is enabled */
+ static bool IsSafeModeEnabled();
+
///@}
/** @name IME Status Window Control
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index b394c5302f5f..e1336ab086ff 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1646,6 +1646,18 @@ void Application::EnableEventTestingMode()
bEventTestingMode = true;
}
+static bool bSafeMode = false;
+
+bool Application::IsSafeModeEnabled()
+{
+ return bSafeMode;
+}
+
+void Application::EnableSafeMode()
+{
+ bSafeMode = true;
+}
+
void Application::ShowNativeErrorBox(const OUString& sTitle ,
const OUString& sMessage)
{
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 45f8f7684df2..f07e7dcbfa8e 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -1024,6 +1024,10 @@ bool OpenGLHelper::isVCLOpenGLEnabled()
else if (officecfg::Office::Common::VCL::UseOpenGL::get())
bEnable = true;
+ // Force disable in safe mode
+ if (Application::IsSafeModeEnabled())
+ bEnable = false;
+
bRet = bEnable;
}