diff --git a/cppcanvas/source/mtfrenderer/outdevstate.hxx b/cppcanvas/source/mtfrenderer/outdevstate.hxx index 10261f9df25e..d6ae62fc1b3a 100644 --- a/cppcanvas/source/mtfrenderer/outdevstate.hxx +++ b/cppcanvas/source/mtfrenderer/outdevstate.hxx @@ -2,9 +2,9 @@ * * $RCSfile: outdevstate.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: rt $ $Date: 2004-11-26 20:55:54 $ + * last change: $Author: rt $ $Date: 2005-01-28 15:30:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,6 +98,9 @@ #ifndef _VCL_VCLENUM_HXX #include #endif +#ifndef _SV_OUTDEV_HXX +#include +#endif namespace cppcanvas @@ -108,6 +111,7 @@ namespace cppcanvas { OutDevState() : clip(), + clipRect(), xClipPoly(), lineColor(), @@ -121,6 +125,7 @@ namespace cppcanvas fontTransform(), textEmphasisMarkStyle(EMPHASISMARK_NONE), + pushFlags(PUSH_ALL), textDirection(::drafts::com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT), textAlignment(0), // TODO(Q2): Synchronize with implrenderer // and possibly new rendering::TextAlignment @@ -142,6 +147,7 @@ namespace cppcanvas } ::basegfx::B2DPolyPolygon clip; + ::Rectangle clipRect; ::com::sun::star::uno::Reference< ::drafts::com::sun::star::rendering::XPolyPolygon2D > xClipPoly; ::com::sun::star::uno::Sequence< double > lineColor; @@ -160,6 +166,7 @@ namespace cppcanvas ::basegfx::B2DHomMatrix fontTransform; sal_uInt16 textEmphasisMarkStyle; + sal_uInt16 pushFlags; sal_Int8 textDirection; sal_Int8 textAlignment; sal_Int8 textReliefStyle; diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index b72312f001a6..fb728ea111b5 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -2,9 +2,9 @@ * * $RCSfile: textaction.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: rt $ $Date: 2004-11-26 20:57:05 $ + * last change: $Author: rt $ $Date: 2005-01-28 15:30:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,6 +73,15 @@ #ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX #include #endif +#ifndef _BGFX_RANGE_B2DRECTANGLE_HXX +#include +#endif +#ifndef _BGFX_POLYGON_B2DPOLYPOLYGONTOOLS_HXX +#include +#endif +#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX +#include +#endif #ifndef _SV_GEN_HXX #include @@ -100,6 +109,7 @@ namespace cppcanvas { void TextAction::init( const ::Point& rStartPoint, const OutDevState& rState, + const CanvasSharedPtr& rCanvas, const ::comphelper::OptionalValue< ::basegfx::B2DHomMatrix >& rTextTransform ) { // ensure that mxFont is valid. It is possible that text actions @@ -121,6 +131,44 @@ namespace cppcanvas tools::initRenderState(maState,rState); + // #i36950# Offset clip back to origin (as it's also moved + // by rStartPoint!) + ::Point aEmptyPoint; + if( rStartPoint != aEmptyPoint ) + { + if( rState.clip.count() ) + { + ::basegfx::B2DPolyPolygon aLocalClip( rState.clip ); + ::basegfx::B2DHomMatrix aTranslate; + + aTranslate.translate( -rStartPoint.X(), + -rStartPoint.Y() ); + aLocalClip.transform( aTranslate ); + + maState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( + rCanvas->getUNOCanvas()->getDevice(), + aLocalClip ); + } + else if( !rState.clipRect.IsEmpty() ) + { + ::Rectangle aLocalClipRect( rState.clipRect ); + + aLocalClipRect.Move( -rStartPoint.X(), + -rStartPoint.Y() ); + + maState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( + rCanvas->getUNOCanvas()->getDevice(), + ::basegfx::B2DPolyPolygon( + ::basegfx::tools::createPolygonFromRect( + ::basegfx::B2DRectangle( aLocalClipRect.Left(), + aLocalClipRect.Top(), + aLocalClipRect.Right(), + aLocalClipRect.Bottom() ) ) ) ); + } + } + + // TODO(F3): Also inversely-transform clip with + // rTextTransform! if( rTextTransform.isValid() ) { // prepend extra font transform to render state @@ -164,7 +212,7 @@ namespace cppcanvas maState(), maTextDirection( rState.textDirection ) { - init( rStartPoint, rState, rTextTransform ); + init( rStartPoint, rState, rCanvas, rTextTransform ); } TextAction::TextAction( const ::Point& rStartPoint, @@ -182,7 +230,7 @@ namespace cppcanvas maState(), maTextDirection( rState.textDirection ) { - init( rStartPoint, rState, rTextTransform ); + init( rStartPoint, rState, rCanvas, rTextTransform ); } TextAction::~TextAction()