INTEGRATION: CWS presfixes02 (1.4.2); FILE MERGED
2005/03/14 16:04:54 thb 1.4.2.1: #i35136# #i36914# #i41113# #i44100# #i40115# #i41839# #i44404# Merge from presfixes01 patches
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: pointaction.hxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: vg $ $Date: 2005-03-10 13:25:52 $
|
||||
* last change: $Author: rt $ $Date: 2005-03-30 08:31:20 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -62,20 +62,14 @@
|
||||
#ifndef _CPPCANVAS_POINTACTION_HXX
|
||||
#define _CPPCANVAS_POINTACTION_HXX
|
||||
|
||||
#ifndef _COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
|
||||
#include <com/sun/star/rendering/RenderState.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _SV_GEN_HXX
|
||||
#include <tools/gen.hxx>
|
||||
#endif
|
||||
|
||||
#include <action.hxx>
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
|
||||
class Point;
|
||||
class Color;
|
||||
|
||||
/* Definition of internal::PointAction class */
|
||||
|
||||
/* Definition of internal::PointActionFactory class */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
@@ -83,28 +77,33 @@ namespace cppcanvas
|
||||
{
|
||||
struct OutDevState;
|
||||
|
||||
class PointAction : public Action
|
||||
/** Creates encapsulated converters between GDIMetaFile and
|
||||
XCanvas. The Canvas argument is deliberately placed at the
|
||||
constructor, to force reconstruction of this object for a
|
||||
new canvas. This considerably eases internal state
|
||||
handling, since a lot of the internal state (e.g. fonts,
|
||||
text layout) is Canvas-dependent.
|
||||
*/
|
||||
class PointActionFactory
|
||||
{
|
||||
public:
|
||||
PointAction( const ::Point&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState& );
|
||||
PointAction( const ::Point&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
const ::Color& );
|
||||
virtual ~PointAction();
|
||||
/// Point in current color
|
||||
static ActionSharedPtr createPointAction( const ::Point&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState& );
|
||||
|
||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
||||
/// Point in given color
|
||||
static ActionSharedPtr createPointAction( const ::Point&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
const ::Color& );
|
||||
|
||||
private:
|
||||
// default: disabled copy/assignment
|
||||
PointAction(const PointAction&);
|
||||
PointAction& operator = ( const PointAction& );
|
||||
|
||||
::Point maPoint;
|
||||
CanvasSharedPtr mpCanvas;
|
||||
::com::sun::star::rendering::RenderState maState;
|
||||
// static factory, disable big four
|
||||
PointActionFactory();
|
||||
~PointActionFactory();
|
||||
PointActionFactory(const PointActionFactory&);
|
||||
PointActionFactory& operator=( const PointActionFactory& );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: polypolyaction.cxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: vg $ $Date: 2005-03-10 13:26:10 $
|
||||
* last change: $Author: rt $ $Date: 2005-03-30 08:31:32 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -87,6 +87,8 @@
|
||||
#include <canvas/canvastools.hxx>
|
||||
#endif
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include <mtftools.hxx>
|
||||
|
||||
|
||||
@@ -96,120 +98,215 @@ namespace cppcanvas
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState ) :
|
||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||
rPolyPoly ) ),
|
||||
mpCanvas( rCanvas ),
|
||||
maState(),
|
||||
maTexture(),
|
||||
maFillColor(),
|
||||
maStrokeColor(),
|
||||
mbFill( rState.isFillColorSet ),
|
||||
mbStroke( rState.isLineColorSet )
|
||||
namespace
|
||||
{
|
||||
tools::initRenderState(maState,rState);
|
||||
class PolyPolyAction : public Action, private ::boost::noncopyable
|
||||
{
|
||||
public:
|
||||
PolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
bool bFill,
|
||||
bool bStroke );
|
||||
PolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
bool bFill,
|
||||
bool bStroke,
|
||||
int nTransparency );
|
||||
|
||||
if( mbFill )
|
||||
maFillColor = rState.fillColor;
|
||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||
const Subset& rSubset ) const;
|
||||
|
||||
if( mbStroke )
|
||||
maStrokeColor = rState.lineColor;
|
||||
}
|
||||
virtual sal_Int32 getActionCount() const;
|
||||
|
||||
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
|
||||
private:
|
||||
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
||||
const CanvasSharedPtr mpCanvas;
|
||||
|
||||
// stroke color is now implicit: the maState.DeviceColor member
|
||||
rendering::RenderState maState;
|
||||
|
||||
uno::Sequence< double > maFillColor;
|
||||
};
|
||||
|
||||
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
bool bFill,
|
||||
bool bStroke ) :
|
||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||
rPolyPoly ) ),
|
||||
mpCanvas( rCanvas ),
|
||||
maState(),
|
||||
maFillColor()
|
||||
{
|
||||
tools::initRenderState(maState,rState);
|
||||
|
||||
if( bFill )
|
||||
maFillColor = rState.fillColor;
|
||||
|
||||
if( bStroke )
|
||||
maState.DeviceColor = rState.lineColor;
|
||||
}
|
||||
|
||||
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
bool bFill,
|
||||
bool bStroke,
|
||||
int nTransparency ) :
|
||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||
rPolyPoly ) ),
|
||||
mpCanvas( rCanvas ),
|
||||
maState(),
|
||||
maFillColor()
|
||||
{
|
||||
tools::initRenderState(maState,rState);
|
||||
|
||||
if( bFill )
|
||||
{
|
||||
maFillColor = rState.fillColor;
|
||||
|
||||
if( maFillColor.getLength() < 4 )
|
||||
maFillColor.realloc( 4 );
|
||||
|
||||
// TODO(F1): Color management
|
||||
// adapt fill color transparency
|
||||
maFillColor[3] = 1.0 - nTransparency / 100.0;
|
||||
}
|
||||
|
||||
if( bStroke )
|
||||
{
|
||||
maState.DeviceColor = rState.lineColor;
|
||||
|
||||
if( maState.DeviceColor.getLength() < 4 )
|
||||
maState.DeviceColor.realloc( 4 );
|
||||
|
||||
// TODO(F1): Color management
|
||||
// adapt fill color transparency
|
||||
maState.DeviceColor[3] = 1.0 - nTransparency / 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
bool PolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||
{
|
||||
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
||||
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
||||
|
||||
rendering::RenderState aLocalState( maState );
|
||||
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
|
||||
|
||||
#ifdef SPECIAL_DEBUG
|
||||
aLocalState.Clip.clear();
|
||||
aLocalState.DeviceColor =
|
||||
::vcl::unotools::colorToDoubleSequence( mpCanvas->getUNOCanvas()->getDevice(),
|
||||
::Color( 0x80FF0000 ) );
|
||||
|
||||
if( maState.Clip.is() )
|
||||
mpCanvas->getUNOCanvas()->fillPolyPolygon( maState.Clip,
|
||||
mpCanvas->getViewState(),
|
||||
aLocalState );
|
||||
|
||||
aLocalState.DeviceColor = maState.DeviceColor;
|
||||
#endif
|
||||
|
||||
if( maFillColor.getLength() )
|
||||
{
|
||||
// TODO(E3): Use DBO's finalizer here,
|
||||
// fillPolyPolygon() might throw
|
||||
const uno::Sequence< double > aTmpColor( aLocalState.DeviceColor );
|
||||
aLocalState.DeviceColor = maFillColor;
|
||||
|
||||
// TODO(P1): implement caching
|
||||
mpCanvas->getUNOCanvas()->fillPolyPolygon( mxPolyPoly,
|
||||
mpCanvas->getViewState(),
|
||||
aLocalState );
|
||||
|
||||
aLocalState.DeviceColor = aTmpColor;
|
||||
}
|
||||
|
||||
if( aLocalState.DeviceColor.getLength() )
|
||||
{
|
||||
// TODO(P1): implement caching
|
||||
mpCanvas->getUNOCanvas()->drawPolyPolygon( mxPolyPoly,
|
||||
mpCanvas->getViewState(),
|
||||
aLocalState );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||
const Subset& rSubset ) const
|
||||
{
|
||||
// TODO(F1): Split up poly-polygon into polygons, or even
|
||||
// line segments, when subsets are requested.
|
||||
|
||||
// polygon only contains a single action, fail if subset
|
||||
// requests different range
|
||||
if( rSubset.mnSubsetBegin != 0 ||
|
||||
rSubset.mnSubsetEnd != 1 )
|
||||
return false;
|
||||
|
||||
return render( rTransformation );
|
||||
}
|
||||
|
||||
sal_Int32 PolyPolyAction::getActionCount() const
|
||||
{
|
||||
// TODO(F1): Split up poly-polygon into polygons, or even
|
||||
// line segments, when subsets are requested.
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
class TexturedPolyPolyAction : public Action, private ::boost::noncopyable
|
||||
{
|
||||
public:
|
||||
TexturedPolyPolyAction( const ::PolyPolygon& rPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
const rendering::Texture& rTexture ) :
|
||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||
rPolyPoly ) ),
|
||||
mpCanvas( rCanvas ),
|
||||
maState(),
|
||||
maTexture( rTexture ),
|
||||
maFillColor(),
|
||||
maStrokeColor(),
|
||||
mbFill( rState.isFillColorSet ),
|
||||
mbStroke( rState.isLineColorSet )
|
||||
{
|
||||
tools::initRenderState(maState,rState);
|
||||
const rendering::Texture& rTexture );
|
||||
|
||||
if( mbFill )
|
||||
maFillColor = rState.fillColor;
|
||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||
const Subset& rSubset ) const;
|
||||
|
||||
if( mbStroke )
|
||||
maStrokeColor = rState.lineColor;
|
||||
}
|
||||
virtual sal_Int32 getActionCount() const;
|
||||
|
||||
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
Mode mode ) :
|
||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||
rPolyPoly ) ),
|
||||
mpCanvas( rCanvas ),
|
||||
maState(),
|
||||
maTexture(),
|
||||
maFillColor(),
|
||||
maStrokeColor(),
|
||||
mbFill( false ),
|
||||
mbStroke( rState.isLineColorSet )
|
||||
{
|
||||
tools::initRenderState(maState,rState);
|
||||
private:
|
||||
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
||||
const CanvasSharedPtr mpCanvas;
|
||||
|
||||
if( mbStroke )
|
||||
maStrokeColor = rState.lineColor;
|
||||
}
|
||||
// stroke color is now implicit: the maState.DeviceColor member
|
||||
rendering::RenderState maState;
|
||||
const rendering::Texture maTexture;
|
||||
};
|
||||
|
||||
PolyPolyAction::PolyPolyAction( const ::PolyPolygon& rPolyPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
int nTransparency ) :
|
||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||
rPolyPoly ) ),
|
||||
mpCanvas( rCanvas ),
|
||||
maState(),
|
||||
maTexture(),
|
||||
maFillColor(),
|
||||
maStrokeColor(),
|
||||
mbFill( rState.isFillColorSet ),
|
||||
mbStroke( rState.isLineColorSet )
|
||||
{
|
||||
tools::initRenderState(maState,rState);
|
||||
|
||||
if( mbFill )
|
||||
TexturedPolyPolyAction::TexturedPolyPolyAction( const ::PolyPolygon& rPolyPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
const rendering::Texture& rTexture ) :
|
||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||
rPolyPoly ) ),
|
||||
mpCanvas( rCanvas ),
|
||||
maState(),
|
||||
maTexture( rTexture )
|
||||
{
|
||||
maFillColor = rState.fillColor;
|
||||
|
||||
// TODO(F1): Color management
|
||||
// adapt fill color transparency
|
||||
maFillColor[3] = 1.0 - nTransparency / 100.0;
|
||||
tools::initRenderState(maState,rState);
|
||||
}
|
||||
|
||||
if( mbStroke )
|
||||
bool TexturedPolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||
{
|
||||
maStrokeColor = rState.lineColor;
|
||||
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
||||
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
||||
|
||||
// TODO(F1): Color management
|
||||
// adapt fill color transparency
|
||||
maStrokeColor[3] = 1.0 - nTransparency / 100.0;
|
||||
}
|
||||
}
|
||||
rendering::RenderState aLocalState( maState );
|
||||
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
|
||||
|
||||
PolyPolyAction::~PolyPolyAction()
|
||||
{
|
||||
}
|
||||
|
||||
bool PolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||
{
|
||||
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
||||
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
||||
|
||||
rendering::RenderState aLocalState( maState );
|
||||
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
|
||||
|
||||
if( maTexture.Gradient.is() )
|
||||
{
|
||||
uno::Sequence< rendering::Texture > aSeq(1);
|
||||
aSeq[0] = maTexture;
|
||||
|
||||
@@ -217,31 +314,158 @@ namespace cppcanvas
|
||||
mpCanvas->getViewState(),
|
||||
aLocalState,
|
||||
aSeq );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
bool TexturedPolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||
const Subset& rSubset ) const
|
||||
{
|
||||
if( mbFill )
|
||||
{
|
||||
aLocalState.DeviceColor = maFillColor;
|
||||
// TODO(F1): Split up poly-polygon into polygons, or even
|
||||
// line segments, when subsets are requested.
|
||||
|
||||
// TODO(P1): implement caching
|
||||
mpCanvas->getUNOCanvas()->fillPolyPolygon( mxPolyPoly,
|
||||
mpCanvas->getViewState(),
|
||||
aLocalState );
|
||||
}
|
||||
// polygon only contains a single action, fail if subset
|
||||
// requests different range
|
||||
if( rSubset.mnSubsetBegin != 0 ||
|
||||
rSubset.mnSubsetEnd != 1 )
|
||||
return false;
|
||||
|
||||
if( mbStroke )
|
||||
{
|
||||
aLocalState.DeviceColor = maStrokeColor;
|
||||
|
||||
// TODO(P1): implement caching
|
||||
mpCanvas->getUNOCanvas()->drawPolyPolygon( mxPolyPoly,
|
||||
mpCanvas->getViewState(),
|
||||
aLocalState );
|
||||
}
|
||||
return render( rTransformation );
|
||||
}
|
||||
|
||||
return true;
|
||||
sal_Int32 TexturedPolyPolyAction::getActionCount() const
|
||||
{
|
||||
// TODO(F1): Split up poly-polygon into polygons, or even
|
||||
// line segments, when subsets are requested.
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
class StrokedPolyPolyAction : public Action, private ::boost::noncopyable
|
||||
{
|
||||
public:
|
||||
StrokedPolyPolyAction( const ::PolyPolygon& rPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
const rendering::StrokeAttributes& rStrokeAttributes );
|
||||
|
||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||
const Subset& rSubset ) const;
|
||||
|
||||
virtual sal_Int32 getActionCount() const;
|
||||
|
||||
private:
|
||||
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
||||
const CanvasSharedPtr mpCanvas;
|
||||
rendering::RenderState maState;
|
||||
const rendering::StrokeAttributes maStrokeAttributes;
|
||||
};
|
||||
|
||||
StrokedPolyPolyAction::StrokedPolyPolyAction( const ::PolyPolygon& rPolyPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
const rendering::StrokeAttributes& rStrokeAttributes ) :
|
||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||
rPolyPoly ) ),
|
||||
mpCanvas( rCanvas ),
|
||||
maState(),
|
||||
maStrokeAttributes( rStrokeAttributes )
|
||||
{
|
||||
tools::initRenderState(maState,rState);
|
||||
maState.DeviceColor = rState.lineColor;
|
||||
}
|
||||
|
||||
bool StrokedPolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||
{
|
||||
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
||||
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
||||
|
||||
rendering::RenderState aLocalState( maState );
|
||||
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
|
||||
|
||||
mpCanvas->getUNOCanvas()->strokePolyPolygon( mxPolyPoly,
|
||||
mpCanvas->getViewState(),
|
||||
aLocalState,
|
||||
maStrokeAttributes );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StrokedPolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||
const Subset& rSubset ) const
|
||||
{
|
||||
// TODO(F1): Split up poly-polygon into polygons, or even
|
||||
// line segments, when subsets are requested.
|
||||
|
||||
// polygon only contains a single action, fail if subset
|
||||
// requests different range
|
||||
if( rSubset.mnSubsetBegin != 0 ||
|
||||
rSubset.mnSubsetEnd != 1 )
|
||||
return false;
|
||||
|
||||
return render( rTransformation );
|
||||
}
|
||||
|
||||
sal_Int32 StrokedPolyPolyAction::getActionCount() const
|
||||
{
|
||||
// TODO(F1): Split up poly-polygon into polygons, or even
|
||||
// line segments, when subsets are requested.
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ActionSharedPtr PolyPolyActionFactory::createPolyPolyAction( const ::PolyPolygon& rPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState )
|
||||
{
|
||||
OSL_ENSURE( rState.isLineColorSet || rState.isFillColorSet,
|
||||
"PolyPolyActionFactory::createPolyPolyAction() with empty line and fill color" );
|
||||
return ActionSharedPtr( new PolyPolyAction( rPoly, rCanvas, rState,
|
||||
rState.isFillColorSet,
|
||||
rState.isLineColorSet ) );
|
||||
}
|
||||
|
||||
ActionSharedPtr PolyPolyActionFactory::createPolyPolyAction( const ::PolyPolygon& rPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
const rendering::Texture& rTexture )
|
||||
{
|
||||
return ActionSharedPtr( new TexturedPolyPolyAction( rPoly, rCanvas, rState, rTexture ) );
|
||||
}
|
||||
|
||||
ActionSharedPtr PolyPolyActionFactory::createLinePolyPolyAction( const ::PolyPolygon& rPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState )
|
||||
{
|
||||
OSL_ENSURE( rState.isLineColorSet,
|
||||
"PolyPolyActionFactory::createLinePolyPolyAction() called with empty line color" );
|
||||
|
||||
return ActionSharedPtr( new PolyPolyAction( rPoly, rCanvas, rState,
|
||||
false,
|
||||
rState.isLineColorSet ) );
|
||||
}
|
||||
|
||||
ActionSharedPtr PolyPolyActionFactory::createPolyPolyAction( const ::PolyPolygon& rPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
const rendering::StrokeAttributes& rStrokeAttributes )
|
||||
{
|
||||
OSL_ENSURE( rState.isLineColorSet,
|
||||
"PolyPolyActionFactory::createPolyPolyAction() for strokes called with empty line color" );
|
||||
return ActionSharedPtr( new StrokedPolyPolyAction( rPoly, rCanvas, rState, rStrokeAttributes ) );
|
||||
}
|
||||
|
||||
ActionSharedPtr PolyPolyActionFactory::createPolyPolyAction( const ::PolyPolygon& rPoly,
|
||||
const CanvasSharedPtr& rCanvas,
|
||||
const OutDevState& rState,
|
||||
int nTransparency )
|
||||
{
|
||||
OSL_ENSURE( rState.isLineColorSet || rState.isFillColorSet,
|
||||
"PolyPolyActionFactory::createPolyPolyAction() with empty line and fill color" );
|
||||
return ActionSharedPtr( new PolyPolyAction( rPoly, rCanvas, rState,
|
||||
rState.isFillColorSet,
|
||||
rState.isLineColorSet,
|
||||
nTransparency ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: polypolyaction.hxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: vg $ $Date: 2005-03-10 13:26:22 $
|
||||
* last change: $Author: rt $ $Date: 2005-03-30 08:31:44 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -62,28 +62,19 @@
|
||||
#ifndef _CPPCANVAS_POLYPOLYACTION_HXX
|
||||
#define _CPPCANVAS_POLYPOLYACTION_HXX
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_RENDERING_RENDERSTATE_HPP__
|
||||
#include <com/sun/star/rendering/RenderState.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_RENDERING_XPOLYPOLYGON2D_HPP__
|
||||
#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_RENDERING_TEXTURE_HPP_
|
||||
#include <com/sun/star/rendering/Texture.hpp>
|
||||
#endif
|
||||
|
||||
#include <action.hxx>
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
|
||||
class PolyPolygon;
|
||||
class Color;
|
||||
|
||||
/* Definition of internal::PolyPolyAction class */
|
||||
namespace com { namespace sun { namespace star { namespace rendering
|
||||
{
|
||||
struct Texture;
|
||||
struct StrokeAttributes;
|
||||
} } } }
|
||||
|
||||
|
||||
/* Definition of internal::PolyPolyActionFactory class */
|
||||
|
||||
namespace cppcanvas
|
||||
{
|
||||
@@ -91,51 +82,50 @@ namespace cppcanvas
|
||||
{
|
||||
struct OutDevState;
|
||||
|
||||
class PolyPolyAction : public Action
|
||||
/** Creates encapsulated converters between GDIMetaFile and
|
||||
XCanvas. The Canvas argument is deliberately placed at the
|
||||
constructor, to force reconstruction of this object for a
|
||||
new canvas. This considerably eases internal state
|
||||
handling, since a lot of the internal state (e.g. fonts,
|
||||
text layout) is Canvas-dependent.
|
||||
*/
|
||||
class PolyPolyActionFactory
|
||||
{
|
||||
public:
|
||||
enum Mode
|
||||
{
|
||||
/// regardless of the state, only stroke polygon (if line color is set, that is)
|
||||
strokeOnly
|
||||
};
|
||||
/// Create polygon, fill/stroke according to state
|
||||
static ActionSharedPtr createPolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState& );
|
||||
|
||||
/// Create texture-filled polygon
|
||||
static ActionSharedPtr createPolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
const ::com::sun::star::rendering::Texture& );
|
||||
|
||||
/// Create line polygon (always stroked, not filled)
|
||||
static ActionSharedPtr createLinePolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState& );
|
||||
|
||||
/// Create stroked polygon
|
||||
static ActionSharedPtr createPolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
const ::com::sun::star::rendering::StrokeAttributes& );
|
||||
|
||||
PolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState& );
|
||||
PolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
const ::com::sun::star::rendering::Texture& );
|
||||
PolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
Mode );
|
||||
/// For transparent painting of the given polygon (normally, we take the colors always opaque)
|
||||
PolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
int nTransparency );
|
||||
virtual ~PolyPolyAction();
|
||||
|
||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
||||
static ActionSharedPtr createPolyPolyAction( const ::PolyPolygon&,
|
||||
const CanvasSharedPtr&,
|
||||
const OutDevState&,
|
||||
int nTransparency );
|
||||
|
||||
private:
|
||||
// default: disabled copy/assignment
|
||||
PolyPolyAction(const PolyPolyAction&);
|
||||
PolyPolyAction& operator = ( const PolyPolyAction& );
|
||||
|
||||
::com::sun::star::uno::Reference<
|
||||
::com::sun::star::rendering::XPolyPolygon2D > mxPolyPoly;
|
||||
CanvasSharedPtr mpCanvas;
|
||||
::com::sun::star::rendering::RenderState maState;
|
||||
|
||||
::com::sun::star::rendering::Texture maTexture;
|
||||
|
||||
::com::sun::star::uno::Sequence< double > maFillColor;
|
||||
::com::sun::star::uno::Sequence< double > maStrokeColor;
|
||||
bool mbFill;
|
||||
bool mbStroke;
|
||||
// static factory, disable big four
|
||||
PolyPolyActionFactory();
|
||||
~PolyPolyActionFactory();
|
||||
PolyPolyActionFactory(const PolyPolyActionFactory&);
|
||||
PolyPolyActionFactory& operator=( const PolyPolyActionFactory& );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user