Kaydet (Commit) eee24f6c authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

refactor ContourWindow to use RenderContext

Change-Id: I4b7b5f98b56c8cfa41dcd71ccb25e2d6c809cac7
üst 613ead6d
...@@ -29,24 +29,24 @@ ...@@ -29,24 +29,24 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx>
#include "svx/sdrpaintwindow.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 ) : ContourWindow::ContourWindow(vcl::Window* pParent, WinBits nBits)
GraphCtrl ( pParent, nBits ), : GraphCtrl (pParent, nBits)
aWorkRect ( 0, 0, 0, 0 ), , aWorkRect(0, 0, 0, 0)
bPipetteMode ( false ), , bPipetteMode(false)
bWorkplaceMode ( false ), , bWorkplaceMode(false)
bClickValid ( 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 ); SdrPage* pPage = pModel->GetPage(0);
const sal_uInt16 nPolyCount = rPolyPoly.Count(); const sal_uInt16 nPolyCount = rPolyPoly.Count();
// First delete all drawing objects // First delete all drawing objects
aPolyPoly = rPolyPoly; aPolyPoly = rPolyPoly;
...@@ -57,30 +57,30 @@ void ContourWindow::SetPolyPolygon( const tools::PolyPolygon& rPolyPoly ) ...@@ -57,30 +57,30 @@ void ContourWindow::SetPolyPolygon( const tools::PolyPolygon& rPolyPoly )
pPage->Clear(); pPage->Clear();
for ( sal_uInt16 i = 0; i < nPolyCount; i++ ) for (sal_uInt16 i = 0; i < nPolyCount; i++)
{ {
basegfx::B2DPolyPolygon aPolyPolygon; basegfx::B2DPolyPolygon aPolyPolygon;
aPolyPolygon.append(aPolyPoly[ i ].getB2DPolygon()); aPolyPolygon.append(aPolyPoly[ i ].getB2DPolygon());
SdrPathObj* pPathObj = new SdrPathObj( OBJ_PATHFILL, aPolyPolygon ); SdrPathObj* pPathObj = new SdrPathObj( OBJ_PATHFILL, aPolyPolygon );
SfxItemSet aSet( pModel->GetItemPool() ); SfxItemSet aSet(pModel->GetItemPool());
aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) ); aSet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
aSet.Put( XFillColorItem( "", TRANSCOL ) ); aSet.Put(XFillColorItem("", TRANSCOL));
aSet.Put( XFillTransparenceItem( 50 ) ); aSet.Put(XFillTransparenceItem(50) );
pPathObj->SetMergedItemSetAndBroadcast(aSet); pPathObj->SetMergedItemSetAndBroadcast(aSet);
pPage->InsertObject( pPathObj ); pPage->InsertObject( pPathObj );
} }
if ( nPolyCount ) if (nPolyCount)
{ {
pView->MarkAll(); pView->MarkAll();
pView->CombineMarkedObjects( false ); pView->CombineMarkedObjects(false);
} }
pModel->SetChanged( false ); pModel->SetChanged(false);
} }
const tools::PolyPolygon& ContourWindow::GetPolyPolygon() const tools::PolyPolygon& ContourWindow::GetPolyPolygon()
...@@ -217,40 +217,33 @@ void ContourWindow::MouseButtonUp(const MouseEvent& rMEvt) ...@@ -217,40 +217,33 @@ void ContourWindow::MouseButtonUp(const MouseEvent& rMEvt)
GraphCtrl::MouseButtonUp( rMEvt ); GraphCtrl::MouseButtonUp( rMEvt );
} }
void ContourWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect ) void ContourWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{ {
// #i75482# // #i75482#
// encapsulate the redraw using Begin/End and use the returned // encapsulate the redraw using Begin/End and use the returned
// data to get the target output device (e.g. when pre-rendering) // 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(); OutputDevice& rTarget = pPaintWindow->GetTargetOutputDevice();
const Graphic& rGraphic = GetGraphic(); const Graphic& rGraphic = GetGraphic();
const Color& rOldLineColor = GetLineColor(); rTarget.Push(PushFlags::LINECOLOR |PushFlags::FILLCOLOR);
const Color& rOldFillColor = GetFillColor(); rTarget.SetLineColor(Color(COL_BLACK));
rTarget.SetFillColor(Color(COL_WHITE));
rTarget.SetLineColor( Color( COL_BLACK ) );
rTarget.SetFillColor( Color( COL_WHITE ) );
rTarget.DrawRect( Rectangle( Point(), GetGraphicSize() ) ); rTarget.DrawRect( Rectangle( Point(), GetGraphicSize() ) );
rTarget.Pop();
rTarget.SetLineColor( rOldLineColor ); if (rGraphic.GetType() != GRAPHIC_NONE)
rTarget.SetFillColor( rOldFillColor ); 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 ); tools::PolyPolygon _aPolyPoly(2, 2);
const Color aOldFillColor( GetFillColor() ); rTarget.Push(PushFlags::FILLCOLOR);
_aPolyPoly.Insert(Rectangle(Point(), GetGraphicSize()));
_aPolyPoly.Insert( Rectangle( Point(), GetGraphicSize() ) ); _aPolyPoly.Insert(aWorkRect);
_aPolyPoly.Insert( aWorkRect ); rTarget.SetFillColor(COL_LIGHTRED);
rTarget.DrawTransparent(_aPolyPoly, 50);
rTarget.SetFillColor( COL_LIGHTRED ); rTarget.Pop();
rTarget.DrawTransparent( _aPolyPoly, 50 );
rTarget.SetFillColor( aOldFillColor );
} }
// #i75482# // #i75482#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment