Resolves tdf#131817 - Option to globally switch toolbar locking on/off

Reverts 6993d5d0f1 and
sets Locked in GlobalSettings to true
New UNO command ToolbarLock to toggle the state added to
the toolbars menu

Change-Id: I246280b2b7930f2bf686e6fc26383da4799b5028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115797
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
Heiko Tietze
2021-06-08 15:28:56 +02:00
committed by Heiko Tietze
parent a2d8a737f4
commit 086fa727ca
12 changed files with 152 additions and 68 deletions
+1
View File
@@ -41,6 +41,7 @@
#define STR_FULL_DISC_RETRY_BUTTON NC_("STR_FULL_DISC_RETRY_BUTTON", "Retry" )
#define STR_FULL_DISC_MSG NC_("STR_FULL_DISC_MSG", "%PRODUCTNAME could not save important internal information due to insufficient free disk space at the following location:\n%PATH\n\nYou will not be able to continue working with %PRODUCTNAME without allocating more free disk space at that location.\n\nPress the 'Retry' button after you have allocated more free disk space to retry saving the data.\n\n" )
#define STR_RESTORE_TOOLBARS NC_("STR_RESTORE_TOOLBARS", "~Reset" )
#define STR_LOCK_TOOLBARS NC_("STR_LOCK_TOOLBARS", "~Lock Toolbars" )
#define STR_CORRUPT_UICFG_SHARE NC_("STR_CORRUPT_UICFG_SHARE", "An error occurred while loading the user interface configuration data. The application will be terminated now.\nPlease try to reinstall the application." )
#define STR_CORRUPT_UICFG_USER NC_("STR_CORRUPT_UICFG_USER", "An error occurred while loading the user interface configuration data. The application will be terminated now.\nPlease try to remove your user profile for the application." )
#define STR_CORRUPT_UICFG_GENERAL NC_("STR_CORRUPT_UICFG_GENERAL", "An error occurred while loading the user interface configuration data. The application will be terminated now.\nPlease try to remove your user profile for the application first or try to reinstall the application." )
@@ -1943,10 +1943,7 @@ void ToolBarManager::AddCustomizeMenuItems(ToolBox const * pToolBar)
pMenu->EnableItem(MENUITEM_TOOLBAR_DOCKALLTOOLBAR, false);
Reference< XDockableWindow > xDockable( VCLUnoHelper::GetInterface( m_pToolBar ), UNO_QUERY );
if( xDockable.is() )
{
pMenu->CheckItem(MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, xDockable->isLocked());
pMenu->EnableItem(MENUITEM_TOOLBAR_UNDOCKTOOLBAR, !xDockable->isLocked());
}
}
else
pMenu->EnableItem(MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, false);
@@ -69,6 +69,7 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::ui;
constexpr OUStringLiteral CMD_RESTOREVISIBILITY = u".cmd:RestoreVisibility";
constexpr OUStringLiteral CMD_LOCKTOOLBARS = u".uno:ToolbarLock";
constexpr OUStringLiteral STATIC_CMD_PART = u".uno:AvailableToolbars?Toolbar:string=";
const char STATIC_INTERNAL_CMD_PART[] = ".cmd:";
@@ -461,6 +462,8 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co
OUString aLabelStr(FwkResId(STR_RESTORE_TOOLBARS));
addCommand( m_xPopupMenu, CMD_RESTOREVISIBILITY, aLabelStr );
aLabelStr = FwkResId(STR_LOCK_TOOLBARS);
addCommand( m_xPopupMenu, CMD_LOCKTOOLBARS, aLabelStr );
}
// XEventListener
+1
View File
@@ -275,6 +275,7 @@ class SvxSearchItem;
#define SID_ADDITIONS_DIALOG (SID_SFX_START + 1740)
#define SID_ADDITIONS_TAG (SID_SFX_START + 1741)
#define SID_TOOLBAR_MODE_UI (SID_SFX_START + 1742)
#define SID_TOOLBAR_LOCK (SID_SFX_START + 1743)
// SID_SFX_free_END (SID_SFX_START + 3999)
+3
View File
@@ -65,6 +65,9 @@ enum RestartReason {
// For restructuring the Form menu,
// %PRODUCTNAME must be restarted:
RESTART_REASON_MSCOMPATIBLE_FORMS_MENU,
// To apply changes, %PRODUCTNAME,
// %PRODUCTNAME must be restarted:
RESTART_REASON_UI_CHANGE,
// No particular reason:
RESTART_REASON_NONE
};
@@ -6548,6 +6548,17 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
<value>1</value>
</prop>
</node>
<node oor:name=".uno:ToolbarLock" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Lock Toolbars</value>
</prop>
<prop oor:name="TooltipLabel" oor:type="xs:string">
<value xml:lang="en-US">Lock or unlock all toolbars</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
</node>
<node oor:name="Popups">
<node oor:name=".uno:PasteSpecialMenu" oor:op="replace">
@@ -35,6 +35,7 @@
TRUE = All toolbars should be locked by default.
FALSE = All toolbars should never be locked by default.
-->
<value>true</value>
</prop>
<prop oor:name="Docked" oor:type="xs:boolean">
<info>
@@ -57,6 +58,7 @@
<info>
<desc>Determines if the global states set should be used or not."</desc>
</info>
<value>true</value>
</prop>
<node-ref oor:name="States" oor:node-type="GlobalWindowState">
<info>
+5
View File
@@ -224,6 +224,11 @@ interface Application
ExecMethod = MiscExec_Impl ;
StateMethod = MiscState_Impl ;
]
SID_TOOLBAR_LOCK
[
ExecMethod = MiscExec_Impl ;
StateMethod = MiscState_Impl ;
]
}
+16
View File
@@ -5754,3 +5754,19 @@ SfxVoidItem AdditionsDialog SID_ADDITIONS_DIALOG
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Application;
]
SfxBoolItem ToolbarLock SID_TOOLBAR_LOCK
[
AutoUpdate = TRUE,
FastCall = FALSE,
ReadOnlyDoc = TRUE,
Toggle = TRUE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = FALSE,
MenuConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Application;
]
+32 -2
View File
@@ -64,6 +64,7 @@
#include <sal/log.hxx>
#include <osl/file.hxx>
#include <vcl/EnumContext.hxx>
#include <vcl/toolbox.hxx>
#include <unotools/moduleoptions.hxx>
#include <svtools/helpopt.hxx>
@@ -1026,7 +1027,32 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
aDialog.run();
break;
}
case SID_TOOLBAR_LOCK:
{
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
if (pViewFrame)
{
Reference<XFrame> xCurrentFrame;
uno::Reference<uno::XComponentContext> xContext
= ::comphelper::getProcessComponentContext();
xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface();
const Reference<frame::XModuleManager> xModuleManager
= frame::ModuleManager::create(xContext);
const utl::OConfigurationTreeRoot aAppNode(
xContext, "org.openoffice.Office.UI.GlobalSettings/Toolbars/States", true);
if (aAppNode.isValid())
{
bool isLocked = comphelper::getBOOL(aAppNode.getNodeValue("Locked"));
aAppNode.setNodeValue("Locked", makeAny(!isLocked));
aAppNode.commit();
//TODO: apply immediately w/o restart needed
SolarMutexGuard aGuard;
svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr,
svtools::RESTART_REASON_UI_CHANGE);
}
}
break;
}
default:
break;
}
@@ -1226,7 +1252,11 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
rSet.DisableItem(nWhich);
}
break;
case SID_TOOLBAR_LOCK:
{
rSet.Put( SfxBoolItem( SID_TOOLBAR_LOCK, ToolBox::AlwaysLocked() ));
}
break;
default:
break;
}
+3
View File
@@ -71,6 +71,9 @@ public:
case svtools::RESTART_REASON_MSCOMPATIBLE_FORMS_MENU:
reason_ = m_xBuilder->weld_widget("reason_mscompatible_formsmenu");
break;
case svtools::RESTART_REASON_UI_CHANGE:
reason_ = m_xBuilder->weld_widget("reason_uichange");
break;
default:
assert(false); // this cannot happen
}
+75 -63
View File
@@ -1,34 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
<!-- Generated with glade 3.38.2 -->
<interface domain="svt">
<requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="RestartDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="can-focus">False</property>
<property name="border-width">6</property>
<property name="title" translatable="yes" context="restartdialog|RestartDialog">Restart %PRODUCTNAME</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<property name="default-width">0</property>
<property name="default-height">0</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="yes">
<property name="label" translatable="yes" context="restartdialog|yes">Restart Now</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="has-default">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -40,8 +40,8 @@
<object class="GtkButton" id="no">
<property name="label" translatable="yes" context="restartdialog|no">Restart Later</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -53,23 +53,23 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="reason_java">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_java">For the selected Java runtime environment to work properly, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">30</property>
<property name="max-width-chars">30</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -80,11 +80,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_mailmerge_install">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_mailmerge_install">For mail merge to work properly, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -95,11 +95,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_pdf">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_pdf">For the modified default print job format to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -110,11 +110,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_bibliography_install">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_bibliography_install">For the bibliography to work properly, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -125,11 +125,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_assigning_folders">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_assigning_folders">For the assigned folders and archives to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -140,11 +140,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_assigning_javaparameters">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_assigning_javaparameters">For the assigned Java parameters to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -155,11 +155,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_adding_path">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_adding_path">For the added path to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -170,11 +170,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_language_change">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_language_change">For the updated language settings to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -185,11 +185,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_exp_features">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_exp_features">For the modified experimental features to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -200,11 +200,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_extension_install">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_extension_install">For the extension to work properly, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -213,13 +213,28 @@
<property name="position">9</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="reason_uichange">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_extension_install">To apply changes, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">10</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="reason_opencl">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_opencl">For the OpenCL changes to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -230,11 +245,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_threading">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_threading">For the multi-threaded calculation changes to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -245,11 +260,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_mscompatible_formsmenu">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_mscompatible_formsmenu">For restructuring the Form menu, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -261,7 +276,7 @@
<child>
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="restartdialog|label">Do you want to restart %PRODUCTNAME now?</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
@@ -274,11 +289,11 @@
</child>
<child>
<object class="GtkLabel" id="reason_skia">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="label" translatable="yes" context="restartdialog|reason_skia">For the Skia changes to take effect, %PRODUCTNAME must be restarted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -300,8 +315,5 @@
<action-widget response="-8">yes</action-widget>
<action-widget response="-9">no</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>