summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/gridwin4.cxx
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-16 15:00:02 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-08 21:51:15 +0200
commite088d7c50277d7187046f899a145e44e17d6a722 (patch)
treeb7272c32d7381f25c1259cd670a718e3d1ce8ea4 /sc/source/ui/view/gridwin4.cxx
parent4d635dcae4d7275d04a17a0efc11b0531d5d0a82 (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
Diffstat (limited to 'sc/source/ui/view/gridwin4.cxx')
-rw-r--r--sc/source/ui/view/gridwin4.cxx41
1 files changed, 29 insertions, 12 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a60fb82812f7..95042d5cca1f 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();
@@ -472,7 +477,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 );
@@ -587,7 +592,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
{
@@ -604,7 +611,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
@@ -877,13 +884,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()