cui/source/customize/SvxNotebookbarConfigPage.cxx | 28 +++++++++++----------- cui/source/inc/SvxNotebookbarConfigPage.hxx | 3 +- include/vcl/menubtn.hxx | 3 +- vcl/source/app/salvtables.cxx | 2 - vcl/source/control/menubtn.cxx | 14 ++++++++++- 5 files changed, 33 insertions(+), 17 deletions(-)
New commits: commit a655117db4b25f8b06a947295058e7257e3b45dd Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 25 10:20:32 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Nov 28 09:54:43 2019 +0100 tdf#126043 load the xml just once Change-Id: I98cfeeeddf2fb2d86259a11368bf3db752f5e556 Reviewed-on: https://gerrit.libreoffice.org/83656 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 7c949066e6aae6ffe3b88d6500e70cdb7cc03b69) Reviewed-on: https://gerrit.libreoffice.org/83902 diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx index 70c9c5e10510..b74353a95758 100644 --- a/cui/source/customize/SvxNotebookbarConfigPage.cxx +++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx @@ -417,31 +417,28 @@ void SvxNotebookbarConfigPage::searchNodeandAttribute(std::vector<NotebookbarEnt } } -void SvxNotebookbarConfigPage::FillFunctionsList(std::vector<NotebookbarEntries>& aEntries, +void SvxNotebookbarConfigPage::FillFunctionsList(xmlNodePtr pRootNodePtr, + std::vector<NotebookbarEntries>& aEntries, std::vector<CategoriesEntries>& aCategoryList, OUString& sActiveCategory) { - OString sUIFileUIPath = CustomNotebookbarGenerator::getSystemPath( - CustomNotebookbarGenerator::getCustomizedUIPath()); - xmlDocPtr pDoc = xmlParseFile(sUIFileUIPath.getStr()); - xmlNodePtr pNodePtr = xmlDocGetRootElement(pDoc); - CategoriesEntries aCurItemEntry; - searchNodeandAttribute(aEntries, aCategoryList, sActiveCategory, aCurItemEntry, pNodePtr, + searchNodeandAttribute(aEntries, aCategoryList, sActiveCategory, aCurItemEntry, pRootNodePtr, false); - if (pDoc != nullptr) - { - xmlFreeDoc(pDoc); - } } void SvxNotebookbarConfigPage::SelectElement() { + OString sUIFileUIPath = CustomNotebookbarGenerator::getSystemPath( + CustomNotebookbarGenerator::getCustomizedUIPath()); + xmlDocPtr pDoc = xmlParseFile(sUIFileUIPath.getStr()); + xmlNodePtr pNodePtr = xmlDocGetRootElement(pDoc); + m_xContentsListBox->clear(); std::vector<NotebookbarEntries> aEntries; std::vector<CategoriesEntries> aCategoryList; OUString sActiveCategory = m_xTopLevelListBox->get_active_id(); - FillFunctionsList(aEntries, aCategoryList, sActiveCategory); + FillFunctionsList(pNodePtr, aEntries, aCategoryList, sActiveCategory); if (m_xTopLevelListBox->get_count() == 1) { @@ -463,7 +460,7 @@ void SvxNotebookbarConfigPage::SelectElement() std::vector<NotebookbarEntries> aGtkEntries; sal_Int32 rPos = 1; sActiveCategory = aEntries[nIdx].sUIItemId.getToken(rPos, ':', rPos); - FillFunctionsList(aGtkEntries, aCategoryList, sActiveCategory); + FillFunctionsList(pNodePtr, aGtkEntries, aCategoryList, sActiveCategory); for (std::size_t Idx = 0; Idx < aGtkEntries.size(); Idx++) aTempEntries.push_back(aGtkEntries[Idx]); aGtkEntries.clear(); @@ -502,6 +499,11 @@ void SvxNotebookbarConfigPage::SelectElement() rTreeView.thaw(); aEntries.clear(); + + if (pDoc != nullptr) + { + xmlFreeDoc(pDoc); + } } SvxNotebookbarEntriesListBox::SvxNotebookbarEntriesListBox(std::unique_ptr<weld::TreeView> xParent, diff --git a/cui/source/inc/SvxNotebookbarConfigPage.hxx b/cui/source/inc/SvxNotebookbarConfigPage.hxx index 7793d6e6415b..3c657db3ca84 100644 --- a/cui/source/inc/SvxNotebookbarConfigPage.hxx +++ b/cui/source/inc/SvxNotebookbarConfigPage.hxx @@ -60,7 +60,8 @@ public: SaveInData* CreateSaveInData(const css::uno::Reference<css::ui::XUIConfigurationManager>&, const css::uno::Reference<css::ui::XUIConfigurationManager>&, const OUString& aModuleId, bool docConfig) override; - static void FillFunctionsList(std::vector<NotebookbarEntries>& aEntries, + static void FillFunctionsList(xmlNodePtr pRootNodePtr, + std::vector<NotebookbarEntries>& aEntries, std::vector<CategoriesEntries>& aCategoryList, OUString& sActiveCategory); static void searchNodeandAttribute(std::vector<NotebookbarEntries>& aEntries, commit f8719f68f8c073c0ad473507b16fc4bd99e79baa Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Nov 27 13:01:46 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Nov 28 09:54:29 2019 +0100 get_active should be true when activated but menu not yet shown Change-Id: Ia2a7cbf5b47eab6d09c78eb9d18233e18b628a3f Reviewed-on: https://gerrit.libreoffice.org/83906 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx index 744ed69241f1..f22fe29a6166 100644 --- a/include/vcl/menubtn.hxx +++ b/include/vcl/menubtn.hxx @@ -38,6 +38,7 @@ private: OString msCurItemIdent; sal_uInt16 mnCurItemId; bool mbDelayMenu; + bool mbStartingMenu; Link<MenuButton*,void> maActivateHdl; Link<MenuButton*,void> maSelectHdl; @@ -62,7 +63,7 @@ public: virtual void Select(); void ExecuteMenu(); - bool MenuShown() const; + bool InPopupMode() const; void CancelMenu(); //if false then the whole button launches the menu diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 30ac908a128c..bf704c2e6026 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -2573,7 +2573,7 @@ public: virtual bool get_active() const override { - return m_xMenuButton->MenuShown(); + return m_xMenuButton->InPopupMode(); } virtual void set_inconsistent(bool /*inconsistent*/) override diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx index dce93cd4c35d..2737d153d715 100644 --- a/vcl/source/control/menubtn.cxx +++ b/vcl/source/control/menubtn.cxx @@ -36,10 +36,15 @@ void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) void MenuButton::ExecuteMenu() { + mbStartingMenu = true; + Activate(); if (!mpMenu && !mpFloatingWindow) + { + mbStartingMenu = false; return; + } Size aSize = GetSizePixel(); SetPressed( true ); @@ -69,6 +74,9 @@ void MenuButton::ExecuteMenu() vcl::Window::GetDockingManager()->StartPopupMode(mpFloatingWindow, aRect, nFlags); } } + + mbStartingMenu = false; + SetPressed(false); if (mnCurItemId) { @@ -96,8 +104,11 @@ void MenuButton::CancelMenu() } } -bool MenuButton::MenuShown() const +bool MenuButton::InPopupMode() const { + if (mbStartingMenu) + return true; + if (!mpMenu && !mpFloatingWindow) return false; @@ -116,6 +127,7 @@ MenuButton::MenuButton( vcl::Window* pParent, WinBits nWinBits ) : PushButton(WindowType::MENUBUTTON) , mnCurItemId(0) , mbDelayMenu(false) + , mbStartingMenu(false) { mnDDStyle = PushButtonDropdownStyle::MenuButton; ImplInit(pParent, nWinBits); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits