summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-11-20 12:23:45 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2020-12-01 13:48:28 +0100
commit73827caacedd2ddf8583ac2c4090c7f6ac05f67b (patch)
treed7983dbc2bb77543fd77c0fc2eac84c30df72c81 /sc
parent411034066510d21a960adced5c6f0f14638da972 (diff)
autofilter: fix submenu popup for online
Change-Id: If48428f99b921d3c6f9927c612e6ade81b980678 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106968 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx36
-rw-r--r--sc/source/ui/view/gridwin2.cxx8
2 files changed, 41 insertions, 3 deletions
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));