sc/source/ui/cctrl/checklistmenu.cxx |   46 ++---------------------------------
 sc/source/ui/inc/checklistmenu.hxx   |   10 +------
 sc/source/ui/view/gridwin.cxx        |    6 ----
 sc/source/ui/view/gridwin2.cxx       |    6 ----
 vcl/jsdialog/jsdialogbuilder.cxx     |    7 +----
 5 files changed, 9 insertions(+), 66 deletions(-)

New commits:
commit 02c9687b0792a568897f911a0f8d6e1582fdbe6a
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Apr 4 23:27:01 2022 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Apr 15 11:26:16 2022 +0200

    jsdialog: autofilter: unify with regular popup
    
    - remove special type "autofilter"
    - now autofilter will be handled by dialog code in online
    
    Change-Id: I3478c3e05ab2e83030a8d68632d0426a5cc0accd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132539
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mert Tumer <mert.tu...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132916
    Tested-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index b1e2f5ca1644..833857614e72 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -182,7 +182,7 @@ ScListSubMenuControl* 
ScCheckListMenuControl::addSubMenuItem(const OUString& rTe
     MenuItemData aItem;
     aItem.mbEnabled = bEnabled;
 
-    aItem.mxSubMenuWin.reset(new ScListSubMenuControl(mxMenu.get(), *this, 
bColorMenu, mpNotifier));
+    aItem.mxSubMenuWin.reset(new ScListSubMenuControl(mxMenu.get(), *this, 
bColorMenu));
     maMenuItems.emplace_back(std::move(aItem));
 
     mxMenu->show();
@@ -439,9 +439,6 @@ void ScCheckListMenuControl::StartPopupMode(weld::Widget* 
pParent, const tools::
 
 void ScCheckListMenuControl::terminateAllPopupMenus()
 {
-    if (comphelper::LibreOfficeKit::isActive())
-        NotifyCloseLOK();
-
     EndPopupMode();
 }
 
@@ -468,7 +465,7 @@ constexpr int nCheckListVisibleRows = 9;
 constexpr int nColorListVisibleRows = 9;
 
 ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, 
ScViewData& rViewData,
-                                               bool bHasDates, int nWidth, 
vcl::ILibreOfficeKitNotifier* pNotifier)
+                                               bool bHasDates, int nWidth)
     : mxBuilder(Application::CreateBuilder(pParent, 
"modules/scalc/ui/filterdropdown.ui"))
     , mxPopover(mxBuilder->weld_popover("FilterDropDown"))
     , mxContainer(mxBuilder->weld_container("container"))
@@ -495,7 +492,6 @@ 
ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScViewData
     , mrViewData(rViewData)
     , mnAsyncPostPopdownId(nullptr)
     , mnAsyncSetDropdownPosId(nullptr)
-    , mpNotifier(pNotifier)
     , mbHasDates(bHasDates)
     , mbIsPoppedUp(false)
     , maOpenTimer(this)
@@ -1439,27 +1435,11 @@ void ScCheckListMenuControl::launch(weld::Widget* 
pWidget, const tools::Rectangl
     StartPopupMode(pWidget, aRect);
 }
 
-void ScCheckListMenuControl::NotifyCloseLOK()
-{
-    if (mpNotifier)
-    {
-        tools::JsonWriter aJsonWriter;
-        aJsonWriter.put("jsontype", "autofilter");
-        aJsonWriter.put("action", "close");
-
-        const std::string message = aJsonWriter.extractAsStdString();
-        mpNotifier->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)
@@ -1490,9 +1470,6 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, PopupModeEndHdl, 
weld::Popover&, void)
         mxPopupEndAction->execute();
 
     DropPendingEvents();
-
-    if (comphelper::LibreOfficeKit::isActive())
-        NotifyCloseLOK();
 }
 
 int ScCheckListMenuControl::GetTextWidth(const OUString& rsName) const
@@ -1513,7 +1490,7 @@ int 
ScCheckListMenuControl::IncreaseWindowWidthToFitText(int nMaxTextWidth)
     return mnCheckWidthReq + nBorder;
 }
 
-ScListSubMenuControl::ScListSubMenuControl(weld::Widget* pParent, 
ScCheckListMenuControl& rParentControl, bool bColorMenu, 
vcl::ILibreOfficeKitNotifier* pNotifier)
+ScListSubMenuControl::ScListSubMenuControl(weld::Widget* pParent, 
ScCheckListMenuControl& rParentControl, bool bColorMenu)
     : mxBuilder(Application::CreateBuilder(pParent, 
"modules/scalc/ui/filtersubdropdown.ui"))
     , mxPopover(mxBuilder->weld_popover("FilterSubDropDown"))
     , mxContainer(mxBuilder->weld_container("container"))
@@ -1522,7 +1499,6 @@ ScListSubMenuControl::ScListSubMenuControl(weld::Widget* 
pParent, ScCheckListMen
     , mxTextColorMenu(mxBuilder->weld_tree_view("textcolor"))
     , mxScratchIter(mxMenu->make_iterator())
     , mrParentControl(rParentControl)
-    , mpNotifier(pNotifier)
     , mnBackColorMenuPrefHeight(-1)
     , mnTextColorMenuPrefHeight(-1)
     , mbColorMenu(bColorMenu)
@@ -1754,24 +1730,8 @@ void 
ScListSubMenuControl::setPopupStartAction(ScCheckListMenuControl::Action* p
 
 void ScListSubMenuControl::terminateAllPopupMenus()
 {
-    if (comphelper::LibreOfficeKit::isActive())
-        NotifyCloseLOK();
-
     EndPopupMode();
     mrParentControl.terminateAllPopupMenus();
 }
 
-void ScListSubMenuControl::NotifyCloseLOK()
-{
-    if (mpNotifier)
-    {
-        tools::JsonWriter aJsonWriter;
-        aJsonWriter.put("jsontype", "autofilter");
-        aJsonWriter.put("action", "close");
-
-        const std::string message = aJsonWriter.extractAsStdString();
-        mpNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, 
message.c_str());
-    }
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/checklistmenu.hxx 
b/sc/source/ui/inc/checklistmenu.hxx
index eaad396bee1a..5585bc3e846f 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -123,8 +123,7 @@ public:
     };
 
     ScCheckListMenuControl(weld::Widget* pParent, ScViewData& rViewData,
-                           bool bTreeMode, int nWidth,
-                           vcl::ILibreOfficeKitNotifier* pNotifier);
+                           bool bTreeMode, int nWidth);
     ~ScCheckListMenuControl();
 
     void addMenuItem(const OUString& rText, Action* pAction);
