diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 3456db21e578..bb836d235b6d 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1056,6 +1056,22 @@ void handleCrashReport() } #endif +void handleSafeMode() +{ + static const char SERVICENAME_SAFEMODE[] = "com.sun.star.comp.svx.SafeModeUI"; + + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + + Reference< css::frame::XSynchronousDispatch > xSafeModeUI( + xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_SAFEMODE, xContext), + css::uno::UNO_QUERY_THROW); + + css::util::URL aURL; + css::uno::Any aRet = xSafeModeUI->dispatchWithReturnValue(aURL, css::uno::Sequence< css::beans::PropertyValue >()); + bool bRet = false; + aRet >>= bRet; +} + /** @short check if recovery must be started or not. @param bCrashed [boolean ... out!] @@ -2029,6 +2045,11 @@ void Desktop::OpenClients() // need some time, where the user won't see any results and wait for finishing the office startup... bool bAllowRecoveryAndSessionManagement = ( !rArgs.IsNoRestore() ) && ( !rArgs.IsHeadless() ); + // Enter safe mode if requested + if (rArgs.IsSafeMode()) + handleSafeMode(); + + #if HAVE_FEATURE_BREAKPAD if (crashReportInfoExists()) handleCrashReport(); diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index e564af8401fd..2c91b137305a 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -146,6 +146,8 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/dialog/rlrcitem \ svx/source/dialog/rubydialog \ svx/source/dialog/rulritem \ + svx/source/dialog/SafeModeDialog \ + svx/source/dialog/SafeModeUI \ svx/source/dialog/SpellDialogChildWindow \ svx/source/dialog/srchctrl \ svx/source/dialog/srchdlg \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index bd9c6d8ba288..65b9bdedd088 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -64,6 +64,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/redlinecontrol \ svx/uiconfig/ui/redlinefilterpage \ svx/uiconfig/ui/redlineviewpage \ + svx/uiconfig/ui/safemodedialog \ svx/uiconfig/ui/savemodifieddialog \ svx/uiconfig/ui/sidebararea \ svx/uiconfig/ui/sidebarshadow \ diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx new file mode 100644 index 000000000000..c9f6e4c7fb99 --- /dev/null +++ b/svx/source/dialog/SafeModeDialog.cxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "SafeModeDialog.hxx" + +#include + +#include +#include + +SafeModeDialog::SafeModeDialog(vcl::Window* pParent): + Dialog(pParent, "SafeModeDialog", "svx/ui/safemodedialog.ui") +{ + get(mpBtnContinue, "btn_continue"); + get(mpBtnQuit, "btn_quit"); + get(mpBtnRestart, "btn_restart"); + get(mpCBCustomizations, "check_customizations"); + get(mpCBExtensions, "check_extensions"); + get(mpCBFull, "check_full"); + + mpBtnContinue->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); + mpBtnQuit->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); + mpBtnRestart->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl)); +} + +SafeModeDialog::~SafeModeDialog() +{ + disposeOnce(); +} + +void SafeModeDialog::dispose() +{ + mpBtnContinue.clear(); + mpBtnQuit.clear(); + mpBtnRestart.clear(); + mpCBCustomizations.clear(); + mpCBExtensions.clear(); + mpCBFull.clear(); + + Dialog::dispose(); +} + +IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void) +{ + if (pBtn == mpBtnContinue.get()) + { + Close(); + } + else if (pBtn == mpBtnQuit.get()) + { + Close(); + } + else if (pBtn == mpBtnRestart.get()) + { + Close(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx new file mode 100644 index 000000000000..ac71cf41a5ac --- /dev/null +++ b/svx/source/dialog/SafeModeDialog.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SVX_SOURCE_DIALOG_SAFEMODEDIALOG_HXX +#define INCLUDED_SVX_SOURCE_DIALOG_SAFEMODEDIALOG_HXX + +#include +#include +#include +#include +#include + +class SafeModeDialog : public Dialog +{ +public: + + explicit SafeModeDialog(vcl::Window* pParent); + + virtual ~SafeModeDialog() override; + + virtual void dispose() override; + +private: + + VclPtr