summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-04-04 11:30:33 +0200
committerAndras Timar <andras.timar@collabora.com>2022-04-11 11:14:18 +0200
commit479e379f7178444d69b4bb5090d8da25f090e061 (patch)
treeed1eafc1e17ac8d7ce3652475eb28da4609aa220
parentba72264d8f17d116186b797b12512b45e788e99f (diff)
jsdialog: reenable after welding, unify with dialogs
Change-Id: I4a589f68fcdaa1c62ac08bd6075071d0fed0b28b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132538 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx4
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx5
-rw-r--r--vcl/jsdialog/enabled.cxx5
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx78
-rw-r--r--vcl/source/window/builder.cxx6
5 files changed, 27 insertions, 71 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 1a834a7aaccc..f6778e32f85c 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -321,10 +321,6 @@ void ScCheckListMenuControl::launchSubMenu()
mxMenu->select(*mxScratchIter);
pSubMenu->GrabFocus();
-
- // TODO: still needed?
- //if (comphelper::LibreOfficeKit::isActive())
- // jsdialog::SendFullUpdate(std::to_string(pSubMenu->GetLOKWindowId()), "toggle_all");
}
IMPL_LINK_NOARG(ScCheckListMenuControl, PostPopdownHdl, void*, void)
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index db010df11d21..077e49235168 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -243,8 +243,6 @@ public:
JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
const css::uno::Reference<css::frame::XFrame>& rFrame,
sal_uInt64 nWindowId = 0);
- /// for autofilter dropdown
- JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile);
static std::unique_ptr<JSInstanceBuilder>
CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile);
@@ -252,9 +250,6 @@ public:
CreateNotebookbarBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
const css::uno::Reference<css::frame::XFrame>& rFrame,
sal_uInt64 nWindowId = 0);
- static std::unique_ptr<JSInstanceBuilder>
- CreateAutofilterWindowBuilder(vcl::Window* pParent, const OUString& rUIRoot,
- const OUString& rUIFile);
static std::unique_ptr<JSInstanceBuilder> CreateSidebarBuilder(weld::Widget* pParent,
const OUString& rUIRoot,
const OUString& rUIFile,
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 99e20b17bb71..ddd7e3ce9ba0 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -90,8 +90,9 @@ bool isBuilderEnabledForPopup(std::u16string_view rUIFile)
|| rUIFile == u"svx/ui/floatinglineend.ui"
|| rUIFile == u"svx/ui/fontworkalignmentcontrol.ui"
|| rUIFile == u"svx/ui/fontworkcharacterspacingcontrol.ui"
- || rUIFile == u"svx/ui/floatingareastyle.ui"
- || rUIFile == u"modules/scalc/ui/filterlist.ui")
+ || rUIFile == u"svx/ui/floatingareastyle.ui" || rUIFile == u"modules/scalc/ui/filterlist.ui"
+ || rUIFile == u"modules/scalc/ui/filterdropdown.ui"
+ || rUIFile == u"modules/scalc/ui/filtersubdropdown.ui")
return true;
return false;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 7ca9cceb16c9..1891e7f72c8e 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -137,26 +137,6 @@ std::unique_ptr<tools::JsonWriter> JSDialogNotifyIdle::generateFullUpdate() cons
aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
aJsonWriter->put("jsontype", m_sTypeOfJSON);
- if (m_sTypeOfJSON == "autofilter")
- {
- vcl::Window* pWindow = m_aContentWindow.get();
- DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow);
- while (pWindow && !pDockingWindow)
- {
- pWindow = pWindow->GetParent();
- pDockingWindow = dynamic_cast<DockingWindow*>(pWindow);
- }
-
- if (pDockingWindow)
- {
- Point aPos = pDockingWindow->GetFloatingPos();
- aJsonWriter->put("posx", aPos.getX());
- aJsonWriter->put("posy", aPos.getY());
- if (!pDockingWindow->IsVisible())
- aJsonWriter->put("visible", "false");
- }
- }
-
return aJsonWriter;
}
@@ -231,7 +211,27 @@ JSDialogNotifyIdle::generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString s
}
}
- aJsonWriter->put("jsontype", "dialog");
+ if (m_sTypeOfJSON == "autofilter")
+ {
+ vcl::Window* pVclWindow = pWindow.get();
+ DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pVclWindow);
+ while (pVclWindow && !pDockingWindow)
+ {
+ pVclWindow = pVclWindow->GetParent();
+ pDockingWindow = dynamic_cast<DockingWindow*>(pVclWindow);
+ }
+
+ if (pDockingWindow)
+ {
+ Point aPos = pDockingWindow->GetFloatingPos();
+ aJsonWriter->put("posx", aPos.getX());
+ aJsonWriter->put("posy", aPos.getY());
+ if (!pDockingWindow->IsVisible())
+ aJsonWriter->put("visible", "false");
+ }
+ }
+
+ aJsonWriter->put("jsontype", (m_sTypeOfJSON == "autofilter") ? "autofilter" : "dialog");
aJsonWriter->put("type", "modalpopup");
aJsonWriter->put("cancellable", true);
aJsonWriter->put("popupParent", sParentId);
@@ -500,6 +500,9 @@ 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;
@@ -588,32 +591,6 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
}
-// used for autofilter dropdown
-JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot,
- const OUString& rUIFile)
- : SalInstanceBuilder(pParent, rUIRoot, rUIFile)
- , m_nWindowId(0)
- , m_aParentDialog(nullptr)
- , m_aContentWindow(nullptr)
- , m_sTypeOfJSON("autofilter")
- , m_bHasTopLevelDialog(false)
- , m_bIsNotebookbar(false)
- , m_aWindowToRelease(nullptr)
-{
- vcl::Window* pRoot = m_xBuilder->get_widget_root();
- m_aContentWindow = pParent;
- if (pRoot && pRoot->GetParent())
- {
- m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
- if (m_aParentDialog)
- m_nWindowId = m_aParentDialog->GetLOKWindowId();
- InsertWindowToMap(getMapIdFromWindowId());
- }
-
- initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
- sendFullUpdate();
-}
-
std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateDialogBuilder(weld::Widget* pParent,
const OUString& rUIRoot,
const OUString& rUIFile)
@@ -628,13 +605,6 @@ std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateNotebookbarBuilder(
return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, rFrame, nWindowId);
}
-std::unique_ptr<JSInstanceBuilder>
-JSInstanceBuilder::CreateAutofilterWindowBuilder(vcl::Window* pParent, const OUString& rUIRoot,
- const OUString& rUIFile)
-{
- return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile);
-}
-
std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateSidebarBuilder(weld::Widget* pParent,
const OUString& rUIRoot,
const OUString& rUIFile,
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 5aa38a038ea8..12c602160709 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -197,13 +197,7 @@ std::unique_ptr<weld::Builder> Application::CreateInterimBuilder(vcl::Window* pP
{
// Notebookbar sub controls
if (comphelper::LibreOfficeKit::isActive() && jsdialog::isInterimBuilderEnabledForNotebookbar(rUIFile))
- {
return JSInstanceBuilder::CreateNotebookbarBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile, css::uno::Reference<css::frame::XFrame>(), nLOKWindowId);
- }
- else if (comphelper::LibreOfficeKit::isActive() && (rUIFile == "modules/scalc/ui/filterdropdown.ui"))
- {
- return JSInstanceBuilder::CreateAutofilterWindowBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile);
- }
return ImplGetSVData()->mpDefInst->CreateInterimBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile, bAllowCycleFocusOut, nLOKWindowId);
}