[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/sfx2 include/vcl sfx2/source vcl/source
Sumit Chauhan (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 26 14:56:35 UTC 2019
include/sfx2/notebookbar/SfxNotebookBar.hxx | 8 +++++---
include/vcl/syswin.hxx | 5 ++++-
sfx2/source/notebookbar/SfxNotebookBar.cxx | 26 ++++++++++++++++++++------
vcl/source/window/syswin.cxx | 6 ++++--
4 files changed, 33 insertions(+), 12 deletions(-)
New commits:
commit b497349fc04d1e3fe4eac265067feae2e5519dd9
Author: Sumit Chauhan <sumitcn25 at gmail.com>
AuthorDate: Mon Jun 10 15:47:55 2019 +0530
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Nov 26 15:55:37 2019 +0100
Reload Notebookbar, when customization is being done.
This patch is related to notebookbar customization tab. When one clicks
the widget checkbox , to preview the real-time changes one need to call
this ReloadNotebookBar() method .
Reviewed-on: https://gerrit.libreoffice.org/73750
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
(cherry picked from commit 6b888ac476fe6ac2ee96c7086cb8c24249f08473)
Change-Id: I3d6314e4b8220a8744331246639acadea941252f
Reviewed-on: https://gerrit.libreoffice.org/82737
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx b/include/sfx2/notebookbar/SfxNotebookBar.hxx
index 9eb76e9c3ba5..2a30a126beaf 100644
--- a/include/sfx2/notebookbar/SfxNotebookBar.hxx
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -36,10 +36,11 @@ public:
static void ExecMethod(SfxBindings& rBindings, const OUString& rUIName);
/// Function to be called from the sdi's StateMethod.
- static bool StateMethod(SfxBindings& rBindings, const OUString& rUIFile);
+ static bool StateMethod(SfxBindings& rBindings, const OUString& rUIFile,
+ bool bReloadNotebookbar = false);
static bool StateMethod(SystemWindow* pSysWindow,
- const css::uno::Reference<css::frame::XFrame> & xFrame,
- const OUString& rUIFile);
+ const css::uno::Reference<css::frame::XFrame>& xFrame,
+ const OUString& rUIFile, bool bReloadNotebookbar = false);
/// Method temporarily blocks showing of the NotebookBar
static void LockNotebookBar();
@@ -53,6 +54,7 @@ public:
/** Show menu bar only in current frame */
static void ShowMenubar(SfxViewFrame const * pViewFrame, bool bShow);
static void ToggleMenubar();
+ static void ReloadNotebookBar(OUString& sUIPath);
private:
static bool m_bLock;
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index c285abe2c024..22dd359e927b 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -215,7 +215,10 @@ public:
MenuBar* GetMenuBar() const { return mpMenuBar; }
void SetMenuBarMode( MenuBarMode nMode );
- void SetNotebookBar(const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame>& rFrame);
+ void SetNotebookBar(const OUString& rUIXMLDescription,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ bool bReloadNotebookbar = false);
+
void CloseNotebookBar();
VclPtr<NotebookBar> const & GetNotebookBar() const;
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 0090cb1de1bd..402874ccb4ef 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -8,6 +8,7 @@
*/
#include <sfx2/bindings.hxx>
+#include <sfx2/viewsh.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/notebookbar/SfxNotebookBar.hxx>
#include <unotools/viewoptions.hxx>
@@ -283,15 +284,17 @@ void SfxNotebookBar::ExecMethod(SfxBindings& rBindings, const OUString& rUIName)
rBindings.Update();
}
-bool SfxNotebookBar::StateMethod(SfxBindings& rBindings, const OUString& rUIFile)
+bool SfxNotebookBar::StateMethod(SfxBindings& rBindings, const OUString& rUIFile,
+ bool bReloadNotebookbar)
{
SfxFrame& rFrame = rBindings.GetDispatcher_Impl()->GetFrame()->GetFrame();
- return StateMethod(rFrame.GetSystemWindow(), rFrame.GetFrameInterface(), rUIFile);
+ return StateMethod(rFrame.GetSystemWindow(), rFrame.GetFrameInterface(), rUIFile,
+ bReloadNotebookbar);
}
bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
- const Reference<css::frame::XFrame> & xFrame,
- const OUString& rUIFile)
+ const Reference<css::frame::XFrame>& xFrame,
+ const OUString& rUIFile, bool bReloadNotebookbar)
{
if (!pSysWindow)
{
@@ -325,15 +328,17 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
bChangedFile = sNewFile != sCurrentFile;
}
- if ( ( !sFile.isEmpty() && bChangedFile ) || !pNotebookBar || !pNotebookBar->IsVisible() )
+ if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || !pNotebookBar->IsVisible()
+ || bReloadNotebookbar)
{
RemoveListeners(pSysWindow);
OUStringBuffer aBuf(rUIFile);
aBuf.append( sFile );
+ OUString aVal = aBuf.makeStringAndClear();
// setup if necessary
- pSysWindow->SetNotebookBar(aBuf.makeStringAndClear(), xFrame);
+ pSysWindow->SetNotebookBar(aVal, xFrame, bReloadNotebookbar);
pNotebookBar = pSysWindow->GetNotebookBar();
pNotebookBar->Show();
pNotebookBar->GetParent()->Resize();
@@ -503,4 +508,13 @@ void SfxNotebookBar::ToggleMenubar()
}
}
+void SfxNotebookBar::ReloadNotebookBar(OUString& sUIPath)
+{
+ if (SfxNotebookBar::IsActive())
+ {
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame()->GetBindings(), sUIPath, true);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 27e0c87cf41f..59d3b2e97189 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -966,9 +966,11 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar)
}
}
-void SystemWindow::SetNotebookBar(const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame>& rFrame)
+void SystemWindow::SetNotebookBar(const OUString& rUIXMLDescription,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ bool bReloadNotebookbar)
{
- if (rUIXMLDescription != maNotebookBarUIFile)
+ if (rUIXMLDescription != maNotebookBarUIFile || bReloadNotebookbar)
{
static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetNotebookBar(rUIXMLDescription, rFrame);
maNotebookBarUIFile = rUIXMLDescription;
More information about the Libreoffice-commits
mailing list