INTEGRATION: CWS canvas02 (1.5.8); FILE MERGED

2005/10/09 09:19:00 thb 1.5.8.2: RESYNC: (1.5-1.6); FILE MERGED
2005/08/19 11:08:34 thb 1.5.8.1: #i53538# Changed clip setting to use basegfx polygon (cppcanvas::PolyPolygon contains reference back to canvas); changed direct access to base class member to getter method, thus, providing the actual XCanvas clip polygon lazily.
This commit is contained in:
Kurt Zenker
2005-11-02 12:43:15 +00:00
parent 692ab6aecf
commit f221d52d2e

View File

@@ -4,9 +4,9 @@
* *
* $RCSfile: implcanvas.cxx,v $ * $RCSfile: implcanvas.cxx,v $
* *
* $Revision: 1.6 $ * $Revision: 1.7 $
* *
* last change: $Author: rt $ $Date: 2005-09-08 08:26:17 $ * last change: $Author: kz $ $Date: 2005-11-02 13:43:15 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
@@ -33,8 +33,6 @@
* *
************************************************************************/ ************************************************************************/
#include <implcanvas.hxx>
#ifndef _RTL_USTRING_HXX_ #ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#endif #endif
@@ -44,6 +42,9 @@
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX #ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx>
#endif #endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP_ #ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP_
#include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/rendering/XCanvas.hpp>
@@ -55,6 +56,8 @@
#include <implfont.hxx> #include <implfont.hxx>
#include <implcolor.hxx> #include <implcolor.hxx>
#include <implcanvas.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
@@ -65,7 +68,7 @@ namespace cppcanvas
ImplCanvas::ImplCanvas( const uno::Reference< rendering::XCanvas >& xCanvas ) : ImplCanvas::ImplCanvas( const uno::Reference< rendering::XCanvas >& xCanvas ) :
maViewState(), maViewState(),
mpClipPolyPolygon(), maClipPolyPolygon(),
mxCanvas( xCanvas ) mxCanvas( xCanvas )
{ {
OSL_ENSURE( mxCanvas.is(), "Canvas::Canvas() invalid XCanvas" ); OSL_ENSURE( mxCanvas.is(), "Canvas::Canvas() invalid XCanvas" );
@@ -89,19 +92,16 @@ namespace cppcanvas
maViewState ); maViewState );
} }
void ImplCanvas::setClip( const PolyPolygonSharedPtr& rClipPoly ) void ImplCanvas::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly )
{ {
mpClipPolyPolygon = rClipPoly; // TODO(T3): not thread-safe. B2DPolyPolygon employs copy-on-write
maClipPolyPolygon = rClipPoly;
if( rClipPoly.get() ) maViewState.Clip.clear();
maViewState.Clip = rClipPoly->getUNOPolyPolygon();
else
maViewState.Clip.clear();
} }
PolyPolygonSharedPtr ImplCanvas::getClip() const ::basegfx::B2DPolyPolygon ImplCanvas::getClip() const
{ {
return mpClipPolyPolygon; return maClipPolyPolygon;
} }
FontSharedPtr ImplCanvas::createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const FontSharedPtr ImplCanvas::createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const
@@ -128,6 +128,16 @@ namespace cppcanvas
rendering::ViewState ImplCanvas::getViewState() const rendering::ViewState ImplCanvas::getViewState() const
{ {
if( maClipPolyPolygon.count() && !maViewState.Clip.is() )
{
if( !mxCanvas.is() )
return maViewState;
maViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
mxCanvas->getDevice(),
maClipPolyPolygon );
}
return maViewState; return maViewState;
} }