summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-04-26 10:43:11 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-05-13 12:14:18 +0200
commit34c89bced5c0289e3c98f0e603717a4f6c4cea80 (patch)
tree32d6f8f76d29f5182fb67b4fbd80811c87d7733d /sc
parent93e031dced1ea68c4bbd93cceb9e31ba9e0b3a3f (diff)
lok: add rendering and input for form controls in Calc
Until now the form controls were nto rendered to a tile when drawing tiles for LOKit usage (online). This change adds LokControlHandler that is responsible for rendering of the form controls on the tiles (currently implemented only for Calc) and handles mouse input events that come through LOKit. Change-Id: Ifcecc9a320a7836b76b0a10771b06c15339baed2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114909 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115510 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx30
1 files changed, 25 insertions, 5 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 5906c85ef498..c2250243b344 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -81,6 +81,7 @@
#endif
#include <sfx2/lokhelper.hxx>
#include <sfx2/lokcharthelper.hxx>
+#include <sfx2/LokControlHandler.hxx>
#include <cellsuno.hxx>
#include <columnspanset.hxx>
@@ -568,6 +569,14 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
LokChartHelper::PaintAllChartsOnTile(rDevice, nOutputWidth, nOutputHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+
+ // Draw Form controls
+ ScDrawLayer* pDrawLayer = pDocShell->GetDocument().GetDrawLayer();
+ SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(pViewData->GetTabNo()));
+ SdrView* pDrawView = pViewData->GetViewShell()->GetScDrawView();
+ tools::Rectangle aTileRect(Point(nTilePosX, nTilePosY), Size(nTileWidth, nTileHeight));
+ Size aOutputSize(nOutputWidth, nOutputHeight);
+ LokControlHandler::paintControlTile(pPage, pDrawView, *pGridWindow, rDevice, aOutputSize, aTileRect);
}
void ScModelObj::setPart( int nPart, bool /*bAllowChangeFocus*/ )
@@ -720,22 +729,33 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt
if (aChartHelper.postMouseEvent(nType, nX, nY,
nCount, nButtons, nModifier,
pViewData->GetPPTX(), pViewData->GetPPTY()))
+ {
return;
+ }
+
+ Point aPointTwip(nX, nY);
// check if the user hit a chart which is being edited by someone else
// and, if so, skip current mouse event
if (nType != LOK_MOUSEEVENT_MOUSEMOVE)
{
- if (LokChartHelper::HitAny(Point(nX, nY)))
+ if (LokChartHelper::HitAny(aPointTwip))
return;
}
- // Calc operates in pixels...
- const Point aPos(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY());
+ // Check if a control is hit
+ Point aPointHMM = LokControlHandler::convertTwipToMm100(aPointTwip);
+ ScDrawLayer* pDrawLayer = pDocShell->GetDocument().GetDrawLayer();
+ SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(pViewData->GetTabNo()));
+ SdrView* pDrawView = pViewData->GetViewShell()->GetScDrawView();
+ if (LokControlHandler::postMouseEvent(pPage, pDrawView, *pGridWindow, nType, aPointHMM, nCount, nButtons, nModifier))
+ return;
- LokMouseEventData aMouseEventData(nType, aPos, nCount, MouseEventModifiers::SIMPLECLICK,
+ // Calc operates in pixels...
+ const Point aPosition(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY());
+ LokMouseEventData aMouseEventData(nType, aPosition, nCount, MouseEventModifiers::SIMPLECLICK,
nButtons, nModifier);
- aMouseEventData.maLogicPosition = Point(convertTwipToMm100(nX), convertTwipToMm100(nY));
+ aMouseEventData.maLogicPosition = aPointHMM;
SfxLokHelper::postMouseEventAsync(pGridWindow, aMouseEventData);
}