diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-12 15:58:22 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-13 08:37:59 +0900 |
commit | eee24f6c5deec1a1dff30597567f6ae121d880fc (patch) | |
tree | 2029d018e13485a522ad6f982099f2e453fbba9e /svx | |
parent | 613ead6d876508b0da32a4511b140b7f2abdac73 (diff) |
refactor ContourWindow to use RenderContext
Change-Id: I4b7b5f98b56c8cfa41dcd71ccb25e2d6c809cac7
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/contwnd.cxx | 79 |
1 files changed, 36 insertions, 43 deletions
diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx index d883417d0a48..691dc737dcb5 100644 --- a/svx/source/dialog/contwnd.cxx +++ b/svx/source/dialog/contwnd.cxx @@ -29,24 +29,24 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include "svx/sdrpaintwindow.hxx" -using namespace com::sun::star; +using namespace css; -#define TRANSCOL Color( COL_WHITE ) +#define TRANSCOL Color(COL_WHITE) -ContourWindow::ContourWindow( vcl::Window* pParent, WinBits nBits ) : - GraphCtrl ( pParent, nBits ), - aWorkRect ( 0, 0, 0, 0 ), - bPipetteMode ( false ), - bWorkplaceMode ( false ), - bClickValid ( false ) +ContourWindow::ContourWindow(vcl::Window* pParent, WinBits nBits) + : GraphCtrl (pParent, nBits) + , aWorkRect(0, 0, 0, 0) + , bPipetteMode(false) + , bWorkplaceMode(false) + , bClickValid(false) { - SetWinStyle( WB_SDRMODE ); + SetWinStyle(WB_SDRMODE); } -void ContourWindow::SetPolyPolygon( const tools::PolyPolygon& rPolyPoly ) +void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { - SdrPage* pPage = pModel->GetPage( 0 ); - const sal_uInt16 nPolyCount = rPolyPoly.Count(); + SdrPage* pPage = pModel->GetPage(0); + const sal_uInt16 nPolyCount = rPolyPoly.Count(); // First delete all drawing objects aPolyPoly = rPolyPoly; @@ -57,30 +57,30 @@ void ContourWindow::SetPolyPolygon( const tools::PolyPolygon& rPolyPoly ) pPage->Clear(); - for ( sal_uInt16 i = 0; i < nPolyCount; i++ ) + for (sal_uInt16 i = 0; i < nPolyCount; i++) { basegfx::B2DPolyPolygon aPolyPolygon; aPolyPolygon.append(aPolyPoly[ i ].getB2DPolygon()); SdrPathObj* pPathObj = new SdrPathObj( OBJ_PATHFILL, aPolyPolygon ); - SfxItemSet aSet( pModel->GetItemPool() ); + SfxItemSet aSet(pModel->GetItemPool()); - aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) ); - aSet.Put( XFillColorItem( "", TRANSCOL ) ); - aSet.Put( XFillTransparenceItem( 50 ) ); + aSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); + aSet.Put(XFillColorItem("", TRANSCOL)); + aSet.Put(XFillTransparenceItem(50) ); pPathObj->SetMergedItemSetAndBroadcast(aSet); pPage->InsertObject( pPathObj ); } - if ( nPolyCount ) + if (nPolyCount) { pView->MarkAll(); - pView->CombineMarkedObjects( false ); + pView->CombineMarkedObjects(false); } - pModel->SetChanged( false ); + pModel->SetChanged(false); } const tools::PolyPolygon& ContourWindow::GetPolyPolygon() @@ -217,40 +217,33 @@ void ContourWindow::MouseButtonUp(const MouseEvent& rMEvt) GraphCtrl::MouseButtonUp( rMEvt ); } -void ContourWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect ) +void ContourWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { // #i75482# // encapsulate the redraw using Begin/End and use the returned // data to get the target output device (e.g. when pre-rendering) - SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(this); + SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext); OutputDevice& rTarget = pPaintWindow->GetTargetOutputDevice(); const Graphic& rGraphic = GetGraphic(); - const Color& rOldLineColor = GetLineColor(); - const Color& rOldFillColor = GetFillColor(); - - rTarget.SetLineColor( Color( COL_BLACK ) ); - rTarget.SetFillColor( Color( COL_WHITE ) ); - + rTarget.Push(PushFlags::LINECOLOR |PushFlags::FILLCOLOR); + rTarget.SetLineColor(Color(COL_BLACK)); + rTarget.SetFillColor(Color(COL_WHITE)); rTarget.DrawRect( Rectangle( Point(), GetGraphicSize() ) ); + rTarget.Pop(); - rTarget.SetLineColor( rOldLineColor ); - rTarget.SetFillColor( rOldFillColor ); - - if ( rGraphic.GetType() != GRAPHIC_NONE ) - rGraphic.Draw( &rTarget, Point(), GetGraphicSize() ); + if (rGraphic.GetType() != GRAPHIC_NONE) + rGraphic.Draw(&rTarget, Point(), GetGraphicSize()); - if ( aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom() ) + if (aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom()) { - tools::PolyPolygon _aPolyPoly( 2, 2 ); - const Color aOldFillColor( GetFillColor() ); - - _aPolyPoly.Insert( Rectangle( Point(), GetGraphicSize() ) ); - _aPolyPoly.Insert( aWorkRect ); - - rTarget.SetFillColor( COL_LIGHTRED ); - rTarget.DrawTransparent( _aPolyPoly, 50 ); - rTarget.SetFillColor( aOldFillColor ); + tools::PolyPolygon _aPolyPoly(2, 2); + rTarget.Push(PushFlags::FILLCOLOR); + _aPolyPoly.Insert(Rectangle(Point(), GetGraphicSize())); + _aPolyPoly.Insert(aWorkRect); + rTarget.SetFillColor(COL_LIGHTRED); + rTarget.DrawTransparent(_aPolyPoly, 50); + rTarget.Pop(); } // #i75482# |