sc/qa/unit/tiledrendering/data/autofilter.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 20 ++++++++++++++++++++ sc/source/ui/inc/gridwin.hxx | 1 + sc/source/ui/view/gridwin.cxx | 18 ++++++++++++++++++ 4 files changed, 39 insertions(+)
New commits: commit 74780936283c3969f1f141b3a179c743ec84a56e Author: Gökay Şatır <gokaysa...@gmail.com> AuthorDate: Thu Jul 10 14:52:37 2025 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Sep 9 12:47:46 2025 +0200 Calc LOK: Needs to send the autofilter position to Online side. Issue: JSDialogs are not sending the position of the popup windows. To precisely position the popup window on the Online side, we need to have the column and row number of the autofilter button. This improvement sends the column and row indexes. Also a test added. Signed-off-by: Gökay Şatır <gokaysa...@gmail.com> Change-Id: I8afaf81595be4e666375699b1efc4efd9b138a17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187634 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Gökay ŞATIR <gokaysa...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190674 Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/sc/qa/unit/tiledrendering/data/autofilter.ods b/sc/qa/unit/tiledrendering/data/autofilter.ods new file mode 100644 index 000000000000..a4ad405fdcc2 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/autofilter.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index d8faaca18469..c56231406c8a 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -4091,6 +4091,26 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testFreezeRowOrColumn) CPPUNIT_ASSERT_EQUAL(std::string("8"), index); } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testAutoFilterPosition) +{ + ScModelObj* pModelObj = createDoc("autofilter.ods"); + ViewCallback aView; + pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); + ScTabViewShell* pView = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()); + + pView->SetCursor(0, 0); // Go to A1. + Scheduler::ProcessEventsToIdle(); + + // Use autofilter button shortcut (ALT + DOWNARROW) to avoid coordinate based click. + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN | KEY_MOD2); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN | KEY_MOD2); + Scheduler::ProcessEventsToIdle(); + + // We should have the autofilter position callback. + auto it = aView.m_aStateChanges.find("AutoFilterInfo"); + CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index bbaba1d1a201..6109f0eef341 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -229,6 +229,7 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::DocWindow, public DropTarget bool DoPageFieldSelection( SCCOL nCol, SCROW nRow ); bool DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt ); + void SendAutofilterPopupPosition(SCCOL nCol, SCROW nRow); void DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt, bool bButton, bool bPopup, bool bMultiField ); void DoPushPivotToggle( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 8419806e2aab..bda7836aacfc 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -145,6 +145,7 @@ #include <sfx2/lokhelper.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <tools/json_writer.hxx> #include <vector> #include <boost/property_tree/json_parser.hpp> @@ -936,6 +937,22 @@ void collectUIInformation(const OUString& aRow, const OUString& aCol , const OUS } +void ScGridWindow::SendAutofilterPopupPosition(SCCOL nCol, SCROW nRow) { + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); + if (pViewShell) + { + tools::JsonWriter writer; + writer.put("commandName", "AutoFilterInfo"); + { + const auto aState = writer.startNode("state"); + writer.put("column", nCol); + writer.put("row", nRow); + } + OString info = writer.finishAndGetAsOString(); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, info); + } +} + void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) { SCTAB nTab = mrViewData.GetTabNo(); @@ -1007,6 +1024,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) aPos.setY(aPos.getY() / fZoomY); nSizeX = nSizeX / fZoomX; nSizeY = nSizeY / fZoomY; + SendAutofilterPopupPosition(nCol, nRow); // Send the position of the autofilter popup. } tools::Rectangle aCellRect(bLOKActive ? aPos : OutputToScreenPixel(aPos), Size(nSizeX, nSizeY));