From f54212fb24a21401edd6593735898c9b42c09d0f Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Mon, 11 May 2015 18:03:15 +0900 Subject: refactor SvResizeWindow to use RenderContext Change-Id: I3c986ff077a6183b6067c5a16a226954fa84b44c --- svtools/source/hatchwindow/ipwin.cxx | 34 +++++++++++----------- svtools/source/hatchwindow/ipwin.hxx | 55 +++++++++++++++++++++++------------- 2 files changed, 52 insertions(+), 37 deletions(-) diff --git a/svtools/source/hatchwindow/ipwin.cxx b/svtools/source/hatchwindow/ipwin.cxx index f0787a15d14f..a04dd8f3e257 100644 --- a/svtools/source/hatchwindow/ipwin.cxx +++ b/svtools/source/hatchwindow/ipwin.cxx @@ -106,31 +106,31 @@ void SvResizeHelper::FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const |* |* Description *************************************************************************/ -void SvResizeHelper::Draw( OutputDevice * pDev ) +void SvResizeHelper::Draw(vcl::RenderContext& rRenderContext) { - pDev->Push(); - pDev->SetMapMode( MapMode() ); + rRenderContext.Push(); + rRenderContext.SetMapMode( MapMode() ); Color aColBlack; Color aFillColor( COL_LIGHTGRAY ); - pDev->SetFillColor( aFillColor ); - pDev->SetLineColor(); + rRenderContext.SetFillColor( aFillColor ); + rRenderContext.SetLineColor(); - Rectangle aMoveRects[ 4 ]; + Rectangle aMoveRects[ 4 ]; FillMoveRectsPixel( aMoveRects ); sal_uInt16 i; - for( i = 0; i < 4; i++ ) - pDev->DrawRect( aMoveRects[ i ] ); - if( bResizeable ) + for (i = 0; i < 4; i++) + rRenderContext.DrawRect(aMoveRects[i]); + if (bResizeable) { // draw handles - pDev->SetFillColor( aColBlack ); - Rectangle aRects[ 8 ]; - FillHandleRectsPixel( aRects ); - for( i = 0; i < 8; i++ ) - pDev->DrawRect( aRects[ i ] ); + rRenderContext.SetFillColor(aColBlack); + Rectangle aRects[ 8 ]; + FillHandleRectsPixel(aRects); + for (i = 0; i < 8; i++) + rRenderContext.DrawRect( aRects[ i ] ); } - pDev->Pop(); + rRenderContext.Pop(); } /************************************************************************* @@ -612,9 +612,9 @@ void SvResizeWindow::Resize() |* |* Description *************************************************************************/ -void SvResizeWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle & /*rRect*/ ) +void SvResizeWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle & /*rRect*/ ) { - m_aResizer.Draw( this ); + m_aResizer.Draw(rRenderContext); } bool SvResizeWindow::PreNotify( NotifyEvent& rEvt ) diff --git a/svtools/source/hatchwindow/ipwin.hxx b/svtools/source/hatchwindow/ipwin.hxx index c706caed5260..efc536d491d0 100644 --- a/svtools/source/hatchwindow/ipwin.hxx +++ b/svtools/source/hatchwindow/ipwin.hxx @@ -33,31 +33,46 @@ class SvResizeHelper Point aSelPos; bool bResizeable; public: - SvResizeHelper(); + SvResizeHelper(); - void SetResizeable( bool b ) { bResizeable = b; } - short GetGrab() const { return nGrab; } - void SetBorderPixel( const Size & rBorderP ) - { aBorder = rBorderP; } - const Size & GetBorderPixel() const { return aBorder; } - const Rectangle & GetOuterRectPixel() const - { return aOuter; } - void SetOuterRectPixel( const Rectangle & rRect ) - { aOuter = rRect; } - Rectangle GetInnerRectPixel() const - { - Rectangle aRect( aOuter ); - aRect.Top() += aBorder.Height(); - aRect.Left() += aBorder.Width(); - aRect.Bottom() -= aBorder.Height(); - aRect.Right() -= aBorder.Width(); - return aRect; - } + void SetResizeable(bool b) + { + bResizeable = b; + } + short GetGrab() const + { + return nGrab; + } + void SetBorderPixel(const Size & rBorderP) + { + aBorder = rBorderP; + } + const Size& GetBorderPixel() const + { + return aBorder; + } + const Rectangle& GetOuterRectPixel() const + { + return aOuter; + } + void SetOuterRectPixel(const Rectangle& rRect) + { + aOuter = rRect; + } + Rectangle GetInnerRectPixel() const + { + Rectangle aRect( aOuter ); + aRect.Top() += aBorder.Height(); + aRect.Left() += aBorder.Width(); + aRect.Bottom() -= aBorder.Height(); + aRect.Right() -= aBorder.Width(); + return aRect; + } // Clockwise, start at upper left void FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const; void FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const; - void Draw( OutputDevice * ); + void Draw(vcl::RenderContext& rRenderContext); void InvalidateBorder( vcl::Window * ); bool SelectBegin( vcl::Window *, const Point & rPos ); short SelectMove( vcl::Window * pWin, const Point & rPos ); -- cgit