summaryrefslogtreecommitdiff
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
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
-rw-r--r--sc/source/ui/inc/gridwin.hxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx2
-rw-r--r--sc/source/ui/view/gridwin4.cxx41
3 files changed, 32 insertions, 14 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index ed066b22becc..e596b0cb320f 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 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()