diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-16 15:00:02 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-11 16:34:49 +0200 |
commit | f3ee5edaf550c9683ee4b1bb7736e7bfaefd61c4 (patch) | |
tree | 6897ff719f3f99d83ed3e5746fdf4e0fd84af94c | |
parent | 59a84a144e84f3e73735bacd08187c049cc3c311 (diff) |
Render tiles from calc.
Currently the document size and number of cells to be rendered
is hardcoded, this will need some more work to select the correct
cells for a given tile (i.e. cells from location). Also, there
isn't really a "size" for a calc sheet, so presumably we'd need
to instead return the area containing cells that aren't empty,
whilst still being able to render larger tiles? (And in any case
the client will need to be aware of this and provide an appropriate
interface, i.e. the current LO UI simply extends the sheet ad-infinitum.)
We also currently get some warnings most likely related to the way
we push our OutputDevice into the rendering methods:
SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), \
this should never be needed
Change-Id: Ia9d64d7de6c22d5b401350f88497a7ec106f1973
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 41 |
3 files changed, 32 insertions, 14 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 17b02f8d5a3a..dede1497db5f 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -360,7 +360,8 @@ public: using Window::Draw; void Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, - ScUpdateMode eMode = SC_UPDATE_ALL ); + ScUpdateMode eMode = SC_UPDATE_ALL, + OutputDevice* pOutDev = 0 ); void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 2893974ced06..4e4bff8177d3 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -484,7 +484,7 @@ Size ScModelObj::getDocumentSize() // TODO: not sure what we want to do here, maybe just return the size for a certain // default minimum number of cells, e.g. 100x100 and more if more cells have // content? - return Size(); + return Size( 3200, 3200 ); } uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index fa697ee5fbdd..020fb4ed6835 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -376,9 +376,14 @@ void ScGridWindow::Paint( const Rectangle& rRect ) } // Draw ---------------------------------------------------------------- - -void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode ) +void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode, + OutputDevice* pOutDev ) { + if ( !pOutDev ) + { + pOutDev = this; + } + ScModule* pScMod = SC_MOD(); bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg(); @@ -470,7 +475,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod Fraction aZoomX = pViewData->GetZoomX(); Fraction aZoomY = pViewData->GetZoomY(); - ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, + ScOutputData aOutputData( pOutDev, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); @@ -585,7 +590,9 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode); } - OutputDevice* pContentDev = this; // device for document content, used by overlay manager + // device for document content, used by overlay manager + // We usually paint to ourselves, but allow other devices for tiled rendering. + OutputDevice* pContentDev = pOutDev; SdrPaintWindow* pTargetPaintWindow = 0; // #i74769# work with SdrPaintWindow directly { @@ -602,7 +609,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod { // #i74769# Use new BeginDrawLayers() interface Region aDrawingRegion(aDrawingRectLogic); - pTargetPaintWindow = pDrawView->BeginDrawLayers(this, aDrawingRegion); + pTargetPaintWindow = pDrawView->BeginDrawLayers(pOutDev, aDrawingRegion); OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)"); // #i74769# get target device from SdrPaintWindow, this may be the prerender @@ -875,13 +882,23 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, int nTilePosX, int nTilePosY, long nTileWidth, long nTileHeight ) { - (void) rDevice; - (void) nOutputWidth; - (void) nOutputHeight; - (void) nTilePosX; - (void) nTilePosY; - (void) nTileWidth; - (void) nTileHeight; + rDevice.SetOutputSizePixel( Size( nOutputWidth, nOutputHeight ) ); + // setup the output device to draw the tile + MapMode aMapMode( rDevice.GetMapMode() ); + aMapMode.SetMapUnit( MAP_TWIP ); + aMapMode.SetOrigin( Point( -nTilePosX, -nTilePosY ) ); + + // Scaling. Must convert from pixels to twips. We know + // that VirtualDevises use a DPI of 96. + Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) / + Fraction( nTileWidth); + Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) / + Fraction( nTileHeight); + aMapMode.SetScaleX( scaleX ); + aMapMode.SetScaleY( scaleY ); + rDevice.SetMapMode( aMapMode ); + + Draw( 0, 0, 3, 3, SC_UPDATE_ALL, &rDevice ); } void ScGridWindow::CheckNeedsRepaint() |