sc/qa/unit/tiledrendering/data/pivotTableFilter.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 20 +++++++++++++++++++ sc/source/ui/view/gridwin2.cxx | 21 ++++++++++++++++++++ 3 files changed, 41 insertions(+)
New commits: commit ed6121fb85f0069691056ff3de13cee05c75fa10 Author: Gökay Şatır <[email protected]> AuthorDate: Fri Aug 15 13:25:36 2025 +0300 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Sep 10 08:38:14 2025 +0200 Calc LOK: Needs to send the pivot table filter 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 filter button. This improvement sends the column and row indexes. Also a test added. Signed-off-by: Gökay Şatır <[email protected]> Change-Id: Ib1a47dac3081baf1e241826ff522973f2c01ac0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189674 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190730 diff --git a/sc/qa/unit/tiledrendering/data/pivotTableFilter.ods b/sc/qa/unit/tiledrendering/data/pivotTableFilter.ods new file mode 100644 index 000000000000..401b957338e2 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/pivotTableFilter.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index c56231406c8a..ed8361678f77 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -4111,6 +4111,26 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testAutoFilterPosition) CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPivotFilterPosition) +{ + ScModelObj* pModelObj = createDoc("pivotTableFilter.ods"); + ViewCallback aView; + pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); + ScTabViewShell* pView = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()); + + pView->SetCursor(1, 0); // Go to B1. + Scheduler::ProcessEventsToIdle(); + + // Use filter 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("PivotTableFilterInfo"); + CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index 01f5f39dd7d3..8602eebb1465 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -48,6 +48,9 @@ #include <memory> #include <vector> +#include <tools/json_writer.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> + using namespace css; using namespace css::sheet; using css::sheet::DataPilotFieldOrientation; @@ -551,6 +554,24 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScreenPosition, const Si DataPilotFieldOrientation nOrient; tools::Long nDimIndex = pDPObject->GetHeaderDim(rAddress, nOrient); + if (comphelper::LibreOfficeKit::isActive()) + { + // We send the cell position of the filter button to Online side. So the position of the popup can be adjusted near to the cell. + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); + if (pViewShell) + { + tools::JsonWriter writer; + writer.put("commandName", "PivotTableFilterInfo"); + { + const auto aState = writer.startNode("state"); + writer.put("column", rAddress.Col()); + writer.put("row", rAddress.Row()); + } + OString info = writer.finishAndGetAsOString(); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, info); + } + } + DPLaunchFieldPopupMenu(rScreenPosition, rScreenSize, nDimIndex, pDPObject); }
