Kaydet (Commit) a1605d68 authored tarafından Jan Holesovsky's avatar Jan Holesovsky Kaydeden (comit) Miklos Vajna

sc tiled editing: Use the LogicMapMode even for mouse positions.

Instead of using whatever MapMode value that was used the last time for
rendering the tile, set it to something predictable when counting the mouse
clicks (100% zoom), and use the value consistently in Calc via
GetDrawMapMode().

This fixes clicking the shapes in various zoom levels.

Change-Id: Idf83b560f57baab4dc79c45b2ff7c3d75653e102
üst 03ee2793
......@@ -540,6 +540,9 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount)
if (!pGridWindow)
return;
// update the aLogicMode in ScViewData to something predictable
pViewData->SetZoom(Fraction(1, 1), Fraction(1, 1), true);
// Calc operates in pixels...
MouseEvent aEvent(Point(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY()), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
......
......@@ -238,6 +238,16 @@ void ScGridWindow::DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pCo
MapMode ScGridWindow::GetDrawMapMode( bool bForce )
{
ScDocument* pDoc = pViewData->GetDocument();
// FIXME this shouldn't be necessary once we change the entire Calc to
// work in the logic coordinates (ideally 100ths of mm - so that it is
// the same as editeng and drawinglayer), and get rid of all the
// SetMapMode's and other unneccessary fun we have with pixels
if (pDoc->GetDrawLayer()->isTiledRendering())
{
return pViewData->GetLogicMode();
}
SCTAB nTab = pViewData->GetTabNo();
bool bNegativePage = pDoc->IsNegativePage( nTab );
......
......@@ -595,10 +595,11 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
MapMode aDrawMode = GetDrawMapMode();
if (bIsTiledRendering)
{
// FIXME this shouldn't be necessary once we change this to work in the
// logic coordinates instead of in pixels (and get rid of all the
// SetMapMode()'s)
aDrawMode = pViewData->GetLogicMode(eWhich);
// FIXME this shouldn't be necessary once we change the entire Calc to
// work in the logic coordinates (ideally 100ths of mm - so that it is
// the same as editeng and drawinglayer), and get rid of all the
// SetMapMode's and other unneccessary fun we have with pixels
// See also ScGridWindow::GetDrawMapMode() for the rest of this hack
aDrawMode.SetOrigin(PixelToLogic(Point(nScrX, nScrY), aDrawMode));
}
Rectangle aDrawingRectLogic;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment