summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-18 08:28:04 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-07-30 14:18:56 +0200
commitc4316944b010219b4934e6e87f836db83a4c7ca8 (patch)
treec06d51326da8cbe69558ab23f2efb8a074a5511e
parentfaf9c297ef0c040a82517843e8af8af40a2ee74f (diff)
Allow overriding of device for Paint, and use that for Tiles.
Paint handles figuring out which cells are within the visible area for us etc. Gridwin being a Window which paints to itself is a bit of a pain, since we now need to be able to reroute painting calls to alternative output devices, however these changes seem to be sufficient to at least get the cells in the desired tile rendered. Change-Id: I7bd1434c97acc6e9ef6e1e63cbcf039b987c88e4
-rw-r--r--sc/source/ui/inc/gridwin.hxx3
-rw-r--r--sc/source/ui/view/gridwin4.cxx18
2 files changed, 14 insertions, 7 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index e596b0cb320f..f14867c99ba9 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -292,6 +292,7 @@ protected:
virtual void Resize( const Size& rSize );
virtual void PrePaint() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void Paint( const Rectangle& rRect, OutputDevice* pOutDev);
virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
@@ -361,7 +362,7 @@ public:
using Window::Draw;
void Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
ScUpdateMode eMode = SC_UPDATE_ALL,
- OutputDevice* pOutDev = 0 );
+ OutputDevice* pOutDev = 0);
void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress);
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f882ab0d76f9..39c423dd68c8 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -301,6 +301,11 @@ void ScGridWindow::PrePaint()
void ScGridWindow::Paint( const Rectangle& rRect )
{
+ Paint( rRect, this );
+}
+
+void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
+{
ScDocument* pDoc = pViewData->GetDocument();
if ( pDoc->IsInInterpreter() )
{
@@ -330,7 +335,7 @@ void ScGridWindow::Paint( const Rectangle& rRect )
bIsInPaint = true;
- Rectangle aPixRect = LogicToPixel( rRect );
+ Rectangle aPixRect = pOutDev->LogicToPixel( rRect );
SCCOL nX1 = pViewData->GetPosX(eHWhich);
SCROW nY1 = pViewData->GetPosY(eVWhich);
@@ -371,8 +376,7 @@ void ScGridWindow::Paint( const Rectangle& rRect )
ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab);
}
- Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS ); // nicht weiterzeichnen
-
+ Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev ); // nicht weiterzeichnen
bIsInPaint = false;
}
@@ -590,7 +594,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
}
// get logic positions
- aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode);
+ aDrawingRectLogic = pOutDev->PixelToLogic(aDrawingRectPixel, aDrawMode);
}
// device for document content, used by overlay manager
@@ -848,7 +852,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
DrawRect( Rectangle( aStart,aEnd ) );
SetMapMode(pViewData->GetLogicMode());
- pEditView->Paint( PixelToLogic( Rectangle( Point( nScrX, nScrY ),
+ pEditView->Paint( pOutDev->PixelToLogic( Rectangle( Point( nScrX, nScrY ),
Size( aOutputData.GetScrW(), aOutputData.GetScrH() ) ) ) );
SetMapMode(MAP_PIXEL);
}
@@ -908,7 +912,9 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
pDrawView->AddWindowToPaintView( &rDevice );
}
- Draw( 0, 0, 3, 3, SC_UPDATE_ALL, &rDevice );
+ Paint( Rectangle( Point(nTilePosX, nTilePosY),
+ rDevice.PixelToLogic(Size(nOutputWidth, nOutputHeight))),
+ &rDevice );
if ( pDrawView )
{