diff options
| author | Sumit Chauhan <sumitcn25@gmail.com> | 2019-06-10 15:47:55 +0530 |
|---|---|---|
| committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-06-16 22:14:10 +0200 |
| commit | 6b888ac476fe6ac2ee96c7086cb8c24249f08473 (patch) | |
| tree | f36fb8dd53a8f0ed4a6b1eae795e5468ecf6dc8b /sfx2 | |
| parent | adcb7bacb452dccde70b20a902f5c1f23f37913f (diff) | |
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 .
Change-Id: I3d6314e4b8220a8744331246639acadea941252f
Reviewed-on: https://gerrit.libreoffice.org/73750
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sfx2')
| -rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 26 |
1 files changed, 20 insertions, 6 deletions
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: */ |
