lok: respect zoom in calc tile rendering of EditView

Issue was that when using 150% zoom in LOK and editing
some textbox inside Calc spreadsheet - we didn't see
content of it (but tiles were invalidated).
In other view we have seen textbox in correct place
if zoom was 100%.

To fix that we need to pass zoom factor and use it.

Change-Id: Ib1cf49af02d0637e09ce68c5c2c41ffb3014c701
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134288
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
Szymon Kłos 2022-05-13 17:06:19 +02:00 committed by Henry Castro
parent 8c5094dfb7
commit 7260b8724f

View file

@ -726,7 +726,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
// the same as editeng and drawinglayer), and get rid of all the
// SetMapMode's and other unnecessary fun we have with pixels
// See also ScGridWindow::GetDrawMapMode() for the rest of this hack
aDrawMode.SetOrigin(PixelToLogic(Point(nScrX, nScrY), aDrawMode));
aDrawMode.SetOrigin(PixelToLogic(Point(tools::Long(nScrX / aOutputData.aZoomX),
tools::Long(nScrY / aOutputData.aZoomY)), aDrawMode));
}
tools::Rectangle aDrawingRectLogic;
bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
@ -1027,6 +1028,9 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
if (bIsTiledRendering)
{
const double fZoomX = static_cast<double>(aOutputData.aZoomX);
const double fZoomY = static_cast<double>(aOutputData.aZoomY);
Point aOrigin = aOriginalMode.GetOrigin();
if (bLayoutRTL)
aOrigin.setX(-aOrigin.getX() / TWIPS_PER_PIXEL + aOutputData.nScrX + aOutputData.GetScrW());
@ -1034,9 +1038,10 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + aOutputData.nScrX);
aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + aOutputData.nScrY);
const double twipFactor = 15 * 1.76388889; // 26.45833335
aOrigin = Point(aOrigin.getX() * twipFactor,
aOrigin.getY() * twipFactor);
aOrigin = Point(aOrigin.getX() * twipFactor / fZoomX,
aOrigin.getY() * twipFactor / fZoomY);
MapMode aNew = rDevice.GetMapMode();
aNew.SetOrigin(aOrigin);
rDevice.SetMapMode(aNew);
@ -1558,7 +1563,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
-nTopLeftTileRowOffset,
nTopLeftTileCol, nTopLeftTileRow,
nBottomRightTileCol, nBottomRightTileRow,
fPPTX, fPPTY, nullptr, nullptr);
fPPTX, fPPTY, &aFracX, &aFracY);
// setup the SdrPage so that drawinglayer works correctly
ScDrawLayer* pModel = rDoc.GetDrawLayer();