summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-04-23 10:40:01 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-04-23 10:50:35 +0200
commit3934ea4f224183f8e78f50e5fa673fb573e1e684 (patch)
treee6e0ffdbe311291b693a1b2d1cd89b7b5fddd936 /sfx2
parent3af811c768eabd775c4c7777a33a1ac1e0ccd448 (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
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/infobar.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index 349d09cf405f..1df9ce51f8f1 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -13,6 +13,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
+#include <officecfg/Office/UI/Infobar.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/infobar.hxx>
@@ -343,6 +344,9 @@ VclPtr<SfxInfoBarWindow> SfxInfoBarContainerWindow::appendInfoBar(const OUString
InfoBarType ibType,
WinBits nMessageStyle)
{
+ if (!isInfobarEnabled(sId))
+ return nullptr;
+
Size aSize = GetSizePixel();
auto pInfoBar = VclPtr<SfxInfoBarWindow>::Create(this, sId, sMessage, ibType, nMessageStyle);
@@ -407,6 +411,20 @@ void SfxInfoBarContainerWindow::removeInfoBar(VclPtr<SfxInfoBarWindow> const & p
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 == "getdonate")
+ return officecfg::Office::UI::Infobar::Enabled::Donate::get();
+ if (sId == "getinvolved")
+ return officecfg::Office::UI::Infobar::Enabled::GetInvolved::get();
+
+ return true;
+}
+
void SfxInfoBarContainerWindow::Resize()
{
// Only need to change the width of the infobars