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 116eee2a007be89952f469210ee826835efe8f07 Author: Gökay Şatır <gokaysa...@gmail.com> AuthorDate: Fri Aug 15 13:25:36 2025 +0300 Commit: Gökay ŞATIR <gokaysa...@gmail.com> CommitDate: Thu Sep 11 20:06:06 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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190802 Reviewed-by: Gökay ŞATIR <gokaysa...@collabora.com> Tested-by: Jenkins 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 7694bf22690f..df3035b55b77 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3635,6 +3635,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 519f55f57c28..5c07253e1de8 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; @@ -549,6 +552,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); }