summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2022-07-22 16:44:29 +0200
committerHossein <hossein@libreoffice.org>2022-07-24 15:53:39 +0200
commite2b7f59c745a79542b15937bc824c7afe9969cde (patch)
treef951572da96fe38d6eeb865ae0439131c4f41a59 /svtools/source
parent78071a36def92096920a0441b5fdac0fdd5a7c8e (diff)
tdf#147868 Disable add sheet when structure is protected
Using "Tools > Protect Spreadsheet Structure...", it is possible to protect the structure of a spreadsheet document. Without this patch in place, the [+] (add new sheet) button is clickable but it does not work. This is confusing for the user, so it was decided that the button should be disabled when the structure is protected. This patch disables the [+] button just after the structure is protected using the above toggle menu option. The menu option becomes checked, and the [+] button gets disabled immediately. After choosing the same toggle menu option again, the check mark goes away, and the [+] button becomes enabled immediately. In this patch, GetDocument().IsDocEditable() is used to check if the document structure is protected. The argument for this choice is that the same function is used when renaming a sheet with ScDocFunc::RenameTable(). Change-Id: If812d94841d3efd98d7ef898cc1f4b2f1387130b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137365 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/control/tabbar.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 5e5aba4af172..a1a074c4470a 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -2494,6 +2494,11 @@ tools::Rectangle TabBar::GetPageArea() const
Size(mnLastOffX - mnOffX + 1, GetSizePixel().Height() - mnOffY));
}
+void TabBar::SetAddButtonEnabled(bool bAddButtonEnabled)
+{
+ mpImpl->mxButtonBox->m_xAddButton->set_sensitive(bAddButtonEnabled);
+}
+
css::uno::Reference<css::accessibility::XAccessible> TabBar::CreateAccessible()
{
return mpImpl->maAccessibleFactory.getFactory().createAccessibleTabBar(*this);