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 c3abc07be23cd26f25e9f576eb0e5979ccdc5854 Author: Gökay Şatır <gokaysa...@gmail.com> AuthorDate: Fri Aug 15 13:25:36 2025 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Aug 15 14:15:03 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 <gokaysa...@gmail.com> Change-Id: Ib1a47dac3081baf1e241826ff522973f2c01ac0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189674 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> 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 5c6a5dac0e7a..95f01579deec 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3616,6 +3616,26 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testAutoFilterPosition) CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPivotFilterPosition) +{ + ScModelObj* pModelObj = createDoc("pivotTableFilter.ods"); + ScTestViewCallback 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 5b85d3c66fd5..fb62160db353 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); }