sc/source/ui/cctrl/checklistmenu.cxx | 26 ++++++++++++++++++++++++++ sc/source/ui/inc/checklistmenu.hxx | 2 ++ vcl/inc/jsdialog/jsdialogbuilder.hxx | 1 + vcl/jsdialog/jsdialogbuilder.cxx | 12 ++++++++++++ 4 files changed, 41 insertions(+)
New commits: commit 6988343aa44506e9b1d34af0d72c2301a108d955 Author: Szymon Kłos <[email protected]> AuthorDate: Tue Nov 3 13:27:47 2020 +0100 Commit: Szymon Kłos <[email protected]> CommitDate: Thu Nov 26 09:19:19 2020 +0100 jsdialog: cleanup when destroying builder Change-Id: I38bf65eb96b560970fb03eafaea89446e89a2896 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106591 Tested-by: Jenkins Reviewed-by: Szymon Kłos <[email protected]> diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 8c379857e4b3..5d7df8086ae4 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -64,6 +64,7 @@ class JSInstanceBuilder : public SalInstanceBuilder /// used in case of tab pages where dialog is not a direct top level VclPtr<vcl::Window> m_aParentDialog; VclPtr<vcl::Window> m_aContentWindow; + std::list<std::string> m_aRememberedWidgets; std::string m_sTypeOfJSON; bool m_bHasTopLevelDialog; bool m_bIsNotebookbar; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index f2bc205d8b88..1ad0f6e73e90 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -190,7 +190,18 @@ JSInstanceBuilder* JSInstanceBuilder::CreateAutofilterWindowBuilder(vcl::Window* JSInstanceBuilder::~JSInstanceBuilder() { if (m_nWindowId && (m_bHasTopLevelDialog || m_bIsNotebookbar)) + { GetLOKWeldWidgetsMap().erase(m_nWindowId); + } + else + { + auto it = GetLOKWeldWidgetsMap().find(m_nWindowId); + if (it != GetLOKWeldWidgetsMap().end()) + { + std::for_each(m_aRememberedWidgets.begin(), m_aRememberedWidgets.end(), + [it](std::string& sId) { it->second.erase(sId.c_str()); }); + } + } } std::map<sal_uInt64, WidgetMap>& JSInstanceBuilder::GetLOKWeldWidgetsMap() @@ -230,6 +241,7 @@ void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget) { it->second.erase(id); it->second.insert(WidgetMap::value_type(id, pWidget)); + m_aRememberedWidgets.push_back(id.getStr()); } } commit 38ec70f2b391594ddb62717d8a3d8fe1ada4bdf3 Author: Szymon Kłos <[email protected]> AuthorDate: Wed Nov 4 11:37:15 2020 +0100 Commit: Szymon Kłos <[email protected]> CommitDate: Thu Nov 26 09:19:02 2020 +0100 jsdialog: notify about autofilter dropdown close Change-Id: If6eb585f04f2d7441a7950bbdca378cc92ba641b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106592 Tested-by: Jenkins Reviewed-by: Szymon Kłos <[email protected]> diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 42ec6f3e711e..1c06b33c59c0 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -32,6 +32,9 @@ #include <rtl/math.hxx> #include <tools/wintypes.hxx> #include <unotools/charclass.hxx> +#include <comphelper/lok.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <tools/json_writer.hxx> #include <document.hxx> @@ -1372,11 +1375,31 @@ void ScCheckListMenuControl::launch(const tools::Rectangle& rRect) StartPopupMode(aRect, FloatWinPopupFlags::Down); } +void ScCheckListMenuControl::NotifyCloseLOK() +{ + VclPtr<vcl::Window> aNotifierWindow = mxFrame->GetParentWithLOKNotifier(); + if (aNotifierWindow) { + const vcl::ILibreOfficeKitNotifier* pNotifier = aNotifierWindow->GetLOKNotifier(); + if (pNotifier) + { + tools::JsonWriter aJsonWriter; + aJsonWriter.put("jsontype", "dockingwindow"); + aJsonWriter.put("action", "close"); + + const std::string message = aJsonWriter.extractAsStdString(); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); + } + } +} + void ScCheckListMenuControl::close(bool bOK) { if (bOK && mxOKAction) mxOKAction->execute(); EndPopupMode(); + + if (comphelper::LibreOfficeKit::isActive()) + NotifyCloseLOK(); } void ScCheckListMenuControl::setExtendedData(std::unique_ptr<ExtendedData> p) @@ -1404,6 +1427,9 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, PopupModeEndHdl, FloatingWindow*, void) clearSelectedMenuItem(); if (mxPopupEndAction) mxPopupEndAction->execute(); + + if (comphelper::LibreOfficeKit::isActive()) + NotifyCloseLOK(); } int ScCheckListMenuControl::GetTextWidth(const OUString& rsName) const diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index 7e54f218cb13..b4f7c9c2a8b4 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -209,6 +209,8 @@ private: void CreateDropDown(); + void NotifyCloseLOK(); + DECL_LINK(ButtonHdl, weld::Button&, void); DECL_LINK(TriStateHdl, weld::ToggleButton&, void); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