@@ -224,8 +223,6 @@ private:
 
     void CreateDropDown();
 
-    void NotifyCloseLOK();
-
     DECL_LINK(ButtonHdl, weld::Button&, void);
     DECL_LINK(TriStateHdl, weld::Toggleable&, void);
 
@@ -302,7 +299,6 @@ private:
 
     ImplSVEvent* mnAsyncPostPopdownId;
     ImplSVEvent* mnAsyncSetDropdownPosId;
-    vcl::ILibreOfficeKitNotifier* mpNotifier;
 
     bool mbHasDates;
     bool mbIsPoppedUp;
@@ -329,7 +325,7 @@ private:
 class ScListSubMenuControl final
 {
 public:
-    ScListSubMenuControl(weld::Widget* pParent, ScCheckListMenuControl& 
rParentControl, bool bColorMenu, vcl::ILibreOfficeKitNotifier* pNotifier);
+    ScListSubMenuControl(weld::Widget* pParent, ScCheckListMenuControl& 
rParentControl, bool bColorMenu);
 
     void setPopupStartAction(ScCheckListMenuControl::Action* p);
 
@@ -368,7 +364,6 @@ private:
     std::unique_ptr<ScCheckListMenuControl::Action> mxPopupStartAction;
     std::vector<ScCheckListMenuControl::MenuItemData> maMenuItems;
     ScCheckListMenuControl& mrParentControl;
-    vcl::ILibreOfficeKitNotifier* mpNotifier;
     int mnBackColorMenuPrefHeight;
     int mnTextColorMenuPrefHeight;
     bool mbColorMenu;
@@ -379,7 +374,6 @@ private:
 
     void SetupMenu(weld::TreeView& rMenu);
 
-    void NotifyCloseLOK();
     void executeMenuItem(ScCheckListMenuControl::Action* pAction);
     void addItem(ScCheckListMenuControl::Action* pAction);
 };
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 516c9ef16d50..0a5a8454c8ec 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -846,14 +846,10 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
     ScFilterEntries aFilterEntries;
     rDoc.GetFilterEntries(nCol, nRow, nTab, aFilterEntries);
 
-    vcl::ILibreOfficeKitNotifier* pNotifier = nullptr;
-    if (bLOKActive)
-        pNotifier = SfxViewShell::Current();
-
     weld::Window* pPopupParent = GetFrameWeld();
     int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(nCol, nTab), 
mrViewData.GetPPTX());
     mpAutoFilterPopup.reset(new ScCheckListMenuControl(pPopupParent, 
mrViewData,
-                                                       
aFilterEntries.mbHasDates, nColWidth, pNotifier));
+                                                       
aFilterEntries.mbHasDates, nColWidth));
 
     int nMaxTextWidth = 0;
     if (aFilterEntries.size() <= 10)
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 4e497e80d664..4c9e62ac3bc4 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -471,13 +471,9 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& 
rScrPos, const Size& rScr
 
     mpDPFieldPopup.reset();
 
-    vcl::ILibreOfficeKitNotifier* pNotifier = nullptr;
-    if (comphelper::LibreOfficeKit::isActive())
-        pNotifier = SfxViewShell::Current();
-
     weld::Window* pPopupParent = GetFrameWeld();
     mpDPFieldPopup.reset(new ScCheckListMenuControl(pPopupParent, mrViewData,
-                                                    false, -1, pNotifier));
+                                                    false, -1));
 
     mpDPFieldPopup->setExtendedData(std::move(pDPData));
     mpDPFieldPopup->setOKAction(new DPFieldPopupOKAction(this));
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 778b174bde21..056a986ccf1f 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -211,7 +211,7 @@ 
JSDialogNotifyIdle::generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString s
         }
     }
 
-    if (m_sTypeOfJSON == "autofilter")
+    // try to get the position eg. for the autofilter
     {
         vcl::Window* pVclWindow = pWindow.get();
         DockingWindow* pDockingWindow = 
dynamic_cast<DockingWindow*>(pVclWindow);
@@ -231,7 +231,7 @@ 
JSDialogNotifyIdle::generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString s
         }
     }
 
-    aJsonWriter->put("jsontype", (m_sTypeOfJSON == "autofilter") ? 
"autofilter" : "dialog");
+    aJsonWriter->put("jsontype", "dialog");
     aJsonWriter->put("type", "modalpopup");
     aJsonWriter->put("cancellable", true);
     aJsonWriter->put("popupParent", sParentId);
@@ -497,9 +497,6 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, 
const OUString& rUIR
     , m_bIsNotebookbar(false)
     , m_aWindowToRelease(nullptr)
 {
-    if (rUIFile == "modules/scalc/ui/filterdropdown.ui")
-        m_sTypeOfJSON = "autofilter";
-
     // when it is a popup we initialize sender in weld_popover
     if (bPopup)
         return;

Reply via email to