cui/source/customize/SvxNotebookbarConfigPage.cxx | 17 +++++++++----- include/sfx2/notebookbar/SfxNotebookBar.hxx | 8 ++++-- include/vcl/syswin.hxx | 5 +++- sfx2/source/notebookbar/SfxNotebookBar.cxx | 26 ++++++++++++++++------ vcl/source/window/syswin.cxx | 6 +++-- 5 files changed, 44 insertions(+), 18 deletions(-)
New commits: commit 6b888ac476fe6ac2ee96c7086cb8c24249f08473 Author: Sumit Chauhan <sumitc...@gmail.com> AuthorDate: Mon Jun 10 15:47:55 2019 +0530 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sun Jun 16 22:14:10 2019 +0200 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.k...@collabora.com> diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx index d2ef34807920..f32ad2c472a0 100644 --- a/cui/source/customize/SvxNotebookbarConfigPage.cxx +++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx @@ -206,6 +206,8 @@ short SvxNotebookbarConfigPage::QueryReset() OUString sNotebookbarInterface = getFileName(sFileName); Sequence<OUString> sSequenceEntries; CustomNotebookbarGenerator::setCustomizedUIItem(sSequenceEntries, sNotebookbarInterface); + OUString sUIPath = "modules/s" + sAppName.toAsciiLowerCase() + "/ui/"; + sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath); } return nValue; } @@ -374,13 +376,10 @@ static OUString getUIItemID(OUString sString) return sUIItemID.makeStringAndClear(); } -static void EditRegistryFile(OUString& sUIItemID, OUString& sSetEntry) +static void EditRegistryFile(OUString& sUIItemID, OUString& sSetEntry, + OUString& sNotebookbarInterface) { int nFlag = 0; - OUString sAppName; - OUString sFileName; - CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName); - OUString sNotebookbarInterface = getFileName(sFileName); Sequence<OUString> aOldEntries = CustomNotebookbarGenerator::getCustomizedUIItem(sNotebookbarInterface); Sequence<OUString> aNewEntries(aOldEntries.getLength() + 1); @@ -411,6 +410,10 @@ static void EditRegistryFile(OUString& sUIItemID, OUString& sSetEntry) void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow) { OUString sUIItemID = m_xControl->get_selected_text(); + OUString sAppName; + OUString sFileName; + CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName); + OUString sNotebookbarInterface = getFileName(sFileName); OUString sVisible; sUIItemID = getUIItemID(sUIItemID); if (m_xControl->get_toggle(nRow, 0) == TRISTATE_TRUE) @@ -420,8 +423,10 @@ void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow) OUString sSetEntries = sUIItemID + ",visible," + sVisible; Sequence<OUString> sSeqOfEntries(1); sSeqOfEntries[0] = sSetEntries; - EditRegistryFile(sUIItemID, sSetEntries); + EditRegistryFile(sUIItemID, sSetEntries, sNotebookbarInterface); CustomNotebookbarGenerator::modifyCustomizedUIFile(sSeqOfEntries); + OUString sUIPath = "modules/s" + sAppName.toAsciiLowerCase() + "/ui/"; + sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath); } IMPL_LINK(SvxNotebookbarEntriesListBox, CheckButtonHdl, const row_col&, rRowCol, void) 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits