include/vcl/jsdialog/executor.hxx | 2 + sc/source/ui/cctrl/checklistmenu.cxx | 36 +++++++++++++++++++++++++++++++++-- sc/source/ui/view/gridwin2.cxx | 8 ++++++- vcl/jsdialog/executor.cxx | 1 4 files changed, 44 insertions(+), 3 deletions(-)
New commits: commit 73827caacedd2ddf8583ac2c4090c7f6ac05f67b Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Nov 20 12:23:45 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Dec 1 13:48:28 2020 +0100 autofilter: fix submenu popup for online Change-Id: If48428f99b921d3c6f9927c612e6ade81b980678 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106968 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx index 5dde733a3823..038b86b30f64 100644 --- a/include/vcl/jsdialog/executor.hxx +++ b/include/vcl/jsdialog/executor.hxx @@ -29,6 +29,8 @@ public: rTreeView.signal_row_activated(); } + static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); } + static void trigger_clicked(weld::Toolbar& rToolbar, const OString& rIdent) { rToolbar.signal_clicked(rIdent); diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 0df3819e686c..deeb987ee806 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -34,6 +34,8 @@ #include <unotools/charclass.hxx> #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <sfx2/viewsh.hxx> +#include <vcl/jsdialog/executor.hxx> #include <document.hxx> @@ -169,8 +171,14 @@ ScCheckListMenuWindow* ScCheckListMenuControl::addSubMenuItem(const OUString& rT MenuItemData aItem; aItem.mbEnabled = bEnabled; vcl::Window *pContainer = mxFrame->GetWindow(GetWindowType::FirstChild); + + vcl::ILibreOfficeKitNotifier* pNotifier = nullptr; + if (comphelper::LibreOfficeKit::isActive()) + pNotifier = SfxViewShell::Current(); + aItem.mxSubMenuWin.reset(VclPtr<ScCheckListMenuWindow>::Create(pContainer, mpDoc, false, - false, -1, mxFrame.get())); + false, -1, mxFrame.get(), + pNotifier)); maMenuItems.emplace_back(std::move(aItem)); mxMenu->append_text(rText); @@ -287,6 +295,16 @@ void ScCheckListMenuControl::launchSubMenu(bool bSetMenuPos) mxMenu->select(*mxScratchIter); rSubMenuControl.GrabFocus(); + + // TODO: something better to retrigger JSON dialog invalidation + if (comphelper::LibreOfficeKit::isActive()) + { + StringMap args; + args["cmd"] = "change"; + args["type"] = "checkbox"; + args["data"] = "true"; + jsdialog::ExecuteAction(pSubMenu->GetLOKWindowId(), "toggle_all", args); + } } IMPL_LINK_NOARG(ScCheckListMenuControl, PostPopdownHdl, void*, void) @@ -515,6 +533,8 @@ ScCheckListMenuControl::ScCheckListMenuControl(ScCheckListMenuWindow* pParent, v mxMenu->connect_size_allocate(LINK(this, ScCheckListMenuControl, TreeSizeAllocHdl)); } + long nContainerHeight = mxContainer->get_preferred_size().Height() + nDiffHeight; + if (!bIsSubMenu) { // determine what width the checklist will end up with @@ -524,9 +544,21 @@ ScCheckListMenuControl::ScCheckListMenuControl(ScCheckListMenuWindow* pParent, v mxTreeChecks->set_size_request(mnCheckWidthReq, nChecksHeight); mxListChecks->set_size_request(mnCheckWidthReq, nChecksHeight); } + else + { + long nMenuWidth = mxMenu->get_preferred_size().Width(); + long nMenuHeight = mxMenu->get_preferred_size().Height(); + + if (nMenuWidth < 200) + nMenuWidth = 200; + if (nMenuHeight < nContainerHeight * 90 / 100) + nMenuHeight = nContainerHeight * 90 / 100; + + mxMenu->set_size_request(nMenuWidth, nMenuHeight); + } mxContainer->set_size_request(mxContainer->get_preferred_size().Width(), - mxContainer->get_preferred_size().Height() + nDiffHeight); + nContainerHeight); } IMPL_LINK_NOARG(ScCheckListMenuControl, FocusHdl, weld::Widget&, void) diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index bfd4eec09a0e..490efe5531be 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -467,8 +467,14 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScr const ScDPLabelData& rLabelData = pDPData->maLabels; mpDPFieldPopup.disposeAndClear(); + + vcl::ILibreOfficeKitNotifier* pNotifier = nullptr; + if (comphelper::LibreOfficeKit::isActive()) + pNotifier = SfxViewShell::Current(); + mpDPFieldPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, pViewData->GetDocument(), - bDimOrientNotPage, false)); + bDimOrientNotPage, false, -1, + nullptr, pNotifier)); ScCheckListMenuControl& rControl = mpDPFieldPopup->get_widget(); rControl.setExtendedData(std::move(pDPData)); diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 813b9d4b00a9..e71990f3c078 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -204,6 +204,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat int nRow = std::atoi(nRowString.getStr()); pTreeView->select(nRow); + LOKTrigger::trigger_changed(*pTreeView); LOKTrigger::trigger_row_activated(*pTreeView); return true; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits