From 482df81a67fc3936d6984396dfd6ce43eb9b16ed Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Tue, 17 Jul 2007 14:26:44 +0000 Subject: INTEGRATION: CWS presfixes12 (1.8.22); FILE MERGED 2007/06/19 11:25:24 thb 1.8.22.4: #i10000# Reversed order, seems that gcc does not handle the safe bool idiom correctly here 2007/06/18 14:33:23 thb 1.8.22.3: #i10000# Avoid boost::optional::get(), which changed semantics after 1.31 (breaks the build for --with-system-boost) 2007/03/08 21:37:07 thb 1.8.22.2: #i37778# Added extra setClip() method to be able to set no clip - setting a clip with zero polygons by definition clips everything 2007/02/20 22:29:30 thb 1.8.22.1: #i37778# Added XCanvas::clear() to all relevant interfaces --- cppcanvas/source/wrapper/implcanvas.cxx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'cppcanvas/source/wrapper') diff --git a/cppcanvas/source/wrapper/implcanvas.cxx b/cppcanvas/source/wrapper/implcanvas.cxx index 138baac4930d..369b4152be8e 100644 --- a/cppcanvas/source/wrapper/implcanvas.cxx +++ b/cppcanvas/source/wrapper/implcanvas.cxx @@ -4,9 +4,9 @@ * * $RCSfile: implcanvas.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: obo $ $Date: 2006-09-17 12:51:57 $ + * last change: $Author: obo $ $Date: 2007-07-17 15:26:44 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -98,13 +98,19 @@ namespace cppcanvas void ImplCanvas::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) { // TODO(T3): not thread-safe. B2DPolyPolygon employs copy-on-write - maClipPolyPolygon = rClipPoly; + maClipPolyPolygon.reset( rClipPoly ); maViewState.Clip.clear(); } - ::basegfx::B2DPolyPolygon ImplCanvas::getClip() const + void ImplCanvas::setClip() { - return maClipPolyPolygon; + maClipPolyPolygon.reset(); + maViewState.Clip.clear(); + } + + ::basegfx::B2DPolyPolygon const* ImplCanvas::getClip() const + { + return !maClipPolyPolygon ? NULL : &(*maClipPolyPolygon); } FontSharedPtr ImplCanvas::createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const @@ -122,6 +128,12 @@ namespace cppcanvas return CanvasSharedPtr( new ImplCanvas( *this ) ); } + void ImplCanvas::clear() const + { + OSL_ENSURE( mxCanvas.is(), "ImplCanvas::clear(): Invalid XCanvas" ); + mxCanvas->clear(); + } + uno::Reference< rendering::XCanvas > ImplCanvas::getUNOCanvas() const { OSL_ENSURE( mxCanvas.is(), "ImplCanvas::getUNOCanvas(): Invalid XCanvas" ); @@ -131,14 +143,14 @@ namespace cppcanvas rendering::ViewState ImplCanvas::getViewState() const { - if( maClipPolyPolygon.count() && !maViewState.Clip.is() ) + if( maClipPolyPolygon && !maViewState.Clip.is() ) { if( !mxCanvas.is() ) return maViewState; maViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxCanvas->getDevice(), - maClipPolyPolygon ); + *maClipPolyPolygon ); } return maViewState; -- cgit v1.2.3