sc/source/ui/unoobj/docuno.cxx | 3 +++ sc/source/ui/view/gridwin3.cxx | 10 ++++++++++ sc/source/ui/view/gridwin4.cxx | 11 ++++++----- sc/source/ui/view/viewdata.cxx | 40 +++++++++++++++------------------------- 4 files changed, 34 insertions(+), 30 deletions(-)
New commits: commit 94f24258fb52ed61c57fe52408d32fbd37008bee Author: Jan Holesovsky <[email protected]> Date: Thu Apr 2 13:43:47 2015 +0200 sc: Don't limit the zoom to some funny numbers. Instead just assert if we get something really really wrong there - and let's fix the root cause. The limits come already from the initial check-in of the OOo code, so maybe the reason why it was there in the first place is long gone anyway. Change-Id: I6e98a6a52eee81bd32d10269aeac76198d30b7c2 diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index ced26de..32ed642 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -621,20 +621,10 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec bool bAll = ( tabs.empty() ); if ( !bAll ) // create associated table data CreateTabData( tabs ); - Fraction aFrac20( 1,5 ); - Fraction aFrac400( 4,1 ); - Fraction aValidX = rNewX; - if (aValidX<aFrac20) - aValidX = aFrac20; - if (aValidX>aFrac400) - aValidX = aFrac400; - - Fraction aValidY = rNewY; - if (aValidY<aFrac20) - aValidY = aFrac20; - if (aValidY>aFrac400) - aValidY = aFrac400; + // sanity check - we shouldn't need something this low / big + assert(rNewX > Fraction(1, 100) && rNewX < Fraction(100, 1)); + assert(rNewY > Fraction(1, 100) && rNewY < Fraction(100, 1)); if ( bAll ) { @@ -644,25 +634,25 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec { if ( bPagebreak ) { - maTabData[i]->aPageZoomX = aValidX; - maTabData[i]->aPageZoomY = aValidY; + maTabData[i]->aPageZoomX = rNewX; + maTabData[i]->aPageZoomY = rNewY; } else { - maTabData[i]->aZoomX = aValidX; - maTabData[i]->aZoomY = aValidY; + maTabData[i]->aZoomX = rNewX; + maTabData[i]->aZoomY = rNewY; } } } if ( bPagebreak ) { - aDefPageZoomX = aValidX; - aDefPageZoomY = aValidY; + aDefPageZoomX = rNewX; + aDefPageZoomY = rNewY; } else { - aDefZoomX = aValidX; - aDefZoomY = aValidY; + aDefZoomX = rNewX; + aDefZoomY = rNewY; } } else @@ -676,13 +666,13 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec { if ( bPagebreak ) { - maTabData[i]->aPageZoomX = aValidX; - maTabData[i]->aPageZoomY = aValidY; + maTabData[i]->aPageZoomX = rNewX; + maTabData[i]->aPageZoomY = rNewY; } else { - maTabData[i]->aZoomX = aValidX; - maTabData[i]->aZoomY = aValidY; + maTabData[i]->aZoomX = rNewX; + maTabData[i]->aZoomY = rNewY; } } } commit 0836587586daa838a18aacedaf5bf9161c09842b Author: Jan Holesovsky <[email protected]> Date: Thu Apr 2 13:33:59 2015 +0200 Update comment. Change-Id: I110c0ff8c14d552ecc24dda7b02e4188a7c39d70 diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 97a3336..e414e10 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -943,7 +943,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); - // page break zoom + // page break zoom, and aLogicMode in ScViewData pViewData->SetZoom(aFracX, aFracY, true); double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth; commit ce4bff5ed572bf3a4d5f9dc1bdd314580e3d6a92 Author: Jan Holesovsky <[email protected]> Date: Thu Apr 2 13:13:33 2015 +0200 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 diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 06a474f..431175a 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -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); diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index 9b87a7b..be017e3 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -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 ); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index c5fe4ea..97a3336 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -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; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
