summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-04-22 15:30:47 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-04-23 10:59:42 +0200
commit29575dc6a481f2548b3fcb0906138861aec03583 (patch)
tree19603c9599c91bd4536c0a43b4d4f8a6c20b9fb6 /sfx2
parent3fb1477de164bba260e3e9a39afcb3f67c78fb5e (diff)
Add config to disable individual infobars
In some deployments users want to disable certain infobars to not interfere with their workflows. Also, there are individual users who want to disable certain infobars for various reasons. This could be a generic config setting where you can set a list of Infobar IDs which should be disabled. That however would require knowledge about the internal IDs which are not exposed (and might even change over time). So instead, add a config option for each known infobar where we suspect users might want to turn it off. This list might change over time. Change-Id: I13f0456435b59aafe929a46498de5a8847f138e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92638 Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/infobar.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index 2c8d18bc0f04..771bda8f4e6c 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -14,6 +14,7 @@
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
#include <memory>
+#include <officecfg/Office/UI/Infobar.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/infobar.hxx>
@@ -393,6 +394,9 @@ SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sP
const OUString& sSecondaryMessage, InfobarType ibType,
WinBits nMessageStyle, bool bShowCloseButton)
{
+ if (!isInfobarEnabled(sId))
+ return nullptr;
+
auto pInfoBar = VclPtr<SfxInfoBarWindow>::Create(this, sId, sPrimaryMessage, sSecondaryMessage,
ibType, nMessageStyle, bShowCloseButton);
@@ -438,6 +442,22 @@ void SfxInfoBarContainerWindow::removeInfoBar(VclPtr<SfxInfoBarWindow> const& pI
m_pChildWin->Update();
}
+bool SfxInfoBarContainerWindow::isInfobarEnabled(const OUString& sId)
+{
+ if (sId == "readonly")
+ return officecfg::Office::UI::Infobar::Enabled::Readonly::get();
+ if (sId == "signature")
+ return officecfg::Office::UI::Infobar::Enabled::Signature::get();
+ if (sId == "donate")
+ return officecfg::Office::UI::Infobar::Enabled::Donate::get();
+ if (sId == "getinvolved")
+ return officecfg::Office::UI::Infobar::Enabled::GetInvolved::get();
+ if (sId == "hyphenationmissing")
+ return officecfg::Office::UI::Infobar::Enabled::HyphenationMissing::get();
+
+ return true;
+}
+
void SfxInfoBarContainerWindow::Resize()
{
long nWidth = GetSizePixel().getWidth();