From 8eeb1400c138e4e1b35c017b228fd358a34d55ed Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 8 Dec 2009 19:05:15 +0100 Subject: aw079: #i107360# test code for trapezoid decomposer --- drawinglayer/source/processor2d/vclprocessor2d.cxx | 84 +++++++++++++--------- 1 file changed, 52 insertions(+), 32 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index ede5aee730cf..2866bb292e58 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -77,6 +77,7 @@ // for test, can be removed again #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -666,51 +667,70 @@ namespace drawinglayer basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon()); aLocalPolyPolygon.transform(maCurrentTransformation); - mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - if(mnPolygonStrokePrimitive2D && getOptionsDrawinglayer().IsAntiAliasing()) + static bool bCheckTrapezoidDecomposition(false); + static bool bShowOutlinesThere(false); + if(bCheckTrapezoidDecomposition) { - // when AA is on and this filled polygons are the result of stroked line geometry, - // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons - mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(Color(aPolygonColor)); - const sal_uInt32 nCount(aLocalPolyPolygon.count()); + // clip against discrete ViewPort + const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport(); + aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnRange( + aLocalPolyPolygon, rDiscreteViewport, true, false); - for(sal_uInt32 a(0); a < nCount; a++) + if(aLocalPolyPolygon.count()) { - mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0); - } - } + // subdivide + aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance( + aLocalPolyPolygon, 0.5); - static bool bTestPolygonClipping(false); - if(bTestPolygonClipping) - { - static bool bInside(true); - static bool bFilled(false); - static bool bLine(false); + // trapezoidize + const basegfx::B2DTrapezoidVector aB2DTrapezoidVector(basegfx::tools::trapezoidSubdivide( + aLocalPolyPolygon)); - basegfx::B2DRange aRange(aLocalPolyPolygon.getB2DRange()); - aRange.grow(aRange.getWidth() * -0.1); + const sal_uInt32 nCount(aB2DTrapezoidVector.size()); - if(bFilled) - { - basegfx::B2DPolyPolygon aFilledClipped(basegfx::tools::clipPolyPolygonOnRange(aLocalPolyPolygon, aRange, bInside, false)); - basegfx::BColor aRand(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0); - mpOutputDevice->SetFillColor(Color(aRand)); - mpOutputDevice->SetLineColor(); - mpOutputDevice->DrawPolyPolygon(aFilledClipped); + if(nCount) + { + basegfx::BColor aInvPolygonColor(aPolygonColor); + aInvPolygonColor.invert(); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon()); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); + } + + mpOutputDevice->DrawPolygon(aTempPolygon); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(Color(aInvPolygonColor)); + mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0); + } + } + } } + } + else + { + mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - if(bLine) + if(mnPolygonStrokePrimitive2D && getOptionsDrawinglayer().IsAntiAliasing()) { - basegfx::B2DPolyPolygon aLineClipped(basegfx::tools::clipPolyPolygonOnRange(aLocalPolyPolygon, aRange, bInside, true)); - basegfx::BColor aRand(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0); + // when AA is on and this filled polygons are the result of stroked line geometry, + // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(Color(aRand)); + mpOutputDevice->SetLineColor(Color(aPolygonColor)); + const sal_uInt32 nCount(aLocalPolyPolygon.count()); - for(sal_uInt32 a(0); a < aLineClipped.count(); a++) + for(sal_uInt32 a(0); a < nCount; a++) { - mpOutputDevice->DrawPolyLine(aLineClipped.getB2DPolygon(a), 0.0); + mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0); } } } -- cgit v1.2.3 From 9f6018ec1472d7e4f2f26b300d8c00b09fda1fe8 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 6 Jan 2010 11:29:46 +0100 Subject: aw079: #i107500# changed 3D renderer to be able to render overlapping transparent parts from back to front (Z-sorted) --- .../processor3d/defaultprocessor3d.hxx | 13 +- .../processor3d/zbufferprocessor3d.hxx | 20 +- .../source/primitive2d/sceneprimitive2d.cxx | 5 +- drawinglayer/source/processor2d/vclprocessor2d.cxx | 72 ++++- .../source/processor3d/defaultprocessor3d.cxx | 54 ++-- .../source/processor3d/zbufferprocessor3d.cxx | 331 ++++++++++++++------- 6 files changed, 319 insertions(+), 176 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx index e965d22ab880..d0f886cca703 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -41,6 +41,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -90,14 +91,17 @@ namespace drawinglayer basegfx::BColorModifierStack maBColorModifierStack; // the current active texture - texture::GeoTexSvx* mpGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx; // the current active transparence texture - texture::GeoTexSvx* mpTransparenceGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx; // SvtOptionsDrawinglayer incarnation to react on diverse settings const SvtOptionsDrawinglayer maDrawinglayerOpt; + // counter for entered transparence textures + sal_uInt32 mnTransparenceCounter; + // bitfield unsigned mbModulate : 1; unsigned mbFilter : 1; @@ -135,8 +139,9 @@ namespace drawinglayer // data read access renderer stuff const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } - const texture::GeoTexSvx* getGeoTexSvx() const { return mpGeoTexSvx; } - const texture::GeoTexSvx* getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } + const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; } bool getModulate() const { return mbModulate; } bool getFilter() const { return mbFilter; } bool getSimpleTextureActive() const { return mbSimpleTextureActive; } diff --git a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx index d2ef8bd7f249..b2e09205dba9 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx @@ -58,6 +58,7 @@ namespace drawinglayer { } class ZBufferRasterConverter3D; +class RasterPrimitive3D; ////////////////////////////////////////////////////////////////////////////// @@ -81,21 +82,15 @@ namespace drawinglayer // will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create sal_uInt16 mnAntiAlialize; - // bitfield - // a combination of bools to allow two-pass rendering to render - // the transparent parts in the 2nd run (if any) as needed for Z-Buffer - unsigned mbProcessTransparent : 1; - unsigned mbContainsTransparent : 1; - + // remembered RasterPrimitive3D's which need to be painted back to front + // for transparent 3D parts + std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds; ////////////////////////////////////////////////////////////////////////////// // rasterconversions for filled and non-filled polygons virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const; virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const; - // the processing method for a single, known primitive - virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive); - public: ZBufferProcessor3D( const geometry::ViewInformation3D& rViewInformation3D, @@ -108,12 +103,7 @@ namespace drawinglayer sal_uInt16 nAntiAlialize); virtual ~ZBufferProcessor3D(); - // helpers for drawing transparent parts in 2nd run. To use this - // processor, call processNonTransparent and then processTransparent - // with the same primitives. The 2nd call will only do something, - // when transparent parts are contained - void processNonTransparent(const primitive3d::Primitive3DSequence& rSource); - void processTransparent(const primitive3d::Primitive3DSequence& rSource); + void finish(); // get the result as bitmapEx BitmapEx getBitmapEx() const; diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index ad36a40ea996..9c32c50e7160 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -235,8 +235,9 @@ namespace drawinglayer aUnitVisibleRange, nOversampleValue); - aZBufferProcessor3D.processNonTransparent(getChildren3D()); - aZBufferProcessor3D.processTransparent(getChildren3D()); + aZBufferProcessor3D.process(getChildren3D()); + aZBufferProcessor3D.finish(); + const_cast< ScenePrimitive2D* >(this)->maOldRenderedBitmap = aZBufferProcessor3D.getBitmapEx(); const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 2866bb292e58..bb0bdfe34154 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -337,17 +337,69 @@ namespace drawinglayer basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon()); aLocalPolygon.transform(maCurrentTransformation); - if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()) + static bool bCheckTrapezoidDecomposition(false); + static bool bShowOutlinesThere(false); + if(bCheckTrapezoidDecomposition) { - // #i98289# - // when a Hairline is painted and AntiAliasing is on the option SnapHorVerLinesToDiscrete - // allows to suppress AntiAliasing for pure horizontal or vertical lines. This is done since - // not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This - // NEEDS to be done in discrete coordinates, so only useful for pixel based rendering. - aLocalPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon); + // clip against discrete ViewPort + const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport(); + basegfx::B2DPolyPolygon aLocalPolyPolygon(basegfx::tools::clipPolygonOnRange( + aLocalPolygon, rDiscreteViewport, true, false)); + + if(aLocalPolyPolygon.count()) + { + // subdivide + aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance( + aLocalPolyPolygon, 0.5); + + // trapezoidize + static double fLineWidth(2.0); + basegfx::B2DTrapezoidVector aB2DTrapezoidVector; + basegfx::tools::createLineTrapezoidFromB2DPolyPolygon(aB2DTrapezoidVector, aLocalPolyPolygon, fLineWidth); + + const sal_uInt32 nCount(aB2DTrapezoidVector.size()); + + if(nCount) + { + basegfx::BColor aInvPolygonColor(aHairlineColor); + aInvPolygonColor.invert(); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon()); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(Color(aHairlineColor)); + mpOutputDevice->SetLineColor(); + } + + mpOutputDevice->DrawPolygon(aTempPolygon); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(Color(aInvPolygonColor)); + mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0); + } + } + } + } } + else + { + if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()) + { + // #i98289# + // when a Hairline is painted and AntiAliasing is on the option SnapHorVerLinesToDiscrete + // allows to suppress AntiAliasing for pure horizontal or vertical lines. This is done since + // not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This + // NEEDS to be done in discrete coordinates, so only useful for pixel based rendering. + aLocalPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon); + } - mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0); + mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0); + } } // direct draw of transformed BitmapEx primitive @@ -684,8 +736,8 @@ namespace drawinglayer aLocalPolyPolygon, 0.5); // trapezoidize - const basegfx::B2DTrapezoidVector aB2DTrapezoidVector(basegfx::tools::trapezoidSubdivide( - aLocalPolyPolygon)); + basegfx::B2DTrapezoidVector aB2DTrapezoidVector; + basegfx::tools::trapezoidSubdivide(aB2DTrapezoidVector, aLocalPolyPolygon); const sal_uInt32 nCount(aB2DTrapezoidVector.size()); diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index d9194ca4b5eb..d4ed86de3b6e 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -71,8 +71,8 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - const bool bOldSimpleTextureActive(mbSimpleTextureActive); - texture::GeoTexSvx* pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx; + const bool bOldSimpleTextureActive(getSimpleTextureActive()); + boost::shared_ptr< texture::GeoTexSvx > pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx; // create texture const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient(); @@ -82,7 +82,7 @@ namespace drawinglayer const basegfx::BColor aStart(rFillGradient.getStartColor()); const basegfx::BColor aEnd(rFillGradient.getEndColor()); const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5)); - texture::GeoTexSvx* pNewTex = 0L; + boost::shared_ptr< texture::GeoTexSvx > pNewTex; if(nMaxSteps) { @@ -106,32 +106,32 @@ namespace drawinglayer { case attribute::GRADIENTSTYLE_LINEAR: { - pNewTex = new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_AXIAL: { - pNewTex = new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_RADIAL: { - pNewTex = new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY()); + pNewTex.reset(new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY())); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { - pNewTex = new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_SQUARE: { - pNewTex = new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_RECT: { - pNewTex = new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } } @@ -141,7 +141,7 @@ namespace drawinglayer else { // no color distance -> same color, use simple texture - pNewTex = new texture::GeoTexSvxMono(aStart, 1.0 - aStart.luminance()); + pNewTex.reset(new texture::GeoTexSvxMono(aStart, 1.0 - aStart.luminance())); mbSimpleTextureActive = true; } @@ -158,9 +158,6 @@ namespace drawinglayer // process sub-list process(rSubSequence); - // delete texture - delete pNewTex; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -186,7 +183,7 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - texture::GeoTexSvx* pOldTex = mpGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx; // calculate logic pixel size in object coordinates. Create transformation view // to object by inverting ObjectToView @@ -206,15 +203,11 @@ namespace drawinglayer const double fLogicTexSize(fLogicTexSizeX > fLogicTexSizeY ? fLogicTexSizeX : fLogicTexSizeY); // create texture and set - texture::GeoTexSvxMultiHatch* pNewTex = new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize); - mpGeoTexSvx = pNewTex; + mpGeoTexSvx.reset(new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize)); // process sub-list process(rSubSequence); - // delete texture - delete mpGeoTexSvx; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -231,32 +224,29 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - texture::GeoTexSvx* pOldTex = mpGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx; // create texture const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getBitmap(); if(rFillBitmapAttribute.getTiling()) { - mpGeoTexSvx = new texture::GeoTexSvxBitmapTiled( + mpGeoTexSvx.reset(new texture::GeoTexSvxBitmapTiled( rFillBitmapAttribute.getBitmap(), rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(), - rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()); + rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize())); } else { - mpGeoTexSvx = new texture::GeoTexSvxBitmap( + mpGeoTexSvx.reset(new texture::GeoTexSvxBitmap( rFillBitmapAttribute.getBitmap(), rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(), - rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()); + rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize())); } // process sub-list process(rSubSequence); - // delete texture - delete mpGeoTexSvx; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -320,7 +310,7 @@ namespace drawinglayer if(bPaintIt) { // get rid of texture coordinates if there is no texture - if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx() && !getTransparenceGeoTexSvx()) + if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx().get() && !getTransparenceGeoTexSvx().get()) { aFill.clearTextureCoordinates(); } @@ -507,7 +497,9 @@ namespace drawinglayer { // AlphaTexturePrimitive3D const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive); + mnTransparenceCounter++; impRenderGradientTexturePrimitive3D(rPrimitive, true); + mnTransparenceCounter--; break; } case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D : @@ -556,8 +548,10 @@ namespace drawinglayer mrSdrLightingAttribute(rSdrLightingAttribute), maRasterRange(), maBColorModifierStack(), - mpGeoTexSvx(0), - mpTransparenceGeoTexSvx(0), + mpGeoTexSvx(), + mpTransparenceGeoTexSvx(), + maDrawinglayerOpt(), + mnTransparenceCounter(0), mbModulate(false), mbFilter(false), mbSimpleTextureActive(false) diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index b5a59e10a119..9346958f6b69 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -50,6 +50,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -233,14 +234,14 @@ private: basegfx::B2DPoint aTexCoor(0.0, 0.0); getTextureCoor(aTexCoor); - if(mrProcessor.getGeoTexSvx()) + if(mrProcessor.getGeoTexSvx().get()) { // calc color in spot. This may also set to invisible already when // e.g. bitmap textures have transparent parts mrProcessor.getGeoTexSvx()->modifyBColor(aTexCoor, rColor, fOpacity); } - if(basegfx::fTools::more(fOpacity, 0.0) && mrProcessor.getTransparenceGeoTexSvx()) + if(basegfx::fTools::more(fOpacity, 0.0) && mrProcessor.getTransparenceGeoTexSvx().get()) { // calc opacity. Object has a 2nd texture, a transparence texture mrProcessor.getTransparenceGeoTexSvx()->modifyOpacity(aTexCoor, fOpacity); @@ -249,7 +250,7 @@ private: if(basegfx::fTools::more(fOpacity, 0.0)) { - if(mrProcessor.getGeoTexSvx()) + if(mrProcessor.getGeoTexSvx().get()) { if(mbUseNrm) { @@ -317,9 +318,9 @@ private: mbModifyColor = mrProcessor.getBColorModifierStack().count(); mbHasTexCoor = SCANLINE_EMPTY_INDEX != rA.getTextureIndex() && SCANLINE_EMPTY_INDEX != rB.getTextureIndex(); mbHasInvTexCoor = SCANLINE_EMPTY_INDEX != rA.getInverseTextureIndex() && SCANLINE_EMPTY_INDEX != rB.getInverseTextureIndex(); - const bool bTextureActive(mrProcessor.getGeoTexSvx() || mrProcessor.getTransparenceGeoTexSvx()); + const bool bTextureActive(mrProcessor.getGeoTexSvx().get() || mrProcessor.getTransparenceGeoTexSvx().get()); mbUseTex = bTextureActive && (mbHasTexCoor || mbHasInvTexCoor || mrProcessor.getSimpleTextureActive()); - const bool bUseColorTex(mbUseTex && mrProcessor.getGeoTexSvx()); + const bool bUseColorTex(mbUseTex && mrProcessor.getGeoTexSvx().get()); const bool bNeedNrmOrCol(!bUseColorTex || (bUseColorTex && mrProcessor.getModulate())); mbUseNrm = bNeedNrmOrCol && SCANLINE_EMPTY_INDEX != rA.getNormalIndex() && SCANLINE_EMPTY_INDEX != rB.getNormalIndex(); mbUseCol = !mbUseNrm && bNeedNrmOrCol && SCANLINE_EMPTY_INDEX != rA.getColorIndex() && SCANLINE_EMPTY_INDEX != rB.getColorIndex(); @@ -434,7 +435,7 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(nOpacity >= 0x00ff) { - // full opacity, set z and color + // full opacity (not transparent), set z and color rOldZ = nNewZ; mrBuffer.getBPixel(nScanlineIndex) = basegfx::BPixel(aNewColor, 0xff); } @@ -444,8 +445,8 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(rDest.getOpacity()) { - // both transparent, mix color based on front pixel's opacity - // (the new one) + // mix new color by using + // color' = color * (1 - opacity) + newcolor * opacity const sal_uInt16 nTransparence(0x0100 - nOpacity); rDest.setRed((sal_uInt8)(((rDest.getRed() * nTransparence) + ((sal_uInt16)(255.0 * aNewColor.getRed()) * nOpacity)) >> 8)); rDest.setGreen((sal_uInt8)(((rDest.getGreen() * nTransparence) + ((sal_uInt16)(255.0 * aNewColor.getGreen()) * nOpacity)) >> 8)); @@ -453,14 +454,14 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(0xff != rDest.getOpacity()) { - // destination is also transparent, mix opacities by weighting - // old opacity with new pixel's transparence and adding new opacity - rDest.setOpacity((sal_uInt8)(((rDest.getOpacity() * nTransparence) >> 8) + nOpacity)); + // both are transparent, mix new opacity by using + // opacity = newopacity * (1 - oldopacity) + oldopacity + rDest.setOpacity(((sal_uInt8)((nOpacity * (0x0100 - rDest.getOpacity())) >> 8)) + rDest.getOpacity()); } } else { - // dest is not visible. Set color. + // dest is unused, set color rDest = basegfx::BPixel(aNewColor, (sal_uInt8)nOpacity); } } @@ -477,135 +478,162 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi } } +////////////////////////////////////////////////////////////////////////////// +// helper class to buffer output for transparent rasterprimitives (filled areas +// and lines) until the end of processing. To ensure correct transparent +// visualisation, ZBuffers require to not set Z and to mix with the transparent +// color. If transparent rasterprimitives overlap, it gets necessary to +// paint transparent rasterprimitives from back to front to ensure that the +// mixing happens from back to front. For that purpose, transparent +// rasterprimitives are held in this class during the processing run, remember +// all data and will be rendered + +class RasterPrimitive3D +{ +private: + boost::shared_ptr< drawinglayer::texture::GeoTexSvx > mpGeoTexSvx; + boost::shared_ptr< drawinglayer::texture::GeoTexSvx > mpTransparenceGeoTexSvx; + drawinglayer::attribute::MaterialAttribute3D maMaterial; + basegfx::B3DPolyPolygon maPolyPolygon; + sal_uInt32 mfCenterZ; + + // bitfield + bool mbModulate : 1; + bool mbFilter : 1; + bool mbSimpleTextureActive : 1; + bool mbIsLine : 1; + +public: + RasterPrimitive3D( + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& pGeoTexSvx, + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& pTransparenceGeoTexSvx, + const drawinglayer::attribute::MaterialAttribute3D& rMaterial, + const basegfx::B3DPolyPolygon& rPolyPolygon, + bool bModulate, + bool bFilter, + bool bSimpleTextureActive, + bool bIsLine) + : mpGeoTexSvx(pGeoTexSvx), + mpTransparenceGeoTexSvx(pTransparenceGeoTexSvx), + maMaterial(rMaterial), + maPolyPolygon(rPolyPolygon), + mfCenterZ(basegfx::tools::getRange(rPolyPolygon).getCenter().getZ()), + mbModulate(bModulate), + mbFilter(bFilter), + mbSimpleTextureActive(bSimpleTextureActive), + mbIsLine(bIsLine) + { + } + + RasterPrimitive3D& operator=(const RasterPrimitive3D& rComp) + { + mpGeoTexSvx = rComp.mpGeoTexSvx; + mpTransparenceGeoTexSvx = rComp.mpTransparenceGeoTexSvx; + maMaterial = rComp.maMaterial; + maPolyPolygon = rComp.maPolyPolygon; + mfCenterZ = rComp.mfCenterZ; + mbModulate = rComp.mbModulate; + mbFilter = rComp.mbFilter; + mbSimpleTextureActive = rComp.mbSimpleTextureActive; + mbIsLine = rComp.mbIsLine; + + return *this; + } + + bool operator<(const RasterPrimitive3D& rComp) const + { + return mfCenterZ < rComp.mfCenterZ; + } + + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + const drawinglayer::attribute::MaterialAttribute3D& getMaterial() const { return maMaterial; } + const basegfx::B3DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; } + bool getModulate() const { return mbModulate; } + bool getFilter() const { return mbFilter; } + bool getSimpleTextureActive() const { return mbSimpleTextureActive; } + bool getIsLine() const { return mbIsLine; } +}; + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace processor3d { - // the processing method for a single, known primitive - void ZBufferProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) + void ZBufferProcessor3D::rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const { - // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch - switch(rBasePrimitive.getPrimitiveID()) + if(mpBZPixelRaster) { - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : + if(getTransparenceCounter()) { - // AlphaTexturePrimitive3D - const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive); - - if(mbProcessTransparent) - { - impRenderGradientTexturePrimitive3D(rPrimitive, true); - } - else + // transparent output; record for later sorting and painting from + // back to front + if(!mpRasterPrimitive3Ds) { - mbContainsTransparent = true; + const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds = new std::vector< RasterPrimitive3D >; } - break; - } - case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : - { - // directdraw of PolygonHairlinePrimitive3D - const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rBasePrimitive); - // do something when either not transparent and no transMap, or transparent and a TransMap - if((bool)mbProcessTransparent == (0 != getTransparenceGeoTexSvx())) - { - impRenderPolygonHairlinePrimitive3D(rPrimitive); - } - break; + mpRasterPrimitive3Ds->push_back(RasterPrimitive3D( + getGeoTexSvx(), + getTransparenceGeoTexSvx(), + rMaterial, + basegfx::B3DPolyPolygon(rHairline), + getModulate(), + getFilter(), + getSimpleTextureActive(), + true)); } - case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : + else { - // directdraw of PolyPolygonMaterialPrimitive3D - const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rBasePrimitive); + // do rasterconversion + mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); - // do something when either not transparent and no transMap, or transparent and a TransMap - if((bool)mbProcessTransparent == (0 != getTransparenceGeoTexSvx())) + if(mnAntiAlialize > 1) { - impRenderPolyPolygonMaterialPrimitive3D(rPrimitive); - } - break; - } - default: - { - // use the DefaultProcessor3D::processBasePrimitive3D() - DefaultProcessor3D::processBasePrimitive3D(rBasePrimitive); - break; - } - } - } - - void ZBufferProcessor3D::processNonTransparent(const primitive3d::Primitive3DSequence& rSource) - { - if(mpBZPixelRaster) - { - mbProcessTransparent = false; - mbContainsTransparent = false; - process(rSource); - } - } - - void ZBufferProcessor3D::processTransparent(const primitive3d::Primitive3DSequence& rSource) - { - if(mpBZPixelRaster && mbContainsTransparent) - { - mbProcessTransparent = true; - process(rSource); - } - } + const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()); - void ZBufferProcessor3D::rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const - { - if(mpBZPixelRaster) - { - mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); + if(bForceLineSnap) + { + basegfx::B3DHomMatrix aTransform; + basegfx::B3DPolygon aSnappedHairline(rHairline); + const double fScaleDown(1.0 / mnAntiAlialize); + const double fScaleUp(mnAntiAlialize); - if(mnAntiAlialize > 1) - { - const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()); + // take oversampling out + aTransform.scale(fScaleDown, fScaleDown, 1.0); + aSnappedHairline.transform(aTransform); - if(bForceLineSnap) - { - basegfx::B3DHomMatrix aTransform; - basegfx::B3DPolygon aSnappedHairline(rHairline); - const double fScaleDown(1.0 / mnAntiAlialize); - const double fScaleUp(mnAntiAlialize); + // snap to integer + aSnappedHairline = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aSnappedHairline); - // take oversampling out - aTransform.scale(fScaleDown, fScaleDown, 1.0); - aSnappedHairline.transform(aTransform); + // add oversampling again + aTransform.identity(); + aTransform.scale(fScaleUp, fScaleUp, 1.0); - // snap to integer - aSnappedHairline = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aSnappedHairline); + if(false) + { + // when really want to go to single pixel lines, move to center. + // Without this translation, all hor/ver hairlines will be centered exactly + // between two pixel lines (which looks best) + const double fTranslateToCenter(mnAntiAlialize * 0.5); + aTransform.translate(fTranslateToCenter, fTranslateToCenter, 0.0); + } - // add oversampling again - aTransform.identity(); - aTransform.scale(fScaleUp, fScaleUp, 1.0); + aSnappedHairline.transform(aTransform); - if(false) + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(aSnappedHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); + } + else { - // when really want to go to single pixel lines, move to center. - // Without this translation, all hor/ver hairlines will be centered exactly - // between two pixel lines (which looks best) - const double fTranslateToCenter(mnAntiAlialize * 0.5); - aTransform.translate(fTranslateToCenter, fTranslateToCenter, 0.0); + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); } - - aSnappedHairline.transform(aTransform); - - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(aSnappedHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); } else { - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), 1); } } - else - { - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), 1); - } } } @@ -613,8 +641,30 @@ namespace drawinglayer { if(mpBZPixelRaster) { - mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); - mpZBufferRasterConverter3D->rasterconvertB3DPolyPolygon(rFill, &maInvEyeToView, 0, mpBZPixelRaster->getHeight()); + if(getTransparenceCounter()) + { + // transparent output; record for later sorting and painting from + // back to front + if(!mpRasterPrimitive3Ds) + { + const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds = new std::vector< RasterPrimitive3D >; + } + + mpRasterPrimitive3Ds->push_back(RasterPrimitive3D( + getGeoTexSvx(), + getTransparenceGeoTexSvx(), + rMaterial, + rFill, + getModulate(), + getFilter(), + getSimpleTextureActive(), + false)); + } + else + { + mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); + mpZBufferRasterConverter3D->rasterconvertB3DPolyPolygon(rFill, &maInvEyeToView, 0, mpBZPixelRaster->getHeight()); + } } } @@ -632,8 +682,7 @@ namespace drawinglayer maInvEyeToView(), mpZBufferRasterConverter3D(0), mnAntiAlialize(nAntiAlialize), - mbProcessTransparent(false), - mbContainsTransparent(false) + mpRasterPrimitive3Ds(0) { // generate ViewSizes const double fFullViewSizeX((rViewInformation2D.getObjectToViewTransformation() * basegfx::B2DVector(fSizeX, 0.0)).getLength()); @@ -729,6 +778,58 @@ namespace drawinglayer delete mpZBufferRasterConverter3D; delete mpBZPixelRaster; } + + if(mpRasterPrimitive3Ds) + { + OSL_ASSERT("ZBufferProcessor3D: destructed, but there are unrendered transparent geometries. Use ZBufferProcessor3D::finish() to render these (!)"); + delete mpRasterPrimitive3Ds; + } + } + + void ZBufferProcessor3D::finish() + { + if(mpRasterPrimitive3Ds) + { + // there are transparent rasterprimitives + const sal_uInt32 nSize(mpRasterPrimitive3Ds->size()); + + if(nSize > 1) + { + // sort them from back to front + std::sort(mpRasterPrimitive3Ds->begin(), mpRasterPrimitive3Ds->end()); + } + + for(sal_uInt32 a(0); a < nSize; a++) + { + // paint each one by setting the remembered data and calling + // the render method + const RasterPrimitive3D& rCandidate = (*mpRasterPrimitive3Ds)[a]; + + mpGeoTexSvx = rCandidate.getGeoTexSvx(); + mpTransparenceGeoTexSvx = rCandidate.getTransparenceGeoTexSvx(); + mbModulate = rCandidate.getModulate(); + mbFilter = rCandidate.getFilter(); + mbSimpleTextureActive = rCandidate.getSimpleTextureActive(); + + if(rCandidate.getIsLine()) + { + rasterconvertB3DPolygon( + rCandidate.getMaterial(), + rCandidate.getPolyPolygon().getB3DPolygon(0)); + } + else + { + rasterconvertB3DPolyPolygon( + rCandidate.getMaterial(), + rCandidate.getPolyPolygon()); + } + } + + // delete them to signal the destructor that all is done and + // to allow asserting there + delete mpRasterPrimitive3Ds; + mpRasterPrimitive3Ds = 0; + } } BitmapEx ZBufferProcessor3D::getBitmapEx() const -- cgit v1.2.3 From ffe5c97056ab181367e49691d487eb6f6f375200 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 27 Jan 2010 11:51:56 +0100 Subject: aw079: #i99147# attribute rework and others --- .../inc/drawinglayer/attribute/fillattribute.hxx | 138 ------ .../drawinglayer/attribute/fillbitmapattribute.hxx | 42 +- .../attribute/fillgradientattribute.hxx | 121 ++++++ .../drawinglayer/attribute/fillhatchattribute.hxx | 112 +++++ .../inc/drawinglayer/attribute/fontattribute.hxx | 81 ++-- .../inc/drawinglayer/attribute/lineattribute.hxx | 61 +-- .../attribute/linestartendattribute.hxx | 47 +- .../drawinglayer/attribute/materialattribute3d.hxx | 12 +- .../drawinglayer/attribute/sdrallattribute3d.hxx | 66 ++- .../inc/drawinglayer/attribute/sdrattribute.hxx | 223 ---------- .../inc/drawinglayer/attribute/sdrattribute3d.hxx | 217 ---------- .../drawinglayer/attribute/sdrfillattribute.hxx | 99 +++++ .../attribute/sdrfillbitmapattribute.hxx | 61 ++- .../drawinglayer/attribute/sdrlightattribute3d.hxx | 96 +++++ .../attribute/sdrlightingattribute3d.hxx | 99 +++++ .../drawinglayer/attribute/sdrlineattribute.hxx | 104 +++++ .../attribute/sdrlinestartendattribute.hxx | 102 +++++ .../attribute/sdrobjectattribute3d.hxx | 111 +++++ .../drawinglayer/attribute/sdrsceneattribute3d.hxx | 94 ++++ .../drawinglayer/attribute/sdrshadowattribute.hxx | 93 ++++ .../inc/drawinglayer/attribute/strokeattribute.hxx | 54 +-- .../drawinglayer/geometry/viewinformation2d.hxx | 6 + .../drawinglayer/geometry/viewinformation3d.hxx | 6 + .../drawinglayer/primitive2d/alphaprimitive2d.hxx | 103 ----- .../drawinglayer/primitive2d/baseprimitive2d.hxx | 8 +- .../primitive2d/drawinglayer_primitivetypes2d.hxx | 20 +- .../primitive2d/fillgradientprimitive2d.hxx | 2 +- .../primitive2d/fillhatchprimitive2d.hxx | 3 +- .../drawinglayer/primitive2d/gridprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/groupprimitive2d.hxx | 2 +- .../primitive2d/hiddengeometryprimitive2d.hxx | 79 ++++ .../primitive2d/hittestprimitive2d.hxx | 86 ---- .../drawinglayer/primitive2d/invertprimitive2d.hxx | 2 +- .../primitive2d/markerarrayprimitive2d.hxx | 2 +- .../primitive2d/metafileprimitive2d.hxx | 2 +- .../primitive2d/polygonprimitive2d.hxx | 2 + .../primitive2d/polypolygonprimitive2d.hxx | 6 +- .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 4 +- .../primitive2d/sdrdecompositiontools2d.hxx | 85 ++++ .../primitive2d/transparenceprimitive2d.hxx | 103 +++++ .../primitive2d/unifiedalphaprimitive2d.hxx | 88 ---- .../primitive2d/unifiedtransparenceprimitive2d.hxx | 91 ++++ .../primitive3d/drawinglayer_primitivetypes3d.hxx | 38 +- .../drawinglayer/primitive3d/groupprimitive3d.hxx | 2 +- .../primitive3d/hatchtextureprimitive3d.hxx | 1 + .../primitive3d/hiddengeometryprimitive3d.hxx | 81 ++++ .../primitive3d/hittestprimitive3d.hxx | 88 ---- .../primitive3d/sdrcubeprimitive3d.hxx | 2 +- .../primitive3d/sdrdecompositiontools3d.hxx | 11 +- .../primitive3d/sdrextrudeprimitive3d.hxx | 2 +- .../primitive3d/sdrlatheprimitive3d.hxx | 2 +- .../primitive3d/sdrpolypolygonprimitive3d.hxx | 2 +- .../drawinglayer/primitive3d/sdrprimitive3d.hxx | 8 +- .../primitive3d/sdrsphereprimitive3d.hxx | 2 +- .../primitive3d/textureprimitive3d.hxx | 26 +- .../drawinglayer/processor2d/baseprocessor2d.hxx | 177 +++++++- .../drawinglayer/processor2d/canvasprocessor.hxx | 13 +- .../processor2d/contourextractor2d.hxx | 9 +- .../processor2d/hittestprocessor2d.hxx | 37 +- .../processor2d/linegeometryextractor2d.hxx | 9 +- .../processor2d/textaspolygonextractor2d.hxx | 8 +- .../processor2d/vclmetafileprocessor2d.hxx | 56 ++- .../processor2d/vclpixelprocessor2d.hxx | 23 +- .../drawinglayer/processor2d/vclprocessor2d.hxx | 13 +- .../drawinglayer/processor3d/baseprocessor3d.hxx | 27 +- .../processor3d/cutfindprocessor3d.hxx | 37 +- .../processor3d/defaultprocessor3d.hxx | 41 +- .../processor3d/geometry2dextractor.hxx | 19 +- .../drawinglayer/processor3d/shadow3dextractor.hxx | 35 +- .../processor3d/zbufferprocessor3d.hxx | 25 +- drawinglayer/prj/d.lst | 22 +- drawinglayer/source/attribute/fillattribute.cxx | 102 ----- .../source/attribute/fillbitmapattribute.cxx | 153 ++++++- .../source/attribute/fillgradientattribute.cxx | 250 +++++++++++ .../source/attribute/fillhatchattribute.cxx | 219 ++++++++++ drawinglayer/source/attribute/fontattribute.cxx | 220 +++++++++- drawinglayer/source/attribute/lineattribute.cxx | 142 +++++++ .../source/attribute/linestartendattribute.cxx | 148 ++++++- drawinglayer/source/attribute/makefile.mk | 27 +- .../source/attribute/materialattribute3d.cxx | 93 ++-- .../source/attribute/sdrallattribute3d.cxx | 169 ++------ drawinglayer/source/attribute/sdrattribute.cxx | 293 ------------- drawinglayer/source/attribute/sdrattribute3d.cxx | 219 ---------- drawinglayer/source/attribute/sdrfillattribute.cxx | 221 ++++++++++ .../source/attribute/sdrfillbitmapattribute.cxx | 259 +++++++++-- .../source/attribute/sdrlightattribute3d.cxx | 196 +++++++++ .../source/attribute/sdrlightingattribute3d.cxx | 235 ++++++++++ drawinglayer/source/attribute/sdrlineattribute.cxx | 250 +++++++++++ .../source/attribute/sdrlinestartendattribute.cxx | 254 +++++++++++ .../source/attribute/sdrobjectattribute3d.cxx | 292 +++++++++++++ .../source/attribute/sdrsceneattribute3d.cxx | 218 ++++++++++ .../source/attribute/sdrshadowattribute.cxx | 193 +++++++++ drawinglayer/source/attribute/strokeattribute.cxx | 139 +++++- drawinglayer/source/geometry/viewinformation2d.cxx | 47 ++ drawinglayer/source/geometry/viewinformation3d.cxx | 47 +- .../source/primitive2d/alphaprimitive2d.cxx | 78 ---- .../source/primitive2d/fillbitmapprimitive2d.cxx | 78 ++-- .../source/primitive2d/fillgradientprimitive2d.cxx | 38 +- .../source/primitive2d/fillhatchprimitive2d.cxx | 108 ++--- .../source/primitive2d/graphicprimitive2d.cxx | 6 +- .../primitive2d/hiddengeometryprimitive2d.cxx | 75 ++++ .../source/primitive2d/hittestprimitive2d.cxx | 76 ---- .../source/primitive2d/invertprimitive2d.cxx | 2 +- drawinglayer/source/primitive2d/makefile.mk | 89 ++-- .../source/primitive2d/mediaprimitive2d.cxx | 17 +- .../source/primitive2d/metafileprimitive2d.cxx | 31 +- .../source/primitive2d/pagepreviewprimitive2d.cxx | 5 +- .../source/primitive2d/polygonprimitive2d.cxx | 31 +- .../source/primitive2d/polypolygonprimitive2d.cxx | 105 +++-- .../source/primitive2d/sceneprimitive2d.cxx | 9 +- .../source/primitive2d/sdrdecompositiontools2d.cxx | 130 ++++++ .../source/primitive2d/shadowprimitive2d.cxx | 4 +- .../source/primitive2d/transparenceprimitive2d.cxx | 78 ++++ .../source/primitive2d/unifiedalphaprimitive2d.cxx | 129 ------ .../primitive2d/unifiedtransparenceprimitive2d.cxx | 136 ++++++ .../source/primitive2d/wallpaperprimitive2d.cxx | 3 +- .../primitive3d/hiddengeometryprimitive3d.cxx | 76 ++++ .../source/primitive3d/hittestprimitive3d.cxx | 76 ---- drawinglayer/source/primitive3d/makefile.mk | 2 +- .../source/primitive3d/polygontubeprimitive3d.cxx | 4 +- .../source/primitive3d/sdrcubeprimitive3d.cxx | 37 +- .../source/primitive3d/sdrdecompositiontools3d.cxx | 88 +++- .../source/primitive3d/sdrextrudeprimitive3d.cxx | 45 +- .../source/primitive3d/sdrlatheprimitive3d.cxx | 47 +- .../primitive3d/sdrpolypolygonprimitive3d.cxx | 44 +- drawinglayer/source/primitive3d/sdrprimitive3d.cxx | 16 +- .../source/primitive3d/sdrsphereprimitive3d.cxx | 38 +- .../source/primitive3d/textureprimitive3d.cxx | 28 +- .../source/processor2d/canvasprocessor.cxx | 139 +++--- .../source/processor2d/contourextractor2d.cxx | 10 +- .../source/processor2d/hittestprocessor2d.cxx | 29 +- .../source/processor2d/vclhelperbufferdevice.cxx | 4 +- .../source/processor2d/vclhelperbufferdevice.hxx | 2 +- .../source/processor2d/vclhelpergradient.cxx | 2 +- .../source/processor2d/vclhelpergradient.hxx | 3 +- .../source/processor2d/vclmetafileprocessor2d.cxx | 260 +++++------ .../source/processor2d/vclpixelprocessor2d.cxx | 74 ++-- drawinglayer/source/processor2d/vclprocessor2d.cxx | 41 +- .../source/processor3d/cutfindprocessor3d.cxx | 50 ++- .../source/processor3d/defaultprocessor3d.cxx | 10 +- .../source/processor3d/geometry2dextractor.cxx | 4 +- .../source/processor3d/shadow3dextractor.cxx | 4 +- .../source/processor3d/zbufferprocessor3d.cxx | 2 +- drawinglayer/source/texture/texture3d.cxx | 1 - svx/inc/svx/scene3d.hxx | 2 + svx/inc/svx/sdr/attribute/sdrallattribute.hxx | 202 --------- svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx | 80 ++++ svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx | 66 ++- .../sdr/attribute/sdrformtextoutlineattribute.hxx | 30 +- .../attribute/sdrlinefillshadowtextattribute.hxx | 81 ++++ .../sdr/attribute/sdrlineshadowtextattribute.hxx | 79 ++++ .../svx/sdr/attribute/sdrshadowtextattribute.hxx | 76 ++++ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx | 107 +++-- svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx | 23 +- .../svx/sdr/contact/viewobjectcontactofgroup.hxx | 3 - .../svx/sdr/primitive2d/sdrattributecreator.hxx | 63 ++- .../svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx | 4 +- .../sdr/primitive2d/sdrconnectorprimitive2d.hxx | 4 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 6 +- .../svx/sdr/primitive2d/sdrdecompositiontools.hxx | 18 +- .../svx/sdr/primitive2d/sdrellipseprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx | 3 +- .../svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx | 3 +- svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx | 3 +- svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx | 4 +- svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx | 5 - .../sdr/primitive2d/sdrrectangleprimitive2d.hxx | 4 +- svx/inc/svx/sdr/properties/oleproperties.hxx | 69 +++ svx/inc/svx/svdogrp.hxx | 1 + svx/prj/d.lst | 3 + svx/source/engine3d/dragmt3d.cxx | 27 +- svx/source/engine3d/scene3d.cxx | 6 + svx/source/engine3d/view3d.cxx | 6 +- svx/source/sdr/attribute/makefile.mk | 5 +- svx/source/sdr/attribute/sdrallattribute.cxx | 412 ------------------ svx/source/sdr/attribute/sdrfilltextattribute.cxx | 92 ++++ svx/source/sdr/attribute/sdrformtextattribute.cxx | 335 ++++++++++----- .../sdr/attribute/sdrformtextoutlineattribute.cxx | 143 ++++++- .../attribute/sdrlinefillshadowtextattribute.cxx | 95 +++++ .../sdr/attribute/sdrlineshadowtextattribute.cxx | 93 ++++ .../sdr/attribute/sdrshadowtextattribute.cxx | 85 ++++ svx/source/sdr/attribute/sdrtextattribute.cxx | 473 +++++++++++++++------ svx/source/sdr/contact/viewcontact.cxx | 3 +- svx/source/sdr/contact/viewcontactofe3d.cxx | 30 +- svx/source/sdr/contact/viewcontactofe3dcube.cxx | 17 +- svx/source/sdr/contact/viewcontactofe3dextrude.cxx | 22 +- svx/source/sdr/contact/viewcontactofe3dlathe.cxx | 24 +- svx/source/sdr/contact/viewcontactofe3dpolygon.cxx | 22 +- svx/source/sdr/contact/viewcontactofe3dscene.cxx | 117 ++--- svx/source/sdr/contact/viewcontactofe3dsphere.cxx | 20 +- svx/source/sdr/contact/viewcontactofgraphic.cxx | 236 +++++----- svx/source/sdr/contact/viewcontactofgroup.cxx | 26 +- .../contact/viewcontactofmasterpagedescriptor.cxx | 41 +- .../sdr/contact/viewcontactofsdrcaptionobj.cxx | 194 ++++----- svx/source/sdr/contact/viewcontactofsdrcircobj.cxx | 91 ++-- svx/source/sdr/contact/viewcontactofsdredgeobj.cxx | 43 +- .../sdr/contact/viewcontactofsdrmeasureobj.cxx | 149 ++++--- .../sdr/contact/viewcontactofsdrmediaobj.cxx | 13 +- .../sdr/contact/viewcontactofsdrobjcustomshape.cxx | 179 ++++---- svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 93 ++-- svx/source/sdr/contact/viewcontactofsdrpage.cxx | 39 +- svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 163 ++++--- svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 105 ++--- svx/source/sdr/contact/viewcontactofunocontrol.cxx | 45 +- svx/source/sdr/contact/viewcontactofvirtobj.cxx | 41 +- svx/source/sdr/contact/viewobjectcontactofe3d.cxx | 1 - .../sdr/contact/viewobjectcontactofe3dscene.cxx | 11 - .../sdr/contact/viewobjectcontactofgroup.cxx | 14 - .../sdr/contact/viewobjectcontactofpageobj.cxx | 25 +- .../sdr/contact/viewobjectcontactofsdrole2obj.cxx | 8 +- svx/source/sdr/overlay/overlayobjectcell.cxx | 8 +- svx/source/sdr/overlay/overlayselection.cxx | 10 +- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 407 +++++++----------- .../sdr/primitive2d/sdrcaptionprimitive2d.cxx | 65 ++- .../sdr/primitive2d/sdrconnectorprimitive2d.cxx | 44 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 27 +- .../sdr/primitive2d/sdrdecompositiontools.cxx | 58 +-- .../sdr/primitive2d/sdrellipseprimitive2d.cxx | 116 +++-- svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 66 ++- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 130 +++--- svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 64 ++- .../sdr/primitive2d/sdrolecontentprimitive2d.cxx | 2 +- svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx | 63 ++- svx/source/sdr/primitive2d/sdrprimitivetools.cxx | 17 - .../sdr/primitive2d/sdrrectangleprimitive2d.cxx | 55 +-- .../sdr/primitive3d/sdrattributecreator3d.cxx | 5 +- svx/source/sdr/properties/oleproperties.cxx | 80 ++++ svx/source/svdraw/svddrgmt.cxx | 44 +- svx/source/svdraw/svdedtv.cxx | 97 ++++- svx/source/svdraw/svdocapt.cxx | 2 +- svx/source/svdraw/svdogrp.cxx | 6 + svx/source/svdraw/svdopath.cxx | 12 +- svx/source/svdraw/svdotextpathdecomposition.cxx | 78 ++-- svx/source/table/tablehandles.cxx | 7 +- svx/source/table/viewcontactoftableobj.cxx | 124 ++++-- 235 files changed, 10476 insertions(+), 5897 deletions(-) delete mode 100644 drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx delete mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx delete mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx delete mode 100644 drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx delete mode 100644 drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx delete mode 100644 drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx delete mode 100644 drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx delete mode 100644 drawinglayer/source/attribute/fillattribute.cxx create mode 100644 drawinglayer/source/attribute/fillgradientattribute.cxx create mode 100644 drawinglayer/source/attribute/fillhatchattribute.cxx delete mode 100644 drawinglayer/source/attribute/sdrattribute.cxx delete mode 100644 drawinglayer/source/attribute/sdrattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrfillattribute.cxx create mode 100644 drawinglayer/source/attribute/sdrlightattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrlightingattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrlineattribute.cxx create mode 100644 drawinglayer/source/attribute/sdrlinestartendattribute.cxx create mode 100644 drawinglayer/source/attribute/sdrobjectattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrsceneattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrshadowattribute.cxx delete mode 100644 drawinglayer/source/primitive2d/alphaprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx delete mode 100644 drawinglayer/source/primitive2d/hittestprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx create mode 100644 drawinglayer/source/primitive2d/transparenceprimitive2d.cxx delete mode 100644 drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx create mode 100644 drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx delete mode 100644 drawinglayer/source/primitive3d/hittestprimitive3d.cxx delete mode 100644 svx/inc/svx/sdr/attribute/sdrallattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/properties/oleproperties.hxx delete mode 100644 svx/source/sdr/attribute/sdrallattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrfilltextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrshadowtextattribute.cxx create mode 100644 svx/source/sdr/properties/oleproperties.cxx (limited to 'drawinglayer') diff --git a/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx deleted file mode 100644 index e50a636e8a83..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: fillattribute.hxx,v $ - * - * $Revision: 1.3 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines -class XHatch; - -namespace drawinglayer -{ - namespace attribute - { - enum GradientStyle - { - GRADIENTSTYLE_LINEAR, - GRADIENTSTYLE_AXIAL, - GRADIENTSTYLE_RADIAL, - GRADIENTSTYLE_ELLIPTICAL, - GRADIENTSTYLE_SQUARE, - GRADIENTSTYLE_RECT - }; - - enum HatchStyle - { - HATCHSTYLE_SINGLE, - HATCHSTYLE_DOUBLE, - HATCHSTYLE_TRIPLE - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class FillGradientAttribute - { - basegfx::BColor maStartColor; - basegfx::BColor maEndColor; - double mfBorder; - double mfOffsetX; - double mfOffsetY; - double mfAngle; - GradientStyle meStyle; - sal_uInt16 mnSteps; - - public: - FillGradientAttribute( - GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, double fAngle, - const basegfx::BColor& rStartColor, const basegfx::BColor& rEndColor, sal_uInt16 nSteps); - bool operator==(const FillGradientAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getStartColor() const { return maStartColor; } - const basegfx::BColor& getEndColor() const { return maEndColor; } - double getBorder() const { return mfBorder; } - double getOffsetX() const { return mfOffsetX; } - double getOffsetY() const { return mfOffsetY; } - double getAngle() const { return mfAngle; } - GradientStyle getStyle() const { return meStyle; } - sal_uInt16 getSteps() const { return mnSteps; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class FillHatchAttribute - { - double mfDistance; - double mfAngle; - basegfx::BColor maColor; - HatchStyle meStyle; - - // bitfield - unsigned mbFillBackground : 1; - - public: - FillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, const basegfx::BColor& rColor, bool bFillBackground); - bool operator==(const FillHatchAttribute& rCandidate) const; - - // data access - double getDistance() const { return mfDistance; } - double getAngle() const { return mfAngle; } - const basegfx::BColor& getColor() const { return maColor; } - HatchStyle getStyle() const { return meStyle; } - bool isFillBackground() const { return mbFillBackground; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx index 376e1d626927..04d1a9298eb5 100644 --- a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx @@ -36,18 +36,22 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX -#include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines +class BitmapEx; + namespace basegfx { - class B2DRange; - class BColor; + class B2DPoint; + class B2DVector; } +namespace drawinglayer { namespace attribute { + class ImpFillBitmapAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -56,26 +60,32 @@ namespace drawinglayer { class FillBitmapAttribute { - BitmapEx maBitmapEx; - basegfx::B2DPoint maTopLeft; - basegfx::B2DVector maSize; - - // bitfield - unsigned mbTiling : 1; + private: + ImpFillBitmapAttribute* mpFillBitmapAttribute; public: + /// constructors/assignmentoperator/destructor FillBitmapAttribute( const BitmapEx& rBitmapEx, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling); + FillBitmapAttribute(); + FillBitmapAttribute(const FillBitmapAttribute& rCandidate); + FillBitmapAttribute& operator=(const FillBitmapAttribute& rCandidate); + ~FillBitmapAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator bool operator==(const FillBitmapAttribute& rCandidate) const; - // data access - const BitmapEx& getBitmapEx() const { return maBitmapEx; } - const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; } - const basegfx::B2DVector& getSize() const { return maSize; } - bool getTiling() const { return mbTiling; } + // data read access + const BitmapEx& getBitmapEx() const; + const basegfx::B2DPoint& getTopLeft() const; + const basegfx::B2DVector& getSize() const; + bool getTiling() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx new file mode 100644 index 000000000000..f7bddbfe0f89 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpFillGradientAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// +// declarations + +namespace drawinglayer +{ + namespace attribute + { + enum GradientStyle + { + GRADIENTSTYLE_LINEAR, + GRADIENTSTYLE_AXIAL, + GRADIENTSTYLE_RADIAL, + GRADIENTSTYLE_ELLIPTICAL, + GRADIENTSTYLE_SQUARE, + GRADIENTSTYLE_RECT + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class FillGradientAttribute + { + private: + ImpFillGradientAttribute* mpFillGradientAttribute; + + public: + /// constructors/assignmentoperator/destructor + FillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps); + FillGradientAttribute(); + FillGradientAttribute(const FillGradientAttribute& rCandidate); + FillGradientAttribute& operator=(const FillGradientAttribute& rCandidate); + ~FillGradientAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillGradientAttribute& rCandidate) const; + + // data read access + GradientStyle getStyle() const; + double getBorder() const; + double getOffsetX() const; + double getOffsetY() const; + double getAngle() const; + const basegfx::BColor& getStartColor() const; + const basegfx::BColor& getEndColor() const; + sal_uInt16 getSteps() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx new file mode 100644 index 000000000000..9f147b36ef34 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpFillHatchAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// +// declarations + +namespace drawinglayer +{ + namespace attribute + { + enum HatchStyle + { + HATCHSTYLE_SINGLE, + HATCHSTYLE_DOUBLE, + HATCHSTYLE_TRIPLE + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class FillHatchAttribute + { + private: + ImpFillHatchAttribute* mpFillHatchAttribute; + + public: + /// constructors/assignmentoperator/destructor + FillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground); + FillHatchAttribute(); + FillHatchAttribute(const FillHatchAttribute& rCandidate); + FillHatchAttribute& operator=(const FillHatchAttribute& rCandidate); + ~FillHatchAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillHatchAttribute& rCandidate) const; + + // data read access + HatchStyle getStyle() const; + double getDistance() const; + double getAngle() const; + const basegfx::BColor& getColor() const; + bool isFillBackground() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx index d8eed659f5e7..6a6cbe26be11 100644 --- a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx @@ -36,9 +36,16 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX -#include #include -#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +class String; + +namespace drawinglayer { namespace attribute { + class ImpFontAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -54,22 +61,11 @@ namespace drawinglayer class FontAttribute { private: - /// core data - String maFamilyName; // Font Family Name - String maStyleName; // Font Style Name - sal_uInt16 mnWeight; // Font weight - - /// bitfield - unsigned mbSymbol : 1; // Symbol Font Flag - unsigned mbVertical : 1; // Vertical Text Flag - unsigned mbItalic : 1; // Italic Flag - unsigned mbOutline : 1; // Outline Flag - unsigned mbRTL : 1; // RTL Flag - unsigned mbBiDiStrong : 1; // BiDi Flag - // TODO: pair kerning and CJK kerning + ImpFontAttribute* mpFontAttribute; public: - /// constructor + /// constructors/assignmentoperator/destructor + /// TODO: pair kerning and CJK kerning FontAttribute( const String& rFamilyName, const String& rStyleName, @@ -79,45 +75,28 @@ namespace drawinglayer bool bItalic = false, bool bOutline = false, bool bRTL = false, - bool bBiDiStrong = false) - : maFamilyName(rFamilyName), - maStyleName(rStyleName), - mnWeight(nWeight), - mbSymbol(bSymbol), - mbVertical(bVertical), - mbItalic(bItalic), - mbOutline(bOutline), - mbRTL(bRTL), - mbBiDiStrong(bBiDiStrong) - { - } + bool bBiDiStrong = false); + FontAttribute(); + FontAttribute(const FontAttribute& rCandidate); + FontAttribute& operator=(const FontAttribute& rCandidate); + ~FontAttribute(); - FontAttribute() - : maFamilyName(), - maStyleName(), - mnWeight(0), - mbSymbol(false), - mbVertical(false), - mbItalic(false), - mbOutline(false), - mbRTL(false), - mbBiDiStrong(false) - { - } + // checks if the incarnation is default constructed + bool isDefault() const; - /// compare operator - bool operator==(const FontAttribute& rCompare) const; + // compare operator + bool operator==(const FontAttribute& rCandidate) const; /// data read access - const String& getFamilyName() const { return maFamilyName; } - const String& getStyleName() const { return maStyleName; } - sal_uInt16 getWeight() const { return mnWeight; } - bool getSymbol() const { return mbSymbol; } - bool getVertical() const { return mbVertical; } - bool getItalic() const { return mbItalic; } - bool getOutline() const { return mbOutline; } - bool getRTL() const { return mbRTL; } - bool getBiDiStrong() const { return mbBiDiStrong; } + const String& getFamilyName() const; + const String& getStyleName() const; + sal_uInt16 getWeight() const; + bool getSymbol() const; + bool getVertical() const; + bool getItalic() const; + bool getOutline() const; + bool getRTL() const; + bool getBiDiStrong() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx index b4bdabe8d646..3ef055355bd5 100644 --- a/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx @@ -36,13 +36,19 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX -#include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpLineAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -52,50 +58,29 @@ namespace drawinglayer class LineAttribute { private: - basegfx::BColor maColor; // color - double mfWidth; // absolute line width - basegfx::B2DLineJoin meLineJoin; // type of LineJoin + ImpLineAttribute* mpLineAttribute; public: + /// constructors/assignmentoperator/destructor LineAttribute( const basegfx::BColor& rColor, double fWidth = 0.0, - basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND) - : maColor(rColor), - mfWidth(fWidth), - meLineJoin(aB2DLineJoin) - { - } - - LineAttribute(const LineAttribute& rCandidate) - { - *this = rCandidate; - } - - LineAttribute& operator=(const LineAttribute& rCandidate) - { - maColor = rCandidate.maColor; - mfWidth = rCandidate.mfWidth; - meLineJoin = rCandidate.meLineJoin; - return *this; - } + basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND); + LineAttribute(); + LineAttribute(const LineAttribute& rCandidate); + LineAttribute& operator=(const LineAttribute& rCandidate); + ~LineAttribute(); - ~LineAttribute() - { - } + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const LineAttribute& rCandidate) const - { - return (maColor == rCandidate.maColor - && mfWidth == rCandidate.mfWidth - && meLineJoin == rCandidate.meLineJoin); - } + bool operator==(const LineAttribute& rCandidate) const; - // data access - const basegfx::BColor& getColor() const { return maColor; } - double getWidth() const { return mfWidth; } - basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; } + // data read access + const basegfx::BColor& getColor() const; + double getWidth() const; + basegfx::B2DLineJoin getLineJoin() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx index dbd12c90c9d8..151e059559ec 100644 --- a/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx @@ -36,12 +36,19 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines +namespace basegfx { + class B2DPolyPolygon; +} + +namespace drawinglayer { namespace attribute { + class ImpLineStartEndAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -51,35 +58,29 @@ namespace drawinglayer class LineStartEndAttribute { private: - double mfWidth; // absolute line StartEndGeometry base width - basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon - - // bitfield - unsigned mbCentered : 1; // use centered to ineStart/End point? + ImpLineStartEndAttribute* mpLineStartEndAttribute; public: + /// constructors/assignmentoperator/destructor LineStartEndAttribute( double fWidth, const basegfx::B2DPolyPolygon& rPolyPolygon, - bool bCentered) - : mfWidth(fWidth), - maPolyPolygon(rPolyPolygon), - mbCentered(bCentered) - { - } + bool bCentered); + LineStartEndAttribute(); + LineStartEndAttribute(const LineStartEndAttribute& rCandidate); + LineStartEndAttribute& operator=(const LineStartEndAttribute& rCandidate); + ~LineStartEndAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const LineStartEndAttribute& rCandidate) const - { - return (basegfx::fTools::equal(mfWidth, rCandidate.mfWidth) - && maPolyPolygon == rCandidate.maPolyPolygon - && mbCentered == rCandidate.mbCentered); - } + bool operator==(const LineStartEndAttribute& rCandidate) const; - // data access - double getWidth() const { return mfWidth; } - const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } - bool isCentered() const { return mbCentered; } + // data read access + double getWidth() const; + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const; + bool isCentered() const; bool isActive() const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx index 392f1b0a9113..1941770b9af3 100644 --- a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx @@ -62,7 +62,11 @@ namespace drawinglayer public: // constructors/destructor - MaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity); + MaterialAttribute3D( + const basegfx::BColor& rColor, + const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, + sal_uInt16 nSpecularIntensity); MaterialAttribute3D(const basegfx::BColor& rColor); MaterialAttribute3D(); MaterialAttribute3D(const MaterialAttribute3D& rCandidate); @@ -71,11 +75,13 @@ namespace drawinglayer // assignment operator MaterialAttribute3D& operator=(const MaterialAttribute3D& rCandidate); + // checks if the incarnation is default constructed + bool isDefault() const; + // compare operator bool operator==(const MaterialAttribute3D& rCandidate) const; - bool operator!=(const MaterialAttribute3D& rCandidate) const { return !operator==(rCandidate); } - // data access + // data read access const basegfx::BColor& getColor() const; const basegfx::BColor& getSpecular() const; const basegfx::BColor& getEmission() const; diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx index 0763c2129f0d..c034a5fcc7a2 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx @@ -36,57 +36,53 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX +#include +#include +#include +#include +#include +#include + ////////////////////////////////////////////////////////////////////////////// // predefines -namespace drawinglayer { namespace attribute { - class SdrLineAttribute; - class SdrFillAttribute; - class SdrLineStartEndAttribute; - class SdrShadowAttribute; - class FillGradientAttribute; -}} - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace attribute { - class SdrLineFillShadowAttribute + class SdrLineFillShadowAttribute3D { - // shadow, line, lineStartEnd, fill, transGradient and compound3D attributes - SdrShadowAttribute* mpShadow; // shadow attributes (if used) - SdrLineAttribute* mpLine; // line attributes (if used) - SdrLineStartEndAttribute* mpLineStartEnd; // line start end (if used) - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) + private: + const SdrLineAttribute maLine; + const SdrFillAttribute maFill; + const SdrLineStartEndAttribute maLineStartEnd; + const SdrShadowAttribute maShadow; + const FillGradientAttribute maFillFloatTransGradient; public: - SdrLineFillShadowAttribute( - SdrLineAttribute* pLine = 0, - SdrFillAttribute* pFill = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - FillGradientAttribute* pFillFloatTransGradient = 0); - ~SdrLineFillShadowAttribute(); + /// constructors/assignmentoperator/destructor + SdrLineFillShadowAttribute3D( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient); + SdrLineFillShadowAttribute3D(); - // copy constructor and assigment operator - SdrLineFillShadowAttribute(const SdrLineFillShadowAttribute& rCandidate); - SdrLineFillShadowAttribute& operator=(const SdrLineFillShadowAttribute& rCandidate); + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const SdrLineFillShadowAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpFill || mpLine); } + bool operator==(const SdrLineFillShadowAttribute3D& rCandidate) const; - // data access - const SdrShadowAttribute* getShadow() const { return mpShadow; } - const SdrLineAttribute* getLine() const { return mpLine; } - const SdrLineStartEndAttribute* getLineStartEnd() const { return mpLineStartEnd; } - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } + // data read access + const SdrLineAttribute& getLine() const { return maLine; } + const SdrFillAttribute& getFill() const { return maFill; } + const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; } + const SdrShadowAttribute& getShadow() const { return maShadow; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } }; } // end of namespace overlay } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx deleted file mode 100644 index a22d453c1657..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx +++ /dev/null @@ -1,223 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrattribute.hxx,v $ - * - * $Revision: 1.4 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX - -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines -class SdrTextObj; - -namespace drawinglayer { namespace attribute { - class SdrFillBitmapAttribute; - class FillHatchAttribute; - class FillGradientAttribute; -}} - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineAttribute - { - // line definitions - basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines - double mfWidth; // 1/100th mm, 0.0==hair - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // color of line - ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern - double mfFullDotDashLen; // sum of maDotDashArray (for convenience) - - public: - SdrLineAttribute( - basegfx::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, - const ::std::vector< double >& rDotDashArray, double fFullDotDashLen); - ~SdrLineAttribute(); - - // constructor to create a line attribute for a colored hairline - SdrLineAttribute(const basegfx::BColor& rColor); - - // compare operator - bool operator==(const SdrLineAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (1.0 != mfTransparence); } - bool isDashed() const { return (0L != maDotDashArray.size()); } - - // data access - basegfx::B2DLineJoin getJoin() const { return meJoin; } - double getWidth() const { return mfWidth; } - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } - double getFullDotDashLen() const { return mfFullDotDashLen; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineStartEndAttribute - { - // line arrow definitions - basegfx::B2DPolyPolygon maStartPolyPolygon; // start Line PolyPolygon - basegfx::B2DPolyPolygon maEndPolyPolygon; // end Line PolyPolygon - double mfStartWidth; // 1/100th mm - double mfEndWidth; // 1/100th mm - - // bitfield - unsigned mbStartActive : 1L; // start of Line is active - unsigned mbEndActive : 1L; // end of Line is active - unsigned mbStartCentered : 1L; // Line is centered on line start point - unsigned mbEndCentered : 1L; // Line is centered on line end point - - public: - SdrLineStartEndAttribute( - const basegfx::B2DPolyPolygon& rStartPolyPolygon, const basegfx::B2DPolyPolygon& rEndPolyPolygon, - double fStartWidth, double fEndWidth, bool bStartActive, bool bEndActive, bool bStartCentered, bool bEndCentered); - ~SdrLineStartEndAttribute(); - - // compare operator - bool operator==(const SdrLineStartEndAttribute& rCandidate) const; - - // bool access - bool isStartActive() const { return mbStartActive; } - bool isEndActive() const { return mbEndActive; } - bool isStartCentered() const { return mbStartCentered; } - bool isEndCentered() const { return mbEndCentered; } - bool isVisible() const { return (isStartActive() || isEndActive()); } - - // data access - const basegfx::B2DPolyPolygon& getStartPolyPolygon() const { return maStartPolyPolygon; } - const basegfx::B2DPolyPolygon& getEndPolyPolygon() const { return maEndPolyPolygon; } - double getStartWidth() const { return mfStartWidth; } - double getEndWidth() const { return mfEndWidth; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrShadowAttribute - { - // shadow definitions - basegfx::B2DVector maOffset; // shadow offset 1/100th mm - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // color of shadow - - public: - SdrShadowAttribute( - const basegfx::B2DVector& rOffset, double fTransparence, const basegfx::BColor& rColor); - ~SdrShadowAttribute(); - - // compare operator - bool operator==(const SdrShadowAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (1.0 != mfTransparence); } - - // data access - const basegfx::B2DVector& getOffset() const { return maOffset; } - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrFillAttribute - { - // fill definitions - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // fill color - FillGradientAttribute* mpGradient; // fill gradient (if used) - FillHatchAttribute* mpHatch; // fill hatch (if used) - SdrFillBitmapAttribute* mpBitmap; // fill bitmap (if used) - - public: - SdrFillAttribute( - double fTransparence, const basegfx::BColor& rColor, FillGradientAttribute* pGradient = 0L, - FillHatchAttribute* pHatch = 0L, SdrFillBitmapAttribute* pBitmap = 0L); - ~SdrFillAttribute(); - - // copy constructor and assigment operator - SdrFillAttribute(const SdrFillAttribute& rCandidate); - SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate); - - // compare operator - bool operator==(const SdrFillAttribute& rCandidate) const; - - // bool access - bool isGradient() const { return (0L != mpGradient); } - bool isHatch() const { return (0L != mpHatch); } - bool isBitmap() const { return (0L != mpBitmap); } - bool isColor() const { return (!mpGradient && !mpHatch && !mpBitmap); } - bool isVisible() const { return (1.0 != mfTransparence); } - - // data access - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - const FillGradientAttribute* getGradient() const { return mpGradient; } - const FillHatchAttribute* getHatch() const { return mpHatch; } - const SdrFillBitmapAttribute* getBitmap() const { return mpBitmap; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx deleted file mode 100644 index fd72f09c00f1..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx +++ /dev/null @@ -1,217 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrattribute3d.hxx,v $ - * - * $Revision: 1.4 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class Sdr3DObjectAttribute - { - // 3D object attribute definitions - ::com::sun::star::drawing::NormalsKind maNormalsKind; // normals type (0..2) - ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionX; // texture projection type X (0..2) - ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionY; // texture projection type Y (0..2) - ::com::sun::star::drawing::TextureKind2 maTextureKind; // texture kind (see uno API) - ::com::sun::star::drawing::TextureMode maTextureMode; // texture kind (see uno API) - MaterialAttribute3D maMaterial; // object, specular and emissive colors, SpecularIntensity - - // bitfield - unsigned mbNormalsInvert : 1; // invert normals - unsigned mbDoubleSided : 1; // surfaces are double sided - unsigned mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene - unsigned mbTextureFilter : 1; // filter texture to make more smooth - unsigned mbReducedLineGeometry : 1; // use reduced line geometry (object specific) - - public: - Sdr3DObjectAttribute( - ::com::sun::star::drawing::NormalsKind aNormalsKind, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, - ::com::sun::star::drawing::TextureKind2 aTextureKind, - ::com::sun::star::drawing::TextureMode aTextureMode, - const MaterialAttribute3D& rMaterial, - bool bNormalsInvert, - bool bDoubleSided, - bool bShadow3D, - bool bTextureFilter, - bool bReducedLineGeometry); - - // compare operator - bool operator==(const Sdr3DObjectAttribute& rCandidate) const; - - // data access - ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; } - ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; } - ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; } - ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; } - ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; } - const MaterialAttribute3D& getMaterial() const { return maMaterial; } - bool getNormalsInvert() const { return mbNormalsInvert; } - bool getDoubleSided() const { return mbDoubleSided; } - bool getShadow3D() const { return mbShadow3D; } - bool getTextureFilter() const { return mbTextureFilter; } - bool getReducedLineGeometry() const { return mbReducedLineGeometry; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class Sdr3DLightAttribute - { - // 3D light attribute definitions - basegfx::BColor maColor; - basegfx::B3DVector maDirection; - - // bitfield - unsigned mbSpecular : 1; - - public: - Sdr3DLightAttribute( - const basegfx::BColor& rColor, - const basegfx::B3DVector& rDirection, - bool bSpecular); - - // compare operator - bool operator==(const Sdr3DLightAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getColor() const { return maColor; } - const basegfx::B3DVector& getDirection() const { return maDirection; } - bool getSpecular() const { return mbSpecular; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLightingAttribute - { - // 3D light attribute definitions - basegfx::BColor maAmbientLight; - ::std::vector< Sdr3DLightAttribute > maLightVector; - - public: - SdrLightingAttribute( - const basegfx::BColor& rAmbientLight, - const ::std::vector< Sdr3DLightAttribute >& rLightVector); - - // compare operator - bool operator==(const SdrLightingAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getAmbientLight() const { return maAmbientLight; } - const ::std::vector< Sdr3DLightAttribute >& getLightVector() const { return maLightVector; } - - // color model solver - basegfx::BColor solveColorModel( - const basegfx::B3DVector& rNormalInEyeCoordinates, - const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, - const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const; - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrSceneAttribute - { - // 3D scene attribute definitions - double mfDistance; - double mfShadowSlant; - ::com::sun::star::drawing::ProjectionMode maProjectionMode; - ::com::sun::star::drawing::ShadeMode maShadeMode; - - // bitfield - unsigned mbTwoSidedLighting : 1; - - public: - SdrSceneAttribute( - double fDistance, - double fShadowSlant, - ::com::sun::star::drawing::ProjectionMode aProjectionMode, - ::com::sun::star::drawing::ShadeMode aShadeMode, - bool bTwoSidedLighting); - - // compare operator - bool operator==(const SdrSceneAttribute& rCandidate) const; - - // data access - double getDistance() const { return mfDistance; } - double getShadowSlant() const { return mfShadowSlant; } - ::com::sun::star::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; } - ::com::sun::star::drawing::ShadeMode getShadeMode() const { return maShadeMode; } - bool getTwoSidedLighting() const { return mbTwoSidedLighting; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx new file mode 100644 index 000000000000..6ae2084d1d30 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrFillAttribute; + class FillGradientAttribute; + class FillHatchAttribute; + class SdrFillBitmapAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFillAttribute + { + private: + ImpSdrFillAttribute* mpSdrFillAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap); + SdrFillAttribute(); + SdrFillAttribute(const SdrFillAttribute& rCandidate); + SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate); + ~SdrFillAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrFillAttribute& rCandidate) const; + + // data read access + double getTransparence() const; + const basegfx::BColor& getColor() const; + const FillGradientAttribute& getGradient() const; + const FillHatchAttribute& getHatch() const; + const SdrFillBitmapAttribute& getBitmap() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx index 67fef6ea7e3d..ce9d9e23a086 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx @@ -36,21 +36,23 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines -class SfxItemSet; -namespace drawinglayer { namespace attribute { - class FillBitmapAttribute; -}} +class Bitmap; namespace basegfx { class B2DRange; + class B2DVector; } +namespace drawinglayer { namespace attribute { + class FillBitmapAttribute; + class ImpSdrFillBitmapAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -59,27 +61,42 @@ namespace drawinglayer { class SdrFillBitmapAttribute { - Bitmap maBitmap; - basegfx::B2DVector maSize; - basegfx::B2DVector maOffset; - basegfx::B2DVector maOffsetPosition; - basegfx::B2DVector maRectPoint; - - // bitfield - unsigned mbTiling : 1; - unsigned mbStretch : 1; - unsigned mbLogSize : 1; + private: + ImpSdrFillBitmapAttribute* mpSdrFillBitmapAttribute; public: + /// constructors/assignmentoperator/destructor SdrFillBitmapAttribute( - const Bitmap& rBitmap, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, - const basegfx::B2DVector& rOffsetPosition, const basegfx::B2DVector& rRectPoint, - bool bTiling, bool bStretch, bool bLogSize); + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize); + SdrFillBitmapAttribute(); + SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate); + SdrFillBitmapAttribute& operator=(const SdrFillBitmapAttribute& rCandidate); + ~SdrFillBitmapAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator bool operator==(const SdrFillBitmapAttribute& rCandidate) const; - // data access - const Bitmap& getBitmap() const { return maBitmap; } - bool getTiling() const { return mbTiling; } + // data read access + const Bitmap& getBitmap() const; + const basegfx::B2DVector& getSize() const; + const basegfx::B2DVector& getOffset() const; + const basegfx::B2DVector& getOffsetPosition() const; + const basegfx::B2DVector& getRectPoint() const; + bool getTiling() const; + bool getStretch() const; + bool getLogSize() const; + + // FillBitmapAttribute generator FillBitmapAttribute getFillBitmapAttribute(const basegfx::B2DRange& rRange) const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx new file mode 100644 index 000000000000..aad8c6ff62ec --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B3DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdr3DLightAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class Sdr3DLightAttribute + { + private: + ImpSdr3DLightAttribute* mpSdr3DLightAttribute; + + public: + // constructors/destructor + Sdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular); + Sdr3DLightAttribute(const basegfx::BColor& rColor); + Sdr3DLightAttribute(); + Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate); + ~Sdr3DLightAttribute(); + + // assignment operator + Sdr3DLightAttribute& operator=(const Sdr3DLightAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const Sdr3DLightAttribute& rCandidate) const; + + // data read access + const basegfx::BColor& getColor() const; + const basegfx::B3DVector& getDirection() const; + bool getSpecular() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx new file mode 100644 index 000000000000..b4c84d7cc1b0 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX + +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B3DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLightingAttribute; + class Sdr3DLightAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLightingAttribute + { + private: + ImpSdrLightingAttribute* mpSdrLightingAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector); + SdrLightingAttribute(); + SdrLightingAttribute(const SdrLightingAttribute& rCandidate); + SdrLightingAttribute& operator=(const SdrLightingAttribute& rCandidate); + ~SdrLightingAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLightingAttribute& rCandidate) const; + + // data read access + const basegfx::BColor& getAmbientLight() const; + const ::std::vector< Sdr3DLightAttribute >& getLightVector() const; + + // color model solver + basegfx::BColor solveColorModel( + const basegfx::B3DVector& rNormalInEyeCoordinates, + const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx new file mode 100644 index 000000000000..5df511995e9f --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLineAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineAttribute + { + private: + ImpSdrLineAttribute* mpSdrLineAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen); + SdrLineAttribute(const basegfx::BColor& rColor); + SdrLineAttribute(); + SdrLineAttribute(const SdrLineAttribute& rCandidate); + SdrLineAttribute& operator=(const SdrLineAttribute& rCandidate); + ~SdrLineAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineAttribute& rCandidate) const; + + // data access + basegfx::B2DLineJoin getJoin() const; + double getWidth() const; + double getTransparence() const; + const basegfx::BColor& getColor() const; + const ::std::vector< double >& getDotDashArray() const; + double getFullDotDashLen() const; + + // bool access + bool isDashed() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx new file mode 100644 index 000000000000..76bd836ac770 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class B2DPolyPolygon; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLineStartEndAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineStartEndAttribute + { + private: + ImpSdrLineStartEndAttribute* mpSdrLineStartEndAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered); + SdrLineStartEndAttribute(); + SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate); + SdrLineStartEndAttribute& operator=(const SdrLineStartEndAttribute& rCandidate); + ~SdrLineStartEndAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineStartEndAttribute& rCandidate) const; + + // data read access + const basegfx::B2DPolyPolygon& getStartPolyPolygon() const; + const basegfx::B2DPolyPolygon& getEndPolyPolygon() const; + double getStartWidth() const; + double getEndWidth() const; + bool isStartActive() const; + bool isEndActive() const; + bool isStartCentered() const; + bool isEndCentered() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx new file mode 100644 index 000000000000..d5ee84e8cfec --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX + +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdr3DObjectAttribute; + class MaterialAttribute3D; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class Sdr3DObjectAttribute + { + private: + ImpSdr3DObjectAttribute* mpSdr3DObjectAttribute; + + public: + // constructors/destructor + Sdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry); + Sdr3DObjectAttribute(); + Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate); + ~Sdr3DObjectAttribute(); + + // assignment operator + Sdr3DObjectAttribute& operator=(const Sdr3DObjectAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const Sdr3DObjectAttribute& rCandidate) const; + + // data read access + ::com::sun::star::drawing::NormalsKind getNormalsKind() const; + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const; + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const; + ::com::sun::star::drawing::TextureKind2 getTextureKind() const; + ::com::sun::star::drawing::TextureMode getTextureMode() const; + const MaterialAttribute3D& getMaterial() const; + bool getNormalsInvert() const; + bool getDoubleSided() const; + bool getShadow3D() const; + bool getTextureFilter() const; + bool getReducedLineGeometry() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx new file mode 100644 index 000000000000..7b25b6c48666 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdrSceneAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrSceneAttribute + { + private: + ImpSdrSceneAttribute* mpSdrSceneAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting); + SdrSceneAttribute(); + SdrSceneAttribute(const SdrSceneAttribute& rCandidate); + SdrSceneAttribute& operator=(const SdrSceneAttribute& rCandidate); + ~SdrSceneAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrSceneAttribute& rCandidate) const; + + // data read access + double getDistance() const; + double getShadowSlant() const; + ::com::sun::star::drawing::ProjectionMode getProjectionMode() const; + ::com::sun::star::drawing::ShadeMode getShadeMode() const; + bool getTwoSidedLighting() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx new file mode 100644 index 000000000000..72bdcd2af2c2 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B2DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrShadowAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrShadowAttribute + { + private: + ImpSdrShadowAttribute* mpSdrShadowAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor); + SdrShadowAttribute(); + SdrShadowAttribute(const SdrShadowAttribute& rCandidate); + SdrShadowAttribute& operator=(const SdrShadowAttribute& rCandidate); + ~SdrShadowAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrShadowAttribute& rCandidate) const; + + // data access + const basegfx::B2DVector& getOffset() const; + double getTransparence() const; + const basegfx::BColor& getColor() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx index efe59d1eb9e5..e24ad09d3d6a 100644 --- a/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx @@ -36,13 +36,16 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX -#include -#include +#include #include ////////////////////////////////////////////////////////////////////////////// // predefines +namespace drawinglayer { namespace attribute { + class ImpStrokeAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -52,49 +55,26 @@ namespace drawinglayer class StrokeAttribute { private: - ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern - double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + ImpStrokeAttribute* mpStrokeAttribute; public: + /// constructors/assignmentoperator/destructor StrokeAttribute( const ::std::vector< double >& rDotDashArray, - double fFullDotDashLen = 0.0) - : maDotDashArray(rDotDashArray), - mfFullDotDashLen(fFullDotDashLen) - { - } - - StrokeAttribute() - : maDotDashArray(), - mfFullDotDashLen(0.0) - { - } - - StrokeAttribute(const StrokeAttribute& rCandidate) - { - *this = rCandidate; - } - - StrokeAttribute& operator=(const StrokeAttribute& rCandidate) - { - maDotDashArray = rCandidate.maDotDashArray; - mfFullDotDashLen = rCandidate.mfFullDotDashLen; - return *this; - } + double fFullDotDashLen = 0.0); + StrokeAttribute(); + StrokeAttribute(const StrokeAttribute& rCandidate); + StrokeAttribute& operator=(const StrokeAttribute& rCandidate); + ~StrokeAttribute(); - ~StrokeAttribute() - { - } + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const StrokeAttribute& rCandidate) const - { - return (mfFullDotDashLen == rCandidate.mfFullDotDashLen - && maDotDashArray == rCandidate.maDotDashArray); - } + bool operator==(const StrokeAttribute& rCandidate) const; - // data access - const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + // data read access + const ::std::vector< double >& getDotDashArray() const; double getFullDotDashLen() const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx index 0a87b268c8b1..c7cd87df6ffd 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx @@ -122,12 +122,18 @@ namespace drawinglayer */ ViewInformation2D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters); + /// default (empty) constructor + ViewInformation2D(); + /// copy constructor ViewInformation2D(const ViewInformation2D& rCandidate); /// destructor ~ViewInformation2D(); + // checks if the incarnation is default constructed + bool isDefault() const; + /// assignment operator ViewInformation2D& operator=(const ViewInformation2D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx index 605c26733cf3..a76ee2e21226 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx @@ -127,12 +127,18 @@ namespace drawinglayer */ ViewInformation3D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters); + /// default (empty) constructor + ViewInformation3D(); + /// copy constructor ViewInformation3D(const ViewInformation3D& rCandidate); /// destructor ~ViewInformation3D(); + // checks if the incarnation is default constructed + bool isDefault() const; + /// assignment operator ViewInformation3D& operator=(const ViewInformation3D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx deleted file mode 100644 index 10288b70bd1b..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: alphaprimitive2d.hxx,v $ - * - * $Revision: 1.3 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** AlphaPrimitive2D class - - This is the basic primitive for applying freely defined transparence - to freely defined content. The basic idea is to associate a content - which is defined as a sequence of primitives and hold as child content - in the GroupPrimitive2D with an alpha channel also defined as a sequence - of primitives and hold in the Alpha member. - - The basic definition is to use the Alpha content as Alpha-Mask by - interpreting the Alpha-content not as RGB, but as Luminance alpha mask - using the common RGB_to_luminance definition as e.g. used by VCL. - - The defining geometry is the Range of the child primitive sequence, - this means the renderers will/shall use this geometric information for - rendering, not the alpha one. The alpha one should/will be clipped - accordingly. - */ - class AlphaPrimitive2D : public GroupPrimitive2D - { - private: - /// The Alpha-Mask who's RGB-Values are interpreted as Luminance - Primitive2DSequence maAlpha; - - public: - /** constructor - - @param rChildren - The content which is defined to have a transparency. The - range of this primitive is defined by this content - - @param rAlpha - The definition of the Alpha-channel for this primitive. It - will be interpreted as mask by interpreting as gray values - using the common RGB_to_luminance definitions - */ - AlphaPrimitive2D( - const Primitive2DSequence& rChildren, - const Primitive2DSequence& rAlpha); - - /// data read access - const Primitive2DSequence& getAlpha() const { return maAlpha; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx index 6cf45ffefe54..254d535f9060 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -110,14 +110,16 @@ namespace drawinglayer Current Basic 2D Primitives are: - - BitmapPrimitive2D (bitmap data, evtl. with alpha) - - MetafilePrimitive2D (VCL Metafile, currently no decomposition, but planned, so may vanish) + - BitmapPrimitive2D (bitmap data, evtl. with transparence) - PointArrayPrimitive2D (single points) - PolygonHairlinePrimitive2D (hairline curves/polygons) - PolyPolygonColorPrimitive2D (colored polygons) + UPDATE: MetafilePrimitive2D (VCL Metafile) is taken off this list since + it is implemented with the integration of CWS aw078 into DV300m69. + All other implemented primitives have a defined decomposition and can thus be - decomposed downt to this small set. + decomposed down to this small set. A renderer implementing support for this minimal set of primitives can completely render primitive-based visualisations. Of course, he also has to take states into account diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index d287482389b5..88848207dae4 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -48,7 +48,7 @@ ////////////////////////////////////////////////////////////////////////////// // local primitives -#define PRIMITIVE2D_ID_ALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0) +#define PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0) #define PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 1) #define PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 2) #define PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 3) @@ -83,7 +83,7 @@ #define PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 32) #define PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 33) #define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 34) -#define PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35) +#define PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35) #define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36) #define PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 37) #define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38) @@ -101,14 +101,14 @@ #define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) #define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) #define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52) -#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) -#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54) -#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55) -#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56) -#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57) -#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58) -#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59) -#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60) +#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) +#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54) +#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55) +#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56) +#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57) +#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58) +#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59) +#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index 0fd084c6fad0..0c6a28f29b41 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -37,7 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX #include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 1df3bb103eb0..a6640d67b877 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -37,7 +37,8 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // FillHatchPrimitive2D class diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx index 4ba83fc75c88..2dee07dd6de9 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx @@ -74,7 +74,7 @@ namespace drawinglayer /// Grid color for single-pixel grid points basegfx::BColor maBColor; - /// The Bitmap (with alpha) for grid cross points + /// The Bitmap (with transparence) for grid cross points BitmapEx maCrossMarker; /** the last used object to view transformtion and the last Viewport, diff --git a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx index 89b49420a3e7..0fe7c1903815 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx @@ -71,7 +71,7 @@ namespace drawinglayer Current Basic 2D StatePrimitives are: - - AlphaPrimitive2D (objects with freely defined transparence) + - TransparencePrimitive2D (objects with freely defined transparence) - InvertPrimitive2D (for XOR) - MaskPrimitive2D (for masking) - ModifiedColorPrimitive2D (for a stack of color modifications) diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx new file mode 100644 index 000000000000..08ddd8237688 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.hxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // This primitive is used to represent geometry for non-visible objects, + // e.g. a PresObj's outline. To still be able to use primitives for HitTest + // functionality, the 2d decompositions will produce an as much as possible + // simplified line geometry encapsulated in this primtive when there is no + // line geometry. In a further enchanced version this may change to 'if neither + // filled nor lines' creation criteria. The whole primitive decomposes to nothing, + // so no one not knowing it will be influenced. Only helper processors for hit test + // (and maybe BoundRect extractors) will use it and it's children subcontent. + class HiddenGeometryPrimitive2D : public GroupPrimitive2D + { + public: + HiddenGeometryPrimitive2D(const Primitive2DSequence& rChildren); + + // despite returning an empty decomposition since it's no visualisation data, + // range calculation is intended to use hidden geometry, so + // the local implementation will return the children's range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// local decomposition. Implementation will return empty Primitive2DSequence + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx deleted file mode 100644 index 3b69c685c985..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: hittestprimitive3d.hxx,v $ - * - * $Revision: 1.1.2.1 $ - * - * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** HitTestPrimitive2D class - - This primitive is used to represent geometry for non-visible objects, - e.g. a PresObj's outline. To still be able to use primitives for HitTest - functionality, the 2d decompositions will produce an as much as possible - simplified line geometry encapsulated in this primtive when there is no - line geometry. In a further enchanced version this may change to 'if neither - filled nor lines' creation criteria. The whole primitive decomposes to nothing, - so no one not knowing it will be influenced. Only helper processors for hit test - (and maybe BoundRect extractors) will use it and it's children subcontent. - */ - class HitTestPrimitive2D : public GroupPrimitive2D - { - public: - /// constructor - HitTestPrimitive2D(const Primitive2DSequence& rChildren); - - /** despite returning an empty decomposition since it's no visualisation data, - range calculation is intended to use invisible replacement geometry, so - the local implementation will return the children's range - */ - virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - - /** local decomposition. Implementation will return empty Primitive2DSequence - since this is no visualisation data - */ - virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx index 85f1c6510c5a..b7c47268dd5d 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx @@ -2,7 +2,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unifiedalphaprimitive2d.hxx,v $ + * $RCSfile: UnifiedTransparencePrimitive2D.hxx,v $ * * $Revision: 1.3 $ * diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index cc4c054f8bb3..0e525ef691d3 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -55,7 +55,7 @@ namespace drawinglayer invariant, so that the bitmap is always visualized unscaled and unrotated. It is used e.g. for grid position visualisation. The given Bitmap - (with alpha) is defined to be visible centered at each of the given + (with transparence) is defined to be visible centered at each of the given positions. It decomposes to the needed number of BitmapPrimitive2D's, so it would be efficient to handle it directly in a renderer. diff --git a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx index 0cbd7e4628cb..0f25ce069021 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - /** MediaPrimitive2D class + /** MetafilePrimitive2D class This is the MetaFile representing primitive. It's geometry is defined by MetaFileTransform. The content (defined by MetaFile) will be scaled diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index 4c6f5b49bf01..2ffa1b01e243 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -41,6 +41,8 @@ #include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// // PolygonHairlinePrimitive2D class diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 187e89f42e97..07e6849ff1fc 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -37,12 +37,14 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX #include -#include #include #include #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // PolyPolygonHairlinePrimitive2D class @@ -409,7 +411,7 @@ namespace drawinglayer /** PolyPolygonBitmapPrimitive2D class This primitive defines a PolyPolygon filled with bitmap data - (including alpha). The decomosition will create a MaskPrimitive2D + (including transparence). The decomosition will create a MaskPrimitive2D containing a FillBitmapPrimitive2D. */ class PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index 65d2bdf67f92..96d58cc0ca10 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -38,10 +38,12 @@ #include #include -#include #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx new file mode 100644 index 000000000000..e27a3b2b7725 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrdecompositiontools3d.hxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class B2DPolyPolygon; + class B2DHomMatrix; +} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // helpers to create HitTestPrimitives Line + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DHomMatrix& rMatrix); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolygon); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange, + const basegfx::B2DHomMatrix& rMatrix); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolygon, + const basegfx::B2DHomMatrix& rMatrix); + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx new file mode 100644 index 000000000000..85032d0bd202 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: alphaprimitive2d.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** TransparencePrimitive2D class + + This is the basic primitive for applying freely defined transparence + to freely defined content. The basic idea is to associate a content + which is defined as a sequence of primitives and hold as child content + in the GroupPrimitive2D with a transparence channel also defined as a sequence + of primitives and hold in the transparence member. + + The basic definition is to use the transparence content as transparence-Mask by + interpreting the transparence-content not as RGB, but as Luminance transparence mask + using the common RGB_to_luminance definition as e.g. used by VCL. + + The defining geometry is the Range of the child primitive sequence, + this means the renderers will/shall use this geometric information for + rendering, not the transparent one. The transparent one should/will be clipped + accordingly. + */ + class TransparencePrimitive2D : public GroupPrimitive2D + { + private: + /// The transparence-Mask who's RGB-Values are interpreted as Luminance + Primitive2DSequence maTransparence; + + public: + /** constructor + + @param rChildren + The content which is defined to have a transparency. The + range of this primitive is defined by this content + + @param rTransparence + The definition of the Transparence-channel for this primitive. It + will be interpreted as mask by interpreting as gray values + using the common RGB_to_luminance definitions + */ + TransparencePrimitive2D( + const Primitive2DSequence& rChildren, + const Primitive2DSequence& rTransparence); + + /// data read access + const Primitive2DSequence& getTransparence() const { return maTransparence; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx deleted file mode 100644 index 6e8970e7bee5..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: unifiedalphaprimitive2d.hxx,v $ - * - * $Revision: 1.3 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** UnifiedAlphaPrimitive2D class - - This primitive encapsualtes a child hierarchy and defines - that it shall be visualized with the given transparency. That - transparency is unique for all contained geometry, so that - e.g. overlapping polygons in the child geometry will not show - regions of combined transparency, but be all rendered with the - defined, single transparency. - */ - class UnifiedAlphaPrimitive2D : public GroupPrimitive2D - { - private: - /// the unified alpha transparence - double mfAlpha; - - public: - /// constructor - UnifiedAlphaPrimitive2D( - const Primitive2DSequence& rChildren, - double fAlpha); - - /// data read access - double getAlpha() const { return mfAlpha; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - - /// create decomposition - virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx new file mode 100644 index 000000000000..52f3747ddba2 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UnifiedTransparencePrimitive2D.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** UnifiedTransparencePrimitive2D class + + This primitive encapsualtes a child hierarchy and defines + that it shall be visualized with the given transparency. That + transparency is unique for all contained geometry, so that + e.g. overlapping polygons in the child geometry will not show + regions of combined transparency, but be all rendered with the + defined, single transparency. + */ + class UnifiedTransparencePrimitive2D : public GroupPrimitive2D + { + private: + /// the unified transparence + double mfTransparence; + + public: + /// constructor + UnifiedTransparencePrimitive2D( + const Primitive2DSequence& rChildren, + double fTransparence); + + /// data read access + double getTransparence() const { return mfTransparence; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// own getB2DRange implementation to include transparent geometries to BoundRect calculations + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// create decomposition + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx index f5a851b0b053..f5d6a92cff68 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx @@ -45,25 +45,25 @@ ////////////////////////////////////////////////////////////////////////////// // local primitives -#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0) -#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1) -#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2) -#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3) -#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4) -#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5) -#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6) -#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7) -#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8) -#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9) -#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10) -#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11) -#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12) -#define PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13) -#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14) -#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15) -#define PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16) -#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17) -#define PRIMITIVE3D_ID_HITTESTPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18) +#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0) +#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1) +#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2) +#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3) +#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4) +#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5) +#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6) +#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7) +#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8) +#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9) +#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10) +#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11) +#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12) +#define PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13) +#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14) +#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15) +#define PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16) +#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17) +#define PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx index 69e406c75d67..8e7004be5b51 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx @@ -59,7 +59,7 @@ namespace drawinglayer - TexturePrimitive3D (with the following variations) - GradientTexturePrimitive3D (for 3D gradient fill) - BitmapTexturePrimitive3D (for 3D Bitmap fill) - - AlphaTexturePrimitive3D (for 3D transparence) + - TransparenceTexturePrimitive3D (for 3D transparence) - HatchTexturePrimitive3D (for 3D hatch fill) - TransformPrimitive3D (for a transformation stack) */ diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx index 2675a1284779..d63125d8cc29 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx @@ -37,6 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX #include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx new file mode 100644 index 000000000000..287bfcc689e4 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.hxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive3d + { + // This primitive is used to represent geometry for non-visible objects, + // e.g. a 3D cube without fill attributes. To still be able to use + // primitives for HitTest functionality, the 3d decompositions produce + // an as much as possible simplified fill geometry encapsulated in this + // primtive when there is no fill geometry. Currently, the 3d hit test + // uses only areas, so maybe in a further enchanced version this will change + // to 'if neither filled nor lines' creation criteria. The whole primitive + // decomposes to nothing, so no one not knowing it will be influenced. Only + // helper processors for hit test (and maybe BoundRect extractors) will + // use it and it's children subcontent. + class HiddenGeometryPrimitive3D : public GroupPrimitive3D + { + public: + HiddenGeometryPrimitive3D(const Primitive3DSequence& rChildren); + + // despite returning an empty decomposition since it's no visualisation data, + // range calculation is intended to use hidden geometry, so + // the local implementation will return the children's range + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; + + /// The default implementation returns an empty sequence + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx deleted file mode 100644 index 4779241033b0..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: hittestprimitive3d.hxx,v $ - * - * $Revision: 1.1.2.1 $ - * - * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive3d - { - /** HitTestPrimitive3D class - - This primitive is used to represent geometry for non-visible objects, - e.g. a 3D cube without fill attributes. To still be able to use - primitives for HitTest functionality, the 3d decompositions produce - an as much as possible simplified fill geometry encapsulated in this - primtive when there is no fill geometry. Currently, the 3d hit test - uses only areas, so maybe in a further enchanced version this will change - to 'if neither filled nor lines' creation criteria. The whole primitive - decomposes to nothing, so no one not knowing it will be influenced. Only - helper processors for hit test (and maybe BoundRect extractors) will - use it and it's children subcontent. - */ - class HitTestPrimitive3D : public GroupPrimitive3D - { - public: - /// constructor - HitTestPrimitive3D(const Primitive3DSequence& rChildren); - - /** despite returning an empty decomposition since it's no visualisation data, - range calculation is intended to use invisible replacement geometry, so - the local implementation will return the children's range - */ - virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - - /** local decomposition. Implementation will return empty Primitive3DSequence - since this is no visualisation data - */ - virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive3DIDBlock() - }; - } // end of namespace primitive3d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx index b3a57f2677dc..8d0e5512f8fa 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx @@ -61,7 +61,7 @@ namespace drawinglayer SdrCubePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// compare operator diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx index 5b793a6928f8..f9710b4b70a7 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx @@ -89,13 +89,20 @@ namespace drawinglayer const basegfx::B2DVector& rTextureSize, const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient = 0L); + const attribute::FillGradientAttribute& rFillGradient); Primitive3DSequence createShadowPrimitive3D( const Primitive3DSequence& rSource, const attribute::SdrShadowAttribute& rShadow, bool bShadow3D); - } // end of namespace overlay + + Primitive3DSequence createHiddenGeometryPrimitives3D( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute); + + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx index a810e0f5ec8e..9531e5ffa0b9 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx @@ -95,7 +95,7 @@ namespace drawinglayer SdrExtrudePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, double fDepth, diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx index 084ce5bce35e..5e429e595d7f 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx @@ -109,7 +109,7 @@ namespace drawinglayer SdrLathePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, sal_uInt32 nHorizontalSegments, diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx index a6c68bd16da8..6c1a677675a0 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx @@ -70,7 +70,7 @@ namespace drawinglayer const basegfx::B3DPolyPolygon& rPolyPolygon3D, const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// data access diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx index 4dd620848387..0a4301d2c00d 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx @@ -40,8 +40,8 @@ #include #include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -61,7 +61,7 @@ namespace drawinglayer /// object surface attributes basegfx::B3DHomMatrix maTransform; basegfx::B2DVector maTextureSize; - attribute::SdrLineFillShadowAttribute maSdrLFSAttribute; + attribute::SdrLineFillShadowAttribute3D maSdrLFSAttribute; attribute::Sdr3DObjectAttribute maSdr3DObjectAttribute; protected: @@ -80,13 +80,13 @@ namespace drawinglayer SdrPrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// data read access const basegfx::B3DHomMatrix& getTransform() const { return maTransform; } const basegfx::B2DVector& getTextureSize() const { return maTextureSize; } - const attribute::SdrLineFillShadowAttribute& getSdrLFSAttribute() const { return maSdrLFSAttribute; } + const attribute::SdrLineFillShadowAttribute3D& getSdrLFSAttribute() const { return maSdrLFSAttribute; } const attribute::Sdr3DObjectAttribute getSdr3DObjectAttribute() const { return maSdr3DObjectAttribute; } /// compare operator diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx index 52e646e6b4dc..0bd1cf7f3e17 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx @@ -66,7 +66,7 @@ namespace drawinglayer SdrSpherePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments); diff --git a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx index f8b81e357ea5..8825c76f6d6c 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -37,9 +37,10 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX #include -#include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -91,13 +92,13 @@ namespace drawinglayer { namespace primitive3d { - /** UnifiedAlphaTexturePrimitive3D class + /** UnifiedTransparenceTexturePrimitive3D class This 3D primitive expands TexturePrimitive3D to a unified - alpha (transparence) texture definition. All 3D primitives + transparence texture definition. All 3D primitives embedded here will be shown with the given transparency. */ - class UnifiedAlphaTexturePrimitive3D : public TexturePrimitive3D + class UnifiedTransparenceTexturePrimitive3D : public TexturePrimitive3D { private: /// transparency definition @@ -105,7 +106,7 @@ namespace drawinglayer public: /// constructor - UnifiedAlphaTexturePrimitive3D( + UnifiedTransparenceTexturePrimitive3D( double fTransparence, const Primitive3DSequence& rChildren); @@ -115,6 +116,9 @@ namespace drawinglayer /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; + /// own getB3DRange implementation to include transparent geometries to BoundRect calculations + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; + /// local decomposition. virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; @@ -208,18 +212,18 @@ namespace drawinglayer { namespace primitive3d { - /** AlphaTexturePrimitive3D class + /** TransparenceTexturePrimitive3D class - This 3D primitive expands TexturePrimitive3D to a alpha texture - definition. For alpha definition, a gradient is used. The values in - that gradient will be interpreted as luminance Alpha-Values. All 3D + This 3D primitive expands TexturePrimitive3D to a transparence texture + definition. For transparence definition, a gradient is used. The values in + that gradient will be interpreted as luminance Transparence-Values. All 3D primitives embedded here will be shown with the defined transparence. */ - class AlphaTexturePrimitive3D : public GradientTexturePrimitive3D + class TransparenceTexturePrimitive3D : public GradientTexturePrimitive3D { public: /// constructor - AlphaTexturePrimitive3D( + TransparenceTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize); diff --git a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx index fceae8dbeb31..58b5601f6242 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx @@ -45,30 +45,159 @@ namespace drawinglayer { namespace processor2d { + /** BaseProcessor2D class + + Baseclass for all C++ implementations of instances which process + primitives. + + Instances which process primitives can be renderers, but also stuff + for HitTests, BoundRect calculations and/or animation processing. The + main usage are renderers, but they are supposed to handle any primitive + processing. + + The base implementation is constructed with a ViewInformation2D which + is accessible throughout the processor implementations. The idea is + to construct any processor with a given ViewInformation2D. To be able + to handle primitives which need to change the current transformation + (as e.g. TransformPrimitive2D) it is allowed for the processor implementation + to change tis local value using updateViewInformation. + + The basic processing method is process(..) which gets handed over the + sequence of primitives to process. For convenience of the C++ implementations, + the default implementation of process(..) maps all accesses to primitives to + single calls to processBasePrimitive2D(..) where the primitive in question is + already casted to the C++ implementation class. + + The process(..) implementation makes a complete iteration over the given + sequence of primitives. If the Primitive is not derived from BasePrimitive2D + and thus not part of the C++ implementations, it converts ViewInformation2D + to the corresponding API implementation (an uno::Sequence< beans::PropertyValue >) + and recursively calls the method process(..) at the primitive with the decomposition + derived from that primitive. This is the preparation to handle unknown implementations + of the com::sun::star::graphic::XPrimitive2D interface in the future. + + So, to implement a basic processor, it is necessary to overload and implement the + processBasePrimitive2D(..) method. A minimal renderer has to support the + Basic Primitives (see baseprimitive2d.hxx) and the Grouping Primitives (see + groupprimitive2d.hxx). These are (currently): + + Basic Primitives: + + - BitmapPrimitive2D (bitmap data, evtl. with transparence) + - PointArrayPrimitive2D (single points) + - PolygonHairlinePrimitive2D (hairline curves/polygons) + - PolyPolygonColorPrimitive2D (colored polygons) + + Grouping Primitives: + + - TransparencePrimitive2D (objects with freely defined transparence) + - InvertPrimitive2D (for XOR) + - MaskPrimitive2D (for masking) + - ModifiedColorPrimitive2D (for a stack of color modifications) + - TransformPrimitive2D (for a transformation stack) + + A processor doing so is a minimal processor. Of course a processor may + handle any higher-level prmitive (that has a decomposition implementation) + for more direct data access or performance reasons, too. + + The main part of a processBasePrimitive2D implementation is a switch..case + construct, looking like the following: + + void foo::processBasePrimitive2D(const BasePrimitive2D& rCandidate) + { + switch(rCandidate.getPrimitive2DID()) + { + case PRIMITIVE2D_ID_??? : + { + // process PRIMITIVE2D_ID_??? here... + + ... + + break; + } + + ... + + default : + { + // process recursively + process(rCandidate.get2DDecomposition(getViewInformation2D())); + break; + } + } + } + + The default case makes the processor work with all complex primitives + by recursively using their decomposition. + + You can also add a case for ignoring primitives by using: + + case PRIMITIVE2D_ID_...IGNORE.A.. : + case PRIMITIVE2D_ID_...IGNORE.B.. : + case PRIMITIVE2D_ID_...IGNORE.C.. : + { + // ignore these primitives by neither processing nor + // recursively processing their decomposition + break; + } + + Another useful case is embedding the processing of a complex primitive by + bracketing it with some actions: + + case PRIMITIVE2D_ID_SOME_TEXT : + { + // encapsulate e.g. with changing local varibles, e.g. + // sometimes it's good to know if a basic primitive is + // part of a text, especially when not handling the text + // self but by purpose want to handle the decomposed + // geometries in the processor + startText(); + process(rCandidate.get2DDecomposition(getViewInformation2D())); + endText(); + break; + } + + As an example a processor collecting the outlines of a sequence of primitives + only needs to handle some Basic Primitives and create outline and collect + outline polygons e.g. for primitives with area like BitmapPrimitive2D (a + rectangle) and PolyPolygonColorPrimitive2D. When also handling the Grouping + Primitives MaskPrimitive2D (e.g. ignoring it's content, using the mask polyPolygon) + and TransformPrimitive2D (to have the correct local transformation), a processor + creating the outline can be written using just four (4) primitives. As a tipp, it can + be helpful to add many for the purpose not interesting higher level primitives + to not force their decomposition to be created and/or parsed. + */ class BaseProcessor2D { private: + /// The ViewInformation2D itself. It's private to isolate accesses to it geometry::ViewInformation2D maViewInformation2D; protected: + /* access method to allow the implementations to change the current + ViewInformation2D if needed. This allows isolating these accesses + later if needed + */ void updateViewInformation(const geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; } - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive2D-based. - // Default implementation does nothing + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive2D-based. + Default implementation does nothing + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: + /// constructor/destructor BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation); virtual ~BaseProcessor2D(); - // the central processing method + /// the central processing method virtual void process(const primitive2d::Primitive2DSequence& rSource); - // data access + /// data read access const geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; } }; } // end of namespace processor2d @@ -76,6 +205,44 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +namespace drawinglayer +{ + namespace processor2d + { + /** CollectingProcessor2D class + + A processor which just collects all primitives given to it in + process(..) calls to maPrimitive2DSequence. This can e.g. be used to + hand around as instance over various methods where every called + method can add graphic content to it. + */ + class CollectingProcessor2D : public BaseProcessor2D + { + private: + primitive2d::Primitive2DSequence maPrimitive2DSequence; + + public: + CollectingProcessor2D(const geometry::ViewInformation2D& rViewInformation); + virtual ~CollectingProcessor2D(); + + /// the central processing method + virtual void process(const primitive2d::Primitive2DSequence& rSource); + + /// helpers for adding to local sequence + void appendPrimitive2DReference(const primitive2d::Primitive2DReference& rSource) + { + primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, rSource); + } + + /// data access and reset + const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + void reset() { maPrimitive2DSequence = primitive2d::Primitive2DSequence(); } + }; + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + #endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX // eof diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx index 0c356e731169..13f1d540c239 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx @@ -64,10 +64,10 @@ namespace drawinglayer { namespace primitive2d { class MetafilePrimitive2D; class TextSimplePortionPrimitive2D; class BitmapPrimitive2D; - class AlphaPrimitive2D; + class TransparencePrimitive2D; class PolygonStrokePrimitive2D; class FillBitmapPrimitive2D; - class UnifiedAlphaPrimitive2D; + class UnifiedTransparencePrimitive2D; }} ////////////////////////////////////////////////////////////////////////////// @@ -76,6 +76,11 @@ namespace drawinglayer { namespace processor2d { + /** canvasProcessor2D class + + A basic implementation of a renderer for com::sun::star::rendering::XCanvas + as a target + */ class canvasProcessor2D : public BaseProcessor2D { private: @@ -111,10 +116,10 @@ namespace drawinglayer void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate); void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate); void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); - void impRenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rAlphaCandidate); + void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate); void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive); void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D); - void impRenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate); + void impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate); public: canvasProcessor2D( diff --git a/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx index dbe85fab07c5..9d4dd48f8dff 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx @@ -46,13 +46,18 @@ namespace drawinglayer { namespace processor2d { + /** ContourExtractor2D class + + A processor who extracts the contour of the primtives feeded to it + in the single local PolyPolygon + */ class ContourExtractor2D : public BaseProcessor2D { private: - // the extracted contour + /// the extracted contour std::vector< basegfx::B2DPolyPolygon > maExtractedContour; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: diff --git a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx index c0ab33052883..640ec11260c3 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx @@ -51,29 +51,36 @@ namespace drawinglayer { namespace processor2d { + /** HitTestProcessor2D class + + This processor implements a HitTest with the feeded primitives, + given tolerance and extras + */ class HitTestProcessor2D : public BaseProcessor2D { private: - // discrete HitTest position + /// discrete HitTest position basegfx::B2DPoint maDiscreteHitPosition; - // discrete HitTolerance + /// discrete HitTolerance double mfDiscreteHitTolerance; - // bitfield + /// bitfield unsigned mbHit : 1; unsigned mbHitToleranceUsed : 1; - // this flag decides if primitives of type HitTestPrimitive2D - // will be taken into account for HitTesting or not. Those primitives - // are created for objects which are else completely invisible and normally - // their content exists of hairline primitives describing the object's contour - unsigned mbUseHitTestPrimitiveContent : 1; + /* this flag decides if primitives which are embedded to an + UnifiedTransparencePrimitive2D and are invisible will be taken into account for + HitTesting or not. Those primitives are created for objects which are else + completely invisible and normally their content exists of hairline + primitives describing the object's contour + */ + unsigned mbUseInvisiblePrimitiveContent : 1; - // flag to concentraze on text hits only + /// flag to concentraze on text hits only unsigned mbHitTextOnly : 1; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); bool checkHairlineHitWithTolerance( const basegfx::B2DPolygon& rPolygon, @@ -91,18 +98,18 @@ namespace drawinglayer bool bHitTextOnly); virtual ~HitTestProcessor2D(); - // data write access - void setUseHitTestPrimitiveContent(bool bNew) + /// data write access + void setUseInvisiblePrimitiveContent(bool bNew) { - if((bool)mbUseHitTestPrimitiveContent != bNew) mbUseHitTestPrimitiveContent = bNew; + if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew; } - // data read access + /// data read access const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; } double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; } bool getHit() const { return mbHit; } bool getHitToleranceUsed() const { return mbHitToleranceUsed; } - bool getUseHitTestPrimitiveContent() const { return mbUseHitTestPrimitiveContent;} + bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;} bool getHitTextOnly() const { return mbHitTextOnly; } }; } // end of namespace processor2d diff --git a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx index b2697abece66..8162bb0934f4 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx @@ -45,16 +45,21 @@ namespace drawinglayer { namespace processor2d { + /** LineGeometryExtractor2D class + + This processor can extract the line geometry from feeded primpitives. The + hairlines and the fille geometry from fat lines are separated. + */ class LineGeometryExtractor2D : public BaseProcessor2D { private: std::vector< basegfx::B2DPolygon > maExtractedHairlines; std::vector< basegfx::B2DPolyPolygon > maExtractedLineFills; - // bitfield + /// bitfield unsigned mbInLineGeometry : 1; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: diff --git a/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx index 88d9416b612a..77fa9432539d 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace processor2d { - // helper data structure for returning the result + /// helper data structure for returning the result struct TextAsPolygonDataNode { private: @@ -73,9 +73,13 @@ namespace drawinglayer bool getIsFilled() const { return mbIsFilled; } }; - // typedef for a vector of that helper data + /// typedef for a vector of that helper data typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector; + /** TextAsPolygonExtractor2D class + + This processor extracts text in the feeded primitives to filled polygons + */ class TextAsPolygonExtractor2D : public BaseProcessor2D { private: diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx index 38e7e5143b8a..66af45a7c6ce 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx @@ -47,6 +47,7 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class GDIMetaFile; class Rectangle; class Gradient; @@ -70,10 +71,22 @@ namespace drawinglayer { namespace processor2d { + /** VclMetafileProcessor2D class + + This processor derived from VclProcessor2D is the base class for rendering + all feeded primitives to a classical VCL-Metafile, including all over the + time grown extra data in comments and PDF exception data creations. Also + printing needs some exception stuff. + + All in all it is needed to emulate the old ::paint output from the old + Drawinglayer as long as exporters and/or filters still use the Metafile + and the extra-data added to it (which can be seen mostly as 'extensions' + or simply as 'hacks'). + */ class VclMetafileProcessor2D : public VclProcessor2D { private: - // local helper(s) + /// local helper(s) Rectangle impDumpToMetaFile( const primitive2d::Primitive2DSequence& rContent, GDIMetaFile& o_rContentMetafile); @@ -93,42 +106,47 @@ namespace drawinglayer void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); - // the current clipping PolyPolygon from MaskPrimitive2D + /// the current clipping PolyPolygon from MaskPrimitive2D basegfx::B2DPolyPolygon maClipPolyPolygon; - // the target MetaFile + /// the target MetaFile GDIMetaFile* mpMetaFile; - // do not allow embedding SvtGraphicFills into each other, - // use a counter to prevent that + /* do not allow embedding SvtGraphicFills into each other, + use a counter to prevent that + */ sal_uInt32 mnSvtGraphicFillCount; - // same for SvtGraphicStroke + /// same for SvtGraphicStroke sal_uInt32 mnSvtGraphicStrokeCount; - // hold the last unified transparence value to have it handy - // on SvtGraphicStroke creation + /* hold the last unified transparence value to have it handy + on SvtGraphicStroke creation + */ double mfCurrentUnifiedTransparence; - // break iterator support - // made static so it only needs to be fetched once, even with many single - // constructed VclMetafileProcessor2D. It's still incarnated on demand, - // but exists for OOo runtime now by purpose. + /* break iterator support + made static so it only needs to be fetched once, even with many single + constructed VclMetafileProcessor2D. It's still incarnated on demand, + but exists for OOo runtime now by purpose. + */ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIterator; - // vcl::PDFExtOutDevData support - // For the first step, some extra actions at vcl::PDFExtOutDevData need to - // be emulated with the VclMetafileProcessor2D. These are potentially temporarily - // since PDF export may use PrimitiveSequences one day directly. + /* vcl::PDFExtOutDevData support + For the first step, some extra actions at vcl::PDFExtOutDevData need to + be emulated with the VclMetafileProcessor2D. These are potentially temporarily + since PDF export may use PrimitiveSequences one day directly. + */ vcl::PDFExtOutDevData* mpPDFExtOutDevData; protected: - // the local processor for BasePrinitive2D-Implementation based primitives, - // called from the common process()-implementation + /* the local processor for BasePrinitive2D-Implementation based primitives, + called from the common process()-implementation + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: - // constructor/destructor + /// constructor/destructor VclMetafileProcessor2D( const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev); diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx index 836a097ae4d9..0d277325129b 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx @@ -39,35 +39,40 @@ #include #include -////////////////////////////////////////////////////////////////////////////// -// predefines - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace processor2d { + /** VclPixelProcessor2D class + + This processor derived from VclProcessor2D is the base class for rendering + all feeded primitives to a VCL Window. It is the currently used renderer + for all VCL editing output from the DrawingLayer. + */ class VclPixelProcessor2D : public VclProcessor2D { private: - // The Pixel renderer resets the original MapMode from the OutputDevice. - // For some situations it is necessary to get it again, so it is rescued here + /* The Pixel renderer resets the original MapMode from the OutputDevice. + For some situations it is necessary to get it again, so it is rescued here + */ MapMode maOriginalMapMode; protected: - // the local processor for BasePrinitive2D-Implementation based primitives, - // called from the common process()-implementation + /* the local processor for BasePrinitive2D-Implementation based primitives, + called from the common process()-implementation + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: - // constructor/destructor + /// constructor/destructor VclPixelProcessor2D( const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev); virtual ~VclPixelProcessor2D(); - // data access + /// data read access const MapMode& getOriginalMapMode() const { return maOriginalMapMode; } }; } // end of namespace processor2d diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index ff77cc3fd5d0..0cef3da7a8ee 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -55,8 +55,8 @@ namespace drawinglayer { namespace primitive2d { class PolyPolygonColorPrimitive2D; class MetafilePrimitive2D; class MaskPrimitive2D; - class UnifiedAlphaPrimitive2D; - class AlphaPrimitive2D; + class UnifiedTransparencePrimitive2D; + class TransparencePrimitive2D; class TransformPrimitive2D; class MarkerArrayPrimitive2D; class PointArrayPrimitive2D; @@ -73,6 +73,11 @@ namespace drawinglayer { namespace processor2d { + /** VclProcessor2D class + + This processor is the base class for VCL-Based processors. It has no + processBasePrimitive2D implementation and thus is not usable directly. + */ class VclProcessor2D : public BaseProcessor2D { protected: @@ -107,8 +112,8 @@ namespace drawinglayer void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate); void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate); void RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate); - void RenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rTransCandidate); - void RenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rTransCandidate); + void RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate); + void RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate); void RenderTransformPrimitive2D(const primitive2d::TransformPrimitive2D& rTransformCandidate); void RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate); void RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkerArrayCandidate); diff --git a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx index effc509d9981..f6e0b53d4362 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx @@ -45,6 +45,13 @@ namespace drawinglayer { namespace processor3d { + /** BaseProcessor3D class + + Baseclass for all C++ implementations of instances which process + primitives. + + Please have a look at baseprocessor2d.hxx for more comments. + */ class BaseProcessor3D { private: @@ -56,9 +63,10 @@ namespace drawinglayer maViewInformation3D = rViewInformation3D; } - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. - // Default implementation does nothing + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + Default implementation does nothing + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -80,6 +88,13 @@ namespace drawinglayer { namespace processor3d { + /** CollectingProcessor3D class + + A processor which just collects all primitives given to it in + process(..) calls to maPrimitive3DSequence. This can e.g. be used to + hand around as instance over various methods where every called + method can add graphic content to it. + */ class CollectingProcessor3D : public BaseProcessor3D { private: @@ -89,16 +104,16 @@ namespace drawinglayer CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation); virtual ~CollectingProcessor3D(); - // the central processing method + /// the central processing method virtual void process(const primitive3d::Primitive3DSequence& rSource); - // helpers for adding to local sequence + /// helpers for adding to local sequence void appendPrimitive3DReference(const primitive3d::Primitive3DReference& rSource) { primitive3d::appendPrimitive3DReferenceToPrimitive3DSequence(maPrimitive3DSequence, rSource); } - // data access and reset + /// data access and reset const primitive3d::Primitive3DSequence& getPrimitive3DSequence() const { return maPrimitive3DSequence; } void reset() { maPrimitive3DSequence = primitive3d::Primitive3DSequence(); } }; diff --git a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx index 8a800d6d24b1..72552ea00e9c 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx @@ -44,26 +44,38 @@ namespace drawinglayer { namespace processor3d { + /** CutFindProcessor class + + This processor extracts all cuts of 3D plane geometries in the feeded primitives + with the given cut vector, based on the ViewInformation3D given. + */ class CutFindProcessor : public BaseProcessor3D { private: - // the start and stop point for the cut vector + /// the start and stop point for the cut vector basegfx::B3DPoint maFront; basegfx::B3DPoint maBack; - // the found cut points + /// the found cut points ::std::vector< basegfx::B3DPoint > maResult; - // #i102956# the transformation change from TransformPrimitive3D processings - // needs to be remembered to be able to transform found cuts to the - // basic coordinate system the processor starts with + /* #i102956# the transformation change from TransformPrimitive3D processings + needs to be remembered to be able to transform found cuts to the + basic coordinate system the processor starts with + */ basegfx::B3DHomMatrix maCombinedTransform; - // bitfield + /// bitfield bool mbAnyHit : 1; - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* this flag decides if primitives which are invisible will be taken into account for + HitTesting or not. + */ + bool mbUseInvisiblePrimitiveContent : 1; + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -72,9 +84,16 @@ namespace drawinglayer const basegfx::B3DPoint& rBack, bool bAnyHit); - // data access + /// data write access + void setUseInvisiblePrimitiveContent(bool bNew) + { + if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew; + } + + /// data read access const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } bool getAnyHit() const { return mbAnyHit; } + bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;} }; } // end of namespace processor3d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx index d0f886cca703..89fbdaafa251 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -45,6 +45,7 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + namespace basegfx { class BZPixelRaster; class B3DPolygon; @@ -77,38 +78,49 @@ namespace drawinglayer { namespace processor3d { + /** DefaultProcessor3D class + + This processor renders all feeded primitives to a 2D raster where for all + primitives the two basic methods rasterconvertB3DPolygon for hairlines and + rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to + e.g. base a Z-Buffer supported renderer on the 3D primitive processing. + */ class DefaultProcessor3D : public BaseProcessor3D { protected: - // render information - const attribute::SdrSceneAttribute& mrSdrSceneAttribute; // read-only scene infos (normal handling, etc...) - const attribute::SdrLightingAttribute& mrSdrLightingAttribute; // read-only light infos (lights, etc...) + /// read-only scene infos (normal handling, etc...) + const attribute::SdrSceneAttribute& mrSdrSceneAttribute; + + /// read-only light infos (lights, etc...) + const attribute::SdrLightingAttribute& mrSdrLightingAttribute; - // renderer range. Need to be correctly set by the derived implementations - basegfx::B2DRange maRasterRange; // the (0, 0, W, H) range from mpBZPixelRaster + /// renderer range. Need to be correctly set by the derived implementations + /// normally the (0, 0, W, H) range from mpBZPixelRaster + basegfx::B2DRange maRasterRange; - // the modifiedColorPrimitive stack + /// the modifiedColorPrimitive stack basegfx::BColorModifierStack maBColorModifierStack; - // the current active texture + /// the current active texture boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx; - // the current active transparence texture + /// the current active transparence texture boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx; - // SvtOptionsDrawinglayer incarnation to react on diverse settings + /// SvtOptionsDrawinglayer incarnation to react on diverse settings const SvtOptionsDrawinglayer maDrawinglayerOpt; - // counter for entered transparence textures + /// counter for entered transparence textures sal_uInt32 mnTransparenceCounter; - // bitfield + /// bitfield unsigned mbModulate : 1; unsigned mbFilter : 1; unsigned mbSimpleTextureActive : 1; ////////////////////////////////////////////////////////////////////////////// // rendering support + void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence); void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive); void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive); @@ -120,6 +132,7 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// // rasterconversions for filled and non-filled polygons. These NEED to be // implemented from derivations + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0; virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0; @@ -133,11 +146,11 @@ namespace drawinglayer const attribute::SdrLightingAttribute& rSdrLightingAttribute); virtual ~DefaultProcessor3D(); - // data read access + /// data read access const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; } const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; } - // data read access renderer stuff + /// data read access renderer stuff const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } @@ -146,7 +159,7 @@ namespace drawinglayer bool getFilter() const { return mbFilter; } bool getSimpleTextureActive() const { return mbSimpleTextureActive; } - // access to Drawinglayer configuration options + /// access to Drawinglayer configuration options const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; } }; } // end of namespace processor3d diff --git a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx index 457ede952ccd..cf25c8813c13 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx @@ -48,20 +48,27 @@ namespace drawinglayer { namespace processor3d { + /** Geometry2DExtractingProcessor class + + This processor extracts the 2D geometry (projected geometry) of all feeded primitives. + It is e.g. used as sub-processor for contour extraction where 3D geometry is only + useful as 2D projected geometry. + */ class Geometry2DExtractingProcessor : public BaseProcessor3D { private: - // result holding vector (2D) + /// result holding vector (2D) primitive2d::Primitive2DSequence maPrimitive2DSequence; - // object transformation for scene for 2d definition + /// object transformation for scene for 2d definition basegfx::B2DHomMatrix maObjectTransformation; - // the modifiedColorPrimitive stack + /// the modifiedColorPrimitive stack basegfx::BColorModifierStack maBColorModifierStack; - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -69,7 +76,7 @@ namespace drawinglayer const geometry::ViewInformation3D& rViewInformation, const basegfx::B2DHomMatrix& rObjectTransformation); - // data access + // data read access const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } diff --git a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx index abb92693a037..977cd8327d94 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx @@ -52,17 +52,24 @@ namespace drawinglayer { namespace processor3d { + /** Shadow3DExtractingProcessor class + + This processor extracts the 2D shadow geometry (projected geometry) of all feeded primitives. + It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite + some data to do so since we do not only offer flat projected 2D shadow, but also projections + dependent on the light source + */ class Shadow3DExtractingProcessor : public BaseProcessor3D { private: - // result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence) + /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence) primitive2d::Primitive2DSequence maPrimitive2DSequence; primitive2d::Primitive2DSequence* mpPrimitive2DSequence; - // object transformation for scene for 2d definition + /// object transformation for scene for 2d definition basegfx::B2DHomMatrix maObjectTransformation; - // prepared data (transformations) for 2D/3D shadow calculations + /// prepared data (transformations) for 2D/3D shadow calculations basegfx::B3DHomMatrix maWorldToEye; basegfx::B3DHomMatrix maEyeToView; basegfx::B3DVector maLightNormal; @@ -70,26 +77,28 @@ namespace drawinglayer basegfx::B3DPoint maPlanePoint; double mfLightPlaneScalar; - // the shadow color used for sub-primitives. Can stay at black since - // the encapsulating 2d shadow primitive will contain the color + /* the shadow color used for sub-primitives. Can stay at black since + the encapsulating 2d shadow primitive will contain the color + */ basegfx::BColor maPrimitiveColor; - // bitfield - // flag if shadow plane projection preparation leaded to valid results + /// bitfield + /// flag if shadow plane projection preparation leaded to valid results unsigned mbShadowProjectionIsValid : 1; - // flag if conversion is switched on + /// flag if conversion is switched on unsigned mbConvert : 1; - // flag if conversion shall use projection + /// flag if conversion shall use projection unsigned mbUseProjection : 1; - // helpers + /// local helpers basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource); basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource); - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -100,7 +109,7 @@ namespace drawinglayer double fShadowSlant, const basegfx::B3DRange& rContained3DRange); - // data access + /// data read access const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; } diff --git a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx index b2e09205dba9..4d0968c6cd57 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx @@ -66,28 +66,37 @@ namespace drawinglayer { namespace processor3d { + /** ZBufferProcessor3D class + + This 3D renderer derived from DefaultProcessor3D renders all feeded primitives to a 2D + raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle + transparent content. + */ class ZBufferProcessor3D : public DefaultProcessor3D { private: - // the raster target, a Z-Buffer + /// the raster target, a Z-Buffer basegfx::BZPixelRaster* mpBZPixelRaster; - // inverse of EyeToView for rasterconversion with evtl. Phong shading + /// inverse of EyeToView for rasterconversion with evtl. Phong shading basegfx::B3DHomMatrix maInvEyeToView; - // The raster converter for Z-Buffer + /// The raster converter for Z-Buffer ZBufferRasterConverter3D* mpZBufferRasterConverter3D; - // AA value. Defines how many oversámples will be used in X and Y. Values 0, 1 - // will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create + /* AA value. Defines how many oversámples will be used in X and Y. Values 0, 1 + will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create + */ sal_uInt16 mnAntiAlialize; - // remembered RasterPrimitive3D's which need to be painted back to front - // for transparent 3D parts + /* remembered RasterPrimitive3D's which need to be painted back to front + for transparent 3D parts + */ std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds; ////////////////////////////////////////////////////////////////////////////// // rasterconversions for filled and non-filled polygons + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const; virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const; @@ -105,7 +114,7 @@ namespace drawinglayer void finish(); - // get the result as bitmapEx + /// get the result as bitmapEx BitmapEx getBitmapEx() const; }; } // end of namespace processor3d diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index ee5b96d98a03..7ae13f8ebe33 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -8,7 +8,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\drawinglayer_primitivetypes2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\drawinglayer_primitivetypes2d.hxx -..\inc\drawinglayer\primitive2d\alphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\alphaprimitive2d.hxx +..\inc\drawinglayer\primitive2d\transparenceprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\transparenceprimitive2d.hxx ..\inc\drawinglayer\primitive2d\animatedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\animatedprimitive2d.hxx ..\inc\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx ..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx @@ -24,7 +24,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\gridprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\gridprimitive2d.hxx ..\inc\drawinglayer\primitive2d\groupprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\groupprimitive2d.hxx ..\inc\drawinglayer\primitive2d\helplineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\helplineprimitive2d.hxx -..\inc\drawinglayer\primitive2d\hittestprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hittestprimitive2d.hxx +..\inc\drawinglayer\primitive2d\hiddengeometryprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hiddengeometryprimitive2d.hxx ..\inc\drawinglayer\primitive2d\invertprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\invertprimitive2d.hxx ..\inc\drawinglayer\primitive2d\markerarrayprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\markerarrayprimitive2d.hxx ..\inc\drawinglayer\primitive2d\maskprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\maskprimitive2d.hxx @@ -36,6 +36,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\polygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polygonprimitive2d.hxx ..\inc\drawinglayer\primitive2d\polypolygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polypolygonprimitive2d.hxx ..\inc\drawinglayer\primitive2d\primitivetools2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\primitivetools2d.hxx +..\inc\drawinglayer\primitive2d\sdrdecompositiontools2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sdrdecompositiontools2d.hxx ..\inc\drawinglayer\primitive2d\sceneprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sceneprimitive2d.hxx ..\inc\drawinglayer\primitive2d\shadowprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\shadowprimitive2d.hxx ..\inc\drawinglayer\primitive2d\structuretagprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\structuretagprimitive2d.hxx @@ -46,7 +47,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx ..\inc\drawinglayer\primitive2d\texthierarchyprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\texthierarchyprimitive2d.hxx ..\inc\drawinglayer\primitive2d\transformprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\transformprimitive2d.hxx -..\inc\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx +..\inc\drawinglayer\primitive2d\unifiedtransparenceprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedtransparenceprimitive2d.hxx ..\inc\drawinglayer\primitive2d\wrongspellprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\wrongspellprimitive2d.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d @@ -54,7 +55,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d ..\inc\drawinglayer\primitive3d\baseprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\baseprimitive3d.hxx ..\inc\drawinglayer\primitive3d\groupprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\groupprimitive3d.hxx ..\inc\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx -..\inc\drawinglayer\primitive3d\hittestprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hittestprimitive3d.hxx +..\inc\drawinglayer\primitive2d\hiddengeometryprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hiddengeometryprimitive3d.hxx ..\inc\drawinglayer\primitive3d\modifiedcolorprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\modifiedcolorprimitive3d.hxx ..\inc\drawinglayer\primitive3d\polygonprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\polygonprimitive3d.hxx ..\inc\drawinglayer\primitive3d\polygontubeprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\polygontubeprimitive3d.hxx @@ -97,13 +98,20 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d ..\inc\drawinglayer\processor3d\tbufferprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\tbufferprocessor3d.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\attribute -..\inc\drawinglayer\attribute\fillattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillattribute.hxx +..\inc\drawinglayer\attribute\fillgradientattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillgradientattribute.hxx +..\inc\drawinglayer\attribute\fillhatchattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillhatchattribute.hxx ..\inc\drawinglayer\attribute\fillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillbitmapattribute.hxx ..\inc\drawinglayer\attribute\fontattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fontattribute.hxx ..\inc\drawinglayer\attribute\materialattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\materialattribute3d.hxx ..\inc\drawinglayer\attribute\sdrallattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrallattribute3d.hxx -..\inc\drawinglayer\attribute\sdrattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute.hxx -..\inc\drawinglayer\attribute\sdrattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlineattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlineattribute.hxx +..\inc\drawinglayer\attribute\sdrlinestartendattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlinestartendattribute.hxx +..\inc\drawinglayer\attribute\sdrshadowattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrshadowattribute.hxx +..\inc\drawinglayer\attribute\sdrfillattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrfillattribute.hxx +..\inc\drawinglayer\attribute\sdrobjectattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrobjectattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlightattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlightattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlightingattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlightingattribute3d.hxx +..\inc\drawinglayer\attribute\sdrsceneattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrsceneattribute3d.hxx ..\inc\drawinglayer\attribute\sdrfillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrfillbitmapattribute.hxx ..\inc\drawinglayer\attribute\strokeattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\strokeattribute.hxx ..\inc\drawinglayer\attribute\lineattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\lineattribute.hxx diff --git a/drawinglayer/source/attribute/fillattribute.cxx b/drawinglayer/source/attribute/fillattribute.cxx deleted file mode 100644 index 12741e40c5c3..000000000000 --- a/drawinglayer/source/attribute/fillattribute.cxx +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: fillattribute.cxx,v $ - * - * $Revision: 1.4 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - FillGradientAttribute::FillGradientAttribute(GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, double fAngle, - const basegfx::BColor& rStartColor, const basegfx::BColor& rEndColor, sal_uInt16 nSteps) - : maStartColor(rStartColor), - maEndColor(rEndColor), - mfBorder(fBorder), - mfOffsetX(fOffsetX), - mfOffsetY(fOffsetY), - mfAngle(fAngle), - meStyle(eStyle), - mnSteps(nSteps) - { - } - - bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const - { - return (meStyle == rCandidate.meStyle - && maStartColor == rCandidate.maStartColor - && maEndColor == rCandidate.maEndColor - && mfBorder == rCandidate.mfBorder - && mfOffsetX == rCandidate.mfOffsetX - && mfOffsetY == rCandidate.mfOffsetY - && mfAngle == rCandidate.mfAngle - && mnSteps == rCandidate.mnSteps); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - FillHatchAttribute::FillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, const basegfx::BColor& rColor, bool bFillBackground) - : mfDistance(fDistance), - mfAngle(fAngle), - maColor(rColor), - meStyle(eStyle), - mbFillBackground(bFillBackground) - { - } - - bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const - { - return (meStyle == rCandidate.meStyle - && mfDistance == rCandidate.mfDistance - && mfAngle == rCandidate.mfAngle - && maColor == rCandidate.maColor - && mbFillBackground == rCandidate.mbFillBackground); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/fillbitmapattribute.cxx b/drawinglayer/source/attribute/fillbitmapattribute.cxx index 99afb234bda5..becd43c24a13 100644 --- a/drawinglayer/source/attribute/fillbitmapattribute.cxx +++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx @@ -37,6 +37,7 @@ #include "precompiled_drawinglayer.hxx" #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -44,25 +45,161 @@ namespace drawinglayer { namespace attribute { + class ImpFillBitmapAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + BitmapEx maBitmapEx; + basegfx::B2DPoint maTopLeft; + basegfx::B2DVector maSize; + + // bitfield + unsigned mbTiling : 1; + + ImpFillBitmapAttribute( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rTopLeft, + const basegfx::B2DVector& rSize, + bool bTiling) + : mnRefCount(0), + maBitmapEx(rBitmapEx), + maTopLeft(rTopLeft), + maSize(rSize), + mbTiling(bTiling) + { + } + + bool operator==(const ImpFillBitmapAttribute& rCandidate) const + { + return (maBitmapEx == rCandidate.maBitmapEx + && maTopLeft == rCandidate.maTopLeft + && maSize == rCandidate.maSize + && mbTiling == rCandidate.mbTiling); + } + + // data read access + const BitmapEx& getBitmapEx() const { return maBitmapEx; } + const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; } + const basegfx::B2DVector& getSize() const { return maSize; } + bool getTiling() const { return mbTiling; } + + static ImpFillBitmapAttribute* get_global_default() + { + static ImpFillBitmapAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillBitmapAttribute( + BitmapEx(), + basegfx::B2DPoint(), + basegfx::B2DVector(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + FillBitmapAttribute::FillBitmapAttribute( const BitmapEx& rBitmapEx, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling) - : maBitmapEx(rBitmapEx), - maTopLeft(rTopLeft), - maSize(rSize), - mbTiling(bTiling) + : mpFillBitmapAttribute(new ImpFillBitmapAttribute( + rBitmapEx, rTopLeft, rSize, bTiling)) { } + FillBitmapAttribute::FillBitmapAttribute() + : mpFillBitmapAttribute(ImpFillBitmapAttribute::get_global_default()) + { + mpFillBitmapAttribute->mnRefCount++; + } + + FillBitmapAttribute::FillBitmapAttribute(const FillBitmapAttribute& rCandidate) + : mpFillBitmapAttribute(rCandidate.mpFillBitmapAttribute) + { + mpFillBitmapAttribute->mnRefCount++; + } + + FillBitmapAttribute::~FillBitmapAttribute() + { + if(mpFillBitmapAttribute->mnRefCount) + { + mpFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpFillBitmapAttribute; + } + } + + bool FillBitmapAttribute::isDefault() const + { + return mpFillBitmapAttribute == ImpFillBitmapAttribute::get_global_default(); + } + + FillBitmapAttribute& FillBitmapAttribute::operator=(const FillBitmapAttribute& rCandidate) + { + if(rCandidate.mpFillBitmapAttribute != mpFillBitmapAttribute) + { + if(mpFillBitmapAttribute->mnRefCount) + { + mpFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpFillBitmapAttribute; + } + + mpFillBitmapAttribute = rCandidate.mpFillBitmapAttribute; + mpFillBitmapAttribute->mnRefCount++; + } + + return *this; + } + bool FillBitmapAttribute::operator==(const FillBitmapAttribute& rCandidate) const { - return (getBitmapEx() == rCandidate.getBitmapEx() - && getTopLeft() == rCandidate.getTopLeft() - && getSize() == rCandidate.getSize() - && getTiling() == rCandidate.getTiling()); + if(rCandidate.mpFillBitmapAttribute == mpFillBitmapAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillBitmapAttribute == *mpFillBitmapAttribute); + } + + const BitmapEx& FillBitmapAttribute::getBitmapEx() const + { + return mpFillBitmapAttribute->getBitmapEx(); } + + const basegfx::B2DPoint& FillBitmapAttribute::getTopLeft() const + { + return mpFillBitmapAttribute->getTopLeft(); + } + + const basegfx::B2DVector& FillBitmapAttribute::getSize() const + { + return mpFillBitmapAttribute->getSize(); + } + + bool FillBitmapAttribute::getTiling() const + { + return mpFillBitmapAttribute->getTiling(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx new file mode 100644 index 000000000000..17e0cd6c098b --- /dev/null +++ b/drawinglayer/source/attribute/fillgradientattribute.cxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.cxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpFillGradientAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + GradientStyle meStyle; + double mfBorder; + double mfOffsetX; + double mfOffsetY; + double mfAngle; + basegfx::BColor maStartColor; + basegfx::BColor maEndColor; + sal_uInt16 mnSteps; + + ImpFillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps) + : mnRefCount(0), + meStyle(eStyle), + mfBorder(fBorder), + mfOffsetX(fOffsetX), + mfOffsetY(fOffsetY), + mfAngle(fAngle), + maStartColor(rStartColor), + maEndColor(rEndColor), + mnSteps(nSteps) + { + } + + // data read access + GradientStyle getStyle() const { return meStyle; } + double getBorder() const { return mfBorder; } + double getOffsetX() const { return mfOffsetX; } + double getOffsetY() const { return mfOffsetY; } + double getAngle() const { return mfAngle; } + const basegfx::BColor& getStartColor() const { return maStartColor; } + const basegfx::BColor& getEndColor() const { return maEndColor; } + sal_uInt16 getSteps() const { return mnSteps; } + + bool operator==(const ImpFillGradientAttribute& rCandidate) const + { + return (getStyle() == rCandidate.getStyle() + && getBorder() == rCandidate.getBorder() + && getOffsetX() == rCandidate.getOffsetX() + && getOffsetY() == rCandidate.getOffsetY() + && getAngle() == rCandidate.getAngle() + && getStartColor() == rCandidate.getStartColor() + && getEndColor() == rCandidate.getEndColor() + && getSteps() == rCandidate.getSteps()); + } + + static ImpFillGradientAttribute* get_global_default() + { + static ImpFillGradientAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillGradientAttribute( + GRADIENTSTYLE_LINEAR, + 0.0, 0.0, 0.0, 0.0, + basegfx::BColor(), + basegfx::BColor(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FillGradientAttribute::FillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps) + : mpFillGradientAttribute(new ImpFillGradientAttribute( + eStyle, fBorder, fOffsetX, fOffsetY, fAngle, rStartColor, rEndColor, nSteps)) + { + } + + FillGradientAttribute::FillGradientAttribute() + : mpFillGradientAttribute(ImpFillGradientAttribute::get_global_default()) + { + mpFillGradientAttribute->mnRefCount++; + } + + FillGradientAttribute::FillGradientAttribute(const FillGradientAttribute& rCandidate) + : mpFillGradientAttribute(rCandidate.mpFillGradientAttribute) + { + mpFillGradientAttribute->mnRefCount++; + } + + FillGradientAttribute::~FillGradientAttribute() + { + if(mpFillGradientAttribute->mnRefCount) + { + mpFillGradientAttribute->mnRefCount--; + } + else + { + delete mpFillGradientAttribute; + } + } + + bool FillGradientAttribute::isDefault() const + { + return mpFillGradientAttribute == ImpFillGradientAttribute::get_global_default(); + } + + FillGradientAttribute& FillGradientAttribute::operator=(const FillGradientAttribute& rCandidate) + { + if(rCandidate.mpFillGradientAttribute != mpFillGradientAttribute) + { + if(mpFillGradientAttribute->mnRefCount) + { + mpFillGradientAttribute->mnRefCount--; + } + else + { + delete mpFillGradientAttribute; + } + + mpFillGradientAttribute = rCandidate.mpFillGradientAttribute; + mpFillGradientAttribute->mnRefCount++; + } + + return *this; + } + + bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const + { + if(rCandidate.mpFillGradientAttribute == mpFillGradientAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillGradientAttribute == *mpFillGradientAttribute); + } + + const basegfx::BColor& FillGradientAttribute::getStartColor() const + { + return mpFillGradientAttribute->getStartColor(); + } + + const basegfx::BColor& FillGradientAttribute::getEndColor() const + { + return mpFillGradientAttribute->getEndColor(); + } + + double FillGradientAttribute::getBorder() const + { + return mpFillGradientAttribute->getBorder(); + } + + double FillGradientAttribute::getOffsetX() const + { + return mpFillGradientAttribute->getOffsetX(); + } + + double FillGradientAttribute::getOffsetY() const + { + return mpFillGradientAttribute->getOffsetY(); + } + + double FillGradientAttribute::getAngle() const + { + return mpFillGradientAttribute->getAngle(); + } + + GradientStyle FillGradientAttribute::getStyle() const + { + return mpFillGradientAttribute->getStyle(); + } + + sal_uInt16 FillGradientAttribute::getSteps() const + { + return mpFillGradientAttribute->getSteps(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx b/drawinglayer/source/attribute/fillhatchattribute.cxx new file mode 100644 index 000000000000..4a82ef5594ab --- /dev/null +++ b/drawinglayer/source/attribute/fillhatchattribute.cxx @@ -0,0 +1,219 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.cxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpFillHatchAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + HatchStyle meStyle; + double mfDistance; + double mfAngle; + basegfx::BColor maColor; + + // bitfield + unsigned mbFillBackground : 1; + + ImpFillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground) + : mnRefCount(0), + meStyle(eStyle), + mfDistance(fDistance), + mfAngle(fAngle), + maColor(rColor), + mbFillBackground(bFillBackground) + { + } + + // data read access + HatchStyle getStyle() const { return meStyle; } + double getDistance() const { return mfDistance; } + double getAngle() const { return mfAngle; } + const basegfx::BColor& getColor() const { return maColor; } + bool isFillBackground() const { return mbFillBackground; } + + bool operator==(const ImpFillHatchAttribute& rCandidate) const + { + return (getStyle() == rCandidate.getStyle() + && getDistance() == rCandidate.getDistance() + && getAngle() == rCandidate.getAngle() + && getColor() == rCandidate.getColor() + && isFillBackground() == rCandidate.isFillBackground()); + } + + static ImpFillHatchAttribute* get_global_default() + { + static ImpFillHatchAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillHatchAttribute( + HATCHSTYLE_SINGLE, + 0.0, 0.0, + basegfx::BColor(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FillHatchAttribute::FillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground) + : mpFillHatchAttribute(new ImpFillHatchAttribute( + eStyle, fDistance, fAngle, rColor, bFillBackground)) + { + } + + FillHatchAttribute::FillHatchAttribute() + : mpFillHatchAttribute(ImpFillHatchAttribute::get_global_default()) + { + mpFillHatchAttribute->mnRefCount++; + } + + FillHatchAttribute::FillHatchAttribute(const FillHatchAttribute& rCandidate) + : mpFillHatchAttribute(rCandidate.mpFillHatchAttribute) + { + mpFillHatchAttribute->mnRefCount++; + } + + FillHatchAttribute::~FillHatchAttribute() + { + if(mpFillHatchAttribute->mnRefCount) + { + mpFillHatchAttribute->mnRefCount--; + } + else + { + delete mpFillHatchAttribute; + } + } + + bool FillHatchAttribute::isDefault() const + { + return mpFillHatchAttribute == ImpFillHatchAttribute::get_global_default(); + } + + FillHatchAttribute& FillHatchAttribute::operator=(const FillHatchAttribute& rCandidate) + { + if(rCandidate.mpFillHatchAttribute != mpFillHatchAttribute) + { + if(mpFillHatchAttribute->mnRefCount) + { + mpFillHatchAttribute->mnRefCount--; + } + else + { + delete mpFillHatchAttribute; + } + + mpFillHatchAttribute = rCandidate.mpFillHatchAttribute; + mpFillHatchAttribute->mnRefCount++; + } + + return *this; + } + + bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const + { + if(rCandidate.mpFillHatchAttribute == mpFillHatchAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillHatchAttribute == *mpFillHatchAttribute); + } + + // data read access + HatchStyle FillHatchAttribute::getStyle() const + { + return mpFillHatchAttribute->getStyle(); + } + + double FillHatchAttribute::getDistance() const + { + return mpFillHatchAttribute->getDistance(); + } + + double FillHatchAttribute::getAngle() const + { + return mpFillHatchAttribute->getAngle(); + } + + const basegfx::BColor& FillHatchAttribute::getColor() const + { + return mpFillHatchAttribute->getColor(); + } + + bool FillHatchAttribute::isFillBackground() const + { + return mpFillHatchAttribute->isFillBackground(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/fontattribute.cxx b/drawinglayer/source/attribute/fontattribute.cxx index 5163e2f6a59a..2439d9894a70 100644 --- a/drawinglayer/source/attribute/fontattribute.cxx +++ b/drawinglayer/source/attribute/fontattribute.cxx @@ -37,6 +37,7 @@ #include "precompiled_drawinglayer.hxx" #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -44,18 +45,215 @@ namespace drawinglayer { namespace attribute { - bool FontAttribute::operator==(const FontAttribute& rCompare) const - { - return (getFamilyName() == rCompare.getFamilyName() - && getStyleName() == rCompare.getStyleName() - && getWeight() == rCompare.getWeight() - && getSymbol() == rCompare.getSymbol() - && getVertical() == rCompare.getVertical() - && getItalic() == rCompare.getItalic() - && getOutline() == rCompare.getOutline() - && getRTL() == rCompare.getRTL() - && getBiDiStrong() == rCompare.getBiDiStrong()); + class ImpFontAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + /// core data + String maFamilyName; // Font Family Name + String maStyleName; // Font Style Name + sal_uInt16 mnWeight; // Font weight + + /// bitfield + unsigned mbSymbol : 1; // Symbol Font Flag + unsigned mbVertical : 1; // Vertical Text Flag + unsigned mbItalic : 1; // Italic Flag + unsigned mbOutline : 1; // Outline Flag + unsigned mbRTL : 1; // RTL Flag + unsigned mbBiDiStrong : 1; // BiDi Flag + + ImpFontAttribute( + const String& rFamilyName, + const String& rStyleName, + sal_uInt16 nWeight, + bool bSymbol, + bool bVertical, + bool bItalic, + bool bOutline, + bool bRTL, + bool bBiDiStrong) + : mnRefCount(0), + maFamilyName(rFamilyName), + maStyleName(rStyleName), + mnWeight(nWeight), + mbSymbol(bSymbol), + mbVertical(bVertical), + mbItalic(bItalic), + mbOutline(bOutline), + mbRTL(bRTL), + mbBiDiStrong(bBiDiStrong) + { + } + + // data read access + const String& getFamilyName() const { return maFamilyName; } + const String& getStyleName() const { return maStyleName; } + sal_uInt16 getWeight() const { return mnWeight; } + bool getSymbol() const { return mbSymbol; } + bool getVertical() const { return mbVertical; } + bool getItalic() const { return mbItalic; } + bool getOutline() const { return mbOutline; } + bool getRTL() const { return mbRTL; } + bool getBiDiStrong() const { return mbBiDiStrong; } + + bool operator==(const ImpFontAttribute& rCompare) const + { + return (getFamilyName() == rCompare.getFamilyName() + && getStyleName() == rCompare.getStyleName() + && getWeight() == rCompare.getWeight() + && getSymbol() == rCompare.getSymbol() + && getVertical() == rCompare.getVertical() + && getItalic() == rCompare.getItalic() + && getOutline() == rCompare.getOutline() + && getRTL() == rCompare.getRTL() + && getBiDiStrong() == rCompare.getBiDiStrong()); + } + + static ImpFontAttribute* get_global_default() + { + static ImpFontAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFontAttribute( + String(), String(), + 0, + false, false, false, false, false, false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FontAttribute::FontAttribute( + const String& rFamilyName, + const String& rStyleName, + sal_uInt16 nWeight, + bool bSymbol, + bool bVertical, + bool bItalic, + bool bOutline, + bool bRTL, + bool bBiDiStrong) + : mpFontAttribute(new ImpFontAttribute( + rFamilyName, rStyleName, nWeight, bSymbol, bVertical, bItalic, bOutline, bRTL, bBiDiStrong)) + { + } + + FontAttribute::FontAttribute() + : mpFontAttribute(ImpFontAttribute::get_global_default()) + { + mpFontAttribute->mnRefCount++; + } + + FontAttribute::FontAttribute(const FontAttribute& rCandidate) + : mpFontAttribute(rCandidate.mpFontAttribute) + { + mpFontAttribute->mnRefCount++; + } + + FontAttribute::~FontAttribute() + { + if(mpFontAttribute->mnRefCount) + { + mpFontAttribute->mnRefCount--; + } + else + { + delete mpFontAttribute; + } + } + + bool FontAttribute::isDefault() const + { + return mpFontAttribute == ImpFontAttribute::get_global_default(); + } + + FontAttribute& FontAttribute::operator=(const FontAttribute& rCandidate) + { + if(rCandidate.mpFontAttribute != mpFontAttribute) + { + if(mpFontAttribute->mnRefCount) + { + mpFontAttribute->mnRefCount--; + } + else + { + delete mpFontAttribute; + } + + mpFontAttribute = rCandidate.mpFontAttribute; + mpFontAttribute->mnRefCount++; + } + + return *this; + } + + bool FontAttribute::operator==(const FontAttribute& rCandidate) const + { + if(rCandidate.mpFontAttribute == mpFontAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFontAttribute == *mpFontAttribute); + } + + const String& FontAttribute::getFamilyName() const + { + return mpFontAttribute->getFamilyName(); + } + + const String& FontAttribute::getStyleName() const + { + return mpFontAttribute->getStyleName(); + } + + sal_uInt16 FontAttribute::getWeight() const + { + return mpFontAttribute->getWeight(); } + + bool FontAttribute::getSymbol() const + { + return mpFontAttribute->getSymbol(); + } + + bool FontAttribute::getVertical() const + { + return mpFontAttribute->getVertical(); + } + + bool FontAttribute::getItalic() const + { + return mpFontAttribute->getItalic(); + } + + bool FontAttribute::getOutline() const + { + return mpFontAttribute->getOutline(); + } + + bool FontAttribute::getRTL() const + { + return mpFontAttribute->getRTL(); + } + + bool FontAttribute::getBiDiStrong() const + { + return mpFontAttribute->getBiDiStrong(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx index 5ab44b73db82..2a346599db8f 100644 --- a/drawinglayer/source/attribute/lineattribute.cxx +++ b/drawinglayer/source/attribute/lineattribute.cxx @@ -37,6 +37,7 @@ #include "precompiled_drawinglayer.hxx" #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -44,6 +45,147 @@ namespace drawinglayer { namespace attribute { + class ImpLineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + basegfx::BColor maColor; // color + double mfWidth; // absolute line width + basegfx::B2DLineJoin meLineJoin; // type of LineJoin + + ImpLineAttribute( + const basegfx::BColor& rColor, + double fWidth, + basegfx::B2DLineJoin aB2DLineJoin) + : mnRefCount(0), + maColor(rColor), + mfWidth(fWidth), + meLineJoin(aB2DLineJoin) + { + } + + // data read access + const basegfx::BColor& getColor() const { return maColor; } + double getWidth() const { return mfWidth; } + basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; } + + bool operator==(const ImpLineAttribute& rCandidate) const + { + return (getColor() == rCandidate.getColor() + && getWidth() == rCandidate.getWidth() + && getLineJoin() == rCandidate.getLineJoin()); + } + + static ImpLineAttribute* get_global_default() + { + static ImpLineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpLineAttribute( + basegfx::BColor(), + 0.0, + basegfx::B2DLINEJOIN_ROUND); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + LineAttribute::LineAttribute( + const basegfx::BColor& rColor, + double fWidth, + basegfx::B2DLineJoin aB2DLineJoin) + : mpLineAttribute(new ImpLineAttribute( + rColor, fWidth, aB2DLineJoin)) + { + } + + LineAttribute::LineAttribute() + : mpLineAttribute(ImpLineAttribute::get_global_default()) + { + mpLineAttribute->mnRefCount++; + } + + LineAttribute::LineAttribute(const LineAttribute& rCandidate) + : mpLineAttribute(rCandidate.mpLineAttribute) + { + mpLineAttribute->mnRefCount++; + } + + LineAttribute::~LineAttribute() + { + if(mpLineAttribute->mnRefCount) + { + mpLineAttribute->mnRefCount--; + } + else + { + delete mpLineAttribute; + } + } + + bool LineAttribute::isDefault() const + { + return mpLineAttribute == ImpLineAttribute::get_global_default(); + } + + LineAttribute& LineAttribute::operator=(const LineAttribute& rCandidate) + { + if(rCandidate.mpLineAttribute != mpLineAttribute) + { + if(mpLineAttribute->mnRefCount) + { + mpLineAttribute->mnRefCount--; + } + else + { + delete mpLineAttribute; + } + + mpLineAttribute = rCandidate.mpLineAttribute; + mpLineAttribute->mnRefCount++; + } + + return *this; + } + + bool LineAttribute::operator==(const LineAttribute& rCandidate) const + { + if(rCandidate.mpLineAttribute == mpLineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpLineAttribute == *mpLineAttribute); + } + + const basegfx::BColor& LineAttribute::getColor() const + { + return mpLineAttribute->getColor(); + } + + double LineAttribute::getWidth() const + { + return mpLineAttribute->getWidth(); + } + + basegfx::B2DLineJoin LineAttribute::getLineJoin() const + { + return mpLineAttribute->getLineJoin(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/linestartendattribute.cxx b/drawinglayer/source/attribute/linestartendattribute.cxx index 785819870114..3d93a6471cb7 100644 --- a/drawinglayer/source/attribute/linestartendattribute.cxx +++ b/drawinglayer/source/attribute/linestartendattribute.cxx @@ -38,6 +38,7 @@ #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -45,11 +46,154 @@ namespace drawinglayer { namespace attribute { + class ImpLineStartEndAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + double mfWidth; // absolute line StartEndGeometry base width + basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon + + // bitfield + unsigned mbCentered : 1; // use centered to ineStart/End point? + + ImpLineStartEndAttribute( + double fWidth, + const basegfx::B2DPolyPolygon& rPolyPolygon, + bool bCentered) + : mnRefCount(0), + mfWidth(fWidth), + maPolyPolygon(rPolyPolygon), + mbCentered(bCentered) + { + } + + // data read access + double getWidth() const { return mfWidth; } + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + bool isCentered() const { return mbCentered; } + + bool operator==(const ImpLineStartEndAttribute& rCandidate) const + { + return (basegfx::fTools::equal(getWidth(), rCandidate.getWidth()) + && getB2DPolyPolygon() == rCandidate.getB2DPolyPolygon() + && isCentered() == rCandidate.isCentered()); + } + + static ImpLineStartEndAttribute* get_global_default() + { + static ImpLineStartEndAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpLineStartEndAttribute( + 0.0, + basegfx::B2DPolyPolygon(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + LineStartEndAttribute::LineStartEndAttribute( + double fWidth, + const basegfx::B2DPolyPolygon& rPolyPolygon, + bool bCentered) + : mpLineStartEndAttribute(new ImpLineStartEndAttribute( + fWidth, rPolyPolygon, bCentered)) + { + } + + LineStartEndAttribute::LineStartEndAttribute() + : mpLineStartEndAttribute(ImpLineStartEndAttribute::get_global_default()) + { + mpLineStartEndAttribute->mnRefCount++; + } + + LineStartEndAttribute::LineStartEndAttribute(const LineStartEndAttribute& rCandidate) + : mpLineStartEndAttribute(rCandidate.mpLineStartEndAttribute) + { + mpLineStartEndAttribute->mnRefCount++; + } + + LineStartEndAttribute::~LineStartEndAttribute() + { + if(mpLineStartEndAttribute->mnRefCount) + { + mpLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpLineStartEndAttribute; + } + } + + bool LineStartEndAttribute::isDefault() const + { + return mpLineStartEndAttribute == ImpLineStartEndAttribute::get_global_default(); + } + + LineStartEndAttribute& LineStartEndAttribute::operator=(const LineStartEndAttribute& rCandidate) + { + if(rCandidate.mpLineStartEndAttribute != mpLineStartEndAttribute) + { + if(mpLineStartEndAttribute->mnRefCount) + { + mpLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpLineStartEndAttribute; + } + + mpLineStartEndAttribute = rCandidate.mpLineStartEndAttribute; + mpLineStartEndAttribute->mnRefCount++; + } + + return *this; + } + + bool LineStartEndAttribute::operator==(const LineStartEndAttribute& rCandidate) const + { + if(rCandidate.mpLineStartEndAttribute == mpLineStartEndAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpLineStartEndAttribute == *mpLineStartEndAttribute); + } + + double LineStartEndAttribute::getWidth() const + { + return mpLineStartEndAttribute->getWidth(); + } + + const basegfx::B2DPolyPolygon& LineStartEndAttribute::getB2DPolyPolygon() const + { + return mpLineStartEndAttribute->getB2DPolyPolygon(); + } + + bool LineStartEndAttribute::isCentered() const + { + return mpLineStartEndAttribute->isCentered(); + } + bool LineStartEndAttribute::isActive() const { return (0.0 != getWidth() - && 0.0 != getB2DPolyPolygon().count() - && 0.0 != getB2DPolyPolygon().getB2DPolygon(0L).count()); + && 0 != getB2DPolyPolygon().count() + && 0 != getB2DPolyPolygon().getB2DPolygon(0).count()); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk index 65f899f67177..83eaa193bb4e 100644 --- a/drawinglayer/source/attribute/makefile.mk +++ b/drawinglayer/source/attribute/makefile.mk @@ -45,16 +45,23 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/fillattribute.obj \ - $(SLO)$/fillbitmapattribute.obj \ - $(SLO)$/fontattribute.obj \ - $(SLO)$/materialattribute3d.obj \ - $(SLO)$/sdrallattribute3d.obj \ - $(SLO)$/sdrattribute.obj \ - $(SLO)$/sdrattribute3d.obj \ - $(SLO)$/sdrfillbitmapattribute.obj \ - $(SLO)$/lineattribute.obj \ - $(SLO)$/linestartendattribute.obj \ + $(SLO)$/fillgradientattribute.obj \ + $(SLO)$/fillhatchattribute.obj \ + $(SLO)$/fillbitmapattribute.obj \ + $(SLO)$/fontattribute.obj \ + $(SLO)$/materialattribute3d.obj \ + $(SLO)$/sdrallattribute3d.obj \ + $(SLO)$/sdrlineattribute.obj \ + $(SLO)$/sdrlinestartendattribute.obj \ + $(SLO)$/sdrshadowattribute.obj \ + $(SLO)$/sdrfillattribute.obj \ + $(SLO)$/sdrobjectattribute3d.obj \ + $(SLO)$/sdrlightattribute3d.obj \ + $(SLO)$/sdrlightingattribute3d.obj \ + $(SLO)$/sdrsceneattribute3d.obj \ + $(SLO)$/sdrfillbitmapattribute.obj \ + $(SLO)$/lineattribute.obj \ + $(SLO)$/linestartendattribute.obj \ $(SLO)$/strokeattribute.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx index bc3e8f3b317b..27bd5d5a1b1a 100644 --- a/drawinglayer/source/attribute/materialattribute3d.cxx +++ b/drawinglayer/source/attribute/materialattribute3d.cxx @@ -48,74 +48,87 @@ namespace drawinglayer class ImpMaterialAttribute3D { public: + // refcounter + sal_uInt32 mnRefCount; + // materialAttribute3D definitions basegfx::BColor maColor; // object color basegfx::BColor maSpecular; // material specular color basegfx::BColor maEmission; // material emissive color - sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128] - - // refcounter - sal_uInt32 mnRefCount; + sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128] ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) - : maColor(rColor), + : mnRefCount(0), + maColor(rColor), maSpecular(rSpecular), maEmission(rEmission), - mnSpecularIntensity(nSpecularIntensity), - mnRefCount(0L) + mnSpecularIntensity(nSpecularIntensity) { } ImpMaterialAttribute3D(const basegfx::BColor& rColor) - : maColor(rColor), + : mnRefCount(0), + maColor(rColor), maSpecular(1.0, 1.0, 1.0), maEmission(), - mnSpecularIntensity(15), - mnRefCount(0L) + mnSpecularIntensity(15) { } - ImpMaterialAttribute3D() - : mnSpecularIntensity(0), - mnRefCount(0L) - { - } + // data read access + const basegfx::BColor& getColor() const { return maColor; } + const basegfx::BColor& getSpecular() const { return maSpecular; } + const basegfx::BColor& getEmission() const { return maEmission; } + sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; } bool operator==(const ImpMaterialAttribute3D& rCandidate) const { - return (maColor == rCandidate.maColor - && maSpecular == rCandidate.maSpecular - && maEmission == rCandidate.maEmission - && mnSpecularIntensity == rCandidate.mnSpecularIntensity); + return (getColor() == rCandidate.getColor() + && getSpecular() == rCandidate.getSpecular() + && getEmission() == rCandidate.getEmission() + && getSpecularIntensity() == rCandidate.getSpecularIntensity()); } - const basegfx::BColor& getColor() const { return maColor; } - const basegfx::BColor& getSpecular() const { return maSpecular; } - const basegfx::BColor& getEmission() const { return maEmission; } - sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; } - }; - } // end of anonymous namespace -} // end of namespace drawinglayer + static ImpMaterialAttribute3D* get_global_default() + { + static ImpMaterialAttribute3D* pDefault = 0; -////////////////////////////////////////////////////////////////////////////// + if(!pDefault) + { + pDefault = new ImpMaterialAttribute3D( + basegfx::BColor(), + basegfx::BColor(), + basegfx::BColor(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } -namespace drawinglayer -{ - namespace attribute - { - MaterialAttribute3D::MaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) - : mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor, rSpecular, rEmission, nSpecularIntensity)) + return pDefault; + } + }; + + MaterialAttribute3D::MaterialAttribute3D( + const basegfx::BColor& rColor, + const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, + sal_uInt16 nSpecularIntensity) + : mpMaterialAttribute3D(new ImpMaterialAttribute3D( + rColor, rSpecular, rEmission, nSpecularIntensity)) { } - MaterialAttribute3D::MaterialAttribute3D(const basegfx::BColor& rColor) + MaterialAttribute3D::MaterialAttribute3D( + const basegfx::BColor& rColor) : mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor)) { } MaterialAttribute3D::MaterialAttribute3D() - : mpMaterialAttribute3D(new ImpMaterialAttribute3D()) + : mpMaterialAttribute3D(ImpMaterialAttribute3D::get_global_default()) { + mpMaterialAttribute3D->mnRefCount++; } MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D& rCandidate) @@ -136,6 +149,11 @@ namespace drawinglayer } } + bool MaterialAttribute3D::isDefault() const + { + return mpMaterialAttribute3D == ImpMaterialAttribute3D::get_global_default(); + } + MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D& rCandidate) { if(rCandidate.mpMaterialAttribute3D != mpMaterialAttribute3D) @@ -163,6 +181,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpMaterialAttribute3D == *mpMaterialAttribute3D); } diff --git a/drawinglayer/source/attribute/sdrallattribute3d.cxx b/drawinglayer/source/attribute/sdrallattribute3d.cxx index 264d8d0432d1..379e38f0e6ed 100644 --- a/drawinglayer/source/attribute/sdrallattribute3d.cxx +++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx @@ -37,12 +37,6 @@ #include "precompiled_drawinglayer.hxx" #include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) ////////////////////////////////////////////////////////////////////////////// @@ -50,150 +44,47 @@ namespace drawinglayer { namespace attribute { - SdrLineFillShadowAttribute::SdrLineFillShadowAttribute( - SdrLineAttribute* pLine, - SdrFillAttribute* pFill, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - FillGradientAttribute* pFillFloatTransGradient) - : mpShadow(pShadow), - mpLine(pLine), - mpLineStartEnd(pLineStartEnd), - mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient) - { - } - - SdrLineFillShadowAttribute::SdrLineFillShadowAttribute( - const SdrLineFillShadowAttribute& rCandidate) - : mpShadow(0), - mpLine(0), - mpLineStartEnd(0), - mpFill(0), - mpFillFloatTransGradient(0) + SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient) + : maLine(rLine), + maFill(rFill), + maLineStartEnd(rLineStartEnd), + maShadow(rShadow), + maFillFloatTransGradient(rFillFloatTransGradient) { - *this = rCandidate; } - SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute() + SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D() + : maLine(), + maFill(), + maLineStartEnd(), + maShadow(), + maFillFloatTransGradient() { - delete mpShadow; - delete mpLine; - delete mpLineStartEnd; - delete mpFill; - delete mpFillFloatTransGradient; } - SdrLineFillShadowAttribute& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute& rCandidate) + bool SdrLineFillShadowAttribute3D::isDefault() const { - // handle mpShadow - { - // delete local mpShadow if necessary - if(mpShadow) - { - delete mpShadow; - mpShadow = 0; - } - - // copy mpShadow if necessary - if(rCandidate.mpShadow) - { - mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow); - } - } - - // handle mpLine - { - // delete local mpLine if necessary - if(mpLine) - { - delete mpLine; - mpLine = 0; - } - - // copy mpLine if necessary - if(rCandidate.mpLine) - { - mpLine = new SdrLineAttribute(*rCandidate.mpLine); - } - } - - // handle mpLineStartEnd - { - // delete local mpLineStartEnd if necessary - if(mpLineStartEnd) - { - delete mpLineStartEnd; - mpLineStartEnd = 0; - } - - // copy mpLineStartEnd if necessary - if(rCandidate.mpLineStartEnd) - { - mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); - } - } - - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - return *this; + return(getLine().isDefault() + && getFill().isDefault() + && getLineStartEnd().isDefault() + && getShadow().isDefault() + && getFillFloatTransGradient().isDefault()); } - bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute& rCandidate) const + bool SdrLineFillShadowAttribute3D::operator==(const SdrLineFillShadowAttribute3D& rCandidate) const { - // handle mpShadow - if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow)) - return false; - - // handle mpLine - if(!pointerOrContentEqual(mpLine, rCandidate.mpLine)) - return false; - - // handle mpLineStartEnd - if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd)) - return false; - - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - return true; + return(getLine() == rCandidate.getLine() + && getFill() == rCandidate.getFill() + && getLineStartEnd() == rCandidate.getLineStartEnd() + && getShadow() == rCandidate.getShadow() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()); } - } // end of namespace attribute + } // end of namespace overlay } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/attribute/sdrattribute.cxx b/drawinglayer/source/attribute/sdrattribute.cxx deleted file mode 100644 index 8e55afa6751e..000000000000 --- a/drawinglayer/source/attribute/sdrattribute.cxx +++ /dev/null @@ -1,293 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrattribute.cxx,v $ - * - * $Revision: 1.5 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineAttribute::SdrLineAttribute( - basegfx::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, - const ::std::vector< double >& rDotDashArray, double fFullDotDashLen) - : meJoin(eJoin), - mfWidth(fWidth), - mfTransparence(fTransparence), - maColor(rColor), - maDotDashArray(rDotDashArray), - mfFullDotDashLen(fFullDotDashLen) - { - } - - SdrLineAttribute::SdrLineAttribute(const basegfx::BColor& rColor) - : meJoin(basegfx::B2DLINEJOIN_NONE), - mfWidth(0.0), - mfTransparence(0.0), - maColor(rColor), - maDotDashArray(), - mfFullDotDashLen(0.0) - { - } - - SdrLineAttribute::~SdrLineAttribute() - { - } - - bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const - { - return (meJoin == rCandidate.meJoin - && mfWidth == rCandidate.mfWidth - && mfTransparence == rCandidate.mfTransparence - && maColor == rCandidate.maColor - && maDotDashArray == rCandidate.maDotDashArray); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineStartEndAttribute::SdrLineStartEndAttribute( - const basegfx::B2DPolyPolygon& rStartPolyPolygon, const basegfx::B2DPolyPolygon& rEndPolyPolygon, - double fStartWidth, double fEndWidth, bool bStartActive, bool bEndActive, bool bStartCentered, bool bEndCentered) - : maStartPolyPolygon(rStartPolyPolygon), - maEndPolyPolygon(rEndPolyPolygon), - mfStartWidth(fStartWidth), - mfEndWidth(fEndWidth), - mbStartActive(bStartActive), - mbEndActive(bEndActive), - mbStartCentered(bStartCentered), - mbEndCentered(bEndCentered) - { - } - - SdrLineStartEndAttribute::~SdrLineStartEndAttribute() - { - } - - bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const - { - return (mbStartActive == rCandidate.mbStartActive - && mbEndActive == rCandidate.mbEndActive - && mbStartCentered == rCandidate.mbStartCentered - && mbEndCentered == rCandidate.mbEndCentered - && mfStartWidth == rCandidate.mfStartWidth - && mfEndWidth == rCandidate.mfEndWidth - && maStartPolyPolygon == rCandidate.maStartPolyPolygon - && maEndPolyPolygon == rCandidate.maEndPolyPolygon); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrShadowAttribute::SdrShadowAttribute(const basegfx::B2DVector& rOffset, double fTransparence, const basegfx::BColor& rColor) - : maOffset(rOffset), - mfTransparence(fTransparence), - maColor(rColor) - { - } - - SdrShadowAttribute::~SdrShadowAttribute() - { - } - - bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const - { - return (mfTransparence == rCandidate.mfTransparence - && maColor == rCandidate.maColor - && maOffset == rCandidate.maOffset); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrFillAttribute::SdrFillAttribute( - double fTransparence, - const basegfx::BColor& rColor, - FillGradientAttribute* pGradient, - FillHatchAttribute* pHatch, - SdrFillBitmapAttribute* pBitmap) - : mfTransparence(fTransparence), - maColor(rColor), - mpGradient(pGradient), - mpHatch(pHatch), - mpBitmap(pBitmap) - { - } - - SdrFillAttribute::SdrFillAttribute(const SdrFillAttribute& rCandidate) - : mfTransparence(1.0), - mpGradient(0L), - mpHatch(0L), - mpBitmap(0L) - { - if(!(*this == rCandidate)) - { - *this = rCandidate; - } - } - - SdrFillAttribute::~SdrFillAttribute() - { - delete mpGradient; - delete mpHatch; - delete mpBitmap; - } - - SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute& rCandidate) - { - // copy data - mfTransparence = rCandidate.mfTransparence; - maColor = rCandidate.maColor; - - // handle mpGradient - { - // delete local mpGradient if necessary - if(mpGradient && ((!rCandidate.mpGradient) || (!(*mpGradient == *rCandidate.mpGradient)))) - { - delete mpGradient; - mpGradient = 0L; - } - - // copy mpGradient if necessary - if(!mpGradient && rCandidate.mpGradient) - { - mpGradient = new FillGradientAttribute(*rCandidate.mpGradient); - } - } - - // handle mpHatch - { - // delete local mpHatch if necessary - if(mpHatch && ((!rCandidate.mpHatch) || (!(*mpHatch == *rCandidate.mpHatch)))) - { - delete mpHatch; - mpHatch = 0L; - } - - // copy mpHatch if necessary - if(!mpHatch && rCandidate.mpHatch) - { - mpHatch = new FillHatchAttribute(*rCandidate.mpHatch); - } - } - - // handle mpBitmap - { - // delete local mpBitmap if necessary - if(mpBitmap && ((!rCandidate.mpBitmap) || (!(*mpBitmap == *rCandidate.mpBitmap)))) - { - delete mpBitmap; - mpBitmap = 0L; - } - - // copy mpBitmap if necessary - if(!mpBitmap && rCandidate.mpBitmap) - { - mpBitmap = new SdrFillBitmapAttribute(*rCandidate.mpBitmap); - } - } - - return *this; - } - - bool SdrFillAttribute::operator==(const SdrFillAttribute& rCandidate) const - { - if(mfTransparence != rCandidate.mfTransparence) - return false; - - if(mpGradient) - { - if(!rCandidate.mpGradient) - return false; - - if(!(*mpGradient == *rCandidate.mpGradient)) - return false; - } - else if(mpHatch) - { - if(!rCandidate.mpHatch) - return false; - - if(!(*mpHatch == *rCandidate.mpHatch)) - return false; - - if(mpHatch->isFillBackground() && !(maColor == rCandidate.maColor)) - return false; - } - else if(mpBitmap) - { - if(!rCandidate.mpBitmap) - return false; - - if(!(*mpBitmap == *rCandidate.mpBitmap)) - return false; - } - else - { - if(!rCandidate.isColor()) - return false; - - if(!(maColor == rCandidate.maColor)) - return false; - } - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/sdrattribute3d.cxx b/drawinglayer/source/attribute/sdrattribute3d.cxx deleted file mode 100644 index c130675b9c97..000000000000 --- a/drawinglayer/source/attribute/sdrattribute3d.cxx +++ /dev/null @@ -1,219 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrattribute3d.cxx,v $ - * - * $Revision: 1.5 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - Sdr3DObjectAttribute::Sdr3DObjectAttribute( - ::com::sun::star::drawing::NormalsKind aNormalsKind, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, - ::com::sun::star::drawing::TextureKind2 aTextureKind, - ::com::sun::star::drawing::TextureMode aTextureMode, - const MaterialAttribute3D& rMaterial, - bool bNormalsInvert, - bool bDoubleSided, - bool bShadow3D, - bool bTextureFilter, - bool bReducedLineGeometry) - : maNormalsKind(aNormalsKind), - maTextureProjectionX(aTextureProjectionX), - maTextureProjectionY(aTextureProjectionY), - maTextureKind(aTextureKind), - maTextureMode(aTextureMode), - maMaterial(rMaterial), - mbNormalsInvert(bNormalsInvert), - mbDoubleSided(bDoubleSided), - mbShadow3D(bShadow3D), - mbTextureFilter(bTextureFilter), - mbReducedLineGeometry(bReducedLineGeometry) - { - } - - bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const - { - return (maNormalsKind == rCandidate.maNormalsKind - && maTextureProjectionX == rCandidate.maTextureProjectionX - && maTextureProjectionY == rCandidate.maTextureProjectionY - && maTextureKind == rCandidate.maTextureKind - && maTextureMode == rCandidate.maTextureMode - && maMaterial == rCandidate.maMaterial - && mbNormalsInvert == rCandidate.mbNormalsInvert - && mbDoubleSided == rCandidate.mbDoubleSided - && mbShadow3D == rCandidate.mbShadow3D - && mbTextureFilter == rCandidate.mbTextureFilter - && mbReducedLineGeometry == rCandidate.mbReducedLineGeometry); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - Sdr3DLightAttribute::Sdr3DLightAttribute(const basegfx::BColor& rColor, const basegfx::B3DVector& rDirection, bool bSpecular) - : maColor(rColor), - maDirection(rDirection), - mbSpecular(bSpecular) - { - } - - bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const - { - return (maColor == rCandidate.maColor - && maDirection == rCandidate.maDirection - && mbSpecular == rCandidate.mbSpecular); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLightingAttribute::SdrLightingAttribute( - const basegfx::BColor& rAmbientLight, - const ::std::vector< Sdr3DLightAttribute >& rLightVector) - : maAmbientLight(rAmbientLight), - maLightVector(rLightVector) - { - } - - bool SdrLightingAttribute::operator==(const SdrLightingAttribute& rCandidate) const - { - return (maAmbientLight == rCandidate.maAmbientLight - && maLightVector == rCandidate.maLightVector); - } - - // color model solver - basegfx::BColor SdrLightingAttribute::solveColorModel( - const basegfx::B3DVector& rNormalInEyeCoordinates, - const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, - const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const - { - // initialize with emissive color - basegfx::BColor aRetval(rEmission); - - // take care of global ambient light - aRetval += getAmbientLight() * rColor; - - // prepare light access. Is there a light? - const sal_uInt32 nLightCount(maLightVector.size()); - - if(nLightCount && !rNormalInEyeCoordinates.equalZero()) - { - // prepare normal - basegfx::B3DVector aEyeNormal(rNormalInEyeCoordinates); - aEyeNormal.normalize(); - - for(sal_uInt32 a(0L); a < nLightCount; a++) - { - const Sdr3DLightAttribute& rLight(maLightVector[a]); - const double fCosFac(rLight.getDirection().scalar(aEyeNormal)); - - if(basegfx::fTools::more(fCosFac, 0.0)) - { - aRetval += ((rLight.getColor() * rColor) * fCosFac); - - if(rLight.getSpecular()) - { - // expand by (0.0, 0.0, 1.0) in Z - basegfx::B3DVector aSpecularNormal(rLight.getDirection().getX(), rLight.getDirection().getY(), rLight.getDirection().getZ() + 1.0); - aSpecularNormal.normalize(); - double fCosFac2(aSpecularNormal.scalar(aEyeNormal)); - - if(basegfx::fTools::more(fCosFac2, 0.0)) - { - fCosFac2 = pow(fCosFac2, (double)nSpecularIntensity); - aRetval += (rSpecular * fCosFac2); - } - } - } - } - } - - // clamp to color space before usage - aRetval.clamp(); - - return aRetval; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrSceneAttribute::SdrSceneAttribute( - double fDistance, - double fShadowSlant, - ::com::sun::star::drawing::ProjectionMode aProjectionMode, - ::com::sun::star::drawing::ShadeMode aShadeMode, - bool bTwoSidedLighting) - : mfDistance(fDistance), - mfShadowSlant(fShadowSlant), - maProjectionMode(aProjectionMode), - maShadeMode(aShadeMode), - mbTwoSidedLighting(bTwoSidedLighting) - { - } - - bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const - { - return (mfDistance == rCandidate.mfDistance - && mfShadowSlant == rCandidate.mfShadowSlant - && maProjectionMode == rCandidate.maProjectionMode - && maShadeMode == rCandidate.maShadeMode - && mbTwoSidedLighting == rCandidate.mbTwoSidedLighting); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/sdrfillattribute.cxx b/drawinglayer/source/attribute/sdrfillattribute.cxx new file mode 100644 index 000000000000..bd99ba2c4ba4 --- /dev/null +++ b/drawinglayer/source/attribute/sdrfillattribute.cxx @@ -0,0 +1,221 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrFillAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // fill definitions + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // fill color + FillGradientAttribute maGradient; // fill gradient (if used) + FillHatchAttribute maHatch; // fill hatch (if used) + SdrFillBitmapAttribute maBitmap; // fill bitmap (if used) + + public: + ImpSdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap) + : mnRefCount(0), + mfTransparence(fTransparence), + maColor(rColor), + maGradient(rGradient), + maHatch(rHatch), + maBitmap(rBitmap) + { + } + + // data read access + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + const FillGradientAttribute& getGradient() const { return maGradient; } + const FillHatchAttribute& getHatch() const { return maHatch; } + const SdrFillBitmapAttribute& getBitmap() const { return maBitmap; } + + // compare operator + bool operator==(const ImpSdrFillAttribute& rCandidate) const + { + return(getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor() + && getGradient() == rCandidate.getGradient() + && getHatch() == rCandidate.getHatch() + && getBitmap() == rCandidate.getBitmap()); + } + + static ImpSdrFillAttribute* get_global_default() + { + static ImpSdrFillAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFillAttribute( + 0.0, + basegfx::BColor(), + FillGradientAttribute(), + FillHatchAttribute(), + SdrFillBitmapAttribute()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrFillAttribute::SdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap) + : mpSdrFillAttribute(new ImpSdrFillAttribute( + fTransparence, rColor, rGradient, rHatch, rBitmap)) + { + } + + SdrFillAttribute::SdrFillAttribute() + : mpSdrFillAttribute(ImpSdrFillAttribute::get_global_default()) + { + mpSdrFillAttribute->mnRefCount++; + } + + SdrFillAttribute::SdrFillAttribute(const SdrFillAttribute& rCandidate) + : mpSdrFillAttribute(rCandidate.mpSdrFillAttribute) + { + mpSdrFillAttribute->mnRefCount++; + } + + SdrFillAttribute::~SdrFillAttribute() + { + if(mpSdrFillAttribute->mnRefCount) + { + mpSdrFillAttribute->mnRefCount--; + } + else + { + delete mpSdrFillAttribute; + } + } + + bool SdrFillAttribute::isDefault() const + { + return mpSdrFillAttribute == ImpSdrFillAttribute::get_global_default(); + } + + SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute& rCandidate) + { + if(rCandidate.mpSdrFillAttribute != mpSdrFillAttribute) + { + if(mpSdrFillAttribute->mnRefCount) + { + mpSdrFillAttribute->mnRefCount--; + } + else + { + delete mpSdrFillAttribute; + } + + mpSdrFillAttribute = rCandidate.mpSdrFillAttribute; + mpSdrFillAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrFillAttribute::operator==(const SdrFillAttribute& rCandidate) const + { + if(rCandidate.mpSdrFillAttribute == mpSdrFillAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFillAttribute == *mpSdrFillAttribute); + } + + double SdrFillAttribute::getTransparence() const + { + return mpSdrFillAttribute->getTransparence(); + } + + const basegfx::BColor& SdrFillAttribute::getColor() const + { + return mpSdrFillAttribute->getColor(); + } + + const FillGradientAttribute& SdrFillAttribute::getGradient() const + { + return mpSdrFillAttribute->getGradient(); + } + + const FillHatchAttribute& SdrFillAttribute::getHatch() const + { + return mpSdrFillAttribute->getHatch(); + } + + const SdrFillBitmapAttribute& SdrFillAttribute::getBitmap() const + { + return mpSdrFillAttribute->getBitmap(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx index d7e9090b0f62..8d46fac4a20e 100644 --- a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx @@ -38,8 +38,7 @@ #include #include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -47,37 +46,213 @@ namespace drawinglayer { namespace attribute { + class ImpSdrFillBitmapAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + Bitmap maBitmap; + basegfx::B2DVector maSize; + basegfx::B2DVector maOffset; + basegfx::B2DVector maOffsetPosition; + basegfx::B2DVector maRectPoint; + + // bitfield + unsigned mbTiling : 1; + unsigned mbStretch : 1; + unsigned mbLogSize : 1; + + ImpSdrFillBitmapAttribute( + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize) + : mnRefCount(0), + maBitmap(rBitmap), + maSize(rSize), + maOffset(rOffset), + maOffsetPosition(rOffsetPosition), + maRectPoint(rRectPoint), + mbTiling(bTiling), + mbStretch(bStretch), + mbLogSize(bLogSize) + { + } + + // data read access + const Bitmap& getBitmap() const { return maBitmap; } + const basegfx::B2DVector& getSize() const { return maSize; } + const basegfx::B2DVector& getOffset() const { return maOffset; } + const basegfx::B2DVector& getOffsetPosition() const { return maOffsetPosition; } + const basegfx::B2DVector& getRectPoint() const { return maRectPoint; } + bool getTiling() const { return mbTiling; } + bool getStretch() const { return mbStretch; } + bool getLogSize() const { return mbLogSize; } + + bool operator==(const ImpSdrFillBitmapAttribute& rCandidate) const + { + return (getBitmap() == rCandidate.getBitmap() + && getSize() == rCandidate.getSize() + && getOffset() == rCandidate.getOffset() + && getOffsetPosition() == rCandidate.getOffsetPosition() + && getRectPoint() == rCandidate.getRectPoint() + && getTiling() == rCandidate.getTiling() + && getStretch() == rCandidate.getStretch() + && getLogSize() == rCandidate.getLogSize()); + } + + static ImpSdrFillBitmapAttribute* get_global_default() + { + static ImpSdrFillBitmapAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFillBitmapAttribute( + Bitmap(), + basegfx::B2DVector(), + basegfx::B2DVector(), + basegfx::B2DVector(), + basegfx::B2DVector(), + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrFillBitmapAttribute::SdrFillBitmapAttribute( - const Bitmap& rBitmap, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, - const basegfx::B2DVector& rOffsetPosition, const basegfx::B2DVector& rRectPoint, - bool bTiling, bool bStretch, bool bLogSize) - : maBitmap(rBitmap), - maSize(rSize), - maOffset(rOffset), - maOffsetPosition(rOffsetPosition), - maRectPoint(rRectPoint), - mbTiling(bTiling), - mbStretch(bStretch), - mbLogSize(bLogSize) + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize) + : mpSdrFillBitmapAttribute(new ImpSdrFillBitmapAttribute( + rBitmap, rSize, rOffset, rOffsetPosition, rRectPoint, bTiling, bStretch, bLogSize)) { } + SdrFillBitmapAttribute::SdrFillBitmapAttribute() + : mpSdrFillBitmapAttribute(ImpSdrFillBitmapAttribute::get_global_default()) + { + mpSdrFillBitmapAttribute->mnRefCount++; + } + + SdrFillBitmapAttribute::SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate) + : mpSdrFillBitmapAttribute(rCandidate.mpSdrFillBitmapAttribute) + { + mpSdrFillBitmapAttribute->mnRefCount++; + } + + SdrFillBitmapAttribute::~SdrFillBitmapAttribute() + { + if(mpSdrFillBitmapAttribute->mnRefCount) + { + mpSdrFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpSdrFillBitmapAttribute; + } + } + + bool SdrFillBitmapAttribute::isDefault() const + { + return mpSdrFillBitmapAttribute == ImpSdrFillBitmapAttribute::get_global_default(); + } + + SdrFillBitmapAttribute& SdrFillBitmapAttribute::operator=(const SdrFillBitmapAttribute& rCandidate) + { + if(rCandidate.mpSdrFillBitmapAttribute != mpSdrFillBitmapAttribute) + { + if(mpSdrFillBitmapAttribute->mnRefCount) + { + mpSdrFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpSdrFillBitmapAttribute; + } + + mpSdrFillBitmapAttribute = rCandidate.mpSdrFillBitmapAttribute; + mpSdrFillBitmapAttribute->mnRefCount++; + } + + return *this; + } + bool SdrFillBitmapAttribute::operator==(const SdrFillBitmapAttribute& rCandidate) const { - return (maBitmap == rCandidate.maBitmap - && maSize == rCandidate.maSize - && maOffset == rCandidate.maOffset - && maOffsetPosition == rCandidate.maOffsetPosition - && maRectPoint == rCandidate.maRectPoint - && mbTiling == rCandidate.mbTiling - && mbStretch == rCandidate.mbStretch - && mbLogSize == rCandidate.mbLogSize); + if(rCandidate.mpSdrFillBitmapAttribute == mpSdrFillBitmapAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFillBitmapAttribute == *mpSdrFillBitmapAttribute); + } + + const Bitmap& SdrFillBitmapAttribute::getBitmap() const + { + return mpSdrFillBitmapAttribute->getBitmap(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getSize() const + { + return mpSdrFillBitmapAttribute->getSize(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getOffset() const + { + return mpSdrFillBitmapAttribute->getOffset(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getOffsetPosition() const + { + return mpSdrFillBitmapAttribute->getOffsetPosition(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getRectPoint() const + { + return mpSdrFillBitmapAttribute->getRectPoint(); + } + + bool SdrFillBitmapAttribute::getTiling() const + { + return mpSdrFillBitmapAttribute->getTiling(); + } + + bool SdrFillBitmapAttribute::getStretch() const + { + return mpSdrFillBitmapAttribute->getStretch(); + } + + bool SdrFillBitmapAttribute::getLogSize() const + { + return mpSdrFillBitmapAttribute->getLogSize(); } FillBitmapAttribute SdrFillBitmapAttribute::getFillBitmapAttribute(const basegfx::B2DRange& rRange) const { // get logical size of bitmap (before expanding eventually) - Bitmap aBitmap(maBitmap); + Bitmap aBitmap(getBitmap()); const basegfx::B2DVector aLogicalSize(aBitmap.GetPrefSize().getWidth(), aBitmap.GetPrefSize().getHeight()); // get hor/ver shiftings and apply them eventually to the bitmap, but only @@ -85,17 +260,17 @@ namespace drawinglayer bool bExpandWidth(false); bool bExpandHeight(false); - if(mbTiling) + if(getTiling()) { - if(0.0 != maOffset.getX() || 0.0 != maOffset.getY()) + if(0.0 != getOffset().getX() || 0.0 != getOffset().getY()) { const sal_uInt32 nWidth(aBitmap.GetSizePixel().getWidth()); const sal_uInt32 nHeight(aBitmap.GetSizePixel().getHeight()); - if(0.0 != maOffset.getX()) + if(0.0 != getOffset().getX()) { bExpandHeight = true; - const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * maOffset.getX()) / 100.0)); + const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * getOffset().getX()) / 100.0)); aBitmap.Expand(0L, nHeight); const Size aSizeA(nOffset, nHeight); @@ -111,7 +286,7 @@ namespace drawinglayer else { bExpandWidth = true; - const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * maOffset.getY()) / 100.0)); + const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * getOffset().getY()) / 100.0)); aBitmap.Expand(nWidth, 0L); const Size aSize(nWidth, nHeight); @@ -137,7 +312,7 @@ namespace drawinglayer basegfx::B2DVector aBitmapTopLeft(0.0, 0.0); // are canges needed? - if(mbTiling || !mbStretch) + if(getTiling() || !getStretch()) { // init values with range sizes const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0); @@ -145,15 +320,15 @@ namespace drawinglayer aBitmapSize = basegfx::B2DPoint(fRangeWidth, fRangeHeight); // size changes - if(0.0 != maSize.getX()) + if(0.0 != getSize().getX()) { - if(maSize.getX() < 0.0) + if(getSize().getX() < 0.0) { - aBitmapSize.setX(aBitmapSize.getX() * (maSize.getX() * -0.01)); + aBitmapSize.setX(aBitmapSize.getX() * (getSize().getX() * -0.01)); } else { - aBitmapSize.setX(maSize.getX()); + aBitmapSize.setX(getSize().getX()); } } else @@ -161,15 +336,15 @@ namespace drawinglayer aBitmapSize.setX(aLogicalSize.getX()); } - if(0.0 != maSize.getY()) + if(0.0 != getSize().getY()) { - if(maSize.getY() < 0.0) + if(getSize().getY() < 0.0) { - aBitmapSize.setY(aBitmapSize.getY() * (maSize.getY() * -0.01)); + aBitmapSize.setY(aBitmapSize.getY() * (getSize().getY() * -0.01)); } else { - aBitmapSize.setY(maSize.getY()); + aBitmapSize.setY(getSize().getY()); } } else @@ -178,7 +353,7 @@ namespace drawinglayer } // get values, force to centered if necessary - const basegfx::B2DVector aRectPoint(mbTiling ? maRectPoint : basegfx::B2DVector(0.0, 0.0)); + const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0)); // position changes X if(0.0 == aRectPoint.getX()) @@ -190,9 +365,9 @@ namespace drawinglayer aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX()); } - if(mbTiling && 0.0 != maOffsetPosition.getX()) + if(getTiling() && 0.0 != getOffsetPosition().getX()) { - aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (maOffsetPosition.getX() * 0.01))); + aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01))); } // position changes Y @@ -205,9 +380,9 @@ namespace drawinglayer aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY()); } - if(mbTiling && 0.0 != maOffsetPosition.getY()) + if(getTiling() && 0.0 != getOffsetPosition().getY()) { - aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (maOffsetPosition.getY() * 0.01))); + aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01))); } // apply expand @@ -228,7 +403,7 @@ namespace drawinglayer aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight); } - return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, mbTiling); + return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, getTiling()); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/sdrlightattribute3d.cxx b/drawinglayer/source/attribute/sdrlightattribute3d.cxx new file mode 100644 index 000000000000..bc22d0a5f183 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlightattribute3d.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdr3DLightAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D light attribute definitions + basegfx::BColor maColor; + basegfx::B3DVector maDirection; + + // bitfield + unsigned mbSpecular : 1; + + ImpSdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular) + : mnRefCount(0), + maColor(rColor), + maDirection(rDirection), + mbSpecular(bSpecular) + { + } + + // data read access + const basegfx::BColor& getColor() const { return maColor; } + const basegfx::B3DVector& getDirection() const { return maDirection; } + bool getSpecular() const { return mbSpecular; } + + bool operator==(const ImpSdr3DLightAttribute& rCandidate) const + { + return (getColor() == rCandidate.getColor() + && getDirection() == rCandidate.getDirection() + && getSpecular() == rCandidate.getSpecular()); + } + + static ImpSdr3DLightAttribute* get_global_default() + { + static ImpSdr3DLightAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdr3DLightAttribute( + basegfx::BColor(), + basegfx::B3DVector(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + Sdr3DLightAttribute::Sdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular) + : mpSdr3DLightAttribute(new ImpSdr3DLightAttribute( + rColor, rDirection, bSpecular)) + { + } + + Sdr3DLightAttribute::Sdr3DLightAttribute() + : mpSdr3DLightAttribute(ImpSdr3DLightAttribute::get_global_default()) + { + mpSdr3DLightAttribute->mnRefCount++; + } + + Sdr3DLightAttribute::Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate) + : mpSdr3DLightAttribute(rCandidate.mpSdr3DLightAttribute) + { + mpSdr3DLightAttribute->mnRefCount++; + } + + Sdr3DLightAttribute::~Sdr3DLightAttribute() + { + if(mpSdr3DLightAttribute->mnRefCount) + { + mpSdr3DLightAttribute->mnRefCount--; + } + else + { + delete mpSdr3DLightAttribute; + } + } + + bool Sdr3DLightAttribute::isDefault() const + { + return mpSdr3DLightAttribute == ImpSdr3DLightAttribute::get_global_default(); + } + + Sdr3DLightAttribute& Sdr3DLightAttribute::operator=(const Sdr3DLightAttribute& rCandidate) + { + if(rCandidate.mpSdr3DLightAttribute != mpSdr3DLightAttribute) + { + if(mpSdr3DLightAttribute->mnRefCount) + { + mpSdr3DLightAttribute->mnRefCount--; + } + else + { + delete mpSdr3DLightAttribute; + } + + mpSdr3DLightAttribute = rCandidate.mpSdr3DLightAttribute; + mpSdr3DLightAttribute->mnRefCount++; + } + + return *this; + } + + bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const + { + if(rCandidate.mpSdr3DLightAttribute == mpSdr3DLightAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdr3DLightAttribute == *mpSdr3DLightAttribute); + } + + const basegfx::BColor& Sdr3DLightAttribute::getColor() const + { + return mpSdr3DLightAttribute->getColor(); + } + + const basegfx::B3DVector& Sdr3DLightAttribute::getDirection() const + { + return mpSdr3DLightAttribute->getDirection(); + } + + bool Sdr3DLightAttribute::getSpecular() const + { + return mpSdr3DLightAttribute->getSpecular(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlightingattribute3d.cxx b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx new file mode 100644 index 000000000000..25407d52f282 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLightingAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D light attribute definitions + basegfx::BColor maAmbientLight; + ::std::vector< Sdr3DLightAttribute > maLightVector; + + ImpSdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector) + : mnRefCount(0), + maAmbientLight(rAmbientLight), + maLightVector(rLightVector) + { + } + + // data read access + const basegfx::BColor& getAmbientLight() const { return maAmbientLight; } + const ::std::vector< Sdr3DLightAttribute >& getLightVector() const { return maLightVector; } + + bool operator==(const ImpSdrLightingAttribute& rCandidate) const + { + return (getAmbientLight() == rCandidate.getAmbientLight() + && getLightVector() == rCandidate.getLightVector()); + } + + static ImpSdrLightingAttribute* get_global_default() + { + static ImpSdrLightingAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLightingAttribute( + basegfx::BColor(), + std::vector< Sdr3DLightAttribute >()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLightingAttribute::SdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector) + : mpSdrLightingAttribute(new ImpSdrLightingAttribute( + rAmbientLight, rLightVector)) + { + } + + SdrLightingAttribute::SdrLightingAttribute() + : mpSdrLightingAttribute(ImpSdrLightingAttribute::get_global_default()) + { + mpSdrLightingAttribute->mnRefCount++; + } + + SdrLightingAttribute::SdrLightingAttribute(const SdrLightingAttribute& rCandidate) + : mpSdrLightingAttribute(rCandidate.mpSdrLightingAttribute) + { + mpSdrLightingAttribute->mnRefCount++; + } + + SdrLightingAttribute::~SdrLightingAttribute() + { + if(mpSdrLightingAttribute->mnRefCount) + { + mpSdrLightingAttribute->mnRefCount--; + } + else + { + delete mpSdrLightingAttribute; + } + } + + bool SdrLightingAttribute::isDefault() const + { + return mpSdrLightingAttribute == ImpSdrLightingAttribute::get_global_default(); + } + + SdrLightingAttribute& SdrLightingAttribute::operator=(const SdrLightingAttribute& rCandidate) + { + if(rCandidate.mpSdrLightingAttribute != mpSdrLightingAttribute) + { + if(mpSdrLightingAttribute->mnRefCount) + { + mpSdrLightingAttribute->mnRefCount--; + } + else + { + delete mpSdrLightingAttribute; + } + + mpSdrLightingAttribute = rCandidate.mpSdrLightingAttribute; + mpSdrLightingAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLightingAttribute::operator==(const SdrLightingAttribute& rCandidate) const + { + if(rCandidate.mpSdrLightingAttribute == mpSdrLightingAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLightingAttribute == *mpSdrLightingAttribute); + } + + const basegfx::BColor& SdrLightingAttribute::getAmbientLight() const + { + return mpSdrLightingAttribute->getAmbientLight(); + } + + const ::std::vector< Sdr3DLightAttribute >& SdrLightingAttribute::getLightVector() const + { + return mpSdrLightingAttribute->getLightVector(); + } + + // color model solver + basegfx::BColor SdrLightingAttribute::solveColorModel( + const basegfx::B3DVector& rNormalInEyeCoordinates, + const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const + { + // initialize with emissive color + basegfx::BColor aRetval(rEmission); + + // take care of global ambient light + aRetval += mpSdrLightingAttribute->getAmbientLight() * rColor; + + // prepare light access. Is there a light? + const sal_uInt32 nLightCount(mpSdrLightingAttribute->getLightVector().size()); + + if(nLightCount && !rNormalInEyeCoordinates.equalZero()) + { + // prepare normal + basegfx::B3DVector aEyeNormal(rNormalInEyeCoordinates); + aEyeNormal.normalize(); + + for(sal_uInt32 a(0L); a < nLightCount; a++) + { + const Sdr3DLightAttribute& rLight(mpSdrLightingAttribute->getLightVector()[a]); + const double fCosFac(rLight.getDirection().scalar(aEyeNormal)); + + if(basegfx::fTools::more(fCosFac, 0.0)) + { + aRetval += ((rLight.getColor() * rColor) * fCosFac); + + if(rLight.getSpecular()) + { + // expand by (0.0, 0.0, 1.0) in Z + basegfx::B3DVector aSpecularNormal(rLight.getDirection().getX(), rLight.getDirection().getY(), rLight.getDirection().getZ() + 1.0); + aSpecularNormal.normalize(); + double fCosFac2(aSpecularNormal.scalar(aEyeNormal)); + + if(basegfx::fTools::more(fCosFac2, 0.0)) + { + fCosFac2 = pow(fCosFac2, (double)nSpecularIntensity); + aRetval += (rSpecular * fCosFac2); + } + } + } + } + } + + // clamp to color space before usage + aRetval.clamp(); + + return aRetval; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlineattribute.cxx b/drawinglayer/source/attribute/sdrlineattribute.cxx new file mode 100644 index 000000000000..1850d919069f --- /dev/null +++ b/drawinglayer/source/attribute/sdrlineattribute.cxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // line definitions + basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines + double mfWidth; // 1/100th mm, 0.0==hair + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // color of line + ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern + double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + + ImpSdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mnRefCount(0), + meJoin(eJoin), + mfWidth(fWidth), + mfTransparence(fTransparence), + maColor(rColor), + maDotDashArray(rDotDashArray), + mfFullDotDashLen(fFullDotDashLen) + { + } + + ImpSdrLineAttribute(const basegfx::BColor& rColor) + : mnRefCount(0), + meJoin(basegfx::B2DLINEJOIN_NONE), + mfWidth(0.0), + mfTransparence(0.0), + maColor(rColor), + maDotDashArray(), + mfFullDotDashLen(0.0) + { + } + + // data read access + basegfx::B2DLineJoin getJoin() const { return meJoin; } + double getWidth() const { return mfWidth; } + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + double getFullDotDashLen() const { return mfFullDotDashLen; } + + bool operator==(const ImpSdrLineAttribute& rCandidate) const + { + return (getJoin() == rCandidate.getJoin() + && getWidth() == rCandidate.getWidth() + && getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor() + && getDotDashArray() == rCandidate.getDotDashArray()); + } + + static ImpSdrLineAttribute* get_global_default() + { + static ImpSdrLineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLineAttribute( + basegfx::B2DLINEJOIN_ROUND, + 0.0, + 0.0, + basegfx::BColor(), + std::vector< double >(), + 0.0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLineAttribute::SdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mpSdrLineAttribute(new ImpSdrLineAttribute( + eJoin, fWidth, fTransparence, rColor, rDotDashArray, fFullDotDashLen)) + { + } + + SdrLineAttribute::SdrLineAttribute( + const basegfx::BColor& rColor) + : mpSdrLineAttribute(new ImpSdrLineAttribute(rColor)) + { + } + + SdrLineAttribute::SdrLineAttribute() + : mpSdrLineAttribute(ImpSdrLineAttribute::get_global_default()) + { + mpSdrLineAttribute->mnRefCount++; + } + + SdrLineAttribute::SdrLineAttribute(const SdrLineAttribute& rCandidate) + : mpSdrLineAttribute(rCandidate.mpSdrLineAttribute) + { + mpSdrLineAttribute->mnRefCount++; + } + + SdrLineAttribute::~SdrLineAttribute() + { + if(mpSdrLineAttribute->mnRefCount) + { + mpSdrLineAttribute->mnRefCount--; + } + else + { + delete mpSdrLineAttribute; + } + } + + bool SdrLineAttribute::isDefault() const + { + return mpSdrLineAttribute == ImpSdrLineAttribute::get_global_default(); + } + + SdrLineAttribute& SdrLineAttribute::operator=(const SdrLineAttribute& rCandidate) + { + if(rCandidate.mpSdrLineAttribute != mpSdrLineAttribute) + { + if(mpSdrLineAttribute->mnRefCount) + { + mpSdrLineAttribute->mnRefCount--; + } + else + { + delete mpSdrLineAttribute; + } + + mpSdrLineAttribute = rCandidate.mpSdrLineAttribute; + mpSdrLineAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const + { + if(rCandidate.mpSdrLineAttribute == mpSdrLineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLineAttribute == *mpSdrLineAttribute); + } + + basegfx::B2DLineJoin SdrLineAttribute::getJoin() const + { + return mpSdrLineAttribute->getJoin(); + } + + double SdrLineAttribute::getWidth() const + { + return mpSdrLineAttribute->getWidth(); + } + + double SdrLineAttribute::getTransparence() const + { + return mpSdrLineAttribute->getTransparence(); + } + + const basegfx::BColor& SdrLineAttribute::getColor() const + { + return mpSdrLineAttribute->getColor(); + } + + const ::std::vector< double >& SdrLineAttribute::getDotDashArray() const + { + return mpSdrLineAttribute->getDotDashArray(); + } + + double SdrLineAttribute::getFullDotDashLen() const + { + return mpSdrLineAttribute->getFullDotDashLen(); + } + + bool SdrLineAttribute::isDashed() const + { + return (0L != getDotDashArray().size()); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlinestartendattribute.cxx b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx new file mode 100644 index 000000000000..ce85bdff5678 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLineStartEndAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // line arrow definitions + basegfx::B2DPolyPolygon maStartPolyPolygon; // start Line PolyPolygon + basegfx::B2DPolyPolygon maEndPolyPolygon; // end Line PolyPolygon + double mfStartWidth; // 1/100th mm + double mfEndWidth; // 1/100th mm + + // bitfield + unsigned mbStartActive : 1L; // start of Line is active + unsigned mbEndActive : 1L; // end of Line is active + unsigned mbStartCentered : 1L; // Line is centered on line start point + unsigned mbEndCentered : 1L; // Line is centered on line end point + + ImpSdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered) + : mnRefCount(0), + maStartPolyPolygon(rStartPolyPolygon), + maEndPolyPolygon(rEndPolyPolygon), + mfStartWidth(fStartWidth), + mfEndWidth(fEndWidth), + mbStartActive(bStartActive), + mbEndActive(bEndActive), + mbStartCentered(bStartCentered), + mbEndCentered(bEndCentered) + { + } + + // data read access + const basegfx::B2DPolyPolygon& getStartPolyPolygon() const { return maStartPolyPolygon; } + const basegfx::B2DPolyPolygon& getEndPolyPolygon() const { return maEndPolyPolygon; } + double getStartWidth() const { return mfStartWidth; } + double getEndWidth() const { return mfEndWidth; } + bool isStartActive() const { return mbStartActive; } + bool isEndActive() const { return mbEndActive; } + bool isStartCentered() const { return mbStartCentered; } + bool isEndCentered() const { return mbEndCentered; } + + bool operator==(const ImpSdrLineStartEndAttribute& rCandidate) const + { + return (getStartPolyPolygon() == rCandidate.getStartPolyPolygon() + && getEndPolyPolygon() == rCandidate.getEndPolyPolygon() + && getStartWidth() == rCandidate.getStartWidth() + && getEndWidth() == rCandidate.getEndWidth() + && isStartActive() == rCandidate.isStartActive() + && isEndActive() == rCandidate.isEndActive() + && isStartCentered() == rCandidate.isStartCentered() + && isEndCentered() == rCandidate.isEndCentered()); + } + + static ImpSdrLineStartEndAttribute* get_global_default() + { + static ImpSdrLineStartEndAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLineStartEndAttribute( + basegfx::B2DPolyPolygon(), + basegfx::B2DPolyPolygon(), + 0.0, + 0.0, + false, + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLineStartEndAttribute::SdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered) + : mpSdrLineStartEndAttribute(new ImpSdrLineStartEndAttribute( + rStartPolyPolygon, rEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered)) + { + } + + SdrLineStartEndAttribute::SdrLineStartEndAttribute() + : mpSdrLineStartEndAttribute(ImpSdrLineStartEndAttribute::get_global_default()) + { + mpSdrLineStartEndAttribute->mnRefCount++; + } + + SdrLineStartEndAttribute::SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate) + : mpSdrLineStartEndAttribute(rCandidate.mpSdrLineStartEndAttribute) + { + mpSdrLineStartEndAttribute->mnRefCount++; + } + + SdrLineStartEndAttribute::~SdrLineStartEndAttribute() + { + if(mpSdrLineStartEndAttribute->mnRefCount) + { + mpSdrLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpSdrLineStartEndAttribute; + } + } + + bool SdrLineStartEndAttribute::isDefault() const + { + return mpSdrLineStartEndAttribute == ImpSdrLineStartEndAttribute::get_global_default(); + } + + SdrLineStartEndAttribute& SdrLineStartEndAttribute::operator=(const SdrLineStartEndAttribute& rCandidate) + { + if(rCandidate.mpSdrLineStartEndAttribute != mpSdrLineStartEndAttribute) + { + if(mpSdrLineStartEndAttribute->mnRefCount) + { + mpSdrLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpSdrLineStartEndAttribute; + } + + mpSdrLineStartEndAttribute = rCandidate.mpSdrLineStartEndAttribute; + mpSdrLineStartEndAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const + { + if(rCandidate.mpSdrLineStartEndAttribute == mpSdrLineStartEndAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLineStartEndAttribute == *mpSdrLineStartEndAttribute); + } + + const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getStartPolyPolygon() const + { + return mpSdrLineStartEndAttribute->getStartPolyPolygon(); + } + + const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getEndPolyPolygon() const + { + return mpSdrLineStartEndAttribute->getEndPolyPolygon(); + } + + double SdrLineStartEndAttribute::getStartWidth() const + { + return mpSdrLineStartEndAttribute->getStartWidth(); + } + + double SdrLineStartEndAttribute::getEndWidth() const + { + return mpSdrLineStartEndAttribute->getEndWidth(); + } + + bool SdrLineStartEndAttribute::isStartActive() const + { + return mpSdrLineStartEndAttribute->isStartActive(); + } + + bool SdrLineStartEndAttribute::isEndActive() const + { + return mpSdrLineStartEndAttribute->isEndActive(); + } + + bool SdrLineStartEndAttribute::isStartCentered() const + { + return mpSdrLineStartEndAttribute->isStartCentered(); + } + + bool SdrLineStartEndAttribute::isEndCentered() const + { + return mpSdrLineStartEndAttribute->isEndCentered(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrobjectattribute3d.cxx b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx new file mode 100644 index 000000000000..a51e333236bc --- /dev/null +++ b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx @@ -0,0 +1,292 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdr3DObjectAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D object attribute definitions + ::com::sun::star::drawing::NormalsKind maNormalsKind; // normals type (0..2) + ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionX; // texture projection type X (0..2) + ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionY; // texture projection type Y (0..2) + ::com::sun::star::drawing::TextureKind2 maTextureKind; // texture kind (see uno API) + ::com::sun::star::drawing::TextureMode maTextureMode; // texture kind (see uno API) + MaterialAttribute3D maMaterial; // object, specular and emissive colors, SpecularIntensity + + // bitfield + unsigned mbNormalsInvert : 1; // invert normals + unsigned mbDoubleSided : 1; // surfaces are double sided + unsigned mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene + unsigned mbTextureFilter : 1; // filter texture to make more smooth + unsigned mbReducedLineGeometry : 1; // use reduced line geometry (object specific) + + ImpSdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry) + : mnRefCount(0), + maNormalsKind(aNormalsKind), + maTextureProjectionX(aTextureProjectionX), + maTextureProjectionY(aTextureProjectionY), + maTextureKind(aTextureKind), + maTextureMode(aTextureMode), + maMaterial(rMaterial), + mbNormalsInvert(bNormalsInvert), + mbDoubleSided(bDoubleSided), + mbShadow3D(bShadow3D), + mbTextureFilter(bTextureFilter), + mbReducedLineGeometry(bReducedLineGeometry) + { + } + + // data read access + ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; } + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; } + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; } + ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; } + ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; } + const MaterialAttribute3D& getMaterial() const { return maMaterial; } + bool getNormalsInvert() const { return mbNormalsInvert; } + bool getDoubleSided() const { return mbDoubleSided; } + bool getShadow3D() const { return mbShadow3D; } + bool getTextureFilter() const { return mbTextureFilter; } + bool getReducedLineGeometry() const { return mbReducedLineGeometry; } + + bool operator==(const ImpSdr3DObjectAttribute& rCandidate) const + { + return (getNormalsKind() == rCandidate.getNormalsKind() + && getTextureProjectionX() == rCandidate.getTextureProjectionX() + && getTextureProjectionY() == rCandidate.getTextureProjectionY() + && getTextureKind() == rCandidate.getTextureKind() + && getTextureMode() == rCandidate.getTextureMode() + && getMaterial() == rCandidate.getMaterial() + && getNormalsInvert() == rCandidate.getNormalsInvert() + && getDoubleSided() == rCandidate.getDoubleSided() + && getShadow3D() == rCandidate.getShadow3D() + && getTextureFilter() == rCandidate.getTextureFilter() + && getReducedLineGeometry() == rCandidate.getReducedLineGeometry()); + } + + static ImpSdr3DObjectAttribute* get_global_default() + { + static ImpSdr3DObjectAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind_SPECIFIC, + ::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC, + ::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC, + ::com::sun::star::drawing::TextureKind2_LUMINANCE, + ::com::sun::star::drawing::TextureMode_REPLACE, + MaterialAttribute3D(), + false, + false, + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + Sdr3DObjectAttribute::Sdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry) + : mpSdr3DObjectAttribute(new ImpSdr3DObjectAttribute( + aNormalsKind, aTextureProjectionX, aTextureProjectionY, aTextureKind, aTextureMode, + rMaterial, bNormalsInvert, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry)) + { + } + + Sdr3DObjectAttribute::Sdr3DObjectAttribute() + : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute::get_global_default()) + { + mpSdr3DObjectAttribute->mnRefCount++; + } + + Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate) + : mpSdr3DObjectAttribute(rCandidate.mpSdr3DObjectAttribute) + { + mpSdr3DObjectAttribute->mnRefCount++; + } + + Sdr3DObjectAttribute::~Sdr3DObjectAttribute() + { + if(mpSdr3DObjectAttribute->mnRefCount) + { + mpSdr3DObjectAttribute->mnRefCount--; + } + else + { + delete mpSdr3DObjectAttribute; + } + } + + bool Sdr3DObjectAttribute::isDefault() const + { + return mpSdr3DObjectAttribute == ImpSdr3DObjectAttribute::get_global_default(); + } + + Sdr3DObjectAttribute& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute& rCandidate) + { + if(rCandidate.mpSdr3DObjectAttribute != mpSdr3DObjectAttribute) + { + if(mpSdr3DObjectAttribute->mnRefCount) + { + mpSdr3DObjectAttribute->mnRefCount--; + } + else + { + delete mpSdr3DObjectAttribute; + } + + mpSdr3DObjectAttribute = rCandidate.mpSdr3DObjectAttribute; + mpSdr3DObjectAttribute->mnRefCount++; + } + + return *this; + } + + bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const + { + if(rCandidate.mpSdr3DObjectAttribute == mpSdr3DObjectAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdr3DObjectAttribute == *mpSdr3DObjectAttribute); + } + + ::com::sun::star::drawing::NormalsKind Sdr3DObjectAttribute::getNormalsKind() const + { + return mpSdr3DObjectAttribute->getNormalsKind(); + } + + ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionX() const + { + return mpSdr3DObjectAttribute->getTextureProjectionX(); + } + + ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionY() const + { + return mpSdr3DObjectAttribute->getTextureProjectionY(); + } + + ::com::sun::star::drawing::TextureKind2 Sdr3DObjectAttribute::getTextureKind() const + { + return mpSdr3DObjectAttribute->getTextureKind(); + } + + ::com::sun::star::drawing::TextureMode Sdr3DObjectAttribute::getTextureMode() const + { + return mpSdr3DObjectAttribute->getTextureMode(); + } + + const MaterialAttribute3D& Sdr3DObjectAttribute::getMaterial() const + { + return mpSdr3DObjectAttribute->getMaterial(); + } + + bool Sdr3DObjectAttribute::getNormalsInvert() const + { + return mpSdr3DObjectAttribute->getNormalsInvert(); + } + + bool Sdr3DObjectAttribute::getDoubleSided() const + { + return mpSdr3DObjectAttribute->getDoubleSided(); + } + + bool Sdr3DObjectAttribute::getShadow3D() const + { + return mpSdr3DObjectAttribute->getShadow3D(); + } + + bool Sdr3DObjectAttribute::getTextureFilter() const + { + return mpSdr3DObjectAttribute->getTextureFilter(); + } + + bool Sdr3DObjectAttribute::getReducedLineGeometry() const + { + return mpSdr3DObjectAttribute->getReducedLineGeometry(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrsceneattribute3d.cxx b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx new file mode 100644 index 000000000000..141f4c904873 --- /dev/null +++ b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrSceneAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D scene attribute definitions + double mfDistance; + double mfShadowSlant; + ::com::sun::star::drawing::ProjectionMode maProjectionMode; + ::com::sun::star::drawing::ShadeMode maShadeMode; + + // bitfield + unsigned mbTwoSidedLighting : 1; + + public: + ImpSdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting) + : mnRefCount(0), + mfDistance(fDistance), + mfShadowSlant(fShadowSlant), + maProjectionMode(aProjectionMode), + maShadeMode(aShadeMode), + mbTwoSidedLighting(bTwoSidedLighting) + { + } + + // data read access + double getDistance() const { return mfDistance; } + double getShadowSlant() const { return mfShadowSlant; } + ::com::sun::star::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; } + ::com::sun::star::drawing::ShadeMode getShadeMode() const { return maShadeMode; } + bool getTwoSidedLighting() const { return mbTwoSidedLighting; } + + bool operator==(const ImpSdrSceneAttribute& rCandidate) const + { + return (getDistance() == rCandidate.getDistance() + && getShadowSlant() == rCandidate.getShadowSlant() + && getProjectionMode() == rCandidate.getProjectionMode() + && getShadeMode() == rCandidate.getShadeMode() + && getTwoSidedLighting() == rCandidate.getTwoSidedLighting()); + } + + static ImpSdrSceneAttribute* get_global_default() + { + static ImpSdrSceneAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrSceneAttribute( + 0.0, 0.0, + ::com::sun::star::drawing::ProjectionMode_PARALLEL, + ::com::sun::star::drawing::ShadeMode_FLAT, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrSceneAttribute::SdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting) + : mpSdrSceneAttribute(new ImpSdrSceneAttribute( + fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting)) + { + } + + SdrSceneAttribute::SdrSceneAttribute() + : mpSdrSceneAttribute(ImpSdrSceneAttribute::get_global_default()) + { + mpSdrSceneAttribute->mnRefCount++; + } + + SdrSceneAttribute::SdrSceneAttribute(const SdrSceneAttribute& rCandidate) + : mpSdrSceneAttribute(rCandidate.mpSdrSceneAttribute) + { + mpSdrSceneAttribute->mnRefCount++; + } + + SdrSceneAttribute::~SdrSceneAttribute() + { + if(mpSdrSceneAttribute->mnRefCount) + { + mpSdrSceneAttribute->mnRefCount--; + } + else + { + delete mpSdrSceneAttribute; + } + } + + bool SdrSceneAttribute::isDefault() const + { + return mpSdrSceneAttribute == ImpSdrSceneAttribute::get_global_default(); + } + + SdrSceneAttribute& SdrSceneAttribute::operator=(const SdrSceneAttribute& rCandidate) + { + if(rCandidate.mpSdrSceneAttribute != mpSdrSceneAttribute) + { + if(mpSdrSceneAttribute->mnRefCount) + { + mpSdrSceneAttribute->mnRefCount--; + } + else + { + delete mpSdrSceneAttribute; + } + + mpSdrSceneAttribute = rCandidate.mpSdrSceneAttribute; + mpSdrSceneAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const + { + if(rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrSceneAttribute == *mpSdrSceneAttribute); + } + + double SdrSceneAttribute::getDistance() const + { + return mpSdrSceneAttribute->getDistance(); + } + + double SdrSceneAttribute::getShadowSlant() const + { + return mpSdrSceneAttribute->getShadowSlant(); + } + + ::com::sun::star::drawing::ProjectionMode SdrSceneAttribute::getProjectionMode() const + { + return mpSdrSceneAttribute->getProjectionMode(); + } + + ::com::sun::star::drawing::ShadeMode SdrSceneAttribute::getShadeMode() const + { + return mpSdrSceneAttribute->getShadeMode(); + } + + bool SdrSceneAttribute::getTwoSidedLighting() const + { + return mpSdrSceneAttribute->getTwoSidedLighting(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx b/drawinglayer/source/attribute/sdrshadowattribute.cxx new file mode 100644 index 000000000000..9b31b5c6d348 --- /dev/null +++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrShadowAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // shadow definitions + basegfx::B2DVector maOffset; // shadow offset 1/100th mm + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // color of shadow + + ImpSdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor) + : mnRefCount(0), + maOffset(rOffset), + mfTransparence(fTransparence), + maColor(rColor) + { + } + + // data read access + const basegfx::B2DVector& getOffset() const { return maOffset; } + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + + bool operator==(const ImpSdrShadowAttribute& rCandidate) const + { + return (getOffset() == rCandidate.getOffset() + && getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor()); + } + + static ImpSdrShadowAttribute* get_global_default() + { + static ImpSdrShadowAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrShadowAttribute( + basegfx::B2DVector(), + 0.0, + basegfx::BColor()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrShadowAttribute::SdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor) + : mpSdrShadowAttribute(new ImpSdrShadowAttribute( + rOffset, fTransparence, rColor)) + { + } + + SdrShadowAttribute::SdrShadowAttribute() + : mpSdrShadowAttribute(ImpSdrShadowAttribute::get_global_default()) + { + mpSdrShadowAttribute->mnRefCount++; + } + + SdrShadowAttribute::SdrShadowAttribute(const SdrShadowAttribute& rCandidate) + : mpSdrShadowAttribute(rCandidate.mpSdrShadowAttribute) + { + mpSdrShadowAttribute->mnRefCount++; + } + + SdrShadowAttribute::~SdrShadowAttribute() + { + if(mpSdrShadowAttribute->mnRefCount) + { + mpSdrShadowAttribute->mnRefCount--; + } + else + { + delete mpSdrShadowAttribute; + } + } + + bool SdrShadowAttribute::isDefault() const + { + return mpSdrShadowAttribute == ImpSdrShadowAttribute::get_global_default(); + } + + SdrShadowAttribute& SdrShadowAttribute::operator=(const SdrShadowAttribute& rCandidate) + { + if(rCandidate.mpSdrShadowAttribute != mpSdrShadowAttribute) + { + if(mpSdrShadowAttribute->mnRefCount) + { + mpSdrShadowAttribute->mnRefCount--; + } + else + { + delete mpSdrShadowAttribute; + } + + mpSdrShadowAttribute = rCandidate.mpSdrShadowAttribute; + mpSdrShadowAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const + { + if(rCandidate.mpSdrShadowAttribute == mpSdrShadowAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrShadowAttribute == *mpSdrShadowAttribute); + } + + const basegfx::B2DVector& SdrShadowAttribute::getOffset() const + { + return mpSdrShadowAttribute->getOffset(); + } + + double SdrShadowAttribute::getTransparence() const + { + return mpSdrShadowAttribute->getTransparence(); + } + + const basegfx::BColor& SdrShadowAttribute::getColor() const + { + return mpSdrShadowAttribute->getColor(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/strokeattribute.cxx b/drawinglayer/source/attribute/strokeattribute.cxx index f3eb4797b832..da1239e53211 100644 --- a/drawinglayer/source/attribute/strokeattribute.cxx +++ b/drawinglayer/source/attribute/strokeattribute.cxx @@ -45,16 +45,143 @@ namespace drawinglayer { namespace attribute { - double StrokeAttribute::getFullDotDashLen() const + class ImpStrokeAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern + double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + + ImpStrokeAttribute( + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mnRefCount(0), + maDotDashArray(rDotDashArray), + mfFullDotDashLen(fFullDotDashLen) + { + } + + // data read access + const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + double getFullDotDashLen() const + { + if(0.0 == mfFullDotDashLen && maDotDashArray.size()) + { + // calculate length on demand + const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0)); + const_cast< ImpStrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated; + } + + return mfFullDotDashLen; + } + + bool operator==(const ImpStrokeAttribute& rCandidate) const + { + return (getDotDashArray() == rCandidate.getDotDashArray() + && getFullDotDashLen() == rCandidate.getFullDotDashLen()); + } + + static ImpStrokeAttribute* get_global_default() + { + static ImpStrokeAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpStrokeAttribute( + std::vector< double >(), + 0.0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + StrokeAttribute::StrokeAttribute( + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mpStrokeAttribute(new ImpStrokeAttribute( + rDotDashArray, fFullDotDashLen)) + { + } + + StrokeAttribute::StrokeAttribute() + : mpStrokeAttribute(ImpStrokeAttribute::get_global_default()) + { + mpStrokeAttribute->mnRefCount++; + } + + StrokeAttribute::StrokeAttribute(const StrokeAttribute& rCandidate) + : mpStrokeAttribute(rCandidate.mpStrokeAttribute) + { + mpStrokeAttribute->mnRefCount++; + } + + StrokeAttribute::~StrokeAttribute() + { + if(mpStrokeAttribute->mnRefCount) + { + mpStrokeAttribute->mnRefCount--; + } + else + { + delete mpStrokeAttribute; + } + } + + bool StrokeAttribute::isDefault() const + { + return mpStrokeAttribute == ImpStrokeAttribute::get_global_default(); + } + + StrokeAttribute& StrokeAttribute::operator=(const StrokeAttribute& rCandidate) + { + if(rCandidate.mpStrokeAttribute != mpStrokeAttribute) + { + if(mpStrokeAttribute->mnRefCount) + { + mpStrokeAttribute->mnRefCount--; + } + else + { + delete mpStrokeAttribute; + } + + mpStrokeAttribute = rCandidate.mpStrokeAttribute; + mpStrokeAttribute->mnRefCount++; + } + + return *this; + } + + bool StrokeAttribute::operator==(const StrokeAttribute& rCandidate) const { - if(0.0 == mfFullDotDashLen && maDotDashArray.size()) + if(rCandidate.mpStrokeAttribute == mpStrokeAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) { - // calculate length on demand - const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0)); - const_cast< StrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated; + return false; } - return mfFullDotDashLen; + return (*rCandidate.mpStrokeAttribute == *mpStrokeAttribute); + } + + const ::std::vector< double >& StrokeAttribute::getDotDashArray() const + { + return mpStrokeAttribute->getDotDashArray(); + } + + double StrokeAttribute::getFullDotDashLen() const + { + return mpStrokeAttribute->getFullDotDashLen(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 3a3fd68831db..0f808e69b205 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -313,6 +313,22 @@ namespace drawinglayer impInterpretPropertyValues(rViewParameters); } + ImpViewInformation2D() + : mnRefCount(0), + maObjectTransformation(), + maViewTransformation(), + maObjectToViewTransformation(), + maInverseObjectToViewTransformation(), + maViewport(), + maDiscreteViewport(), + mxVisualizedPage(), + mfViewTime(), + mbReducedDisplayQuality(false), + mxViewInformation(), + mxExtendedInformation() + { + } + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; @@ -410,6 +426,21 @@ namespace drawinglayer && mfViewTime == rCandidate.mfViewTime && mxExtendedInformation == rCandidate.mxExtendedInformation); } + + static ImpViewInformation2D* get_global_default() + { + static ImpViewInformation2D* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpViewInformation2D(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } }; } // end of anonymous namespace } // end of namespace drawinglayer @@ -442,6 +473,12 @@ namespace drawinglayer { } + ViewInformation2D::ViewInformation2D() + : mpViewInformation2D(ImpViewInformation2D::get_global_default()) + { + mpViewInformation2D->mnRefCount++; + } + ViewInformation2D::ViewInformation2D(const ViewInformation2D& rCandidate) : mpViewInformation2D(rCandidate.mpViewInformation2D) { @@ -463,6 +500,11 @@ namespace drawinglayer } } + bool ViewInformation2D::isDefault() const + { + return mpViewInformation2D == ImpViewInformation2D::get_global_default(); + } + ViewInformation2D& ViewInformation2D::operator=(const ViewInformation2D& rCandidate) { ::osl::Mutex m_mutex; @@ -489,6 +531,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpViewInformation2D == *mpViewInformation2D); } diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx index a47384485ee7..62388adad37c 100644 --- a/drawinglayer/source/geometry/viewinformation3d.cxx +++ b/drawinglayer/source/geometry/viewinformation3d.cxx @@ -395,6 +395,18 @@ namespace drawinglayer impInterpretPropertyValues(rViewParameters); } + ImpViewInformation3D() + : mnRefCount(0), + maObjectTransformation(), + maOrientation(), + maProjection(), + maDeviceToView(), + mfViewTime(), + mxViewInformation(), + mxExtendedInformation() + { + } + const basegfx::B3DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::B3DHomMatrix& getOrientation() const { return maOrientation; } const basegfx::B3DHomMatrix& getProjection() const { return maProjection; } @@ -440,6 +452,21 @@ namespace drawinglayer && mfViewTime == rCandidate.mfViewTime && mxExtendedInformation == rCandidate.mxExtendedInformation); } + + static ImpViewInformation3D* get_global_default() + { + static ImpViewInformation3D* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpViewInformation3D(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } }; } // end of anonymous namespace } // end of namespace drawinglayer @@ -457,7 +484,9 @@ namespace drawinglayer const basegfx::B3DHomMatrix& rDeviceToView, double fViewTime, const uno::Sequence< beans::PropertyValue >& rExtendedParameters) - : mpViewInformation3D(new ImpViewInformation3D(rObjectObjectTransformation, rOrientation, rProjection, rDeviceToView, fViewTime, rExtendedParameters)) + : mpViewInformation3D(new ImpViewInformation3D( + rObjectObjectTransformation, rOrientation, rProjection, + rDeviceToView, fViewTime, rExtendedParameters)) { } @@ -466,6 +495,12 @@ namespace drawinglayer { } + ViewInformation3D::ViewInformation3D() + : mpViewInformation3D(ImpViewInformation3D::get_global_default()) + { + mpViewInformation3D->mnRefCount++; + } + ViewInformation3D::ViewInformation3D(const ViewInformation3D& rCandidate) : mpViewInformation3D(rCandidate.mpViewInformation3D) { @@ -487,6 +522,11 @@ namespace drawinglayer } } + bool ViewInformation3D::isDefault() const + { + return mpViewInformation3D == ImpViewInformation3D::get_global_default(); + } + ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D& rCandidate) { ::osl::Mutex m_mutex; @@ -513,6 +553,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpViewInformation3D == *mpViewInformation3D); } diff --git a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx b/drawinglayer/source/primitive2d/alphaprimitive2d.cxx deleted file mode 100644 index a503c2979c41..000000000000 --- a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: alphaprimitive2d.cxx,v $ - * - * $Revision: 1.5 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - AlphaPrimitive2D::AlphaPrimitive2D( - const Primitive2DSequence& rChildren, - const Primitive2DSequence& rAlpha) - : GroupPrimitive2D(rChildren), - maAlpha(rAlpha) - { - } - - bool AlphaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(GroupPrimitive2D::operator==(rPrimitive)) - { - const AlphaPrimitive2D& rCompare = (AlphaPrimitive2D&)rPrimitive; - - return (getAlpha() == rCompare.getAlpha()); - } - - return false; - } - - // provide unique ID - ImplPrimitrive2DIDBlock(AlphaPrimitive2D, PRIMITIVE2D_ID_ALPHAPRIMITIVE2D) - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx index ab9e9d19f6d2..aa5ede25314c 100644 --- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx @@ -56,46 +56,54 @@ namespace drawinglayer { Primitive2DSequence FillBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - const Size aTileSizePixel(getFillBitmap().getBitmapEx().GetSizePixel()); Primitive2DSequence aRetval; - // is there a tile with some size at all? - if(aTileSizePixel.getWidth() && aTileSizePixel.getHeight()) + if(!getFillBitmap().isDefault()) { - if(getFillBitmap().getTiling()) - { - // get object range and create tiling matrices - ::std::vector< basegfx::B2DHomMatrix > aMatrices; - texture::GeoTexSvxTiled aTiling(getFillBitmap().getTopLeft(), getFillBitmap().getSize()); - aTiling.appendTransformations(aMatrices); - - // resize result - aRetval.realloc(aMatrices.size()); + const Size aTileSizePixel(getFillBitmap().getBitmapEx().GetSizePixel()); - // create one primitive for each matrix - for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + // is there a tile with some size at all? + if(aTileSizePixel.getWidth() && aTileSizePixel.getHeight()) + { + if(getFillBitmap().getTiling()) { - basegfx::B2DHomMatrix aNewMatrix = aMatrices[a]; - aNewMatrix *= getTransformation(); - - // create bitmap primitive and add to result - const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aNewMatrix)); - aRetval[a] = xRef; + // get object range and create tiling matrices + ::std::vector< basegfx::B2DHomMatrix > aMatrices; + texture::GeoTexSvxTiled aTiling(getFillBitmap().getTopLeft(), getFillBitmap().getSize()); + aTiling.appendTransformations(aMatrices); + + // resize result + aRetval.realloc(aMatrices.size()); + + // create one primitive for each matrix + for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + { + basegfx::B2DHomMatrix aNewMatrix = aMatrices[a]; + aNewMatrix *= getTransformation(); + + // create bitmap primitive and add to result + const Primitive2DReference xRef( + new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aNewMatrix)); + + aRetval[a] = xRef; + } + } + else + { + // create new object transform + basegfx::B2DHomMatrix aObjectTransform; + aObjectTransform.set(0L, 0L, getFillBitmap().getSize().getX()); + aObjectTransform.set(1L, 1L, getFillBitmap().getSize().getY()); + aObjectTransform.set(0L, 2L, getFillBitmap().getTopLeft().getX()); + aObjectTransform.set(1L, 2L, getFillBitmap().getTopLeft().getY()); + aObjectTransform *= getTransformation(); + + // create bitmap primitive and add exclusive to decomposition (hand over ownership) + const Primitive2DReference xRef( + new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aObjectTransform)); + + aRetval = Primitive2DSequence(&xRef, 1L); } - } - else - { - // create new object transform - basegfx::B2DHomMatrix aObjectTransform; - aObjectTransform.set(0L, 0L, getFillBitmap().getSize().getX()); - aObjectTransform.set(1L, 1L, getFillBitmap().getSize().getY()); - aObjectTransform.set(0L, 2L, getFillBitmap().getTopLeft().getX()); - aObjectTransform.set(1L, 2L, getFillBitmap().getTopLeft().getY()); - aObjectTransform *= getTransformation(); - - // create bitmap primitive and add exclusive to decomposition (hand over ownership) - const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aObjectTransform)); - aRetval = Primitive2DSequence(&xRef, 1L); } } @@ -127,7 +135,7 @@ namespace drawinglayer basegfx::B2DRange FillBitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { // return range of it - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(getTransformation()); return basegfx::tools::getRange(aPolygon); } diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 625dae6cb93a..7df93f9defce 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -62,10 +62,10 @@ namespace drawinglayer rColors.clear(); // make sure steps is not too high/low - const basegfx::BColor aStart(maFillGradient.getStartColor()); - const basegfx::BColor aEnd(maFillGradient.getEndColor()); + const basegfx::BColor aStart(getFillGradient().getStartColor()); + const basegfx::BColor aEnd(getFillGradient().getEndColor()); const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5)); - sal_uInt32 nSteps(maFillGradient.getSteps()); + sal_uInt32 nSteps(getFillGradient().getSteps()); if(nSteps == 0) { @@ -82,46 +82,46 @@ namespace drawinglayer nSteps = nMaxSteps; } - switch(maFillGradient.getStyle()) + switch(getFillGradient().getStyle()) { case attribute::GRADIENTSTYLE_LINEAR: { - texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_AXIAL: { - texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_RADIAL: { - texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY()); + texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { - texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_SQUARE: { - texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_RECT: { - texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; @@ -218,15 +218,15 @@ namespace drawinglayer // prepare shape of the Unit Polygon basegfx::B2DPolygon aUnitPolygon; - if(attribute::GRADIENTSTYLE_RADIAL == maFillGradient.getStyle() - || attribute::GRADIENTSTYLE_ELLIPTICAL == maFillGradient.getStyle()) + if(attribute::GRADIENTSTYLE_RADIAL == getFillGradient().getStyle() + || attribute::GRADIENTSTYLE_ELLIPTICAL == getFillGradient().getStyle()) { const basegfx::B2DPoint aCircleCenter(0.5, 0.5); aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5); } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // get the transform matrices and colors (where colors @@ -253,7 +253,15 @@ namespace drawinglayer // that the rings will not overlap. This is useful fir the old XOR-paint // 'trick' of VCL which is recorded in Metafiles; so this version may be // used from the MetafilePrimitive2D in it's decomposition. - return createFill(true); + + if(!getFillGradient().isDefault()) + { + return createFill(true); + } + else + { + return Primitive2DSequence(); + } } FillGradientPrimitive2D::FillGradientPrimitive2D( @@ -272,7 +280,7 @@ namespace drawinglayer const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive; return (getObjectRange() == rCompare.getObjectRange() - && maFillGradient == rCompare.maFillGradient); + && getFillGradient() == rCompare.getFillGradient()); } return false; diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index 9e6e69516d43..e042019eb64b 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -57,65 +57,73 @@ namespace drawinglayer { Primitive2DSequence FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create hatch - const basegfx::BColor aHatchColor(maFillHatch.getColor()); - const double fAngle(-maFillHatch.getAngle()); - ::std::vector< basegfx::B2DHomMatrix > aMatrices; + Primitive2DSequence aRetval; - // get hatch transformations - switch(maFillHatch.getStyle()) + if(!getFillHatch().isDefault()) { - case attribute::HATCHSTYLE_TRIPLE: - { - // rotated 45 degrees - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle + F_PI4); - aHatch.appendTransformations(aMatrices); + // create hatch + const basegfx::BColor aHatchColor(getFillHatch().getColor()); + const double fAngle(-getFillHatch().getAngle()); + ::std::vector< basegfx::B2DHomMatrix > aMatrices; - // fall-through by purpose - } - case attribute::HATCHSTYLE_DOUBLE: + // get hatch transformations + switch(getFillHatch().getStyle()) { - // rotated 90 degrees - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle + F_PI2); - aHatch.appendTransformations(aMatrices); - - // fall-through by purpose + case attribute::HATCHSTYLE_TRIPLE: + { + // rotated 45 degrees + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle + F_PI4); + aHatch.appendTransformations(aMatrices); + + // fall-through by purpose + } + case attribute::HATCHSTYLE_DOUBLE: + { + // rotated 90 degrees + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle + F_PI2); + aHatch.appendTransformations(aMatrices); + + // fall-through by purpose + } + case attribute::HATCHSTYLE_SINGLE: + { + // angle as given + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle); + aHatch.appendTransformations(aMatrices); + } } - case attribute::HATCHSTYLE_SINGLE: - { - // angle as given - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle); - aHatch.appendTransformations(aMatrices); - } - } - // prepare return value - const bool bFillBackground(maFillHatch.isFillBackground()); - Primitive2DSequence aRetval(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); + // prepare return value + const bool bFillBackground(getFillHatch().isFillBackground()); + aRetval.realloc(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); - // evtl. create filled background - if(bFillBackground) - { - // create primitive for background - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), maBColor)); - aRetval[0L] = xRef; - } + // evtl. create filled background + if(bFillBackground) + { + // create primitive for background + const Primitive2DReference xRef( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon( + basegfx::tools::createPolygonFromRect(getObjectRange())), getBColor())); + aRetval[0] = xRef; + } - // create primitives - const basegfx::B2DPoint aStart(0.0, 0.0); - const basegfx::B2DPoint aEnd(1.0, 0.0); + // create primitives + const basegfx::B2DPoint aStart(0.0, 0.0); + const basegfx::B2DPoint aEnd(1.0, 0.0); - for(sal_uInt32 a(0L); a < aMatrices.size(); a++) - { - const basegfx::B2DHomMatrix& rMatrix = aMatrices[a]; - basegfx::B2DPolygon aNewLine; + for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + { + const basegfx::B2DHomMatrix& rMatrix = aMatrices[a]; + basegfx::B2DPolygon aNewLine; - aNewLine.append(rMatrix * aStart); - aNewLine.append(rMatrix * aEnd); + aNewLine.append(rMatrix * aStart); + aNewLine.append(rMatrix * aEnd); - // create hairline - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor)); - aRetval[bFillBackground ? (a + 1L) : a] = xRef; + // create hairline + const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor)); + aRetval[bFillBackground ? (a + 1) : a] = xRef; + } } return aRetval; @@ -139,8 +147,8 @@ namespace drawinglayer const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive; return (getObjectRange() == rCompare.getObjectRange() - && maFillHatch == rCompare.maFillHatch - && maBColor == rCompare.maBColor); + && getFillHatch() == rCompare.getFillHatch() + && getBColor() == rCompare.getBColor()); } return false; diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 6d1540594dc9..2176a45341ec 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -772,9 +772,7 @@ namespace drawinglayer { // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1); - basegfx::B2DPolygon aMaskPolygon( - basegfx::tools::createPolygonFromRect( - basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon()); aMaskPolygon.transform(aTransform); xPrimitive = Primitive2DReference( @@ -880,7 +878,7 @@ namespace drawinglayer else { // cropped got bigger, mask it with original object's bounds - basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createUnitPolygon()); aMaskPolyPolygon.transform(getTransform()); // create maskPrimitive with aMaskPolyPolygon and aMaskContentVector diff --git a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx new file mode 100644 index 000000000000..2b3afeb0f8ed --- /dev/null +++ b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.cxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + HiddenGeometryPrimitive2D::HiddenGeometryPrimitive2D( + const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + basegfx::B2DRange HiddenGeometryPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + } + + Primitive2DSequence HiddenGeometryPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + return Primitive2DSequence(); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(HiddenGeometryPrimitive2D, PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx b/drawinglayer/source/primitive2d/hittestprimitive2d.cxx deleted file mode 100644 index 137f8cf8ad5c..000000000000 --- a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: hittestprimitive3d.cxx,v $ - * - * $Revision: 1.1.2.1 $ - * - * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - HitTestPrimitive2D::HitTestPrimitive2D( - const Primitive2DSequence& rChildren) - : GroupPrimitive2D(rChildren) - { - } - - basegfx::B2DRange HitTestPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const - { - return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); - } - - Primitive2DSequence HitTestPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const - { - // return empty sequence - return Primitive2DSequence(); - } - - // provide unique ID - ImplPrimitrive2DIDBlock(HitTestPrimitive2D, PRIMITIVE2D_ID_HITTESTPRIMITIVE2D) - - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive2d/invertprimitive2d.cxx b/drawinglayer/source/primitive2d/invertprimitive2d.cxx index 374ec578113d..6faf4f2cf0ad 100644 --- a/drawinglayer/source/primitive2d/invertprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/invertprimitive2d.cxx @@ -2,7 +2,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unifiedalphaprimitive2d.cxx,v $ + * $RCSfile: UnifiedTransparencePrimitive2D.cxx,v $ * * $Revision: 1.5 $ * diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk index c9a3cc191a35..078142b673b2 100644 --- a/drawinglayer/source/primitive2d/makefile.mk +++ b/drawinglayer/source/primitive2d/makefile.mk @@ -45,50 +45,51 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/alphaprimitive2d.obj \ - $(SLO)$/animatedprimitive2d.obj \ - $(SLO)$/baseprimitive2d.obj \ - $(SLO)$/backgroundcolorprimitive2d.obj \ - $(SLO)$/bitmapprimitive2d.obj \ - $(SLO)$/borderlineprimitive2d.obj \ - $(SLO)$/chartprimitive2d.obj \ - $(SLO)$/controlprimitive2d.obj \ - $(SLO)$/discretebitmapprimitive2d.obj \ - $(SLO)$/embedded3dprimitive2d.obj \ - $(SLO)$/epsprimitive2d.obj \ - $(SLO)$/fillbitmapprimitive2d.obj \ - $(SLO)$/fillgradientprimitive2d.obj \ - $(SLO)$/fillhatchprimitive2d.obj \ - $(SLO)$/graphicprimitive2d.obj \ - $(SLO)$/gridprimitive2d.obj \ - $(SLO)$/groupprimitive2d.obj \ - $(SLO)$/helplineprimitive2d.obj \ - $(SLO)$/hittestprimitive2d.obj \ - $(SLO)$/invertprimitive2d.obj \ - $(SLO)$/markerarrayprimitive2d.obj \ - $(SLO)$/pointarrayprimitive2d.obj \ - $(SLO)$/maskprimitive2d.obj \ - $(SLO)$/mediaprimitive2d.obj \ - $(SLO)$/metafileprimitive2d.obj \ - $(SLO)$/modifiedcolorprimitive2d.obj \ - $(SLO)$/pagepreviewprimitive2d.obj \ - $(SLO)$/polypolygonprimitive2d.obj \ - $(SLO)$/polygonprimitive2d.obj \ - $(SLO)$/primitivetools2d.obj \ - $(SLO)$/sceneprimitive2d.obj \ - $(SLO)$/shadowprimitive2d.obj \ - $(SLO)$/structuretagprimitive2d.obj \ - $(SLO)$/texteffectprimitive2d.obj \ - $(SLO)$/textenumsprimitive2d.obj \ - $(SLO)$/textlayoutdevice.obj \ - $(SLO)$/textlineprimitive2d.obj \ - $(SLO)$/textprimitive2d.obj \ - $(SLO)$/textstrikeoutprimitive2d.obj \ - $(SLO)$/textdecoratedprimitive2d.obj \ - $(SLO)$/texthierarchyprimitive2d.obj \ - $(SLO)$/transformprimitive2d.obj \ - $(SLO)$/unifiedalphaprimitive2d.obj \ - $(SLO)$/wallpaperprimitive2d.obj \ + $(SLO)$/transparenceprimitive2d.obj \ + $(SLO)$/animatedprimitive2d.obj \ + $(SLO)$/baseprimitive2d.obj \ + $(SLO)$/backgroundcolorprimitive2d.obj \ + $(SLO)$/bitmapprimitive2d.obj \ + $(SLO)$/borderlineprimitive2d.obj \ + $(SLO)$/chartprimitive2d.obj \ + $(SLO)$/controlprimitive2d.obj \ + $(SLO)$/discretebitmapprimitive2d.obj \ + $(SLO)$/embedded3dprimitive2d.obj \ + $(SLO)$/epsprimitive2d.obj \ + $(SLO)$/fillbitmapprimitive2d.obj \ + $(SLO)$/fillgradientprimitive2d.obj \ + $(SLO)$/fillhatchprimitive2d.obj \ + $(SLO)$/graphicprimitive2d.obj \ + $(SLO)$/gridprimitive2d.obj \ + $(SLO)$/groupprimitive2d.obj \ + $(SLO)$/helplineprimitive2d.obj \ + $(SLO)$/hiddengeometryprimitive2d.obj \ + $(SLO)$/invertprimitive2d.obj \ + $(SLO)$/markerarrayprimitive2d.obj \ + $(SLO)$/pointarrayprimitive2d.obj \ + $(SLO)$/maskprimitive2d.obj \ + $(SLO)$/mediaprimitive2d.obj \ + $(SLO)$/metafileprimitive2d.obj \ + $(SLO)$/modifiedcolorprimitive2d.obj \ + $(SLO)$/pagepreviewprimitive2d.obj \ + $(SLO)$/polypolygonprimitive2d.obj \ + $(SLO)$/polygonprimitive2d.obj \ + $(SLO)$/primitivetools2d.obj \ + $(SLO)$/sceneprimitive2d.obj \ + $(SLO)$/sdrdecompositiontools2d.obj \ + $(SLO)$/shadowprimitive2d.obj \ + $(SLO)$/structuretagprimitive2d.obj \ + $(SLO)$/texteffectprimitive2d.obj \ + $(SLO)$/textenumsprimitive2d.obj \ + $(SLO)$/textlayoutdevice.obj \ + $(SLO)$/textlineprimitive2d.obj \ + $(SLO)$/textprimitive2d.obj \ + $(SLO)$/textstrikeoutprimitive2d.obj \ + $(SLO)$/textdecoratedprimitive2d.obj \ + $(SLO)$/texthierarchyprimitive2d.obj \ + $(SLO)$/transformprimitive2d.obj \ + $(SLO)$/unifiedtransparenceprimitive2d.obj \ + $(SLO)$/wallpaperprimitive2d.obj \ $(SLO)$/wrongspellprimitive2d.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index ba8f81448968..f99508be03e6 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -46,6 +46,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -58,9 +59,12 @@ namespace drawinglayer Primitive2DSequence xRetval(1); // create background object - basegfx::B2DPolygon aBackgroundPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aBackgroundPolygon(basegfx::tools::createUnitPolygon()); aBackgroundPolygon.transform(getTransform()); - const Primitive2DReference xRefBackground(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aBackgroundPolygon), getBackgroundColor())); + const Primitive2DReference xRefBackground( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aBackgroundPolygon), + getBackgroundColor())); xRetval[0] = xRefBackground; // try to get graphic snapshot @@ -87,10 +91,13 @@ namespace drawinglayer basegfx::B2DRange aDestRange(aSourceRange); aDestRange.grow(-0.5 * fDiscreteSize); - if(::basegfx::fTools::equalZero(aDestRange.getWidth()) || ::basegfx::fTools::equalZero(aDestRange.getHeight())) + if(basegfx::fTools::equalZero(aDestRange.getWidth()) || basegfx::fTools::equalZero(aDestRange.getHeight())) { - // shrunk primitive has no content (zero size in X or Y), nothing to display, nothing to return - xRetval = Primitive2DSequence(); + // shrunk primitive has no content (zero size in X or Y), nothing to display. Still create + // invisible content for HitTest and BoundRect + const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(xRetval)); + + xRetval = Primitive2DSequence(&xHiddenLines, 1); } else { diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 2fb3d119d4bd..4bb123380ee6 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -53,10 +53,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include #include @@ -589,7 +589,14 @@ namespace drawinglayer Primitive2DSequence NonOverlappingFillGradientPrimitive2D::create2DDecomposition( const geometry::ViewInformation2D& /*rViewInformation*/) const { - return createFill(false); + if(!getFillGradient().isDefault()) + { + return createFill(false); + } + else + { + return Primitive2DSequence(); + } } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -841,7 +848,7 @@ namespace } /** helper to create a regular BotmapEx from a MaskAction (definitions - which use a bitmap without alpha but define one of the colors as + which use a bitmap without transparence but define one of the colors as transparent) */ BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor) @@ -2728,7 +2735,7 @@ namespace if(aSubContent.hasElements()) { rTargetHolders.Current().append( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aSubContent, nTransparence * 0.01)); } @@ -2839,9 +2846,9 @@ namespace if(aAttribute.getStartColor() == aAttribute.getEndColor()) { - // not really a gradient; create UnifiedAlphaPrimitive2D + // not really a gradient; create UnifiedTransparencePrimitive2D rTargetHolders.Current().append( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( xSubContent, aAttribute.getStartColor().luminance())); } @@ -2853,17 +2860,17 @@ namespace aTargetRectangle.Right(), aTargetRectangle.Bottom()); aRange.transform(rPropertyHolders.Current().getTransformation()); - // prepare gradient for alpha content - const drawinglayer::primitive2d::Primitive2DReference xAlpha( + // prepare gradient for transparent content + const drawinglayer::primitive2d::Primitive2DReference xTransparence( new drawinglayer::primitive2d::FillGradientPrimitive2D( aRange, aAttribute)); - // create alpha primitive + // create transparence primitive rTargetHolders.Current().append( - new drawinglayer::primitive2d::AlphaPrimitive2D( + new drawinglayer::primitive2d::TransparencePrimitive2D( xSubContent, - drawinglayer::primitive2d::Primitive2DSequence(&xAlpha, 1))); + drawinglayer::primitive2d::Primitive2DSequence(&xTransparence, 1))); } } } diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index b747c79ee0c7..ec23791a7230 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -77,7 +77,10 @@ namespace drawinglayer if(!aAllowedContentRange.isInside(aRealContentRange)) { - const Primitive2DReference xReferenceA(new MaskPrimitive2D(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aAllowedContentRange)), aContent)); + const Primitive2DReference xReferenceA( + new MaskPrimitive2D( + basegfx::B2DPolyPolygon( + basegfx::tools::createPolygonFromRect(aAllowedContentRange)), aContent)); aContent = Primitive2DSequence(&xReferenceA, 1); } diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 69cbd046efd2..c9108b58b000 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -43,6 +43,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -243,7 +244,7 @@ namespace drawinglayer const basegfx::B2DPolygon aB2DPolygon(basegfx::tools::simplifyCurveSegments(getB2DPolygon())); basegfx::B2DPolyPolygon aHairLinePolyPolygon; - if(0.0 == getStrokeAttribute().getFullDotDashLen()) + if(getStrokeAttribute().isDefault() || 0.0 == getStrokeAttribute().getFullDotDashLen()) { // no line dashing, just copy aHairLinePolyPolygon.append(aB2DPolygon); @@ -251,12 +252,14 @@ namespace drawinglayer else { // apply LineStyle - basegfx::tools::applyLineDashing(aB2DPolygon, getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); + basegfx::tools::applyLineDashing( + aB2DPolygon, getStrokeAttribute().getDotDashArray(), + &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); } const sal_uInt32 nCount(aHairLinePolyPolygon.count()); - if(getLineAttribute().getWidth()) + if(!getLineAttribute().isDefault() && getLineAttribute().getWidth()) { // create fat line data const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0); @@ -293,7 +296,11 @@ namespace drawinglayer else { // prepare return value - const Primitive2DReference xRef(new PolyPolygonHairlinePrimitive2D(aHairLinePolyPolygon, getLineAttribute().getColor())); + const Primitive2DReference xRef( + new PolyPolygonHairlinePrimitive2D( + aHairLinePolyPolygon, + getLineAttribute().getColor())); + return Primitive2DSequence(&xRef, 1); } } @@ -519,7 +526,7 @@ namespace drawinglayer double fStart(0.0); double fEnd(0.0); - if(getStart().isActive()) + if(!getStart().isDefault() && getStart().isActive()) { // create start arrow primitive and consume aArrowA = basegfx::tools::createAreaGeometryForLineStartEnd( @@ -530,7 +537,7 @@ namespace drawinglayer fStart *= 0.8; } - if(getEnd().isActive()) + if(!getEnd().isDefault() && getEnd().isActive()) { // create end arrow primitive and consume aArrowB = basegfx::tools::createAreaGeometryForLineStartEnd( @@ -553,18 +560,24 @@ namespace drawinglayer sal_uInt32 nInd(0L); // add shaft - const Primitive2DReference xRefShaft(new PolygonStrokePrimitive2D(aLocalPolygon, getLineAttribute(), getStrokeAttribute())); + const Primitive2DReference xRefShaft(new + PolygonStrokePrimitive2D( + aLocalPolygon, getLineAttribute(), getStrokeAttribute())); aRetval[nInd++] = xRefShaft; if(aArrowA.count()) { - const Primitive2DReference xRefA(new PolyPolygonColorPrimitive2D(aArrowA, getLineAttribute().getColor())); + const Primitive2DReference xRefA( + new PolyPolygonColorPrimitive2D( + aArrowA, getLineAttribute().getColor())); aRetval[nInd++] = xRefA; } if(aArrowB.count()) { - const Primitive2DReference xRefB(new PolyPolygonColorPrimitive2D(aArrowB, getLineAttribute().getColor())); + const Primitive2DReference xRefB( + new PolyPolygonColorPrimitive2D( + aArrowB, getLineAttribute().getColor())); aRetval[nInd++] = xRefB; } diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 55c334434c70..0a7236a59127 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -196,7 +196,9 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); + aRetval[a] = Primitive2DReference( + new PolygonStrokePrimitive2D( + aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); } return aRetval; @@ -284,11 +286,14 @@ namespace drawinglayer if(aPolygon.isClosed()) { // no need for PolygonStrokeArrowPrimitive2D when polygon is closed - aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute())); + aRetval[a] = Primitive2DReference( + new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute())); } else { - aRetval[a] = Primitive2DReference(new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute(), getStart(), getEnd())); + aRetval[a] = Primitive2DReference( + new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(), + getStrokeAttribute(), getStart(), getEnd())); } } @@ -406,16 +411,24 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillGradientPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient()); - const Primitive2DReference xSubRef(pNewGradient); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillGradient().isDefault()) + { + // create SubSequence with FillGradientPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient()); + const Primitive2DReference xSubRef(pNewGradient); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D( @@ -453,16 +466,24 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillHatchPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch()); - const Primitive2DReference xSubRef(pNewHatch); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillHatch().isDefault()) + { + // create SubSequence with FillHatchPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch()); + const Primitive2DReference xSubRef(pNewHatch); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D( @@ -503,21 +524,29 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillBitmapPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - basegfx::B2DHomMatrix aNewObjectTransform; - aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); - aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); - aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); - aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); - FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap()); - const Primitive2DReference xSubRef(pNewBitmap); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillBitmap().isDefault()) + { + // create SubSequence with FillBitmapPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + basegfx::B2DHomMatrix aNewObjectTransform; + aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); + aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); + aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); + aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); + FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap()); + const Primitive2DReference xSubRef(pNewBitmap); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonBitmapPrimitive2D::PolyPolygonBitmapPrimitive2D( diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 0223fb85d23e..48946810ee5f 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -156,8 +156,10 @@ namespace drawinglayer if(impGetShadow3D(rViewInformation)) { // test visibility - const basegfx::B2DRange aShadow2DRange(getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); - const basegfx::B2DRange aViewRange(rViewInformation.getViewport()); + const basegfx::B2DRange aShadow2DRange( + getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); + const basegfx::B2DRange aViewRange( + rViewInformation.getViewport()); if(aViewRange.isEmpty() || aShadow2DRange.overlaps(aViewRange)) { @@ -170,6 +172,7 @@ namespace drawinglayer basegfx::B2DRange aDiscreteRange; basegfx::B2DRange aVisibleDiscreteRange; basegfx::B2DRange aUnitVisibleRange; + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); if(!aVisibleDiscreteRange.isEmpty()) @@ -263,7 +266,7 @@ namespace drawinglayer if(bAddOutlineToCreated3DSceneRepresentation) { - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(aNew2DTransform); const Primitive2DReference xRef2(new PolygonHairlinePrimitive2D(aOutline, basegfx::BColor(1.0, 0.0, 0.0))); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef2); diff --git a/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx b/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx new file mode 100644 index 000000000000..9d90c35103d9 --- /dev/null +++ b/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrdecompositiontools3d.cxx,v $ + * + * $Revision: 1.7 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DHomMatrix& rMatrix) + { + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); + + return createHiddenGeometryPrimitives2D( + bFilled, + basegfx::B2DPolyPolygon(aUnitOutline), + rMatrix); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolyPolygon) + { + return createHiddenGeometryPrimitives2D( + bFilled, + rPolyPolygon, + basegfx::B2DHomMatrix()); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange) + { + return createHiddenGeometryPrimitives2D( + bFilled, + rRange, + basegfx::B2DHomMatrix()); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange, + const basegfx::B2DHomMatrix& rMatrix) + { + const basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(rRange)); + + return createHiddenGeometryPrimitives2D( + bFilled, + aOutline, + rMatrix); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DHomMatrix& rMatrix) + { + // create fill or line primitive + Primitive2DReference xReference; + basegfx::B2DPolyPolygon aScaledOutline(rPolyPolygon); + aScaledOutline.transform(rMatrix); + + if(bFilled) + { + xReference = new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aScaledOutline), + basegfx::BColor(0.0, 0.0, 0.0)); + } + else + { + const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); + + xReference = new PolyPolygonHairlinePrimitive2D( + aScaledOutline, + aGrayTone); + } + + // create HiddenGeometryPrimitive2D + return Primitive2DReference( + new HiddenGeometryPrimitive2D(Primitive2DSequence(&xReference, 1))); + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index b6ce7dc3248d..7d8abd5490fb 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -41,8 +41,8 @@ #include #include #include -#include -#include +#include +#include #include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx new file mode 100644 index 000000000000..cfe1e184e89e --- /dev/null +++ b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: alphaprimitive2d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TransparencePrimitive2D::TransparencePrimitive2D( + const Primitive2DSequence& rChildren, + const Primitive2DSequence& rTransparence) + : GroupPrimitive2D(rChildren), + maTransparence(rTransparence) + { + } + + bool TransparencePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(GroupPrimitive2D::operator==(rPrimitive)) + { + const TransparencePrimitive2D& rCompare = (TransparencePrimitive2D&)rPrimitive; + + return (getTransparence() == rCompare.getTransparence()); + } + + return false; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TransparencePrimitive2D, PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D) + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx deleted file mode 100644 index a66ac0f3a539..000000000000 --- a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: unifiedalphaprimitive2d.cxx,v $ - * - * $Revision: 1.5 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - UnifiedAlphaPrimitive2D::UnifiedAlphaPrimitive2D( - const Primitive2DSequence& rChildren, - double fAlpha) - : GroupPrimitive2D(rChildren), - mfAlpha(fAlpha) - { - } - - bool UnifiedAlphaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(GroupPrimitive2D::operator==(rPrimitive)) - { - const UnifiedAlphaPrimitive2D& rCompare = (UnifiedAlphaPrimitive2D&)rPrimitive; - - return (getAlpha() == rCompare.getAlpha()); - } - - return false; - } - - Primitive2DSequence UnifiedAlphaPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const - { - if(0.0 == getAlpha()) - { - // no transparence used, so just use the content - return getChildren(); - } - else if(getAlpha() > 0.0 && getAlpha() < 1.0) - { - // The idea is to create a AlphaPrimitive2D with alpha content using a fill color - // corresponding to the alpha value. Problem is that in most systems, the right - // and bottom pixel array is not filled when filling polygons, thus this would not - // always produce a complete alpha bitmap. There are some solutions: - // - // - Grow the used polygon range by one discrete unit in X and Y. This - // will make the decomposition view-dependent. - // - // - For all filled polygon renderings, dra wthe polygon outline extra. This - // would lead to unwanted side effects when using concatenated polygons. - // - // - At this decomposition, add a filled polygon and a hairline polygon. This - // solution stays view-independent. - // - // I will take the last one here. The small overhead of two primitives will only be - // used when UnifiedAlphaPrimitive2D is not handled directly. - const basegfx::B2DRange aPolygonRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aPolygonRange)); - const basegfx::BColor aGray(getAlpha(), getAlpha(), getAlpha()); - Primitive2DSequence aAlphaContent(2); - - aAlphaContent[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); - aAlphaContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); - - // create sub-transparence group with a gray-colored rectangular fill polygon - const Primitive2DReference xRefB(new AlphaPrimitive2D(getChildren(), aAlphaContent)); - return Primitive2DSequence(&xRefB, 1L); - } - else - { - // completely transparent or invalid definition, add nothing - return Primitive2DSequence(); - } - } - - // provide unique ID - ImplPrimitrive2DIDBlock(UnifiedAlphaPrimitive2D, PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D) - - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx new file mode 100644 index 000000000000..b0905b2adf39 --- /dev/null +++ b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UnifiedTransparencePrimitive2D.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + UnifiedTransparencePrimitive2D::UnifiedTransparencePrimitive2D( + const Primitive2DSequence& rChildren, + double fTransparence) + : GroupPrimitive2D(rChildren), + mfTransparence(fTransparence) + { + } + + bool UnifiedTransparencePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(GroupPrimitive2D::operator==(rPrimitive)) + { + const UnifiedTransparencePrimitive2D& rCompare = (UnifiedTransparencePrimitive2D&)rPrimitive; + + return (getTransparence() == rCompare.getTransparence()); + } + + return false; + } + + basegfx::B2DRange UnifiedTransparencePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + // do not use the fallback to decomposition here since for a correct BoundRect we also + // need invisible (1.0 == getTransparence()) geometry; these would be deleted in the decomposition + return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + } + + Primitive2DSequence UnifiedTransparencePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + if(0.0 == getTransparence()) + { + // no transparence used, so just use the content + return getChildren(); + } + else if(getTransparence() > 0.0 && getTransparence() < 1.0) + { + // The idea is to create a TransparencePrimitive2D with transparent content using a fill color + // corresponding to the transparence value. Problem is that in most systems, the right + // and bottom pixel array is not filled when filling polygons, thus this would not + // always produce a complete transparent bitmap. There are some solutions: + // + // - Grow the used polygon range by one discrete unit in X and Y. This + // will make the decomposition view-dependent. + // + // - For all filled polygon renderings, dra wthe polygon outline extra. This + // would lead to unwanted side effects when using concatenated polygons. + // + // - At this decomposition, add a filled polygon and a hairline polygon. This + // solution stays view-independent. + // + // I will take the last one here. The small overhead of two primitives will only be + // used when UnifiedTransparencePrimitive2D is not handled directly. + const basegfx::B2DRange aPolygonRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aPolygonRange)); + const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence()); + Primitive2DSequence aTransparenceContent(2); + + aTransparenceContent[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); + aTransparenceContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); + + // create sub-transparence group with a gray-colored rectangular fill polygon + const Primitive2DReference xRefB(new TransparencePrimitive2D(getChildren(), aTransparenceContent)); + return Primitive2DSequence(&xRefB, 1L); + } + else + { + // completely transparent or invalid definition, add nothing + return Primitive2DSequence(); + } + } + + // provide unique ID + ImplPrimitrive2DIDBlock(UnifiedTransparencePrimitive2D, PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx index 621b0b25ad98..dfa29c9260eb 100644 --- a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx @@ -223,7 +223,8 @@ namespace drawinglayer if(bNeedsClipping) { // embed to clipping; this is necessary for tiled fills - const basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createPolygonFromRect(getLocalObjectRange())); + const basegfx::B2DPolyPolygon aPolyPolygon( + basegfx::tools::createPolygonFromRect(getLocalObjectRange())); const drawinglayer::primitive2d::Primitive2DReference xClippedFill( new drawinglayer::primitive2d::MaskPrimitive2D( aPolyPolygon, diff --git a/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx new file mode 100644 index 000000000000..e94eeb99f764 --- /dev/null +++ b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.cxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive3d + { + HiddenGeometryPrimitive3D::HiddenGeometryPrimitive3D( + const Primitive3DSequence& rChildren) + : GroupPrimitive3D(rChildren) + { + } + + basegfx::B3DRange HiddenGeometryPrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const + { + return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); + } + + Primitive3DSequence HiddenGeometryPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + { + // return empty sequence + return Primitive3DSequence(); + } + + // provide unique ID + ImplPrimitrive3DIDBlock(HiddenGeometryPrimitive3D, PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D) + + } // end of namespace primitive3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx b/drawinglayer/source/primitive3d/hittestprimitive3d.cxx deleted file mode 100644 index 65aede8142aa..000000000000 --- a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: hittestprimitive3d.cxx,v $ - * - * $Revision: 1.1.2.1 $ - * - * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive3d - { - HitTestPrimitive3D::HitTestPrimitive3D( - const Primitive3DSequence& rChildren) - : GroupPrimitive3D(rChildren) - { - } - - basegfx::B3DRange HitTestPrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const - { - return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); - } - - Primitive3DSequence HitTestPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const - { - // return empty sequence - return Primitive3DSequence(); - } - - // provide unique ID - ImplPrimitrive3DIDBlock(HitTestPrimitive3D, PRIMITIVE3D_ID_HITTESTPRIMITIVE3D) - - } // end of namespace primitive3d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive3d/makefile.mk b/drawinglayer/source/primitive3d/makefile.mk index fb160fb9bfa7..31c0c911bf0e 100644 --- a/drawinglayer/source/primitive3d/makefile.mk +++ b/drawinglayer/source/primitive3d/makefile.mk @@ -48,7 +48,7 @@ SLOFILES= \ $(SLO)$/baseprimitive3d.obj \ $(SLO)$/groupprimitive3d.obj \ $(SLO)$/hatchtextureprimitive3d.obj \ - $(SLO)$/hittestprimitive3d.obj \ + $(SLO)$/hiddengeometryprimitive3d.obj \ $(SLO)$/modifiedcolorprimitive3d.obj \ $(SLO)$/polypolygonprimitive3d.obj \ $(SLO)$/polygonprimitive3d.obj \ diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index de28e3ad74e5..23277a6eb91d 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -65,7 +65,7 @@ namespace drawinglayer // may exclusively change static data, use mutex ::osl::Mutex m_mutex; - if(nSegments != nLineTubeSegments || rMaterial != aLineMaterial) + if(nSegments != nLineTubeSegments || !(rMaterial == aLineMaterial)) { nLineTubeSegments = nSegments; aLineMaterial = rMaterial; @@ -126,7 +126,7 @@ namespace drawinglayer // may exclusively change static data, use mutex ::osl::Mutex m_mutex; - if(nSegments != nLineCapSegments || rMaterial != aLineMaterial) + if(nSegments != nLineCapSegments || !(rMaterial == aLineMaterial)) { nLineCapSegments = nSegments; aLineMaterial = rMaterial; diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx index 739914562071..307ee3a0db82 100644 --- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx @@ -43,8 +43,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -63,7 +64,7 @@ namespace drawinglayer basegfx::B3DPolyPolygon aFill(basegfx::tools::createCubeFillPolyPolygonFromB3DRange(aUnitRange)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind() || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) @@ -81,7 +82,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // handle texture coordinates X const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); @@ -153,7 +154,7 @@ namespace drawinglayer a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -161,39 +162,33 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( a3DPolyPolygonVector, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aLine(basegfx::tools::createCubePolyPolygonFromB3DRange(aUnitRange)); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } @@ -203,7 +198,7 @@ namespace drawinglayer SdrCubePrimitive3D::SdrCubePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute) { diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index df682ab04e6f..210fed49065d 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -39,14 +39,11 @@ #include #include #include -#include #include #include #include #include -#include #include -#include #include #include #include @@ -55,8 +52,12 @@ #include #include #include -#include #include +#include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -175,8 +176,8 @@ namespace drawinglayer if(0.0 != rLine.getTransparence()) { - // create UnifiedAlphaTexturePrimitive3D, add created primitives and exchange - const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rLine.getTransparence(), aRetval)); + // create UnifiedTransparenceTexturePrimitive3D, add created primitives and exchange + const Primitive3DReference xRef(new UnifiedTransparenceTexturePrimitive3D(rLine.getTransparence(), aRetval)); aRetval = Primitive3DSequence(&xRef, 1L); } @@ -189,7 +190,7 @@ namespace drawinglayer const basegfx::B2DVector& rTextureSize, const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient) + const attribute::FillGradientAttribute& rFillGradient) { Primitive3DSequence aRetval; @@ -217,27 +218,45 @@ namespace drawinglayer } // look for and evtl. build texture sub-group primitive - if(rFill.isGradient() || rFill.isHatch() || rFill.isBitmap()) + if(!rFill.getGradient().isDefault() + || !rFill.getHatch().isDefault() + || !rFill.getBitmap().isDefault()) { bool bModulate(::com::sun::star::drawing::TextureMode_MODULATE == aSdr3DObjectAttribute.getTextureMode()); bool bFilter(aSdr3DObjectAttribute.getTextureFilter()); - BasePrimitive3D* pNewTexturePrimitive3D = 0L; + BasePrimitive3D* pNewTexturePrimitive3D = 0; - if(rFill.isGradient()) + if(!rFill.getGradient().isDefault()) { // create gradientTexture3D with sublist, add to local aRetval - pNewTexturePrimitive3D = new GradientTexturePrimitive3D(*rFill.getGradient(), aRetval, rTextureSize, bModulate, bFilter); + pNewTexturePrimitive3D = new GradientTexturePrimitive3D( + rFill.getGradient(), + aRetval, + rTextureSize, + bModulate, + bFilter); } - else if(rFill.isHatch()) + else if(!rFill.getHatch().isDefault()) { // create hatchTexture3D with sublist, add to local aRetval - pNewTexturePrimitive3D = new HatchTexturePrimitive3D(*rFill.getHatch(), aRetval, rTextureSize, bModulate, bFilter); + pNewTexturePrimitive3D = new HatchTexturePrimitive3D( + rFill.getHatch(), + aRetval, + rTextureSize, + bModulate, + bFilter); } - else // if(rFill.isBitmap()) + else // if(!rFill.getBitmap().isDefault()) { // create bitmapTexture3D with sublist, add to local aRetval basegfx::B2DRange aTexRange(0.0, 0.0, rTextureSize.getX(), rTextureSize.getY()); - pNewTexturePrimitive3D = new BitmapTexturePrimitive3D(rFill.getBitmap()->getFillBitmapAttribute(aTexRange), aRetval, rTextureSize, bModulate, bFilter); + + pNewTexturePrimitive3D = new BitmapTexturePrimitive3D( + rFill.getBitmap().getFillBitmapAttribute(aTexRange), + aRetval, + rTextureSize, + bModulate, + bFilter); } // exchange aRetval content with texture group @@ -255,14 +274,14 @@ namespace drawinglayer if(0.0 != rFill.getTransparence()) { - // create UnifiedAlphaTexturePrimitive3D with sublist and exchange - const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rFill.getTransparence(), aRetval)); + // create UnifiedTransparenceTexturePrimitive3D with sublist and exchange + const Primitive3DReference xRef(new UnifiedTransparenceTexturePrimitive3D(rFill.getTransparence(), aRetval)); aRetval = Primitive3DSequence(&xRef, 1L); } - else if(pFillGradient) + else if(!rFillGradient.isDefault()) { - // create AlphaTexturePrimitive3D with sublist and exchange - const Primitive3DReference xRef(new AlphaTexturePrimitive3D(*pFillGradient, aRetval, rTextureSize)); + // create TransparenceTexturePrimitive3D with sublist and exchange + const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(rFillGradient, aRetval, rTextureSize)); aRetval = Primitive3DSequence(&xRef, 1L); } } @@ -292,6 +311,35 @@ namespace drawinglayer return Primitive3DSequence(); } } + + Primitive3DSequence createHiddenGeometryPrimitives3D( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute) + { + // create hidden sub-geometry which can be used for HitTest + // and BoundRect calculations, but will not be visualized + const attribute::SdrFillAttribute aSimplifiedFillAttribute( + 0.0, + basegfx::BColor(), + attribute::FillGradientAttribute(), + attribute::FillHatchAttribute(), + attribute::SdrFillBitmapAttribute()); + + const Primitive3DReference aHidden( + new HiddenGeometryPrimitive3D( + create3DPolyPolygonFillPrimitives( + r3DPolyPolygonVector, + rObjectTransform, + rTextureSize, + aSdr3DObjectAttribute, + aSimplifiedFillAttribute, + attribute::FillGradientAttribute()))); + + return Primitive3DSequence(&aHidden, 1); + } + } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index 3554e9266ec1..87d5d3a50283 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -44,8 +44,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -76,7 +77,7 @@ namespace drawinglayer double fRelativeTextureWidth(1.0); basegfx::B2DHomMatrix aTexTransform; - if(getSdrLFSAttribute().getFill() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) + if(!getSdrLFSAttribute().getFill().isDefault() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) { const basegfx::B2DPolygon aFirstPolygon(maCorrectedPolyPolygon.getB2DPolygon(0L)); const double fFrontLength(basegfx::tools::getLength(aFirstPolygon)); @@ -106,7 +107,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { @@ -124,7 +125,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -134,7 +135,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -142,29 +143,21 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { if(getSdr3DObjectAttribute().getReducedLineGeometry()) { @@ -349,7 +342,8 @@ namespace drawinglayer if(aNewLineGeometry.count()) { - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aNewLineGeometry, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } } @@ -360,19 +354,22 @@ namespace drawinglayer const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector)); // add horizontal lines - const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives( + aHorLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines); // add vertical lines - const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives( + aVerLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines); } } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -409,7 +406,7 @@ namespace drawinglayer SdrExtrudePrimitive3D::SdrExtrudePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, double fDepth, diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index 5e6c34e644de..0ee8fb1593e5 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -44,8 +44,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -77,7 +78,8 @@ namespace drawinglayer const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); basegfx::B2DHomMatrix aTexTransform; - if(getSdrLFSAttribute().getFill() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) + if(!getSdrLFSAttribute().getFill().isDefault() + && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) { aTexTransform.set(0, 0, 0.0); aTexTransform.set(0, 1, 1.0); @@ -99,7 +101,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { @@ -117,7 +119,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -127,7 +129,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -135,29 +137,21 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { if(getSdr3DObjectAttribute().getReducedLineGeometry()) { @@ -191,7 +185,8 @@ namespace drawinglayer if(aNewLineGeometry.count()) { - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aNewLineGeometry, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } } @@ -202,19 +197,23 @@ namespace drawinglayer const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector)); // add horizontal lines - const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives( + aHorLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines); // add vertical lines - const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives( + aVerLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines); } } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -262,7 +261,7 @@ namespace drawinglayer SdrLathePrimitive3D::SdrLathePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, sal_uInt32 nHorizontalSegments, diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx index 69049fb7b24d..51f37be5b35b 100644 --- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx @@ -40,8 +40,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -66,7 +67,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // #i98295# normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) { @@ -84,7 +85,7 @@ namespace drawinglayer } // #i98314# texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -94,7 +95,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -102,41 +103,36 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aLine(getPolyPolygon3D()); aLine.clearNormals(); aLine.clearTextureCoordinates(); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -148,7 +144,7 @@ namespace drawinglayer const basegfx::B3DPolyPolygon& rPolyPolygon3D, const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute), maPolyPolygon3D(rPolyPolygon3D) @@ -181,11 +177,11 @@ namespace drawinglayer aRetval = basegfx::tools::getRange(getPolyPolygon3D()); aRetval.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by half LineWidth as tube radius aRetval.grow(rLine.getWidth() / 2.0); diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx index f8489b6418ff..53d7f7c9e96a 100644 --- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx @@ -37,9 +37,9 @@ #include "precompiled_drawinglayer.hxx" #include -#include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -56,11 +56,11 @@ namespace drawinglayer basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); aUnitRange.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by hald LineWidth as tube radius aUnitRange.grow(rLine.getWidth() / 2.0); @@ -83,11 +83,11 @@ namespace drawinglayer aRetval.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by half LineWidth as tube radius aRetval.grow(rLine.getWidth() / 2.0); @@ -101,7 +101,7 @@ namespace drawinglayer SdrPrimitive3D::SdrPrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : BufferedDecompositionPrimitive3D(), maTransform(rTransform), diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx index 663ae6ad0d37..d993f5117d3a 100644 --- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx @@ -43,8 +43,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -68,7 +69,7 @@ namespace drawinglayer getHorizontalSegments(), getVerticalSegments(), bCreateNormals)); // normal inversion - if(getSdrLFSAttribute().getFill() + if(!getSdrLFSAttribute().getFill().isDefault() && bCreateNormals && getSdr3DObjectAttribute().getNormalsInvert() && aFill.areNormalsUsed()) @@ -78,7 +79,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // handle texture coordinates X const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); @@ -142,7 +143,7 @@ namespace drawinglayer a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -150,39 +151,34 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( a3DPolyPolygonVector, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aSphere(basegfx::tools::createSpherePolyPolygonFromB3DRange(aUnitRange, getHorizontalSegments(), getVerticalSegments())); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aSphere, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aSphere, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } @@ -192,7 +188,7 @@ namespace drawinglayer SdrSpherePrimitive3D::SdrSpherePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments) diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index deeed95a71fd..9ba2c70ae074 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -38,6 +38,7 @@ #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -81,7 +82,7 @@ namespace drawinglayer { namespace primitive3d { - UnifiedAlphaTexturePrimitive3D::UnifiedAlphaTexturePrimitive3D( + UnifiedTransparenceTexturePrimitive3D::UnifiedTransparenceTexturePrimitive3D( double fTransparence, const Primitive3DSequence& rChildren) : TexturePrimitive3D(rChildren, basegfx::B2DVector(), false, false), @@ -89,11 +90,11 @@ namespace drawinglayer { } - bool UnifiedAlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const + bool UnifiedTransparenceTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { if(TexturePrimitive3D::operator==(rPrimitive)) { - const UnifiedAlphaTexturePrimitive3D& rCompare = (UnifiedAlphaTexturePrimitive3D&)rPrimitive; + const UnifiedTransparenceTexturePrimitive3D& rCompare = (UnifiedTransparenceTexturePrimitive3D&)rPrimitive; return (getTransparence() == rCompare.getTransparence()); } @@ -101,7 +102,14 @@ namespace drawinglayer return false; } - Primitive3DSequence UnifiedAlphaTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + basegfx::B3DRange UnifiedTransparenceTexturePrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const + { + // do not use the fallback to decomposition here since for a correct BoundRect we also + // need invisible (1.0 == getTransparence()) geometry; these would be deleted in the decomposition + return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); + } + + Primitive3DSequence UnifiedTransparenceTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { if(0.0 == getTransparence()) { @@ -110,10 +118,10 @@ namespace drawinglayer } else if(getTransparence() > 0.0 && getTransparence() < 1.0) { - // create AlphaTexturePrimitive3D with fixed transparence as replacement + // create TransparenceTexturePrimitive3D with fixed transparence as replacement const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence()); const attribute::FillGradientAttribute aFillGradient(attribute::GRADIENTSTYLE_LINEAR, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1); - const Primitive3DReference xRef(new AlphaTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize())); + const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize())); return Primitive3DSequence(&xRef, 1L); } else @@ -124,7 +132,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(UnifiedAlphaTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D) + ImplPrimitrive3DIDBlock(UnifiedTransparenceTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer @@ -204,7 +212,7 @@ namespace drawinglayer { namespace primitive3d { - AlphaTexturePrimitive3D::AlphaTexturePrimitive3D( + TransparenceTexturePrimitive3D::TransparenceTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize) @@ -212,13 +220,13 @@ namespace drawinglayer { } - bool AlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const + bool TransparenceTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { return (GradientTexturePrimitive3D::operator==(rPrimitive)); } // provide unique ID - ImplPrimitrive3DIDBlock(AlphaTexturePrimitive3D, PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D) + ImplPrimitrive3DIDBlock(TransparenceTexturePrimitive3D, PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index 8eb713258b25..d089e6a440de 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include @@ -70,7 +70,7 @@ #include #include #include -#include +#include #include #include #include @@ -388,7 +388,7 @@ using namespace com::sun::star; // slightly inside), slightly enlarge the // gradient: // - // y/2 sin(alpha) + x/2 cos(alpha) + // y/2 sin(transparence) + x/2 cos(transparence) // // (values to change are not actual // gradient scales, but original bound @@ -603,8 +603,7 @@ using namespace com::sun::star; } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect( - basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // create geometries @@ -977,10 +976,10 @@ using namespace com::sun::star; // paint content to it process(rSubList); - // TODO(F3): render transparent list to alpha + // TODO(F3): render transparent list to transparence // channel. Note that the OutDev implementation has a // shortcoming, in that nested transparency groups - // don't work - alpha is not combined properly. + // don't work - transparence is not combined properly. // process(rTransCandidate.getTransparenceList()); @@ -988,7 +987,7 @@ using namespace com::sun::star; mxCanvas = xLastCanvas; setWorldToView(aLastWorldToView); - // DUMMY: add alpha modulation value to DeviceColor + // DUMMY: add transparence modulation value to DeviceColor // TODO(F3): color management canvas::tools::setDeviceColor( maRenderState, 1.0, 1.0, 1.0, 0.5 ); @@ -1307,7 +1306,7 @@ namespace drawinglayer { // there are principally two methods for implementing the mask primitive. One // is to set a clip polygon at the canvas, the other is to create and use a - // alpha-using XBitmap for content and draw the mask as alpha. Both have their + // transparence-using XBitmap for content and draw the mask as transparence. Both have their // advantages and disadvantages, so here are both with a bool allowing simple // change if(bUseMaskBitmapMethod) @@ -1380,8 +1379,8 @@ namespace drawinglayer if(getOptionsDrawinglayer().IsAntiAliasing()) { // with AA, use 8bit AlphaMask to get nice borders - VirtualDevice& rAlpha = aBufferDevice.getAlpha(); - rAlpha.GetCanvas()->fillPolyPolygon( + VirtualDevice& rTransparence = aBufferDevice.getTransparence(); + rTransparence.GetCanvas()->fillPolyPolygon( basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), aMask), maViewState, maRenderState); } @@ -1586,7 +1585,7 @@ namespace drawinglayer { // replace with color filled polygon const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice()); canvas::tools::setRenderStateTransform(maRenderState, @@ -1619,12 +1618,12 @@ namespace drawinglayer } } - void canvasProcessor2D::impRenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rAlphaCandidate) + void canvasProcessor2D::impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate) { - const primitive2d::Primitive2DSequence& rChildren = rAlphaCandidate.getChildren(); - const primitive2d::Primitive2DSequence& rAlpha = rAlphaCandidate.getAlpha(); + const primitive2d::Primitive2DSequence& rChildren = rTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DSequence& rTransparence = rTransparenceCandidate.getTransparence(); - if(rChildren.hasElements() && rAlpha.hasElements()) + if(rChildren.hasElements() && rTransparence.hasElements()) { // get logic range of transparent part and clip with ViewRange basegfx::B2DRange aLogicRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rChildren, getViewInformation2D())); @@ -1688,16 +1687,16 @@ namespace drawinglayer process(rChildren); // set to mask - mpOutputDevice = &aBufferDevice.getAlpha(); + mpOutputDevice = &aBufferDevice.getTransparence(); mxCanvas = mpOutputDevice->GetCanvas(); canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation()); - // when painting alpha masks, reset the color stack + // when painting transparence masks, reset the color stack basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack); maBColorModifierStack = basegfx::BColorModifierStack(); - // paint mask to it (always with alpha intensities, evtl. with AA) - process(rAlpha); + // paint mask to it (always with transparence intensities, evtl. with AA) + process(rTransparence); // back to old color stack, OutDev, Canvas and ViewTransform maBColorModifierStack = aLastBColorModifierStack; @@ -1801,7 +1800,7 @@ namespace drawinglayer { // replace with color filled polygon const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice()); canvas::tools::setRenderStateTransform(maRenderState, @@ -1832,7 +1831,7 @@ namespace drawinglayer aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; // canvas needs a polygon to fill, create unit rectangle polygon - const basegfx::B2DPolygon aOutlineRectangle(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aOutlineRectangle(basegfx::tools::createUnitPolygon()); // set primitive's transformation as render state transform canvas::tools::setRenderStateTransform(maRenderState, @@ -1860,52 +1859,60 @@ namespace drawinglayer } } - void canvasProcessor2D::impRenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate) + void canvasProcessor2D::impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate) { - const primitive2d::Primitive2DSequence rChildren = rUniAlphaCandidate.getChildren(); - - if(rChildren.hasElements()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) + { + // not transparent at all, directly use content + process(rUniTransparenceCandidate.getChildren()); + } + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - bool bOutputDone(false); + const primitive2d::Primitive2DSequence rChildren = rUniTransparenceCandidate.getChildren(); - // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, - // use the fillPolyPolygon method with correctly set alpha. This is a often used - // case, so detectiong it is valuable - if(1 == rChildren.getLength()) + if(rChildren.hasElements()) { - const primitive2d::Primitive2DReference xReference(rChildren[0]); - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + bool bOutputDone(false); - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, + // use the fillPolyPolygon method with correctly set transparence. This is a often used + // case, so detectiong it is valuable + if(1 == rChildren.getLength()) { - // direct draw of PolyPolygon with color and transparence - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - - // add alpha modulation value to DeviceColor - uno::Sequence< double > aColor(4); - - aColor[0] = aPolygonColor.getRed(); - aColor[1] = aPolygonColor.getGreen(); - aColor[2] = aPolygonColor.getBlue(); - aColor[3] = 1.0 - rUniAlphaCandidate.getAlpha(); - maRenderState.DeviceColor = aColor; - - canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation()); - mxCanvas->fillPolyPolygon( - basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), pPoPoColor->getB2DPolyPolygon()), - maViewState, maRenderState); - bOutputDone = true; + const primitive2d::Primitive2DReference xReference(rChildren[0]); + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // direct draw of PolyPolygon with color and transparence + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + + // add transparence modulation value to DeviceColor + uno::Sequence< double > aColor(4); + + aColor[0] = aPolygonColor.getRed(); + aColor[1] = aPolygonColor.getGreen(); + aColor[2] = aPolygonColor.getBlue(); + aColor[3] = 1.0 - rUniTransparenceCandidate.getTransparence(); + maRenderState.DeviceColor = aColor; + + canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation()); + mxCanvas->fillPolyPolygon( + basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), pPoPoColor->getB2DPolyPolygon()), + maViewState, maRenderState); + bOutputDone = true; + } } - } - if(!bOutputDone) - { - // process decomposition. This will be decomposed to an AlphaPrimitive2D - // with the same child context and a single polygon for alpha context. This could be - // directly handled here with known VCL-buffer technology, but would only - // make a small difference compared to directly rendering the AlphaPrimitive2D - // using impRenderAlphaPrimitive2D above. - process(rUniAlphaCandidate.get2DDecomposition(getViewInformation2D())); + if(!bOutputDone) + { + // process decomposition. This will be decomposed to an TransparencePrimitive2D + // with the same child context and a single polygon for transparent context. This could be + // directly handled here with known VCL-buffer technology, but would only + // make a small difference compared to directly rendering the TransparencePrimitive2D + // using impRenderTransparencePrimitive2D above. + process(rUniTransparenceCandidate.get2DDecomposition(getViewInformation2D())); + } } } } @@ -2063,10 +2070,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { - // Alpha primitive - impRenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + // Transparence primitive + impRenderTransparencePrimitive2D(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); break; } @@ -2084,10 +2091,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { - // UnifiedAlphaPrimitive2D - impRenderUnifiedAlphaPrimitive2D(static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate)); + // UnifiedTransparencePrimitive2D + impRenderUnifiedTransparencePrimitive2D(static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate)); break; } diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx index 3225651a6754..6c80c0dc4efc 100644 --- a/drawinglayer/source/processor2d/contourextractor2d.cxx +++ b/drawinglayer/source/processor2d/contourextractor2d.cxx @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -103,7 +103,7 @@ namespace drawinglayer // extract BoundRect from bitmaps in world coordinates const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate)); basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rBitmapCandidate.getTransform()); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon)); break; @@ -113,15 +113,15 @@ namespace drawinglayer // extract BoundRect from MetaFiles in world coordinates const primitive2d::MetafilePrimitive2D& rMetaCandidate(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate)); basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rMetaCandidate.getTransform()); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon)); break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group. Look at children - const primitive2d::AlphaPrimitive2D& rTransCandidate(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + const primitive2d::TransparencePrimitive2D& rTransCandidate(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); process(rTransCandidate.getChildren()); break; } diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index b10e10706520..e699f1ae8ea4 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -43,13 +43,13 @@ #include #include #include -#include +#include #include #include -#include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ namespace drawinglayer mfDiscreteHitTolerance(0.0), mbHit(false), mbHitToleranceUsed(false), - mbUseHitTestPrimitiveContent(true), + mbUseInvisiblePrimitiveContent(true), mbHitTextOnly(bHitTextOnly) { // init hit tolerance @@ -247,7 +247,7 @@ namespace drawinglayer if(!getHit()) { // empty 3D scene; Check for border hit - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rCandidate.getObjectTransformation()); mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); @@ -420,10 +420,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group - const primitive2d::AlphaPrimitive2D& rTransCandidate(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + const primitive2d::TransparencePrimitive2D& rTransCandidate(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); // Currently the transparence content is not taken into account; only // the children are recursively checked for hit. This may be refined for @@ -499,7 +499,7 @@ namespace drawinglayer // will be used for HitTest currently. // // This may be refined in the future, e.g: - // - For Bitamps, the mask and/or alpha information may be used + // - For Bitamps, the mask and/or transparence information may be used // - For MetaFiles, the MetaFile content may be used const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); @@ -512,15 +512,20 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_HITTESTPRIMITIVE2D : + case PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D : { - // HitTest primitive; the default decomposition would return an empty seqence, + // HiddenGeometryPrimitive2D; the default decomposition would return an empty seqence, // so force this primitive to process it's children directly if the switch is set // (which is the default). Else, ignore invisible content - if(getUseHitTestPrimitiveContent()) + const primitive2d::HiddenGeometryPrimitive2D& rHiddenGeometry(static_cast< const primitive2d::HiddenGeometryPrimitive2D& >(rCandidate)); + const primitive2d::Primitive2DSequence& rChildren = rHiddenGeometry.getChildren(); + + if(rChildren.hasElements()) { - const primitive2d::HitTestPrimitive2D& rHitTestCandidate(static_cast< const primitive2d::HitTestPrimitive2D& >(rCandidate)); - process(rHitTestCandidate.getChildren()); + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } } break; diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 9d63bd5c7df6..a1e6373f1557 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -123,7 +123,7 @@ namespace drawinglayer if(bDoSaveForVisualControl) { - SvFileStream aNew((const String&)String(ByteString( "c:\\alpha.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); + SvFileStream aNew((const String&)String(ByteString( "c:\\transparence.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); aNew << aAlphaMask.GetBitmap(); } @@ -170,7 +170,7 @@ namespace drawinglayer return *mpMask; } - VirtualDevice& impBufferDevice::getAlpha() + VirtualDevice& impBufferDevice::getTransparence() { if(!mpAlpha) { diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx index f987585249ad..02a0faffa06c 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx @@ -67,7 +67,7 @@ namespace drawinglayer bool isVisible() const { return !maDestPixel.IsEmpty(); } VirtualDevice& getContent() { return maContent; } VirtualDevice& getMask(); - VirtualDevice& getAlpha(); + VirtualDevice& getTransparence(); }; } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx index 25d7513006fa..753ccfd7140d 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.cxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx @@ -225,7 +225,7 @@ namespace drawinglayer } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // make sure steps is not too high/low diff --git a/drawinglayer/source/processor2d/vclhelpergradient.hxx b/drawinglayer/source/processor2d/vclhelpergradient.hxx index e1671dbb87b2..a86256105c90 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.hxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.hxx @@ -36,7 +36,8 @@ #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index a99115a095c4..687bb751ca20 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -52,8 +51,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -73,8 +72,8 @@ #include #include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// // for PDFExtOutDevData Graphic support @@ -160,7 +159,7 @@ namespace drawinglayer { if(bIsTransparenceGradient) { - // it's about alpha channel intensities (black/white), do not use color modifier + // it's about transparence channel intensities (black/white), do not use color modifier o_rVCLGradient.SetStartColor(Color(rFiGrAtt.getStartColor())); o_rVCLGradient.SetEndColor(Color(rFiGrAtt.getEndColor())); } @@ -444,13 +443,13 @@ namespace drawinglayer fills. Thus, users have the choice to use the SvtGraphicFill info or the created output actions. Even for XFillTransparenceItem it is used, thus it may need to be supported in - UnifiedAlphaPrimitive2D, too, when interpreted as normally filled PolyPolygon. + UnifiedTransparencePrimitive2D, too, when interpreted as normally filled PolyPolygon. Implemented for: PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D, - and for PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D when detected unified alpha + and for PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D when detected unified transparence XPATHSTROKE_SEQ_BEGIN, XPATHSTROKE_SEQ_END: @@ -1483,138 +1482,166 @@ namespace drawinglayer RenderModifiedColorPrimitive2D(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(rCandidate)); break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D : + { + // HiddenGeometryPrimitive2D; to rebuilt the old MetaFile creation, it is necessary to + // not ignore them (as it was thought), but to add a MetaFile entry for them. + basegfx::B2DRange aInvisibleRange(rCandidate.getB2DRange(getViewInformation2D())); + + if(!aInvisibleRange.isEmpty()) + { + aInvisibleRange.transform(maCurrentTransformation); + const Rectangle aRectLogic( + (sal_Int32)floor(aInvisibleRange.getMinX()), (sal_Int32)floor(aInvisibleRange.getMinY()), + (sal_Int32)ceil(aInvisibleRange.getMaxX()), (sal_Int32)ceil(aInvisibleRange.getMaxY())); + + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(); + mpOutputDevice->DrawRect(aRectLogic); + } + + break; + } + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { // for metafile: Need to examine what the pure vcl version is doing here actually // - uses DrawTransparent with metafile for content and a gradient // - uses DrawTransparent for single PolyPoylgons directly. Can be detected by // checking the content for single PolyPolygonColorPrimitive2D - const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate = static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rUniAlphaCandidate.getChildren(); + const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate = static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rUniTransparenceCandidate.getChildren(); if(rContent.hasElements()) { - // try to identify a single PolyPolygonColorPrimitive2D in the - // content part of the alpha primitive - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = 0; - static bool bForceToMetafile(false); - - if(!bForceToMetafile && 1 == rContent.getLength()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) { - const primitive2d::Primitive2DReference xReference(rContent[0]); - pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + // not transparent at all, use content + process(rUniTransparenceCandidate.getChildren()); } - - // PolyPolygonGradientPrimitive2D, PolyPolygonHatchPrimitive2D and - // PolyPolygonBitmapPrimitive2D are derived from PolyPolygonColorPrimitive2D. - // Check also for correct ID to exclude derived implementations - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - // single transparent PolyPolygon identified, use directly - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); - aLocalPolyPolygon.transform(maCurrentTransformation); - - // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support - SvtGraphicFill* pSvtGraphicFill = 0; + // try to identify a single PolyPolygonColorPrimitive2D in the + // content part of the transparence primitive + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = 0; + static bool bForceToMetafile(false); - if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) + if(!bForceToMetafile && 1 == rContent.getLength()) { - // setup simple color with transparence fill stuff like in impgrfll - pSvtGraphicFill = new SvtGraphicFill( - PolyPolygon(aLocalPolyPolygon), - Color(aPolygonColor), - rUniAlphaCandidate.getAlpha(), - SvtGraphicFill::fillEvenOdd, - SvtGraphicFill::fillSolid, - SvtGraphicFill::Transform(), - false, - SvtGraphicFill::hatchSingle, - Color(), - SvtGraphicFill::gradientLinear, - Color(), - Color(), - 0, - Graphic()); + const primitive2d::Primitive2DReference xReference(rContent[0]); + pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); } - // set line and fill color - const sal_uInt16 nTransPercentVcl((sal_uInt16)basegfx::fround(rUniAlphaCandidate.getAlpha() * 100.0)); - mpOutputDevice->SetFillColor(Color(aPolygonColor)); - mpOutputDevice->SetLineColor(); + // PolyPolygonGradientPrimitive2D, PolyPolygonHatchPrimitive2D and + // PolyPolygonBitmapPrimitive2D are derived from PolyPolygonColorPrimitive2D. + // Check also for correct ID to exclude derived implementations + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // single transparent PolyPolygon identified, use directly + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); + aLocalPolyPolygon.transform(maCurrentTransformation); - // call VCL directly; encapsulate with SvtGraphicFill - impStartSvtGraphicFill(pSvtGraphicFill); - mpOutputDevice->DrawTransparent( - PolyPolygon(aLocalPolyPolygon), - nTransPercentVcl); - impEndSvtGraphicFill(pSvtGraphicFill); - } - else - { - // svae old mfCurrentUnifiedTransparence and set new one - // so that contained SvtGraphicStroke may use the current one - const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence); - // #i105377# paint the content metafile opaque as the transparency gets - // split of into the gradient below - // mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha(); - mfCurrentUnifiedTransparence = 0; + // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support + SvtGraphicFill* pSvtGraphicFill = 0; - // various content, create content-metafile - GDIMetaFile aContentMetafile; - const Rectangle aPrimitiveRectangle(impDumpToMetaFile(rContent, aContentMetafile)); - - // restore mfCurrentUnifiedTransparence; it may have been used - // while processing the sub-content in impDumpToMetaFile - mfCurrentUnifiedTransparence = fLastCurrentUnifiedTransparence; + if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) + { + // setup simple color with transparence fill stuff like in impgrfll + pSvtGraphicFill = new SvtGraphicFill( + PolyPolygon(aLocalPolyPolygon), + Color(aPolygonColor), + rUniTransparenceCandidate.getTransparence(), + SvtGraphicFill::fillEvenOdd, + SvtGraphicFill::fillSolid, + SvtGraphicFill::Transform(), + false, + SvtGraphicFill::hatchSingle, + Color(), + SvtGraphicFill::gradientLinear, + Color(), + Color(), + 0, + Graphic()); + } - // create uniform VCL gradient for uniform transparency - Gradient aVCLGradient; - const sal_uInt8 nTransPercentVcl((sal_uInt8)basegfx::fround(rUniAlphaCandidate.getAlpha() * 255.0)); - const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl); - - aVCLGradient.SetStyle(GRADIENT_LINEAR); - aVCLGradient.SetStartColor(aTransColor); - aVCLGradient.SetEndColor(aTransColor); - aVCLGradient.SetAngle(0); - aVCLGradient.SetBorder(0); - aVCLGradient.SetOfsX(0); - aVCLGradient.SetOfsY(0); - aVCLGradient.SetStartIntensity(100); - aVCLGradient.SetEndIntensity(100); - aVCLGradient.SetSteps(2); + // set line and fill color + const sal_uInt16 nTransPercentVcl((sal_uInt16)basegfx::fround(rUniTransparenceCandidate.getTransparence() * 100.0)); + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); - // render it to VCL - mpOutputDevice->DrawTransparent( - aContentMetafile, aPrimitiveRectangle.TopLeft(), - aPrimitiveRectangle.GetSize(), aVCLGradient); + // call VCL directly; encapsulate with SvtGraphicFill + impStartSvtGraphicFill(pSvtGraphicFill); + mpOutputDevice->DrawTransparent( + PolyPolygon(aLocalPolyPolygon), + nTransPercentVcl); + impEndSvtGraphicFill(pSvtGraphicFill); + } + else + { + // svae old mfCurrentUnifiedTransparence and set new one + // so that contained SvtGraphicStroke may use the current one + const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence); + // #i105377# paint the content metafile opaque as the transparency gets + // split of into the gradient below + // mfCurrentUnifiedTransparence = rUniTransparenceCandidate.getTransparence(); + mfCurrentUnifiedTransparence = 0; + + // various content, create content-metafile + GDIMetaFile aContentMetafile; + const Rectangle aPrimitiveRectangle(impDumpToMetaFile(rContent, aContentMetafile)); + + // restore mfCurrentUnifiedTransparence; it may have been used + // while processing the sub-content in impDumpToMetaFile + mfCurrentUnifiedTransparence = fLastCurrentUnifiedTransparence; + + // create uniform VCL gradient for uniform transparency + Gradient aVCLGradient; + const sal_uInt8 nTransPercentVcl((sal_uInt8)basegfx::fround(rUniTransparenceCandidate.getTransparence() * 255.0)); + const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl); + + aVCLGradient.SetStyle(GRADIENT_LINEAR); + aVCLGradient.SetStartColor(aTransColor); + aVCLGradient.SetEndColor(aTransColor); + aVCLGradient.SetAngle(0); + aVCLGradient.SetBorder(0); + aVCLGradient.SetOfsX(0); + aVCLGradient.SetOfsY(0); + aVCLGradient.SetStartIntensity(100); + aVCLGradient.SetEndIntensity(100); + aVCLGradient.SetSteps(2); + + // render it to VCL + mpOutputDevice->DrawTransparent( + aContentMetafile, aPrimitiveRectangle.TopLeft(), + aPrimitiveRectangle.GetSize(), aVCLGradient); + } } } break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // for metafile: Need to examine what the pure vcl version is doing here actually // - uses DrawTransparent with metafile for content and a gradient // i can detect this here with checking the gradient part for a single // FillGradientPrimitive2D and reconstruct the gradient. - // If that detection goes wrong, i have to create an alpha-blended bitmap. Eventually - // do that in stripes, else RenderAlphaPrimitive2D may just be used - const primitive2d::AlphaPrimitive2D& rAlphaCandidate = static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rAlphaCandidate.getChildren(); - const primitive2d::Primitive2DSequence rAlpha = rAlphaCandidate.getAlpha(); + // If that detection goes wrong, i have to create an transparence-blended bitmap. Eventually + // do that in stripes, else RenderTransparencePrimitive2D may just be used + const primitive2d::TransparencePrimitive2D& rTransparenceCandidate = static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DSequence rTransparence = rTransparenceCandidate.getTransparence(); - if(rContent.hasElements() && rAlpha.hasElements()) + if(rContent.hasElements() && rTransparence.hasElements()) { // try to identify a single FillGradientPrimitive2D in the - // alpha part of the primitive + // transparence part of the primitive const primitive2d::FillGradientPrimitive2D* pFiGradient = 0; static bool bForceToBigTransparentVDev(false); - if(!bForceToBigTransparentVDev && 1 == rAlpha.getLength()) + if(!bForceToBigTransparentVDev && 1 == rTransparence.getLength()) { - const primitive2d::Primitive2DReference xReference(rAlpha[0]); + const primitive2d::Primitive2DReference xReference(rTransparence[0]); pFiGradient = dynamic_cast< const primitive2d::FillGradientPrimitive2D* >(xReference.get()); } @@ -1646,7 +1673,7 @@ namespace drawinglayer // Okay, basic implementation finished and tested. The DPI stuff was hard // and not easy to find out that it's needed. // Since this will not yet happen normally (as long as noone constructs - // alpha primitives with non-trivial alpha content) i will for now not + // transparence primitives with non-trivial transparence content) i will for now not // refine to tiling here. basegfx::B2DRange aViewRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D())); @@ -1697,9 +1724,9 @@ namespace drawinglayer aBufferProcessor.process(rContent); const Bitmap aBmContent(aBufferDevice.GetBitmap(aEmptyPoint, aSizePixel)); - // draw alpha using pixel renderer + // draw transparence using pixel renderer aBufferDevice.Erase(); - aBufferProcessor.process(rAlpha); + aBufferProcessor.process(rTransparence); const AlphaMask aBmAlpha(aBufferDevice.GetBitmap(aEmptyPoint, aSizePixel)); #ifdef DBG_UTIL @@ -1785,27 +1812,6 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_HITTESTPRIMITIVE2D : - { - // #i99123# - // invisible primitive; to rebuilt the old MetaFile creation, it is necessary to - // not ignore them (as it was thought), but to add a MetaFile entry for them. - basegfx::B2DRange aInvisibleRange(rCandidate.getB2DRange(getViewInformation2D())); - - if(!aInvisibleRange.isEmpty()) - { - aInvisibleRange.transform(maCurrentTransformation); - const Rectangle aRectLogic( - (sal_Int32)floor(aInvisibleRange.getMinX()), (sal_Int32)floor(aInvisibleRange.getMinY()), - (sal_Int32)ceil(aInvisibleRange.getMaxX()), (sal_Int32)ceil(aInvisibleRange.getMaxY())); - - mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(); - mpOutputDevice->DrawRect(aRectLogic); - } - - break; - } case PRIMITIVE2D_ID_EPSPRIMITIVE2D : { RenderEpsPrimitive2D(static_cast< const primitive2d::EpsPrimitive2D& >(rCandidate)); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 5a74b0471b7f..aed085a0bc9a 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -47,14 +47,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include #include @@ -264,50 +264,62 @@ namespace drawinglayer RenderModifiedColorPrimitive2D(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(rCandidate)); break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, // use the faster OutputDevice::DrawTransparent method - const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate = static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rUniAlphaCandidate.getChildren(); - bool bDrawTransparentUsed(false); + const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate = static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rUniTransparenceCandidate.getChildren(); - // since DEV300 m33 DrawTransparent is supported in VCL (for some targets - // natively), so i am now enabling this shortcut - static bool bAllowUsingDrawTransparent(true); - - if(bAllowUsingDrawTransparent && rContent.hasElements() && 1 == rContent.getLength()) + if(rContent.hasElements()) { - const primitive2d::Primitive2DReference xReference(rContent[0]); - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); - - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) + { + // not transparent at all, use content + process(rUniTransparenceCandidate.getChildren()); + } + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - // single transparent PolyPolygon identified, use directly - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - mpOutputDevice->SetFillColor(Color(aPolygonColor)); - mpOutputDevice->SetLineColor(); + bool bDrawTransparentUsed(false); - basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); - aLocalPolyPolygon.transform(maCurrentTransformation); + // since DEV300 m33 DrawTransparent is supported in VCL (for some targets + // natively), so i am now enabling this shortcut + static bool bAllowUsingDrawTransparent(true); - mpOutputDevice->DrawTransparent(aLocalPolyPolygon, rUniAlphaCandidate.getAlpha()); - bDrawTransparentUsed = true; - } - } + if(bAllowUsingDrawTransparent && 1 == rContent.getLength()) + { + const primitive2d::Primitive2DReference xReference(rContent[0]); + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // single transparent PolyPolygon identified, use directly + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); + + basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); + aLocalPolyPolygon.transform(maCurrentTransformation); + + mpOutputDevice->DrawTransparent(aLocalPolyPolygon, rUniTransparenceCandidate.getTransparence()); + bDrawTransparentUsed = true; + } + } - if(!bDrawTransparentUsed) - { - // unified sub-transparence. Draw to VDev first. - RenderUnifiedAlphaPrimitive2D(rUniAlphaCandidate); + if(!bDrawTransparentUsed) + { + // unified sub-transparence. Draw to VDev first. + RenderUnifiedTransparencePrimitive2D(rUniTransparenceCandidate); + } + } } break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group. Draw to VDev first. - RenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + RenderTransparencePrimitive2D(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); break; } case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D : diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index e9de4199026b..1c1865c13f75 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -52,8 +51,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -380,7 +379,7 @@ namespace drawinglayer { // color gets completely replaced, get it const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); mpOutputDevice->SetFillColor(Color(aModifiedColor)); @@ -454,7 +453,7 @@ namespace drawinglayer { // color gets completely replaced, get it const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); mpOutputDevice->SetFillColor(Color(aModifiedColor)); @@ -610,7 +609,7 @@ namespace drawinglayer else { // try to catch cases where the bitmap will be color-modified to a single - // color (e.g. shadow). This would NOT be optimizable with an alpha channel + // color (e.g. shadow). This would NOT be optimizable with an transparence channel // at the Bitmap which we do not have here. When this should change, this // optimization has to be reworked accordingly. const sal_uInt32 nBColorModifierStackCount(maBColorModifierStack.count()); @@ -883,10 +882,10 @@ namespace drawinglayer if(getOptionsDrawinglayer().IsAntiAliasing()) { // with AA, use 8bit AlphaMask to get nice borders - VirtualDevice& rAlpha = aBufferDevice.getAlpha(); - rAlpha.SetLineColor(); - rAlpha.SetFillColor(COL_BLACK); - rAlpha.DrawPolyPolygon(aMask); + VirtualDevice& rTransparence = aBufferDevice.getTransparence(); + rTransparence.SetLineColor(); + rTransparence.SetFillColor(COL_BLACK); + rTransparence.DrawPolyPolygon(aMask); // dump buffer to outdev aBufferDevice.paint(); @@ -919,7 +918,7 @@ namespace drawinglayer } // unified sub-transparence. Draw to VDev first. - void VclProcessor2D::RenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rTransCandidate) + void VclProcessor2D::RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate) { static bool bForceToDecomposition(false); @@ -932,14 +931,14 @@ namespace drawinglayer } else { - if(0.0 == rTransCandidate.getAlpha()) + if(0.0 == rTransCandidate.getTransparence()) { // no transparence used, so just use the content process(rTransCandidate.getChildren()); } - else if(rTransCandidate.getAlpha() > 0.0 && rTransCandidate.getAlpha() < 1.0) + else if(rTransCandidate.getTransparence() > 0.0 && rTransCandidate.getTransparence() < 1.0) { - // alpha is in visible range + // transparence is in visible range basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D())); aRange.transform(maCurrentTransformation); impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true); @@ -956,8 +955,8 @@ namespace drawinglayer // back to old OutDev mpOutputDevice = pLastOutputDevice; - // dump buffer to outdev using given alpha - aBufferDevice.paint(rTransCandidate.getAlpha()); + // dump buffer to outdev using given transparence + aBufferDevice.paint(rTransCandidate.getTransparence()); } } } @@ -965,7 +964,7 @@ namespace drawinglayer } // sub-transparence group. Draw to VDev first. - void VclProcessor2D::RenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rTransCandidate) + void VclProcessor2D::RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate) { if(rTransCandidate.getChildren().hasElements()) { @@ -983,14 +982,14 @@ namespace drawinglayer process(rTransCandidate.getChildren()); // set to mask - mpOutputDevice = &aBufferDevice.getAlpha(); + mpOutputDevice = &aBufferDevice.getTransparence(); - // when painting alpha masks, reset the color stack + // when painting transparence masks, reset the color stack basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack); maBColorModifierStack = basegfx::BColorModifierStack(); - // paint mask to it (always with alpha intensities, evtl. with AA) - process(rTransCandidate.getAlpha()); + // paint mask to it (always with transparence intensities, evtl. with AA) + process(rTransCandidate.getTransparence()); // back to old color stack maBColorModifierStack = aLastBColorModifierStack; diff --git a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx index 42e2e1565803..305a575a50d9 100644 --- a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx +++ b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx @@ -40,11 +40,11 @@ #include #include #include -#include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -61,7 +61,8 @@ namespace drawinglayer maBack(rBack), maResult(), maCombinedTransform(), - mbAnyHit(bAnyHit) + mbAnyHit(bAnyHit), + mbUseInvisiblePrimitiveContent(true) { } @@ -132,13 +133,46 @@ namespace drawinglayer process(rPrimitive.getChildren()); break; } - case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D : + case PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D : { - // HitTestPrimitive3D, force usage due to we are doing a hit test and this - // primitive only gets generated on 3d objects without fill, exactly for this - // purpose - const primitive3d::HitTestPrimitive3D& rPrimitive = static_cast< const primitive3d::HitTestPrimitive3D& >(rCandidate); - process(rPrimitive.getChildren()); + // HiddenGeometryPrimitive3D; the default decomposition would return an empty seqence, + // so force this primitive to process it's children directly if the switch is set + // (which is the default). Else, ignore invisible content + const primitive3d::HiddenGeometryPrimitive3D& rHiddenGeometry(static_cast< const primitive3d::HiddenGeometryPrimitive3D& >(rCandidate)); + const primitive3d::Primitive3DSequence& rChildren = rHiddenGeometry.getChildren(); + + if(rChildren.hasElements()) + { + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } + } + + break; + } + case PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D : + { + const primitive3d::UnifiedTransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::UnifiedTransparenceTexturePrimitive3D& >(rCandidate); + const primitive3d::Primitive3DSequence rChildren = rPrimitive.getChildren(); + + if(rChildren.getLength()) + { + if(1.0 <= rPrimitive.getTransparence()) + { + // not visible, but use for HitTest + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } + } + else if(rPrimitive.getTransparence() >= 0.0 && rPrimitive.getTransparence() < 1.0) + { + // visible; use content + process(rChildren); + } + } + break; } case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 509a8e5db2ba..da179b546cf9 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -48,9 +48,11 @@ #include #include #include -#include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -493,10 +495,10 @@ namespace drawinglayer impRenderBitmapTexturePrimitive3D(rPrimitive); break; } - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D : { - // AlphaTexturePrimitive3D - const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive); + // TransparenceTexturePrimitive3D + const primitive3d::TransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::TransparenceTexturePrimitive3D& >(rBasePrimitive); mnTransparenceCounter++; impRenderGradientTexturePrimitive3D(rPrimitive, true); mnTransparenceCounter--; diff --git a/drawinglayer/source/processor3d/geometry2dextractor.cxx b/drawinglayer/source/processor3d/geometry2dextractor.cxx index c2e1c73b5181..29ff433c5af8 100644 --- a/drawinglayer/source/processor3d/geometry2dextractor.cxx +++ b/drawinglayer/source/processor3d/geometry2dextractor.cxx @@ -135,8 +135,8 @@ namespace drawinglayer case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D : case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D : case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D : - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : - case PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D : { // TexturePrimitive3D: Process children, do not try to decompose const primitive3d::TexturePrimitive3D& rTexturePrimitive = static_cast< const primitive3d::TexturePrimitive3D& >(rCandidate); diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index 5e6678fc3a8e..6e7b6a587b1e 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -99,7 +99,7 @@ namespace drawinglayer { // create simpleTransparencePrimitive, add created primitives const primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&xRef, 1L); - const primitive2d::Primitive2DReference xRef2(new primitive2d::UnifiedAlphaPrimitive2D(aNewTransPrimitiveVector, rPrimitive.getShadowTransparence())); + const primitive2d::Primitive2DReference xRef2(new primitive2d::UnifiedTransparencePrimitive2D(aNewTransPrimitiveVector, rPrimitive.getShadowTransparence())); primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef2); } else diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index 9346958f6b69..4ccefddcb100 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -51,6 +50,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 0e103ad385c9..d11dc5978d47 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -38,7 +38,6 @@ #include #include -#include #include ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx index 718225aa990b..a4cd8c497cd6 100644 --- a/svx/inc/svx/scene3d.hxx +++ b/svx/inc/svx/scene3d.hxx @@ -111,6 +111,8 @@ public: E3dScene(E3dDefaultAttributes& rDefault); virtual ~E3dScene(); + virtual void SetBoundRectDirty(); + // access to cleanup of depth mapper void Cleanup3DDepthMapper() { ImpCleanup3DDepthMapper(); } diff --git a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx b/svx/inc/svx/sdr/attribute/sdrallattribute.hxx deleted file mode 100644 index a699c7f9a198..000000000000 --- a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx +++ /dev/null @@ -1,202 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrallattribute.hxx,v $ - * - * $Revision: 1.2 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX -#define _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines - -namespace drawinglayer { namespace attribute { - class SdrLineAttribute; - class SdrFillAttribute; - class SdrLineStartEndAttribute; - class SdrShadowAttribute; - class FillGradientAttribute; - class SdrTextAttribute; -}} - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrShadowTextAttribute - { - // shadow and text attributes - SdrShadowAttribute* mpShadow; // shadow attributes (if used) - SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) - - public: - SdrShadowTextAttribute( - SdrShadowAttribute* pShadow = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrShadowTextAttribute(); - - // copy constructor and assigment operator - SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate); - SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (0 != mpTextAttribute); } - - // data access - const SdrShadowAttribute* getShadow() const { return mpShadow; } - const SdrTextAttribute* getText() const { return mpTextAttribute; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrFillTextAttribute - { - // shadow and text attributes - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) - SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) - - public: - SdrFillTextAttribute( - SdrFillAttribute* pFill = 0, - FillGradientAttribute* pFillFloatTransGradient = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrFillTextAttribute(); - - // copy constructor and assigment operator - SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate); - SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrFillTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return ((mpTextAttribute) || (mpFill)); } - - // data access - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } - const SdrTextAttribute* getText() const { return mpTextAttribute; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineShadowTextAttribute : public SdrShadowTextAttribute - { - // line, shadow, lineStartEnd and text attributes - SdrLineAttribute* mpLine; // line attributes (if used) - SdrLineStartEndAttribute* mpLineStartEnd; // line start end (if used) - - public: - SdrLineShadowTextAttribute( - SdrLineAttribute* pLine = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrLineShadowTextAttribute(); - - // copy constructor and assigment operator - SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate); - SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrLineShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpLine || (SdrShadowTextAttribute::isVisible())); } - - // data access - const SdrLineAttribute* getLine() const { return mpLine; } - const SdrLineStartEndAttribute* getLineStartEnd() const { return mpLineStartEnd; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute - { - // add fill and transGradient attributes - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) - - public: - SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine = 0, - SdrFillAttribute* pFill = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - FillGradientAttribute* pFillFloatTransGradient = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrLineFillShadowTextAttribute(); - - // copy constructor and assigment operator - SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate); - SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpFill || (SdrLineShadowTextAttribute::isVisible())); } - - // data access - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif // _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX - -// eof diff --git a/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx new file mode 100644 index 000000000000..df8ee7c666a9 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFillTextAttribute + { + // shadow and text attributes + SdrFillAttribute maFill; // fill attributes (if used) + FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used) + SdrTextAttribute maTextAttribute; // text and text attributes (if used) + + public: + SdrFillTextAttribute( + const SdrFillAttribute& rFill, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute); + SdrFillTextAttribute(); + SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate); + SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrFillTextAttribute& rCandidate) const; + + // data access + const SdrFillAttribute& getFill() const { return maFill; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } + const SdrTextAttribute& getText() const { return maTextAttribute; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx index 77273bd9cb03..449c8cb8fcf6 100644 --- a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx @@ -38,8 +38,13 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class SfxItemSet; -namespace drawinglayer { namespace attribute { class SdrFormTextOutlineAttribute; }} + +namespace drawinglayer { namespace attribute { + class ImpSdrFormTextAttribute; + class SdrFormTextOutlineAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -50,53 +55,36 @@ namespace drawinglayer class SdrFormTextAttribute { private: - // FormText (FontWork) Attributes - sal_Int32 mnFormTextDistance; // distance from line in upright direction - sal_Int32 mnFormTextStart; // shift from polygon start - sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees - sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling - sal_uInt16 mnFormTextShdwTransp; // shadow transparence - XFormTextStyle meFormTextStyle; // on/off and char orientation - XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale - XFormTextShadow meFormTextShadow; // shadow mode - Color maFormTextShdwColor; // shadow color - - // outline attributes; used when getFormTextOutline() is true and (for - // shadow) when getFormTextShadow() != XFTSHADOW_NONE - SdrFormTextOutlineAttribute* mpOutline; - SdrFormTextOutlineAttribute* mpShadowOutline; - - // bitfield - unsigned mbFormTextMirror : 1; // change orientation - unsigned mbFormTextOutline : 1; // show contour of objects + ImpSdrFormTextAttribute* mpSdrFormTextAttribute; public: + /// constructors/assignmentoperator/destructor SdrFormTextAttribute(const SfxItemSet& rSet); - ~SdrFormTextAttribute(); - - // copy constructor and assigment operator + SdrFormTextAttribute(); SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate); SdrFormTextAttribute& operator=(const SdrFormTextAttribute& rCandidate); + ~SdrFormTextAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrFormTextAttribute& rCandidate) const; - // data access - sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } - sal_Int32 getFormTextStart() const { return mnFormTextStart; } - sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } - sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } - sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } - XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } - XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } - XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } - Color getFormTextShdwColor() const { return maFormTextShdwColor; } - - const SdrFormTextOutlineAttribute* getOutline() const { return mpOutline; } - const SdrFormTextOutlineAttribute* getShadowOutline() const { return mpShadowOutline; } - - bool getFormTextMirror() const { return mbFormTextMirror; } - bool getFormTextOutline() const { return mbFormTextOutline; } + // data read access + sal_Int32 getFormTextDistance() const; + sal_Int32 getFormTextStart() const; + sal_Int32 getFormTextShdwXVal() const; + sal_Int32 getFormTextShdwYVal() const; + sal_uInt16 getFormTextShdwTransp() const; + XFormTextStyle getFormTextStyle() const; + XFormTextAdjust getFormTextAdjust() const; + XFormTextShadow getFormTextShadow() const; + Color getFormTextShdwColor() const; + const SdrFormTextOutlineAttribute& getOutline() const; + const SdrFormTextOutlineAttribute& getShadowOutline() const; + bool getFormTextMirror() const; + bool getFormTextOutline() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx index 8e11c97ed5c3..d13fe39232ff 100644 --- a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx @@ -33,8 +33,15 @@ #define _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX #include -#include -#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdrFormTextOutlineAttribute; + class LineAttribute; + class StrokeAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -45,24 +52,29 @@ namespace drawinglayer class SdrFormTextOutlineAttribute { private: - // one set of attributes for FormText (FontWork) outline visualisation - LineAttribute maLineAttribute; - StrokeAttribute maStrokeAttribute; - sal_uInt8 mnTransparence; + ImpSdrFormTextOutlineAttribute* mpSdrFormTextOutlineAttribute; public: + /// constructors/assignmentoperator/destructor SdrFormTextOutlineAttribute( const LineAttribute& rLineAttribute, const StrokeAttribute& rStrokeAttribute, sal_uInt8 nTransparence); + SdrFormTextOutlineAttribute(); + SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate); + SdrFormTextOutlineAttribute& operator=(const SdrFormTextOutlineAttribute& rCandidate); + ~SdrFormTextOutlineAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrFormTextOutlineAttribute& rCandidate) const; // data read access - const LineAttribute& getLineAttribute() const { return maLineAttribute; } - const StrokeAttribute getStrokeAttribute() const { return maStrokeAttribute; } - sal_uInt8 getTransparence() const { return mnTransparence; } + const LineAttribute& getLineAttribute() const; + const StrokeAttribute& getStrokeAttribute() const; + sal_uInt8 getTransparence() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx new file mode 100644 index 000000000000..c2fa9200dfe8 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute + { + // add fill and transGradient attributes + SdrFillAttribute maFill; // fill attributes (if used) + FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used) + + public: + SdrLineFillShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute); + SdrLineFillShadowTextAttribute(); + SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate); + SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const; + + // data access + const SdrFillAttribute& getFill() const { return maFill; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx new file mode 100644 index 000000000000..e5d19cef5f4e --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineShadowTextAttribute : public SdrShadowTextAttribute + { + // line, shadow, lineStartEnd and text attributes + SdrLineAttribute maLine; // line attributes (if used) + SdrLineStartEndAttribute maLineStartEnd; // line start end (if used) + + public: + SdrLineShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute); + SdrLineShadowTextAttribute(); + SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate); + SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineShadowTextAttribute& rCandidate) const; + + // data access + const SdrLineAttribute& getLine() const { return maLine; } + const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx new file mode 100644 index 000000000000..f71a74d6a580 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrShadowTextAttribute + { + // shadow and text attributes + SdrShadowAttribute maShadow; // shadow attributes (if used) + SdrTextAttribute maTextAttribute; // text and text attributes (if used) + + public: + SdrShadowTextAttribute( + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute); + SdrShadowTextAttribute(); + SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate); + SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrShadowTextAttribute& rCandidate) const; + + // data access + const SdrShadowAttribute& getShadow() const { return maShadow; } + const SdrTextAttribute& getText() const { return maTextAttribute; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index f672086ea5cd..36a9c2591c43 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -39,9 +39,20 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class SdrText; -namespace drawinglayer { namespace animation { class AnimationEntryList; }} -namespace drawinglayer { namespace attribute { class SdrFormTextAttribute; }} + +namespace drawinglayer { namespace animation { + class AnimationEntryList; +}} + +namespace drawinglayer { namespace attribute { + class SdrFormTextAttribute; +}} + +namespace drawinglayer { namespace attribute { + class ImpSdrTextAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -52,41 +63,13 @@ namespace drawinglayer class SdrTextAttribute { private: - // all-text attributes. The SdrText itself and a copy - // of te OPO - const SdrText* mpSdrText; - OutlinerParaObject maOutlinerParaObject; - - // Set when it's a FormText; contains all FormText attributes - SdrFormTextAttribute* mpSdrFormTextAttribute; - - // text distances - sal_Int32 maTextLeftDistance; - sal_Int32 maTextUpperDistance; - sal_Int32 maTextRightDistance; - sal_Int32 maTextLowerDistance; - - // #i101556# use versioning from text attributes to detect changes - sal_uInt32 maPropertiesVersion; - - // text alignments - SdrTextHorzAdjust maSdrTextHorzAdjust; - SdrTextVertAdjust maSdrTextVertAdjust; - - // bitfield - unsigned mbContour : 1; - unsigned mbFitToSize : 1; - unsigned mbHideContour : 1; - unsigned mbBlink : 1; - unsigned mbScroll : 1; - unsigned mbInEditMode : 1; - unsigned mbFixedCellHeight : 1; - unsigned mbWrongSpell : 1; + ImpSdrTextAttribute* mpSdrTextAttribute; public: + /// constructors/assignmentoperator/destructor SdrTextAttribute( const SdrText& rSdrText, - const OutlinerParaObject& rOutlinerParaObjectPtr, + const OutlinerParaObject& rOutlinerParaObject, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, @@ -102,38 +85,44 @@ namespace drawinglayer bool bInEditMode, bool bFixedCellHeight, bool bWrongSpell); - ~SdrTextAttribute(); - - // copy constructor and assigment operator + SdrTextAttribute(); SdrTextAttribute(const SdrTextAttribute& rCandidate); SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate); + ~SdrTextAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrTextAttribute& rCandidate) const; - // data access - const SdrText& getSdrText() const { return *mpSdrText; } - const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } - bool isContour() const { return mbContour; } - bool isFitToSize() const { return mbFitToSize; } - bool isHideContour() const { return mbHideContour; } - bool isBlink() const { return mbBlink; } - bool isScroll() const { return mbScroll; } - bool isInEditMode() const { return mbInEditMode; } - bool isFixedCellHeight() const { return mbFixedCellHeight; } - bool isWrongSpell() const { return mbWrongSpell; } - const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; } - sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } - sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } - sal_Int32 getTextRightDistance() const { return maTextRightDistance; } - sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } - sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } - SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } - SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } - - // animation timing generation - void getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const; - void getScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const; + // data read access + const SdrText& getSdrText() const; + const OutlinerParaObject& getOutlinerParaObject() const; + bool isContour() const; + bool isFitToSize() const; + bool isHideContour() const; + bool isBlink() const; + bool isScroll() const; + bool isInEditMode() const; + bool isFixedCellHeight() const; + bool isWrongSpell() const; + const SdrFormTextAttribute& getSdrFormTextAttribute() const; + sal_Int32 getTextLeftDistance() const; + sal_Int32 getTextUpperDistance() const; + sal_Int32 getTextRightDistance() const; + sal_Int32 getTextLowerDistance() const; + sal_uInt32 getPropertiesVersion() const; + SdrTextHorzAdjust getSdrTextHorzAdjust() const; + SdrTextVertAdjust getSdrTextVertAdjust() const; + + // helpers: animation timing generators + void getBlinkTextTiming( + drawinglayer::animation::AnimationEntryList& rAnimList) const; + void getScrollTextTiming( + drawinglayer::animation::AnimationEntryList& rAnimList, + double fFrameLength, + double fTextLength) const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx index 415526b07d77..49ba86d2bb69 100644 --- a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx +++ b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx @@ -33,22 +33,16 @@ #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predeclarations class E3dScene; -namespace drawinglayer { - namespace geometry { - class ViewInformation3D; - } - namespace attribute { - class SdrSceneAttribute; - class SdrLightingAttribute; - } -} - namespace basegfx { class B3DRange; } @@ -70,7 +64,6 @@ namespace sdr public: // basic constructor, used from SdrObject. ViewContactOfE3dScene(E3dScene& rScene); - virtual ~ViewContactOfE3dScene(); // access to SdrObject E3dScene& GetE3dScene() const @@ -101,14 +94,14 @@ namespace sdr protected: // the 3d transformation stack - drawinglayer::geometry::ViewInformation3D* mpViewInformation3D; + drawinglayer::geometry::ViewInformation3D maViewInformation3D; // the object transformation - basegfx::B2DHomMatrix* mpObjectTransformation; + basegfx::B2DHomMatrix maObjectTransformation; // attributes - drawinglayer::attribute::SdrSceneAttribute* mpSdrSceneAttribute; - drawinglayer::attribute::SdrLightingAttribute* mpSdrLightingAttribute; + drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute; + drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute; // create methods for ViewInformation3D and ObjectTransformation void createViewInformation3D(const ::basegfx::B3DRange& rContentRange); diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx index 902ce95a9fc4..252906d55aa4 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx @@ -50,9 +50,6 @@ namespace sdr ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact); virtual ~ViewObjectContactOfGroup(); - // test this VOC for visibility concerning model-view stuff like e.g. Layer - virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; - // This method recursively paints the draw hierarchy. virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; }; diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx index e4a8fa01902f..638aae7ee7ef 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -50,7 +50,7 @@ namespace drawinglayer { namespace attribute { class SdrShadowTextAttribute; class SdrLineShadowTextAttribute; class SdrLineFillShadowTextAttribute; - class SdrLineFillShadowAttribute; + class SdrLineFillShadowAttribute3D; class SdrSceneAttribute; class SdrLightingAttribute; class SdrFillTextAttribute; @@ -67,13 +67,21 @@ namespace drawinglayer namespace primitive2d { // SdrAttribute creators - attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet); - attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth); - attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet); - attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet); + attribute::SdrLineAttribute createNewSdrLineAttribute( + const SfxItemSet& rSet); + + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth); + + attribute::SdrShadowAttribute createNewSdrShadowAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillAttribute createNewSdrFillAttribute( + const SfxItemSet& rSet); // #i101508# Support handing over given text-to-border distances - attribute::SdrTextAttribute* createNewSdrTextAttribute( + attribute::SdrTextAttribute createNewSdrTextAttribute( const SfxItemSet& rSet, const SdrText& rText, const sal_Int32* pLeft = 0, @@ -81,20 +89,37 @@ namespace drawinglayer const sal_Int32* pRight = 0, const sal_Int32* pLower = 0); - attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet); - attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet); - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute( + attribute::FillGradientAttribute createNewTransparenceGradientAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute( + const SfxItemSet& rSet); + + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( const SfxItemSet& rSet, - const SdrText& rText, + const SdrText* pText, bool bSuppressText); // #i98072# added option to suppress text on demand - attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); - attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); - attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill); - attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet); - attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet); + + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute( + const SfxItemSet& rSet, + bool bSuppressFill); + + attribute::SdrSceneAttribute createNewSdrSceneAttribute( + const SfxItemSet& rSet); + + attribute::SdrLightingAttribute createNewSdrLightingAttribute( + const SfxItemSet& rSet); // #i101508# Support handing over given text-to-border distances - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( const SfxItemSet& rSet, const SdrText* pSdrText, const sal_Int32* pLeft = 0, @@ -103,7 +128,11 @@ namespace drawinglayer const sal_Int32* pLower = 0); // helpers - void calculateRelativeCornerRadius(sal_Int32 nRadius, const ::basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY); + void calculateRelativeCornerRadius( + sal_Int32 nRadius, + const ::basegfx::B2DRange& rObjectRange, + double& rfCornerRadiusX, + double& rfCornerRadiusY); } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx index 177c42bfff17..e70cc4992e17 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx index 5523480f1f51..e5b8b4834e0f 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx @@ -33,8 +33,8 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index 72035eb99569..99d3fb180a25 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -33,8 +33,8 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -61,8 +61,8 @@ namespace drawinglayer // making exceptions with shadow generation unsigned mb3DShape : 1; - // #SJ# Allow text clipping against TextBox in special cases (used for SC) - unsigned mbForceTextClipToTextRange : 1; + // #SJ# Allow text clipping against TextBox in special cases (used for SC) + unsigned mbForceTextClipToTextRange : 1; protected: // local decomposition. diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx index 0f46c2809597..51171ec99f67 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx @@ -58,22 +58,22 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference createPolyPolygonFillPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient = 0L); + const attribute::FillGradientAttribute& rFillGradient); Primitive2DReference createPolygonLinePrimitive( - const ::basegfx::B2DPolygon& rUnitPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolygon& rUnitPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, - const attribute::SdrLineStartEndAttribute* pStroke = 0L); + const attribute::SdrLineStartEndAttribute& rStroke); Primitive2DReference createTextPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, - const attribute::SdrLineAttribute* pStroke, + const attribute::SdrLineAttribute& rStroke, bool bCellText, bool bWordWrap, bool bClipOnBounds); diff --git a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx index 1d11c27ede71..b4dae8aed62a 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx @@ -34,7 +34,7 @@ #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx index 787c230d7b3d..c93d188177b2 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -34,9 +34,8 @@ #include #include -#include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 3e998f23fd2b..c5d5c31bd302 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -33,8 +33,7 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX #include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx index 2deaf474e12e..658bbe3429f7 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx @@ -34,8 +34,7 @@ #include #include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx index d6de666d901f..b95563c69741 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx index 2d419e9cd45d..766c4439e5be 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx @@ -40,7 +40,6 @@ namespace basegfx { class BColor; - class B2DHomMatrix; } ////////////////////////////////////////////////////////////////////////////// @@ -55,10 +54,6 @@ namespace drawinglayer // create a 7x7 gluepoint symbol in given colors as BitmapEx BitmapEx createDefaultGluepoint_7x7(const basegfx::BColor& rBColorA, const basegfx::BColor& rBColorB); - - // #i99123# - Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix); - } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 816956b188fe..18ca37872351 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/properties/oleproperties.hxx b/svx/inc/svx/sdr/properties/oleproperties.hxx new file mode 100644 index 000000000000..009c375dff99 --- /dev/null +++ b/svx/inc/svx/sdr/properties/oleproperties.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: graphicproperties.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_PROPERTIES_OLEPROPERTIES_HXX +#define _SDR_PROPERTIES_OLEPROPERTIES_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace properties + { + class OleProperties : public RectangleProperties + { + protected: + public: + // basic constructor + OleProperties(SdrObject& rObj); + + // constructor for copying, but using new object + OleProperties(const OleProperties& rProps, SdrObject& rObj); + + // destructor + virtual ~OleProperties(); + + // Clone() operator, normally just calls the local copy constructor + virtual BaseProperties& Clone(SdrObject& rObj) const; + + // force default attributes for a specific object type, called from + // DefaultProperties::GetObjectItemSet() if a new ItemSet is created + virtual void ForceDefaultAttributes(); + }; + } // end of namespace properties +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_PROPERTIES_OLEPROPERTIES_HXX + +// eof diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index 5f243d451f90..db799da81e1d 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -69,6 +69,7 @@ public: SdrObjGroup(); virtual ~SdrObjGroup(); + virtual void SetBoundRectDirty(); virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual SdrLayerID GetLayer() const; diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 8b4675feb3e9..7d2f508d9d21 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -637,6 +637,9 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay ..\inc\svx\sdr\overlay\overlayselection.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayselection.hxx ..\inc\svx\sdr\overlay\overlaytools.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytools.hxx +mkdir: %_DEST%\inc%_EXT%\svx\sdr\primitive2d +..\inc\svx\sdr\primitive2d\sdrprimitivetools.hxx %_DEST%\inc%_EXT%\svx\sdr\primitive2d\sdrprimitivetools.hxx + mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation ..\inc\svx\sdr\animation\ainfographic.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfographic.hxx ..\inc\svx\sdr\animation\ainfoscrolltext.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfoscrolltext.hxx diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 3408108788c4..4c09e6720fe2 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -70,8 +70,33 @@ E3dDragMethod::E3dDragMethod ( // eine Unit anlegen const long nCnt(rMark.GetMarkCount()); static bool bDoInvalidate(false); + long nObjs(0); - for(long nObjs = 0;nObjs < nCnt;nObjs++) + if(mbMoveFull) + { + // for non-visible 3D objects fallback to wireframe interaction + bool bInvisibleObjects(false); + + for(nObjs = 0;!bInvisibleObjects && nObjs < nCnt;nObjs++) + { + E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj()); + + if(pE3dObj) + { + if(!pE3dObj->HasFillStyle() && !pE3dObj->HasLineStyle()) + { + bInvisibleObjects = true; + } + } + } + + if(bInvisibleObjects) + { + mbMoveFull = false; + } + } + + for(nObjs = 0;nObjs < nCnt;nObjs++) { E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj()); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 0e2b87be4ca7..171eda577a9c 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -337,6 +337,12 @@ UINT16 E3dScene::GetObjIdentifier() const return E3D_SCENE_ID; } +void E3dScene::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + /************************************************************************* |* |* SetSnapRect diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 3f89d202b6ba..e789da69d6e3 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include #include @@ -208,8 +208,8 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr // if we have full overlay from selected objects, embed with 50% transparence, the // transformation is added to the OverlayPrimitive2DSequenceObject - drawinglayer::primitive2d::Primitive2DReference aUnifiedAlphaPrimitive2D(new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aContent, 0.5)); - aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlphaPrimitive2D, 1); + drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aContent, 0.5)); + aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); sdr::overlay::OverlayPrimitive2DSequenceObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aContent); diff --git a/svx/source/sdr/attribute/makefile.mk b/svx/source/sdr/attribute/makefile.mk index 44e161a3b503..33ef24169ab4 100644 --- a/svx/source/sdr/attribute/makefile.mk +++ b/svx/source/sdr/attribute/makefile.mk @@ -43,7 +43,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES=\ - $(SLO)$/sdrallattribute.obj \ + $(SLO)$/sdrfilltextattribute.obj \ + $(SLO)$/sdrlinefillshadowtextattribute.obj \ + $(SLO)$/sdrlineshadowtextattribute.obj \ + $(SLO)$/sdrshadowtextattribute.obj \ $(SLO)$/sdrtextattribute.obj \ $(SLO)$/sdrformtextattribute.obj \ $(SLO)$/sdrformtextoutlineattribute.obj diff --git a/svx/source/sdr/attribute/sdrallattribute.cxx b/svx/source/sdr/attribute/sdrallattribute.cxx deleted file mode 100644 index 9eee8dbccce8..000000000000 --- a/svx/source/sdr/attribute/sdrallattribute.cxx +++ /dev/null @@ -1,412 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrallattribute.cxx,v $ - * - * $Revision: 1.2 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_svx.hxx" - -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrShadowTextAttribute::SdrShadowTextAttribute( - SdrShadowAttribute* pShadow, - SdrTextAttribute* pTextAttribute) - : mpShadow(pShadow), - mpTextAttribute(pTextAttribute) - { - } - - SdrShadowTextAttribute::SdrShadowTextAttribute( - const SdrShadowTextAttribute& rCandidate) - : mpShadow(0), - mpTextAttribute(0) - { - *this = rCandidate; - } - - SdrShadowTextAttribute::~SdrShadowTextAttribute() - { - delete mpShadow; - delete mpTextAttribute; - } - - SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate) - { - // handle mpShadow - { - // delete local mpShadow if necessary - if(mpShadow) - { - delete mpShadow; - mpShadow = 0; - } - - // copy mpShadow if necessary - if(rCandidate.mpShadow) - { - mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow); - } - } - - // handle mpTextAttribute - { - // delete local mpTextAttribute if necessary - if(mpTextAttribute) - { - delete mpTextAttribute; - mpTextAttribute = 0; - } - - // copy mpTextAttribute if necessary - if(rCandidate.mpTextAttribute) - { - mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); - } - } - - return *this; - } - - bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const - { - // handle mpShadow - if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow)) - return false; - - // handle mpTextAttribute - if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrFillTextAttribute::SdrFillTextAttribute( - SdrFillAttribute* pFill, - FillGradientAttribute* pFillFloatTransGradient, - SdrTextAttribute* pTextAttribute) - : mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient), - mpTextAttribute(pTextAttribute) - { - } - - SdrFillTextAttribute::SdrFillTextAttribute( - const SdrFillTextAttribute& rCandidate) - : mpFill(0), - mpFillFloatTransGradient(0), - mpTextAttribute(0) - { - *this = rCandidate; - } - - SdrFillTextAttribute::~SdrFillTextAttribute() - { - delete mpFill; - delete mpFillFloatTransGradient; - delete mpTextAttribute; - } - - SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate) - { - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - // handle mpTextAttribute - { - // delete local mpTextAttribute if necessary - if(mpTextAttribute) - { - delete mpTextAttribute; - mpTextAttribute = 0; - } - - // copy mpTextAttribute if necessary - if(rCandidate.mpTextAttribute) - { - mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); - } - } - - return *this; - } - - bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const - { - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - // handle mpTextAttribute - if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - SdrLineAttribute* pLine, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - SdrTextAttribute* pTextAttribute) - : SdrShadowTextAttribute(pShadow, pTextAttribute), - mpLine(pLine), - mpLineStartEnd(pLineStartEnd) - { - } - - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - const SdrLineShadowTextAttribute& rCandidate) - : SdrShadowTextAttribute(0, 0), - mpLine(0), - mpLineStartEnd(0) - { - *this = rCandidate; - } - - SdrLineShadowTextAttribute::~SdrLineShadowTextAttribute() - { - delete mpLine; - delete mpLineStartEnd; - } - - SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate) - { - // call parent - SdrShadowTextAttribute::operator=(rCandidate); - - // handle mpLine - { - // delete local mpLine if necessary - if(mpLine) - { - delete mpLine; - mpLine = 0; - } - - // copy mpLine if necessary - if(rCandidate.mpLine) - { - mpLine = new SdrLineAttribute(*rCandidate.mpLine); - } - } - - // handle mpLineStartEnd - { - // delete local mpLineStartEnd if necessary - if(mpLineStartEnd) - { - delete mpLineStartEnd; - mpLineStartEnd = 0; - } - - // copy mpLineStartEnd if necessary - if(rCandidate.mpLineStartEnd) - { - mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); - } - } - - return *this; - } - - bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const - { - // call parent - if(!(SdrShadowTextAttribute::operator==(rCandidate))) - return false; - - // handle mpLine - if(!pointerOrContentEqual(mpLine, rCandidate.mpLine)) - return false; - - // handle mpLineStartEnd - if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine, - attribute::SdrFillAttribute* pFill, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - FillGradientAttribute* pFillFloatTransGradient, - SdrTextAttribute* pTextAttribute) - : SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pTextAttribute), - mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient) - { - } - - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - const SdrLineFillShadowTextAttribute& rCandidate) - : SdrLineShadowTextAttribute(0, 0, 0, 0), - mpFill(0), - mpFillFloatTransGradient(0) - { - *this = rCandidate; - } - - SdrLineFillShadowTextAttribute::~SdrLineFillShadowTextAttribute() - { - delete mpFill; - delete mpFillFloatTransGradient; - } - - SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate) - { - // call parent - SdrLineShadowTextAttribute::operator=(rCandidate); - - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - return *this; - } - - bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const - { - // call parent - if(!(SdrLineShadowTextAttribute::operator==(rCandidate))) - return false; - - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/svx/source/sdr/attribute/sdrfilltextattribute.cxx b/svx/source/sdr/attribute/sdrfilltextattribute.cxx new file mode 100644 index 000000000000..e281c77068c5 --- /dev/null +++ b/svx/source/sdr/attribute/sdrfilltextattribute.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrFillTextAttribute::SdrFillTextAttribute( + const SdrFillAttribute& rFill, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute) + : maFill(rFill), + maFillFloatTransGradient(rFillFloatTransGradient), + maTextAttribute(rTextAttribute) + { + } + + SdrFillTextAttribute::SdrFillTextAttribute() + : maFill(), + maFillFloatTransGradient(), + maTextAttribute() + { + } + + SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate) + : maFill(rCandidate.getFill()), + maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()), + maTextAttribute(rCandidate.getText()) + { + } + + SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate) + { + maFill = rCandidate.getFill(); + maFillFloatTransGradient = rCandidate.getFillFloatTransGradient(); + maTextAttribute = rCandidate.getText(); + + return *this; + } + + bool SdrFillTextAttribute::isDefault() const + { + return(getFill().isDefault() + && getFillFloatTransGradient().isDefault() + && getText().isDefault()); + } + + bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const + { + return(getFill() == rCandidate.getFill() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient() + && getText() == rCandidate.getText()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index a33ee3f7dfe4..5b6140cc3ea7 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -32,8 +32,8 @@ #include "precompiled_svx.hxx" #include +#include #include - #include #include #include @@ -44,11 +44,8 @@ #include #include #include - #include #include -#include -#include #include #include #include @@ -56,12 +53,10 @@ #include #include #include +#include +#include #include -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - ////////////////////////////////////////////////////////////////////////////// // helper to get line, stroke and transparence attributes from SfxItemSet @@ -158,144 +153,272 @@ namespace drawinglayer { namespace attribute { - SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) - : mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), - mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), - mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), - mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), - mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), - meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), - meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), - meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), - maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), - mpOutline(0), - mpShadowOutline(0), - mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), - mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) + class ImpSdrFormTextAttribute { - if(getFormTextOutline()) + public: + // refcounter + sal_uInt32 mnRefCount; + + // FormText (FontWork) Attributes + sal_Int32 mnFormTextDistance; // distance from line in upright direction + sal_Int32 mnFormTextStart; // shift from polygon start + sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees + sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling + sal_uInt16 mnFormTextShdwTransp; // shadow transparence + XFormTextStyle meFormTextStyle; // on/off and char orientation + XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale + XFormTextShadow meFormTextShadow; // shadow mode + Color maFormTextShdwColor; // shadow color + + // outline attributes; used when getFormTextOutline() is true and (for + // shadow) when getFormTextShadow() != XFTSHADOW_NONE + SdrFormTextOutlineAttribute maOutline; + SdrFormTextOutlineAttribute maShadowOutline; + + // bitfield + unsigned mbFormTextMirror : 1; // change orientation + unsigned mbFormTextOutline : 1; // show contour of objects + + ImpSdrFormTextAttribute(const SfxItemSet& rSet) + : mnRefCount(0), + mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), + mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), + mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), + mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), + mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), + meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), + meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), + meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), + maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), + maOutline(), + maShadowOutline(), + mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), + mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) { - const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); - - // also need to prepare attributes for outlines + if(getFormTextOutline()) { - const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); - - mpOutline = new SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); + const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); + + // also need to prepare attributes for outlines + { + const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); + + maOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } + + if(XFTSHADOW_NONE != getFormTextShadow()) + { + // also need to prepare attributes for shadow outlines + const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); + + maShadowOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } } + } - if(XFTSHADOW_NONE != getFormTextShadow()) - { - // also need to prepare attributes for shadow outlines - const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); - - mpShadowOutline = new SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); - } + ImpSdrFormTextAttribute() + : mnRefCount(0), + mnFormTextDistance(0), + mnFormTextStart(0), + mnFormTextShdwXVal(0), + mnFormTextShdwYVal(0), + mnFormTextShdwTransp(0), + meFormTextStyle(XFT_NONE), + meFormTextAdjust(XFT_CENTER), + meFormTextShadow(XFTSHADOW_NONE), + maFormTextShdwColor(), + maOutline(), + maShadowOutline(), + mbFormTextMirror(false), + mbFormTextOutline(false) + { } - } - SdrFormTextAttribute::~SdrFormTextAttribute() - { - if(mpOutline) + // data read access + sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } + sal_Int32 getFormTextStart() const { return mnFormTextStart; } + sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } + sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } + sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } + XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } + XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } + XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } + Color getFormTextShdwColor() const { return maFormTextShdwColor; } + const SdrFormTextOutlineAttribute& getOutline() const { return maOutline; } + const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; } + bool getFormTextMirror() const { return mbFormTextMirror; } + bool getFormTextOutline() const { return mbFormTextOutline; } + + // compare operator + bool operator==(const ImpSdrFormTextAttribute& rCandidate) const { - delete mpOutline; - mpOutline = 0; + return (getFormTextDistance() == rCandidate.getFormTextDistance() + && getFormTextStart() == rCandidate.getFormTextStart() + && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() + && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() + && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() + && getFormTextStyle() == rCandidate.getFormTextStyle() + && getFormTextAdjust() == rCandidate.getFormTextAdjust() + && getFormTextShadow() == rCandidate.getFormTextShadow() + && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() + && getOutline() == rCandidate.getOutline() + && getShadowOutline() == rCandidate.getShadowOutline() + && getFormTextMirror() == rCandidate.getFormTextMirror() + && getFormTextOutline() == rCandidate.getFormTextOutline()); } - if(mpShadowOutline) + static ImpSdrFormTextAttribute* get_global_default() { - delete mpShadowOutline; - mpShadowOutline = 0; + static ImpSdrFormTextAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFormTextAttribute(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; } + }; + + SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) + : mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet)) + { + } + + SdrFormTextAttribute::SdrFormTextAttribute() + : mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default()) + { + mpSdrFormTextAttribute->mnRefCount++; } SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate) - : mnFormTextDistance(rCandidate.getFormTextDistance()), - mnFormTextStart(rCandidate.getFormTextStart()), - mnFormTextShdwXVal(rCandidate.getFormTextShdwXVal()), - mnFormTextShdwYVal(rCandidate.getFormTextShdwYVal()), - mnFormTextShdwTransp(rCandidate.getFormTextShdwTransp()), - meFormTextStyle(rCandidate.getFormTextStyle()), - meFormTextAdjust(rCandidate.getFormTextAdjust()), - meFormTextShadow(rCandidate.getFormTextShadow()), - maFormTextShdwColor(rCandidate.getFormTextShdwColor()), - mpOutline(0), - mpShadowOutline(0), - mbFormTextMirror(rCandidate.getFormTextMirror()), - mbFormTextOutline(rCandidate.getFormTextOutline()) + : mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute) { - if(rCandidate.getOutline()) + mpSdrFormTextAttribute->mnRefCount++; + } + + SdrFormTextAttribute::~SdrFormTextAttribute() + { + if(mpSdrFormTextAttribute->mnRefCount) { - mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + mpSdrFormTextAttribute->mnRefCount--; } - - if(rCandidate.getShadowOutline()) + else { - mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); + delete mpSdrFormTextAttribute; } } + bool SdrFormTextAttribute::isDefault() const + { + return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default(); + } + SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate) { - mnFormTextDistance = rCandidate.getFormTextDistance(); - mnFormTextStart = rCandidate.getFormTextStart(); - mnFormTextShdwXVal = rCandidate.getFormTextShdwXVal(); - mnFormTextShdwYVal = rCandidate.getFormTextShdwYVal(); - mnFormTextShdwTransp = rCandidate.getFormTextShdwTransp(); - meFormTextStyle = rCandidate.getFormTextStyle(); - meFormTextAdjust = rCandidate.getFormTextAdjust(); - meFormTextShadow = rCandidate.getFormTextShadow(); - maFormTextShdwColor = rCandidate.getFormTextShdwColor(); - - if(mpOutline) + if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute) { - delete mpOutline; + if(mpSdrFormTextAttribute->mnRefCount) + { + mpSdrFormTextAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextAttribute; + } + + mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute; + mpSdrFormTextAttribute->mnRefCount++; } - mpOutline = 0; + return *this; + } - if(rCandidate.getOutline()) + bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + { + if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute) { - mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + return true; } - if(mpShadowOutline) + if(rCandidate.isDefault() != isDefault()) { - delete mpShadowOutline; + return false; } - mpShadowOutline = 0; + return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute); + } - if(rCandidate.getShadowOutline()) - { - mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); - } + sal_Int32 SdrFormTextAttribute::getFormTextDistance() const + { + return mpSdrFormTextAttribute->getFormTextDistance(); + } - mbFormTextMirror = rCandidate.getFormTextMirror(); - mbFormTextOutline = rCandidate.getFormTextOutline(); + sal_Int32 SdrFormTextAttribute::getFormTextStart() const + { + return mpSdrFormTextAttribute->getFormTextStart(); + } - return *this; + sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const + { + return mpSdrFormTextAttribute->getFormTextShdwXVal(); } - bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const + { + return mpSdrFormTextAttribute->getFormTextShdwYVal(); + } + + sal_uInt16 SdrFormTextAttribute::getFormTextShdwTransp() const + { + return mpSdrFormTextAttribute->getFormTextShdwTransp(); + } + + XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const + { + return mpSdrFormTextAttribute->getFormTextStyle(); + } + + XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const + { + return mpSdrFormTextAttribute->getFormTextAdjust(); + } + + XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const + { + return mpSdrFormTextAttribute->getFormTextShadow(); + } + + Color SdrFormTextAttribute::getFormTextShdwColor() const + { + return mpSdrFormTextAttribute->getFormTextShdwColor(); + } + + const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const + { + return mpSdrFormTextAttribute->getOutline(); + } + + const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const + { + return mpSdrFormTextAttribute->getShadowOutline(); + } + + bool SdrFormTextAttribute::getFormTextMirror() const + { + return mpSdrFormTextAttribute->getFormTextMirror(); + } + + bool SdrFormTextAttribute::getFormTextOutline() const { - return (getFormTextDistance() == rCandidate.getFormTextDistance() - && getFormTextStart() == rCandidate.getFormTextStart() - && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() - && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() - && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() - && getFormTextStyle() == rCandidate.getFormTextStyle() - && getFormTextAdjust() == rCandidate.getFormTextAdjust() - && getFormTextShadow() == rCandidate.getFormTextShadow() - && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() - && pointerOrContentEqual(getOutline(), rCandidate.getOutline()) - && pointerOrContentEqual(getShadowOutline(), rCandidate.getShadowOutline()) - && getFormTextMirror() == rCandidate.getFormTextMirror() - && getFormTextOutline() == rCandidate.getFormTextOutline()); + return mpSdrFormTextAttribute->getFormTextOutline(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx index db2fe20ae21b..fa225f1a0094 100644 --- a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx @@ -32,10 +32,8 @@ #include "precompiled_svx.hxx" #include - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -43,21 +41,146 @@ namespace drawinglayer { namespace attribute { + class ImpSdrFormTextOutlineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // one set of attributes for FormText (FontWork) outline visualisation + LineAttribute maLineAttribute; + StrokeAttribute maStrokeAttribute; + sal_uInt8 mnTransparence; + + ImpSdrFormTextOutlineAttribute( + const LineAttribute& rLineAttribute, + const StrokeAttribute& rStrokeAttribute, + sal_uInt8 nTransparence) + : mnRefCount(0), + maLineAttribute(rLineAttribute), + maStrokeAttribute(rStrokeAttribute), + mnTransparence(nTransparence) + { + } + + // data read access + const LineAttribute& getLineAttribute() const { return maLineAttribute; } + const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } + sal_uInt8 getTransparence() const { return mnTransparence; } + + // compare operator + bool operator==(const ImpSdrFormTextOutlineAttribute& rCandidate) const + { + return (getLineAttribute() == rCandidate.getLineAttribute() + && getStrokeAttribute() == rCandidate.getStrokeAttribute() + && getTransparence() == rCandidate.getTransparence()); + } + + static ImpSdrFormTextOutlineAttribute* get_global_default() + { + static ImpSdrFormTextOutlineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFormTextOutlineAttribute( + LineAttribute(), + StrokeAttribute(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute( const LineAttribute& rLineAttribute, const StrokeAttribute& rStrokeAttribute, sal_uInt8 nTransparence) - : maLineAttribute(rLineAttribute), - maStrokeAttribute(rStrokeAttribute), - mnTransparence(nTransparence) + : mpSdrFormTextOutlineAttribute(new ImpSdrFormTextOutlineAttribute( + rLineAttribute, rStrokeAttribute, nTransparence)) + { + } + + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute() + : mpSdrFormTextOutlineAttribute(ImpSdrFormTextOutlineAttribute::get_global_default()) + { + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate) + : mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute) + { + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute() + { + if(mpSdrFormTextOutlineAttribute->mnRefCount) + { + mpSdrFormTextOutlineAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextOutlineAttribute; + } + } + + bool SdrFormTextOutlineAttribute::isDefault() const + { + return mpSdrFormTextOutlineAttribute == ImpSdrFormTextOutlineAttribute::get_global_default(); + } + + SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate) { + if(rCandidate.mpSdrFormTextOutlineAttribute != mpSdrFormTextOutlineAttribute) + { + if(mpSdrFormTextOutlineAttribute->mnRefCount) + { + mpSdrFormTextOutlineAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextOutlineAttribute; + } + + mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute; + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + return *this; } bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const { - return (getLineAttribute() == rCandidate.getLineAttribute() - && getStrokeAttribute() == rCandidate.getStrokeAttribute() - && getTransparence() == rCandidate.getTransparence()); + if(rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFormTextOutlineAttribute == *mpSdrFormTextOutlineAttribute); + } + + const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const + { + return mpSdrFormTextOutlineAttribute->getLineAttribute(); + } + + const StrokeAttribute& SdrFormTextOutlineAttribute::getStrokeAttribute() const + { + return mpSdrFormTextOutlineAttribute->getStrokeAttribute(); + } + + sal_uInt8 SdrFormTextOutlineAttribute::getTransparence() const + { + return mpSdrFormTextOutlineAttribute->getTransparence(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx new file mode 100644 index 000000000000..6d8356833829 --- /dev/null +++ b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute) + : SdrLineShadowTextAttribute(rLine, rLineStartEnd, rShadow, rTextAttribute), + maFill(rFill), + maFillFloatTransGradient(rFillFloatTransGradient) + { + } + + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute() + : SdrLineShadowTextAttribute(), + maFill(), + maFillFloatTransGradient() + { + } + + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate) + : SdrLineShadowTextAttribute(rCandidate), + maFill(rCandidate.getFill()), + maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()) + { + } + + SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate) + { + SdrLineShadowTextAttribute::operator=(rCandidate); + maFill = rCandidate.getFill(); + maFillFloatTransGradient = rCandidate.getFillFloatTransGradient(); + + return *this; + } + + bool SdrLineFillShadowTextAttribute::isDefault() const + { + return (SdrLineShadowTextAttribute::isDefault() + && getFill().isDefault() + && getFillFloatTransGradient().isDefault()); + } + + bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const + { + return(SdrLineShadowTextAttribute::operator==(rCandidate) + && getFill() == rCandidate.getFill() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx new file mode 100644 index 000000000000..6b863a11aa03 --- /dev/null +++ b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute) + : SdrShadowTextAttribute(rShadow, rTextAttribute), + maLine(rLine), + maLineStartEnd(rLineStartEnd) + { + } + + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute() + : SdrShadowTextAttribute(), + maLine(), + maLineStartEnd() + { + } + + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate) + : SdrShadowTextAttribute(rCandidate), + maLine(rCandidate.getLine()), + maLineStartEnd(rCandidate.getLineStartEnd()) + { + } + + SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate) + { + SdrShadowTextAttribute::operator=(rCandidate); + maLine = rCandidate.getLine(); + maLineStartEnd = rCandidate.getLineStartEnd(); + + return *this; + } + + bool SdrLineShadowTextAttribute::isDefault() const + { + return(SdrShadowTextAttribute::isDefault() + && getLine().isDefault() + && getLineStartEnd().isDefault()); + } + + bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const + { + return(SdrShadowTextAttribute::operator==(rCandidate) + && getLine() == rCandidate.getLine() + && getLineStartEnd() == rCandidate.getLineStartEnd()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx new file mode 100644 index 000000000000..34485b57399c --- /dev/null +++ b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrShadowTextAttribute::SdrShadowTextAttribute( + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute) + : maShadow(rShadow), + maTextAttribute(rTextAttribute) + { + } + + SdrShadowTextAttribute::SdrShadowTextAttribute() + : maShadow(), + maTextAttribute() + { + } + + SdrShadowTextAttribute::SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate) + : maShadow(rCandidate.getShadow()), + maTextAttribute(rCandidate.getText()) + { + } + + SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate) + { + maShadow = rCandidate.getShadow(); + maTextAttribute = rCandidate.getText(); + + return *this; + } + + bool SdrShadowTextAttribute::isDefault() const + { + return (getShadow().isDefault() + && getText().isDefault()); + } + + bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const + { + return (getShadow() == rCandidate.getShadow() + && getText() == rCandidate.getText()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 3afc03d1600d..0acc7cfc6c86 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -34,21 +34,233 @@ #include #include #include -#include -#include -#include #include -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace attribute { + class ImpSdrTextAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // all-text attributes. The SdrText itself and a copy + // of te OPO + const SdrText* mpSdrText; + const OutlinerParaObject* mpOutlinerParaObject; + + // Set when it's a FormText; contains all FormText attributes + SdrFormTextAttribute maSdrFormTextAttribute; + + // text distances + sal_Int32 maTextLeftDistance; + sal_Int32 maTextUpperDistance; + sal_Int32 maTextRightDistance; + sal_Int32 maTextLowerDistance; + + // #i101556# use versioning from text attributes to detect changes + sal_uInt32 maPropertiesVersion; + + // text alignments + SdrTextHorzAdjust maSdrTextHorzAdjust; + SdrTextVertAdjust maSdrTextVertAdjust; + + // bitfield + unsigned mbContour : 1; + unsigned mbFitToSize : 1; + unsigned mbHideContour : 1; + unsigned mbBlink : 1; + unsigned mbScroll : 1; + unsigned mbInEditMode : 1; + unsigned mbFixedCellHeight : 1; + unsigned mbWrongSpell : 1; + + public: + ImpSdrTextAttribute( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObject, + XFormTextStyle eFormTextStyle, + sal_Int32 aTextLeftDistance, + sal_Int32 aTextUpperDistance, + sal_Int32 aTextRightDistance, + sal_Int32 aTextLowerDistance, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, + bool bContour, + bool bFitToSize, + bool bHideContour, + bool bBlink, + bool bScroll, + bool bInEditMode, + bool bFixedCellHeight, + bool bWrongSpell) + : mnRefCount(0), + mpSdrText(pSdrText), + mpOutlinerParaObject(new OutlinerParaObject(rOutlinerParaObject)), + maSdrFormTextAttribute(), + maTextLeftDistance(aTextLeftDistance), + maTextUpperDistance(aTextUpperDistance), + maTextRightDistance(aTextRightDistance), + maTextLowerDistance(aTextLowerDistance), + maPropertiesVersion(0), + maSdrTextHorzAdjust(aSdrTextHorzAdjust), + maSdrTextVertAdjust(aSdrTextVertAdjust), + mbContour(bContour), + mbFitToSize(bFitToSize), + mbHideContour(bHideContour), + mbBlink(bBlink), + mbScroll(bScroll), + mbInEditMode(bInEditMode), + mbFixedCellHeight(bFixedCellHeight), + mbWrongSpell(bWrongSpell) + { + if(pSdrText) + { + if(XFT_NONE != eFormTextStyle) + { + // text on path. Create FormText attribute + const SfxItemSet& rSet = pSdrText->GetItemSet(); + maSdrFormTextAttribute = SdrFormTextAttribute(rSet); + } + + // #i101556# init with version number to detect changes of single text + // attribute and/or style sheets in primitive data without having to + // copy that data locally (which would be better from principle) + maPropertiesVersion = pSdrText->GetObject().GetProperties().getVersion(); + } + } + + ImpSdrTextAttribute() + : mnRefCount(0), + mpSdrText(0), + mpOutlinerParaObject(0), + maSdrFormTextAttribute(), + maTextLeftDistance(0), + maTextUpperDistance(0), + maTextRightDistance(0), + maTextLowerDistance(0), + maPropertiesVersion(0), + maSdrTextHorzAdjust(SDRTEXTHORZADJUST_LEFT), + maSdrTextVertAdjust(SDRTEXTVERTADJUST_TOP), + mbContour(false), + mbFitToSize(false), + mbHideContour(false), + mbBlink(false), + mbScroll(false), + mbInEditMode(false), + mbFixedCellHeight(false), + mbWrongSpell(false) + { + } + + ~ImpSdrTextAttribute() + { + if(mpOutlinerParaObject) + { + delete mpOutlinerParaObject; + } + } + + // data read access + const SdrText& getSdrText() const + { + OSL_ENSURE(mpSdrText, "Access to text of default version of ImpSdrTextAttribute (!)"); + return *mpSdrText; + } + const OutlinerParaObject& getOutlinerParaObject() const + { + OSL_ENSURE(mpOutlinerParaObject, "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)"); + return *mpOutlinerParaObject; + } + bool isContour() const { return mbContour; } + bool isFitToSize() const { return mbFitToSize; } + bool isHideContour() const { return mbHideContour; } + bool isBlink() const { return mbBlink; } + bool isScroll() const { return mbScroll; } + bool isInEditMode() const { return mbInEditMode; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } + bool isWrongSpell() const { return mbWrongSpell; } + const SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; } + sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } + sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } + sal_Int32 getTextRightDistance() const { return maTextRightDistance; } + sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } + sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } + SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } + SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } + + // compare operator + bool operator==(const ImpSdrTextAttribute& rCandidate) const + { + if(mpOutlinerParaObject != rCandidate.mpOutlinerParaObject) + { + if(mpOutlinerParaObject && rCandidate.mpOutlinerParaObject) + { + // compares OPO and it's contents, but traditionally not the RedLining + // which is not seen as model, but as temporary information + if(!(getOutlinerParaObject() == rCandidate.getOutlinerParaObject())) + { + return false; + } + + // #i102062# for primitive visualisation, the WrongList (SpellChecking) + // is important, too, so use isWrongListEqual since there is no WrongList + // comparison in the regular OutlinerParaObject compare (since it's + // not-persistent data) + if(!(getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()))) + { + return false; + } + } + else + { + // only one is zero; not equal + return false; + } + } + + return ( + getSdrFormTextAttribute() == rCandidate.getSdrFormTextAttribute() + && getTextLeftDistance() == rCandidate.getTextLeftDistance() + && getTextUpperDistance() == rCandidate.getTextUpperDistance() + && getTextRightDistance() == rCandidate.getTextRightDistance() + && getTextLowerDistance() == rCandidate.getTextLowerDistance() + && getPropertiesVersion() == rCandidate.getPropertiesVersion() + + && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() + && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() + + && isContour() == rCandidate.isContour() + && isFitToSize() == rCandidate.isFitToSize() + && isHideContour() == rCandidate.isHideContour() + && isBlink() == rCandidate.isBlink() + && isScroll() == rCandidate.isScroll() + && isInEditMode() == rCandidate.isInEditMode() + && isFixedCellHeight() == rCandidate.isFixedCellHeight() + && isWrongSpell() == rCandidate.isWrongSpell()); + } + + static ImpSdrTextAttribute* get_global_default() + { + static ImpSdrTextAttribute* pDefault = 0; + + if(!pDefault) + { + // use default constructor + pDefault = new ImpSdrTextAttribute(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrTextAttribute::SdrTextAttribute( const SdrText& rSdrText, const OutlinerParaObject& rOutlinerParaObject, @@ -67,149 +279,172 @@ namespace drawinglayer bool bInEditMode, bool bFixedCellHeight, bool bWrongSpell) - : mpSdrText(&rSdrText), - maOutlinerParaObject(rOutlinerParaObject), - mpSdrFormTextAttribute(0), - maTextLeftDistance(aTextLeftDistance), - maTextUpperDistance(aTextUpperDistance), - maTextRightDistance(aTextRightDistance), - maTextLowerDistance(aTextLowerDistance), - maPropertiesVersion(0), - maSdrTextHorzAdjust(aSdrTextHorzAdjust), - maSdrTextVertAdjust(aSdrTextVertAdjust), - mbContour(bContour), - mbFitToSize(bFitToSize), - mbHideContour(bHideContour), - mbBlink(bBlink), - mbScroll(bScroll), - mbInEditMode(bInEditMode), - mbFixedCellHeight(bFixedCellHeight), - mbWrongSpell(bWrongSpell) - { - if(XFT_NONE != eFormTextStyle) - { - // text on path. Create FormText attribute - const SfxItemSet& rSet = getSdrText().GetItemSet(); - mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet); - } + : mpSdrTextAttribute(new ImpSdrTextAttribute( + &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance, + aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour, + bFitToSize, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell)) + { + } - // #i101556# init with version number to detect changes of single text - // attribute and/or style sheets in primitive data without having to - // copy that data locally (which would be better from principle) - maPropertiesVersion = rSdrText.GetObject().GetProperties().getVersion(); + SdrTextAttribute::SdrTextAttribute() + : mpSdrTextAttribute(ImpSdrTextAttribute::get_global_default()) + { + mpSdrTextAttribute->mnRefCount++; + } + + SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) + : mpSdrTextAttribute(rCandidate.mpSdrTextAttribute) + { + mpSdrTextAttribute->mnRefCount++; } SdrTextAttribute::~SdrTextAttribute() { - if(mpSdrFormTextAttribute) + if(mpSdrTextAttribute->mnRefCount) { - delete mpSdrFormTextAttribute; - mpSdrFormTextAttribute = 0; + mpSdrTextAttribute->mnRefCount--; } - } - - SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) - : mpSdrText(&rCandidate.getSdrText()), - maOutlinerParaObject(rCandidate.getOutlinerParaObject()), - mpSdrFormTextAttribute(0), - maTextLeftDistance(rCandidate.getTextLeftDistance()), - maTextUpperDistance(rCandidate.getTextUpperDistance()), - maTextRightDistance(rCandidate.getTextRightDistance()), - maTextLowerDistance(rCandidate.getTextLowerDistance()), - maPropertiesVersion(rCandidate.getPropertiesVersion()), - maSdrTextHorzAdjust(rCandidate.getSdrTextHorzAdjust()), - maSdrTextVertAdjust(rCandidate.getSdrTextVertAdjust()), - mbContour(rCandidate.isContour()), - mbFitToSize(rCandidate.isFitToSize()), - mbHideContour(rCandidate.isHideContour()), - mbBlink(rCandidate.isBlink()), - mbScroll(rCandidate.isScroll()), - mbInEditMode(rCandidate.isInEditMode()), - mbFixedCellHeight(rCandidate.isFixedCellHeight()), - mbWrongSpell(rCandidate.isWrongSpell()) - { - if(rCandidate.getSdrFormTextAttribute()) + else { - mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + delete mpSdrTextAttribute; } } - SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + bool SdrTextAttribute::isDefault() const { - mpSdrText = &rCandidate.getSdrText(); - maOutlinerParaObject = rCandidate.getOutlinerParaObject(); + return mpSdrTextAttribute == ImpSdrTextAttribute::get_global_default(); + } - if(mpSdrFormTextAttribute) + SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + { + if(rCandidate.mpSdrTextAttribute != mpSdrTextAttribute) { - delete mpSdrFormTextAttribute; + if(mpSdrTextAttribute->mnRefCount) + { + mpSdrTextAttribute->mnRefCount--; + } + else + { + delete mpSdrTextAttribute; + } + + mpSdrTextAttribute = rCandidate.mpSdrTextAttribute; + mpSdrTextAttribute->mnRefCount++; } - mpSdrFormTextAttribute = 0; + return *this; + } + + bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const + { + if(rCandidate.mpSdrTextAttribute == mpSdrTextAttribute) + { + return true; + } - if(rCandidate.getSdrFormTextAttribute()) + if(rCandidate.isDefault() != isDefault()) { - mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + return false; } - maTextLeftDistance = rCandidate.getTextLeftDistance(); - maTextUpperDistance = rCandidate.getTextUpperDistance(); - maTextRightDistance = rCandidate.getTextRightDistance(); - maTextLowerDistance = rCandidate.getTextLowerDistance(); - maPropertiesVersion = rCandidate.getPropertiesVersion(); + return (*rCandidate.mpSdrTextAttribute == *mpSdrTextAttribute); + } - maSdrTextHorzAdjust = rCandidate.getSdrTextHorzAdjust(); - maSdrTextVertAdjust = rCandidate.getSdrTextVertAdjust(); + const SdrText& SdrTextAttribute::getSdrText() const + { + return mpSdrTextAttribute->getSdrText(); + } - mbContour = rCandidate.isContour(); - mbFitToSize = rCandidate.isFitToSize(); - mbHideContour = rCandidate.isHideContour(); - mbBlink = rCandidate.isBlink(); - mbScroll = rCandidate.isScroll(); - mbInEditMode = rCandidate.isInEditMode(); - mbFixedCellHeight = rCandidate.isFixedCellHeight(); - mbWrongSpell = rCandidate.isWrongSpell(); + const OutlinerParaObject& SdrTextAttribute::getOutlinerParaObject() const + { + return mpSdrTextAttribute->getOutlinerParaObject(); + } - return *this; + bool SdrTextAttribute::isContour() const + { + return mpSdrTextAttribute->isContour(); } - bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const + bool SdrTextAttribute::isFitToSize() const + { + return mpSdrTextAttribute->isFitToSize(); + } + + bool SdrTextAttribute::isHideContour() const + { + return mpSdrTextAttribute->isHideContour(); + } + + bool SdrTextAttribute::isBlink() const + { + return mpSdrTextAttribute->isBlink(); + } + + bool SdrTextAttribute::isScroll() const + { + return mpSdrTextAttribute->isScroll(); + } + + bool SdrTextAttribute::isInEditMode() const + { + return mpSdrTextAttribute->isInEditMode(); + } + + bool SdrTextAttribute::isFixedCellHeight() const + { + return mpSdrTextAttribute->isFixedCellHeight(); + } + + bool SdrTextAttribute::isWrongSpell() const + { + return mpSdrTextAttribute->isWrongSpell(); + } + + const SdrFormTextAttribute& SdrTextAttribute::getSdrFormTextAttribute() const + { + return mpSdrTextAttribute->getSdrFormTextAttribute(); + } + + sal_Int32 SdrTextAttribute::getTextLeftDistance() const + { + return mpSdrTextAttribute->getTextLeftDistance(); + } + + sal_Int32 SdrTextAttribute::getTextUpperDistance() const + { + return mpSdrTextAttribute->getTextUpperDistance(); + } + + sal_Int32 SdrTextAttribute::getTextRightDistance() const + { + return mpSdrTextAttribute->getTextRightDistance(); + } + + sal_Int32 SdrTextAttribute::getTextLowerDistance() const + { + return mpSdrTextAttribute->getTextLowerDistance(); + } + + sal_uInt32 SdrTextAttribute::getPropertiesVersion() const + { + return mpSdrTextAttribute->getPropertiesVersion(); + } + + SdrTextHorzAdjust SdrTextAttribute::getSdrTextHorzAdjust() const + { + return mpSdrTextAttribute->getSdrTextHorzAdjust(); + } + + SdrTextVertAdjust SdrTextAttribute::getSdrTextVertAdjust() const { - return ( - // compares OPO and it's contents, but traditionally not the RedLining - // which is not seen as model, but as temporary information - getOutlinerParaObject() == rCandidate.getOutlinerParaObject() - - // #i102062# for primitive visualisation, the WrongList (SpellChecking) - // is important, too, so use isWrongListEqual since there is no WrongList - // comparison in the regular OutlinerParaObject compare (since it's - // not-persistent data) - && getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()) - - && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute()) - && getTextLeftDistance() == rCandidate.getTextLeftDistance() - && getTextUpperDistance() == rCandidate.getTextUpperDistance() - && getTextRightDistance() == rCandidate.getTextRightDistance() - && getTextLowerDistance() == rCandidate.getTextLowerDistance() - && getPropertiesVersion() == rCandidate.getPropertiesVersion() - - && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() - && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() - - && isContour() == rCandidate.isContour() - && isFitToSize() == rCandidate.isFitToSize() - && isHideContour() == rCandidate.isHideContour() - && isBlink() == rCandidate.isBlink() - && isScroll() == rCandidate.isScroll() - && isInEditMode() == rCandidate.isInEditMode() - && isFixedCellHeight() == rCandidate.isFixedCellHeight() - && isWrongSpell() == rCandidate.isWrongSpell()); + return mpSdrTextAttribute->getSdrTextVertAdjust(); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const { if(isBlink()) { - mpSdrText->GetObject().impGetBlinkTextTiming(rAnimList); + getSdrText().GetObject().impGetBlinkTextTiming(rAnimList); } } @@ -217,7 +452,7 @@ namespace drawinglayer { if(isScroll()) { - mpSdrText->GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); + getSdrText().GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); } } } // end of namespace attribute diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index fa9bc88d8f73..4f78318a5b49 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -280,7 +280,8 @@ namespace sdr DBG_ERROR("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)"); const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0))); const basegfx::BColor aYellow(1.0, 1.0, 0.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx index 77a5bf4dff3c..5a2b25010009 100644 --- a/svx/source/sdr/contact/viewcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewcontactofe3d.cxx @@ -37,10 +37,12 @@ #include #include #include -#include -#include #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -128,13 +130,14 @@ namespace sdr // create embedded 2d primitive and add. LightNormal and ShadowSlant are needed for evtl. // 3D shadow extraction for correct B2DRange calculation (shadow is part of the object) - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::Embedded3DPrimitive2D( - rxContent3D, - pVCOfE3DScene->getObjectTransformation(), - aViewInformation3D, - aLightNormal, - fShadowSlant, - rAllContentRange)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::Embedded3DPrimitive2D( + rxContent3D, + pVCOfE3DScene->getObjectTransformation(), + aViewInformation3D, + aLightNormal, + fShadowSlant, + rAllContentRange)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -179,9 +182,12 @@ namespace sdr if(!rObjectTransform.isIdentity()) { - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::TransformPrimitive3D( - rObjectTransform, xRetval)); - return drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::TransformPrimitive3D( + rObjectTransform, + xRetval)); + + xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx index 8626296cb42a..bccccd1d074d 100644 --- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dCubeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get cube geometry and use as traslation and scaling for unit cube basegfx::B3DRange aCubeRange; @@ -100,12 +92,13 @@ namespace sdr const basegfx::B2DVector aTextureSize(aCubeSize.getX(), aCubeSize.getY()); // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrCubePrimitive3D(aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrCubePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx index 815a9416c7de..501727aa9782 100644 --- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon()); @@ -93,15 +85,15 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrExtrudePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, - bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrExtrudePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, + bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx index 877ffaca2117..8bea766cbdfe 100644 --- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dLatheObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D()); @@ -107,16 +99,16 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrLathePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, nHorizontalSegments, nVerticalSegments, - fDiagonal, fBackScale, fRotation, - bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrLathePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, nHorizontalSegments, nVerticalSegments, + fDiagonal, fBackScale, fRotation, + bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx index 9ae265d29362..b69d1d6a8ced 100644 --- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx @@ -60,23 +60,15 @@ namespace sdr drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dPolygonObj().GetMergedItemSet(); const bool bSuppressFill(GetE3dPolygonObj().GetLineOnly()); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill)); // get extrude geometry basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D()); const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D()); const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D()); - const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count()); - const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count()); + const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count()); + const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count()); if(bNormals || bTexture) { @@ -181,13 +173,13 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( - aPolyPolygon3D, aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( + aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx index 9c5885d2bf95..ca6168c4aafb 100644 --- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx @@ -41,11 +41,11 @@ #include #include #include -#include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -167,21 +167,13 @@ namespace sdr ViewContactOfE3dScene::ViewContactOfE3dScene(E3dScene& rScene) : ViewContactOfSdrObj(rScene), - mpViewInformation3D(0), - mpObjectTransformation(0), - mpSdrSceneAttribute(0), - mpSdrLightingAttribute(0) + maViewInformation3D(), + maObjectTransformation(), + maSdrSceneAttribute(), + maSdrLightingAttribute() { } - ViewContactOfE3dScene::~ViewContactOfE3dScene() - { - delete mpViewInformation3D; - delete mpObjectTransformation; - delete mpSdrSceneAttribute; - delete mpSdrLightingAttribute; - } - void ViewContactOfE3dScene::createViewInformation3D(const basegfx::B3DRange& rContentRange) { basegfx::B3DHomMatrix aTransformation; @@ -265,34 +257,36 @@ namespace sdr } const uno::Sequence< beans::PropertyValue > aEmptyProperties; - mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(aTransformation, aOrientation, aProjection, aDeviceToView, 0.0, aEmptyProperties); + maViewInformation3D = drawinglayer::geometry::ViewInformation3D( + aTransformation, aOrientation, aProjection, + aDeviceToView, 0.0, aEmptyProperties); } void ViewContactOfE3dScene::createObjectTransformation() { // create 2d Object Transformation from relative point in 2d scene to world - mpObjectTransformation = new basegfx::B2DHomMatrix; const Rectangle& rRectangle = GetE3dScene().GetSnapRect(); - mpObjectTransformation->set(0, 0, rRectangle.getWidth()); - mpObjectTransformation->set(1, 1, rRectangle.getHeight()); - mpObjectTransformation->set(0, 2, rRectangle.Left()); - mpObjectTransformation->set(1, 2, rRectangle.Top()); + maObjectTransformation.set(0, 0, rRectangle.getWidth()); + maObjectTransformation.set(1, 1, rRectangle.getHeight()); + maObjectTransformation.set(0, 2, rRectangle.Left()); + maObjectTransformation.set(1, 2, rRectangle.Top()); } void ViewContactOfE3dScene::createSdrSceneAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); + maSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); } void ViewContactOfE3dScene::createSdrLightingAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); + maSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence( + const SetOfByte* pLayerVisibility) const { drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_uInt32 nChildrenCount(GetObjectCount()); @@ -332,19 +326,27 @@ namespace sdr // on identity and the time on 0.0. const uno::Sequence< beans::PropertyValue > aEmptyProperties; const drawinglayer::geometry::ViewInformation3D aNeutralViewInformation3D(aEmptyProperties); - const basegfx::B3DRange aContentRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); + const basegfx::B3DRange aContentRange( + drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); // create 2d primitive 3dscene with generated sub-list from collector - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ScenePrimitive2D( - bTestVisibility ? aVisibleSequence : aAllSequence, - getSdrSceneAttribute(), - getSdrLightingAttribute(), - getObjectTransformation(), - getViewInformation3D(aContentRange))); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::ScenePrimitive2D( + bTestVisibility ? aVisibleSequence : aAllSequence, + getSdrSceneAttribute(), + getSdrLightingAttribute(), + getObjectTransformation(), + getViewInformation3D(aContentRange))); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, getObjectTransformation())); + return xRetval; } @@ -358,27 +360,7 @@ namespace sdr xRetval = createScenePrimitive2DSequence(0); } - if(xRetval.hasElements()) - { - return xRetval; - } - else - { - // create a gray placeholder hairline polygon in object size as empty 3D scene marker. Use object size - // model information directly, NOT getBoundRect()/getSnapRect() since these will - // be using the geometry data we get just asked for. AFAIK for empty 3D Scenes, the model data - // is SdrObject::aOutRect which i can access directly using GetLastBoundRect() here - const Rectangle aEmptySceneGeometry(GetE3dScene().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aEmptySceneGeometry.Left(), aEmptySceneGeometry.Top(), - aEmptySceneGeometry.Right(), aEmptySceneGeometry.Bottom()))); - const double fGrayTone(0xc0 / 255.0); - const basegfx::BColor aGrayTone(fGrayTone, fGrayTone, fGrayTone); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); - - // The replacement object may also get a text like 'empty 3D Scene' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + return xRetval; } void ViewContactOfE3dScene::ActionChanged() @@ -387,22 +369,15 @@ namespace sdr ViewContactOfSdrObj::ActionChanged(); // mark locally cached values as invalid - delete mpViewInformation3D; - mpViewInformation3D = 0; - - delete mpObjectTransformation; - mpObjectTransformation = 0; - - delete mpSdrSceneAttribute; - mpSdrSceneAttribute = 0; - - delete mpSdrLightingAttribute; - mpSdrLightingAttribute = 0; + maViewInformation3D = drawinglayer::geometry::ViewInformation3D(); + maObjectTransformation.identity(); + maSdrSceneAttribute = drawinglayer::attribute::SdrSceneAttribute(); + maSdrLightingAttribute = drawinglayer::attribute::SdrLightingAttribute(); } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D() const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { // this version will create the content range on demand locally and thus is less // performant than the other one. Since the information is buffered the planned @@ -421,47 +396,47 @@ namespace sdr const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(aContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D(const basegfx::B3DRange& rContentRange) const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(rContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const basegfx::B2DHomMatrix& ViewContactOfE3dScene::getObjectTransformation() const { - if(!mpObjectTransformation) + if(maObjectTransformation.isIdentity()) { const_cast < ViewContactOfE3dScene* >(this)->createObjectTransformation(); } - return *mpObjectTransformation; + return maObjectTransformation; } const drawinglayer::attribute::SdrSceneAttribute& ViewContactOfE3dScene::getSdrSceneAttribute() const { - if(!mpSdrSceneAttribute) + if(maSdrSceneAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrSceneAttribute(); } - return *mpSdrSceneAttribute; + return maSdrSceneAttribute; } const drawinglayer::attribute::SdrLightingAttribute& ViewContactOfE3dScene::getSdrLightingAttribute() const { - if(!mpSdrLightingAttribute) + if(maSdrLightingAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrLightingAttribute(); } - return *mpSdrLightingAttribute; + return maSdrLightingAttribute; } drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dScene::getAllPrimitive3DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx index e175416d7552..cb234138d8f7 100644 --- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx @@ -57,16 +57,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dSphereObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get sphere center and size for geometry basegfx::B3DRange aSphereRange; @@ -92,14 +84,14 @@ namespace sdr F_PI2 * aSphereSize.getY()); // half outline, (PI * d)/2 -> PI/2 * d // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrSpherePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - nHorizontalSegments, nVerticalSegments)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrSpherePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + nHorizontalSegments, nVerticalSegments)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index fcac5f68056e..b7663fc30dcf 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -42,7 +41,6 @@ #endif #include -#include #include #include #include @@ -62,6 +60,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -151,10 +150,9 @@ namespace sdr * aSmallerMatrix; const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D( aSmallerMatrix, - aEmptyAttributes, + drawinglayer::attribute::SdrLineFillShadowTextAttribute(), rGraphicObject, rLocalGrafInfo)); @@ -180,14 +178,12 @@ namespace sdr aEmptyGraphicAttr)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); - if(!rAttribute.getLine()) + if(rAttribute.getLine().isDefault()) { // create a surrounding frame when no linestyle given const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor()); const basegfx::BColor aBColor(aColor.getBColor()); - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rObjectMatrix); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, @@ -317,127 +313,123 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetGrafObject().getText(0); - - if(pSdrText) + const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); + drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetGrafObject().getText(0))); + + // create and fill GraphicAttr + GraphicAttr aLocalGrafInfo; + const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); + const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); + aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); + aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); + aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); + aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); + aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); + aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); + aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); + aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); + aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); + aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); + + if(aAttribute.isDefault() && 255L != aLocalGrafInfo.GetTransparency()) { - const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - bool bVisible(pAttribute && pAttribute->isVisible()); - - // create and fill GraphicAttr - GraphicAttr aLocalGrafInfo; - const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); - const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); - aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); - aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); - aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); - aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); - aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); - aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); - aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); - aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); - aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); - aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); - - if(!bVisible && 255L != aLocalGrafInfo.GetTransparency()) + // no fill, no line, no text (invisible), but the graphic content is visible. + // Create evtl. shadow for content which was not created by createNewSdrLineFillShadowTextAttribute yet + const drawinglayer::attribute::SdrShadowAttribute aShadow( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet)); + + if(!aShadow.isDefault()) { - // content is visible, so force some fill stuff - delete pAttribute; - bVisible = true; + // create new attribute set if indeed shadow is used + aAttribute = drawinglayer::attribute::SdrLineFillShadowTextAttribute( + aAttribute.getLine(), + aAttribute.getFill(), + aAttribute.getLineStartEnd(), + aShadow, + aAttribute.getFillFloatTransGradient(), + aAttribute.getText()); + } + } - // check shadow - drawinglayer::attribute::SdrShadowAttribute* pShadow = drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet); + // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() + // which will use the primitive data we just create in the near future + const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // look for mirroring + const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); + const sal_Int32 nDrehWink(rGeoStat.nDrehWink); + const bool bRota180(18000 == nDrehWink); + const bool bMirrored(GetGrafObject().IsMirrored()); + const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); + bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); + bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); + + // set mirror flags at LocalGrafInfo. Take into account that the geometry in + // aObjectRange is already changed and rotated when bRota180 is used. To rebuild + // that old behaviour (as long as part of the model data), correct the H/V flags + // accordingly. The created bitmapPrimitive WILL use the rotation, too. + if(bRota180) + { + // if bRota180 which is used for vertical mirroring, the graphic will already be rotated + // by 180 degrees. To correct, switch off VMirror and invert HMirroring. + bHMirr = !bHMirr; + bVMirr = false; + } - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + if(bHMirr || bVMirr) + { + aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); + } - // create new attribute set - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0L, 0L, 0L, pShadow, 0L, 0L); - } + // fill object matrix + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); - if(pAttribute) - { - if(pAttribute->isVisible() || bVisible) - { - // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() - // which will use the primitive data we just create in the near future - const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // look for mirroring - const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); - const sal_Int32 nDrehWink(rGeoStat.nDrehWink); - const bool bRota180(18000 == nDrehWink); - const bool bMirrored(GetGrafObject().IsMirrored()); - const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); - bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); - bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); - - // set mirror flags at LocalGrafInfo. Take into account that the geometry in - // aObjectRange is already changed and rotated when bRota180 is used. To rebuild - // that old behaviour (as long as part of the model data), correct the H/V flags - // accordingly. The created bitmapPrimitive WILL use the rotation, too. - if(bRota180) - { - // if bRota180 which is used for vertical mirroring, the graphic will already be rotated - // by 180 degrees. To correct, switch off VMirror and invert HMirroring. - bHMirr = !bHMirr; - bVMirr = false; - } - - if(bHMirr || bVMirr) - { - aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); - } - - // fill object matrix - const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); - const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // get the current, unchenged graphic obect from SdrGrafObj - const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - - if(visualisationUsesPresObj()) - { - // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one - // with the content which is the placeholder graphic - xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo); - } - else if(visualisationUsesDraft()) - { - // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism - // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious - // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent - // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster - // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages - xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute); - } - else - { - // create primitive. Info: Calling the copy-constructor of GraphicObject in this - // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( - aObjectMatrix, - *pAttribute, - rGraphicObject, - aLocalGrafInfo)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // get the current, unchenged graphic obect from SdrGrafObj + const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + + if(visualisationUsesPresObj()) + { + // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one + // with the content which is the placeholder graphic + xRetval = createVIP2DSForPresObj(aObjectMatrix, aAttribute, aLocalGrafInfo); + } + else if(visualisationUsesDraft()) + { + // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism + // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious + // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent + // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster + // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages + xRetval = createVIP2DSForDraft(aObjectMatrix, aAttribute); } + else + { + // create primitive. Info: Calling the copy-constructor of GraphicObject in this + // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic + const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( + aObjectMatrix, + aAttribute, + rGraphicObject, + aLocalGrafInfo)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx index 3dd2b4bd4388..00e9ad8cb684 100644 --- a/svx/source/sdr/contact/viewcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewcontactofgroup.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -81,25 +82,22 @@ namespace sdr drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq); } } - - if(xRetval.hasElements()) - { - return xRetval; - } else { - // create a gray placeholder hairline polygon in object size. Use the model data directly. For empty groups, - // this is SdrObject::aOutRect, as can be seen in SdrObjGroup::GetSnapRect(). Access that using GetLastBoundRect() - // to not execute anything. + // append an invisible outline for the cases where no visible content exists const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()))); - const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); + const basegfx::B2DRange aCurrentRange( + aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), + aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()); - // The replacement object may also get a text like 'empty group' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aCurrentRange)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + + return xRetval; } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 748d5c083a65..84f6c7c9bfe2 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -41,12 +41,14 @@ #include #include #include -#include #include #include #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -68,26 +70,27 @@ namespace sdr { // build primitive from pBackgroundCandidate's attributes const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - if(pFill) + if(!aFill.isDefault()) { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pFill; + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 337681e4d391..57e7ec69485b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -70,107 +69,108 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence xRetval; const SdrCaptionObj& rCaptionObj(GetCaptionObj()); const SfxItemSet& rItemSet = rCaptionObj.GetMergedItemSet(); - SdrText* pSdrText = rCaptionObj.getText(0); - - if(pSdrText) + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + rCaptionObj.getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); + + // fill object matrix + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // calculate corner radius + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius( + rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // create primitive. Always create one (even if invisible) to let the decomposition + // of SdrCaptionPrimitive2D create needed invisible elements for HitTest and BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCaptionPrimitive2D( + aObjectMatrix, + aAttribute, + rCaptionObj.getTailPolygon(), + fCornerRadiusX, + fCornerRadiusY)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + + if(!aAttribute.isDefault() && rCaptionObj.GetSpecialTextBoxShadow()) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) + // for SC, the caption object may have a specialized shadow. The usual object shadow is off + // and a specialized shadow gets created here (see old paint) + const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); + const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); + const Color aShadCol(rShadColItem.GetColorValue()); + const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); + + // Create own ItemSet and modify as needed + // Always hide lines for special calc shadow + SfxItemSet aSet(rItemSet); + aSet.Put(XLineStyleItem(XLINE_NONE)); + + if(XFILL_HATCH == eStyle) + { + // #41666# Hatch color is set hard to shadow color + XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); + aHatch.SetColor(aShadCol); + aSet.Put(XFillHatchItem(String(),aHatch)); + } + else { - if(pAttribute->isVisible()) + if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); - - // fill object matrix - basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // calculate corner radius - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCaptionPrimitive2D( - aObjectMatrix, *pAttribute, rCaptionObj.getTailPolygon(), fCornerRadiusX, fCornerRadiusY)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - - if(rCaptionObj.GetSpecialTextBoxShadow()) - { - // for SC, the caption object may have a specialized shadow. The usual object shadow is off - // and a specialized shadow gets created here (see old paint) - const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); - const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); - const Color aShadCol(rShadColItem.GetColorValue()); - const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); - - // Create own ItemSet and modify as needed - // Always hide lines for special calc shadow - SfxItemSet aSet(rItemSet); - aSet.Put(XLineStyleItem(XLINE_NONE)); - - if(XFILL_HATCH == eStyle) - { - // #41666# Hatch color is set hard to shadow color - XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); - aHatch.SetColor(aShadCol); - aSet.Put(XFillHatchItem(String(),aHatch)); - } - else - { - if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) - { - // force fill to solid (for Gradient and Bitmap) - aSet.Put(XFillStyleItem(XFILL_SOLID)); - } - - aSet.Put(XFillColorItem(String(),aShadCol)); - aSet.Put(XFillTransparenceItem(nTransp)); - } - - // crete FillAttribute from modified ItemSet - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(aSet); - drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; - - if(pFill) - { - if(pFill->isVisible()) - { - // add shadow offset to object matrix - const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); - const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); - aObjectMatrix.translate(nXDist, nYDist); - - // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); - - // create the specialized shadow primitive - xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), aObjectMatrix, *pFill); - } - - delete pFill; - } - - if(xSpecialShadow.is()) - { - // if we really got a special shadow, create a two-element retval with the shadow - // behind the standard object's geometry - xRetval.realloc(2); - - xRetval[0] = xSpecialShadow; - xRetval[1] = xReference; - } - } + // force fill to solid (for Gradient and Bitmap) + aSet.Put(XFillStyleItem(XFILL_SOLID)); } - delete pAttribute; + aSet.Put(XFillColorItem(String(),aShadCol)); + aSet.Put(XFillTransparenceItem(nTransp)); + } + + // crete FillAttribute from modified ItemSet + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(aSet)); + drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; + + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) + { + // add shadow offset to object matrix + const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); + const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); + aObjectMatrix.translate(nXDist, nYDist); + + // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); + + // create the specialized shadow primitive + xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + aObjectMatrix, + aFill, + drawinglayer::attribute::FillGradientAttribute()); + } + + if(xSpecialShadow.is()) + { + // if we really got a special shadow, create a two-element retval with the shadow + // behind the standard object's geometry + xRetval.realloc(2); + + xRetval[0] = xSpecialShadow; + xRetval[1] = xReference; } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 047685dc14f2..2ff6a48686e9 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -58,56 +57,62 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCircObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet(); - SdrText* pSdrText = GetCircObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetCircObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetCircObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetCircObj().GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); - // fill object matrix - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); + // fill object matrix + const basegfx::B2DHomMatrix aObjectMatrix( + basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); - // create primitive data - const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); + // create primitive data + const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); - if(OBJ_CIRC == nIdentifier) - { - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipsePrimitive2D(aObjectMatrix, *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - else - { - const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); - const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); - const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); - const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); - const bool bCloseSegment(OBJ_CARC != nIdentifier); - const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(aObjectMatrix, *pAttribute, fStart, fEnd, bCloseSegment, bCloseUsingCenter)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } + // always create primitives to allow the decomposition of SdrEllipsePrimitive2D + // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + if(OBJ_CIRC == nIdentifier) + { + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipsePrimitive2D( + aObjectMatrix, + aAttribute)); - delete pAttribute; - } + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); + const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); + const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); + const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); + const bool bCloseSegment(OBJ_CARC != nIdentifier); + const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); + + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D( + aObjectMatrix, + aAttribute, + fStart, + fEnd, + bCloseSegment, + bCloseUsingCenter)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx index 10b63f8044bf..df0151d65615 100644 --- a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include ////////////////////////////////////////////////////////////////////////////// @@ -55,35 +54,27 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrEdgeObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - ::basegfx::B2DPolygon aEdgeTrack(GetEdgeObj().getEdgeTrack()); + const basegfx::B2DPolygon& rEdgeTrack = GetEdgeObj().getEdgeTrack(); - // base visualisation on EdgeTrack - if(aEdgeTrack.count()) - { - // ckeck attributes - const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); - SdrText* pSdrText = GetEdgeObj().getText(0); + // what to do when no EdgeTrack is provided (HitTest and selectability) ? + OSL_ENSURE(0 != rEdgeTrack.count(), "Connectors with no geometry are not allowed (!)"); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // ckeck attributes + const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetEdgeObj().getText(0))); - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrConnectorPrimitive2D(*pAttribute, aEdgeTrack)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + // create primitive. Always create primitives to allow the decomposition of + // SdrConnectorPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrConnectorPrimitive2D( + aAttribute, + rEdgeTrack)); - delete pAttribute; - } - } - } - - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx index 18a82377d582..a129882686c8 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -61,91 +60,85 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMeasureObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetMeasureObj().GetMergedItemSet(); - SdrText* pSdrText = GetMeasureObj().getText(0); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetMeasureObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // take properties which are the model data. + const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); + const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); + const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); + const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); + const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); + const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); + const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); + const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); + const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); + const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); + drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); + drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - if(pAttribute) + switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) + { + case SDRMEASURE_TEXTLEFTOUTSIDE : { - if(pAttribute->isVisible()) - { - // take properties which are the model data. - const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); - const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); - const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); - const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); - const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); - const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); - const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); - const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); - const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); - const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); - drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - - switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) - { - case SDRMEASURE_TEXTLEFTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURE_TEXTINSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_TEXTRIGHTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTHAUTO - { - break; - } - } - - switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) - { - case SDRMEASURE_ABOVE : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURETEXT_BREAKEDLINE : - case SDRMEASURETEXT_VERTICALCENTERED : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_BELOW : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTVAUTO - { - break; - } - } - - // create primitive with the model data - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrMeasurePrimitive2D(*pAttribute, - aStart, aEnd, aMTPHor, aMTPVer, fDistance, fUpperDistance, fLowerDistance, fLeftDelta, fRightDelta, - bBelow, bTextRotation, bTextAutoAngle)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURE_TEXTINSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_TEXTRIGHTOUTSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTHAUTO + { + break; + } + } - delete pAttribute; + switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) + { + case SDRMEASURE_ABOVE : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURETEXT_BREAKEDLINE : + case SDRMEASURETEXT_VERTICALCENTERED : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_BELOW : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTVAUTO + { + break; } } - return xRetval; + // create primitive with the model data. Always create primitives to allow the + // decomposition of SdrMeasurePrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrMeasurePrimitive2D( + aAttribute, aStart, aEnd, + aMTPHor, aMTPVer, fDistance, + fUpperDistance, fLowerDistance, + fLeftDelta, fRightDelta, bBelow, + bTextRotation, bTextAutoAngle)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx index 96a2f65e32ee..03eb97281240 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx @@ -157,7 +157,9 @@ namespace sdr // create range using the model data directly. This is in SdrTextObj::aRect which i will access using // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM. const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); // create object transform basegfx::B2DHomMatrix aTransform; @@ -166,12 +168,15 @@ namespace sdr aTransform.set(0, 2, aRange.getMinX()); aTransform.set(1, 2, aRange.getMinY()); - // create media primitive + // create media primitive. Always create primitives to allow the + // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0); const rtl::OUString& rURL(GetSdrMediaObj().getURL()); const sal_uInt32 nPixelBorder(4L); - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::MediaPrimitive2D( - aTransform, rURL, aBackgroundColor, nPixelBorder)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::MediaPrimitive2D( + aTransform, rURL, aBackgroundColor, nPixelBorder)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 352b9198e97b..36475a38eb64 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -34,13 +34,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -121,126 +121,121 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCustomShapeObj().GetMergedItemSet(); - SdrText* pSdrText = GetCustomShapeObj().getText(0); - if(pSdrText) - { - // #i98072# Get shandow and text; eventually suppress the text if it's - // a TextPath FontworkGallery object - drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute( + // #i98072# Get shandow and text; eventually suppress the text if it's + // a TextPath FontworkGallery object + const drawinglayer::attribute::SdrShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrShadowTextAttribute( rItemSet, - *pSdrText, - GetCustomShapeObj().IsTextPath()); - drawinglayer::primitive2d::Primitive2DSequence xGroup; - bool bHasText(pAttribute && pAttribute->getText()); + GetCustomShapeObj().getText(0), + GetCustomShapeObj().IsTextPath())); + drawinglayer::primitive2d::Primitive2DSequence xGroup; + bool bHasText(!aAttribute.getText().isDefault()); + + // create Primitive2DSequence from sub-geometry + const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); + bool b3DShape(false); - // create Primitive2DSequence from sub-geometry - const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); - bool b3DShape(false); + if(pSdrObjRepresentation) + { + SdrObjListIter aIterator(*pSdrObjRepresentation); - if(pSdrObjRepresentation) + while(aIterator.IsMore()) { - SdrObjListIter aIterator(*pSdrObjRepresentation); + SdrObject& rCandidate = *aIterator.Next(); - while(aIterator.IsMore()) + if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) { - SdrObject& rCandidate = *aIterator.Next(); - - if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) - { - b3DShape = true; - } - - const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); + b3DShape = true; } + + const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); } + } + + if(bHasText || xGroup.hasElements()) + { + // prepare text box geometry + basegfx::B2DHomMatrix aTextBoxMatrix; + bool bWordWrap(false); - if(bHasText || xGroup.hasElements()) + if(bHasText) { - // prepare text box geometry - basegfx::B2DHomMatrix aTextBoxMatrix; - bool bWordWrap(false); + // take unrotated snap rect as default, then get the + // unrotated text box. Rotation needs to be done centered + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); - if(bHasText) - { - // take unrotated snap rect as default, then get the - // unrotated text box. Rotation needs to be done centered - const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); - const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); + // #i101684# get the text range unrotated and absolute to the object range + const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); - // #i101684# get the text range unrotated and absolute to the object range - const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); + // give text object a size + aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); - // give text object a size - aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); + // check if we have a rotation/shear at all to take care of + const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); + const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); - // check if we have a rotation/shear at all to take care of - const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); - const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); + if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + { + if(aObjectRange != aTextRange) + { + // move relative to unrotated object range + aTextBoxMatrix.translate( + aTextRange.getMinX() - aObjectRange.getMinimum().getX(), + aTextRange.getMinY() - aObjectRange.getMinimum().getY()); + } - if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + if(rGeoStat.nShearWink) { - if(aObjectRange != aTextRange) - { - // move relative to unrotated object range - aTextBoxMatrix.translate( - aTextRange.getMinX() - aObjectRange.getMinimum().getX(), - aTextRange.getMinY() - aObjectRange.getMinimum().getY()); - } - - if(rGeoStat.nShearWink) - { - aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - if(!basegfx::fTools::equalZero(fExtraTextRotation)) - { - aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); - } - - // give text it's target position - aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); } - else + + if(rGeoStat.nDrehWink) { - aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); + aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); } - // check if SdrTextWordWrapItem is set - bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); - } + if(!basegfx::fTools::equalZero(fExtraTextRotation)) + { + aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); + } - // make sure a (even empty) SdrShadowTextAttribute exists for - // primitive creation - if(!pAttribute) + // give text it's target position + aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + } + else { - pAttribute = new drawinglayer::attribute::SdrShadowTextAttribute(0L, 0L); + aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); } - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( - *pAttribute, - xGroup, - aTextBoxMatrix, - bWordWrap, - b3DShape, - false)); // #SJ# New parameter to force to clipped BlockText for SC - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + // check if SdrTextWordWrapItem is set + bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); } - if(pAttribute) - { - delete pAttribute; - } + // create primitive + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( + aAttribute, + xGroup, + aTextBoxMatrix, + bWordWrap, + b3DShape, + false)); // #SJ# New parameter to force to clipped BlockText for SC + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + // always append an invisible outline for the cases where no visible content exists + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange( + aObjectBound.Left(), aObjectBound.Top(), + aObjectBound.Right(), aObjectBound.Bottom()); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectRange)); + return xRetval; } } // end of namespace contact diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 7672577138d0..bcd7646f326a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -76,59 +75,51 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters( bool bHighContrast) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetOle2Obj().getText(0); - - if(pSdrText) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); - const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object matrix - const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); - const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); - const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // Prepare attribute settings, will be used soon anyways - const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(!pAttribute) - { - // force existence, even when not visible - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0, 0, 0, 0, 0, 0); - } - - // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing - // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect - // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). - // It will also take care of HighContrast and ScaleContent - const drawinglayer::primitive2d::Primitive2DReference xOleContent( - new drawinglayer::primitive2d::SdrOleContentPrimitive2D( - GetOle2Obj(), - aObjectMatrix, - - // #i104867# add GraphicVersion number to be able to check for - // content change in the primitive later - GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), - - bHighContrast)); - - // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. - const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrOle2Primitive2D( + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); + const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // Prepare attribute settings, will be used soon anyways + const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetOle2Obj().getText(0))); + + // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing + // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect + // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). + // It will also take care of HighContrast and ScaleContent + const drawinglayer::primitive2d::Primitive2DReference xOleContent( + new drawinglayer::primitive2d::SdrOleContentPrimitive2D( + GetOle2Obj(), + aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + + bHighContrast)); + + // create primitive. Use Ole2 primitive here. Prepare attribute settings, will + // be used soon anyways. Always create primitives to allow the decomposition of + // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrOle2Primitive2D( xOLEContent, aObjectMatrix, - *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - delete pAttribute; - } + aAttribute)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 26a3934c179e..12b7e1b0acf4 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -45,9 +45,9 @@ #include #include #include -#include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -101,7 +101,8 @@ namespace sdr const svtools::ColorConfig aColorConfig; const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); const basegfx::BColor aRGBColor(aInitColor.getBColor()); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -216,25 +217,25 @@ namespace sdr { // build primitive from pObject's attributes const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - if(pFill) + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const basegfx::B2DRange aInnerRange( - rPage.GetLftBorder(), rPage.GetUppBorder(), - rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pFill; + // direct model data is the page size, get and use it + const basegfx::B2DRange aInnerRange( + rPage.GetLftBorder(), rPage.GetUppBorder(), + rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } } diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index 3c8449bae7f6..97716a7fdddd 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -57,93 +56,91 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet(); - SdrText* pSdrText = GetPathObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetPathObj().getText(0))); + basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); + sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); + sal_uInt32 nPointCount(0); + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count(); + } + + if(!nPointCount) + { + OSL_ENSURE(false, "PolyPolygon object without geometry detected, this should not be created (!)"); + basegfx::B2DPolygon aFallbackLine; + aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0)); + aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0)); + aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine); + + nPolyCount = 1; + } + + // prepare object transformation and unit polygon (direct model data) + basegfx::B2DHomMatrix aObjectMatrix; + const bool bIsLine( + !aUnitPolyPolygon.areControlPointsUsed() + && 1 == nPolyCount + && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - if(pSdrText) + if(bIsLine) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( - rItemSet, - *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); - const sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); - - if(nPolyCount) - { - // prepare object transformation and unit polygon (direct model data) - basegfx::B2DHomMatrix aObjectMatrix; - const bool bIsLine( - !aUnitPolyPolygon.areControlPointsUsed() - && 1 == nPolyCount - && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - - if(bIsLine) - { - // special handling for single line mode (2 points) - const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); - const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); - const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); - const basegfx::B2DVector aLine(aEnd - aStart); - - // #i102548# create new unit polygon for line (horizontal) - basegfx::B2DPolygon aNewPolygon; - aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); - aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); - aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); - - // #i102548# fill objectMatrix with rotation and offset (no shear for lines) - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aLine.getLength(), 1.0, - 0.0, - atan2(aLine.getY(), aLine.getX()), - aStart.getX(), aStart.getY()); - } - else - { - // #i102548# create unscaled, unsheared, unrotated and untranslated polygon - // (unit polygon) by creating the object matrix and back-transforming the polygon - const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); - const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); - const double fWidth(aObjectRange.getWidth()); - const double fHeight(aObjectRange.getHeight()); - const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); - const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); - - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - fScaleX, fScaleY, - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY()); - - // ceate unit polygon from object's absolute path - basegfx::B2DHomMatrix aInverse(aObjectMatrix); - aInverse.invert(); - aUnitPolyPolygon.transform(aInverse); - } - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrPathPrimitive2D( - aObjectMatrix, - *pAttribute, - aUnitPolyPolygon)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // special handling for single line mode (2 points) + const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); + const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); + const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); + const basegfx::B2DVector aLine(aEnd - aStart); + + // #i102548# create new unit polygon for line (horizontal) + basegfx::B2DPolygon aNewPolygon; + aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); + aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); + aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); + + // #i102548# fill objectMatrix with rotation and offset (no shear for lines) + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aLine.getLength(), 1.0, + 0.0, + atan2(aLine.getY(), aLine.getX()), + aStart.getX(), aStart.getY()); } + else + { + // #i102548# create unscaled, unsheared, unrotated and untranslated polygon + // (unit polygon) by creating the object matrix and back-transforming the polygon + const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); + const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); + const double fWidth(aObjectRange.getWidth()); + const double fHeight(aObjectRange.getHeight()); + const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); + const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); + + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + fScaleX, fScaleY, + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY()); + + // ceate unit polygon from object's absolute path + basegfx::B2DHomMatrix aInverse(aObjectMatrix); + aInverse.invert(); + aUnitPolyPolygon.transform(aInverse); + } + + // create primitive. Always create primitives to allow the decomposition of + // SdrPathPrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrPathPrimitive2D( + aObjectMatrix, + aAttribute, + aUnitPolyPolygon)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 94b26b5d020e..6a7f6842a76d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -59,70 +58,48 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet(); - SdrText* pSdrText = GetRectObj().getText(0); - - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetRectObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); - - // fill object matrix - basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // calculate corner radius - sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // #i105856# use knowledge about pickthrough from the model - const bool bPickThroughTransparentTextFrames( - GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrRectanglePrimitive2D( - aObjectMatrix, - *pAttribute, - fCornerRadiusX, - fCornerRadiusY, - // #i105856# use fill for HitTest when TextFrame and not PickThrough - GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pAttribute; - } - - if(!xRetval.hasElements()) - { - // #i99123# - // Object is invisible. Create a fallback primitive for HitTest - basegfx::B2DHomMatrix aObjectMatrix; - basegfx::B2DPolyPolygon aObjectPolyPolygon; - GetRectObj().TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createFallbackHitTestPrimitive(aObjectMatrix)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - return xRetval; + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetRectObj().getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetRectObj().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); + + // fill object matrix + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // calculate corner radius + sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // #i105856# use knowledge about pickthrough from the model + const bool bPickThroughTransparentTextFrames( + GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); + + // create primitive. Always create primitives to allow the decomposition of + // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrRectanglePrimitive2D( + aObjectMatrix, + aAttribute, + fCornerRadiusX, + fCornerRadiusY, + // #i105856# use fill for HitTest when TextFrame and not PickThrough + GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx index 7bea25feeeed..f830369fc2ec 100644 --- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx @@ -50,6 +50,7 @@ #include #include #include +#include //........................................................................ namespace sdr { namespace contact { @@ -138,35 +139,43 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence() const { + // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use + // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) + // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything + const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object transform + basegfx::B2DHomMatrix aTransform; + + aTransform.set(0, 0, aRange.getWidth()); + aTransform.set(1, 1, aRange.getHeight()); + aTransform.set(0, 2, aRange.getMinX()); + aTransform.set(1, 2, aRange.getMinY()); + Reference< XControlModel > xControlModel = GetSdrUnoObj().GetUnoControlModel(); if(xControlModel.is()) { - // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use - // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) - // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything - const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object transform - basegfx::B2DHomMatrix aTransform; - aTransform.set(0, 0, aRange.getWidth()); - aTransform.set(1, 1, aRange.getHeight()); - aTransform.set(0, 2, aRange.getMinX()); - aTransform.set(1, 2, aRange.getMinY()); - // create control primitive WITHOUT possibly existing XControl; this would be done in // the VOC in createPrimitive2DSequence() - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D( - aTransform, xControlModel)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::ControlPrimitive2D( + aTransform, + xControlModel)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } else { - // #i93161# This UnoControl does not yet have a xControlModel (can happen - // during diverse creations). Without a model, create no visualisation. - return drawinglayer::primitive2d::Primitive2DSequence(); + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xRetval( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aTransform)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx b/svx/source/sdr/contact/viewcontactofvirtobj.cxx index 0f046bdda97f..5578bf399f84 100644 --- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx +++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx @@ -36,6 +36,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -77,29 +78,39 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfVirtObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; + // create displacement transformation if we have content + basegfx::B2DHomMatrix aObjectMatrix; + Point aAnchor(GetVirtObj().GetAnchorPos()); + + if(aAnchor.X() || aAnchor.Y()) + { + aObjectMatrix.set(0, 2, aAnchor.X()); + aObjectMatrix.set(1, 2, aAnchor.Y()); + } // use method from referenced object to get the Primitive2DSequence - const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual(GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); + const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual( + GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); if(xSequenceVirtual.hasElements()) { - // create displacement transformation if we have content - ::basegfx::B2DHomMatrix aObjectMatrix; - Point aAnchor(GetVirtObj().GetAnchorPos()); - - if(aAnchor.X() || aAnchor.Y()) - { - aObjectMatrix.set(0, 2, aAnchor.X()); - aObjectMatrix.set(1, 2, aAnchor.Y()); - } - // create transform primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::TransformPrimitive2D(aObjectMatrix, xSequenceVirtual)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::TransformPrimitive2D( + aObjectMatrix, + xSequenceVirtual)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx index 435eb31c47f0..d031ef552486 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx @@ -39,7 +39,6 @@ #include #include #include -#include ////////////////////////////////////////////////////////////////////////////// // predeclarations diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index b093ddbe8b75..68ac3365796e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -125,17 +125,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } - else - { - // do neither print nor PDF export the fallback visualisation - if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) - { - // empty group, fallback to parent method which will create the default - // grayed frame for empty 3d scenes by using model data and - // createViewIndependentPrimitive2DSequence::ViewContactOfE3dScene - xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); - } - } if(bIsActiveVC) { diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx index 0f67ba46acb9..b7406bd1cc58 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx @@ -59,20 +59,6 @@ namespace sdr { } - bool ViewObjectContactOfGroup::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const - { - const bool bHasChildren(0 != GetViewContact().GetObjectCount()); - - if(!bHasChildren && (GetObjectContact().isOutputToPrinter() || GetObjectContact().isOutputToRecordingMetaFile())) - { - // empty group uses fallback gray empty frame display. Do neither print nor PDF export it - return false; - } - - // call parent - return ViewObjectContactOfSdrObj::isPrimitiveVisible(rDisplayInfo); - } - drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const { const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index bd208b5cf54f..645632c956f8 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -44,7 +44,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -296,28 +296,19 @@ namespace sdr else if(bCreateGrayFrame) { // #i105146# no content, but frame display. To make hitting the page preview objects - // on the handout page more simple, add a HitTest fill primitive - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); - aOutline.transform(aPageObjectTransform); - - const drawinglayer::primitive2d::Primitive2DReference xHitFill( - new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aOutline), - basegfx::BColor(0.0, 0.0, 0.0))); - - const drawinglayer::primitive2d::Primitive2DReference xHit( - new drawinglayer::primitive2d::HitTestPrimitive2D( - drawinglayer::primitive2d::Primitive2DSequence(&xHitFill, 1))); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xHit, 1); + // on the handout page more simple, add hidden fill geometry + const drawinglayer::primitive2d::Primitive2DReference xFrameHit( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aPageObjectTransform)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xFrameHit, 1); } // add a gray outline frame, except not when printing if(bCreateGrayFrame) { const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor); - basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOwnOutline(basegfx::tools::createUnitPolygon()); aOwnOutline.transform(aPageObjectTransform); const drawinglayer::primitive2d::Primitive2DReference xGrayFrame( diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index 635ae9c7fcc8..954102c0a8cb 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -39,11 +39,11 @@ #include #include #include -#include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -207,7 +207,7 @@ namespace sdr if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) { // shade the representation if the object is activated outplace - basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon()); aObjectOutline.transform(aObjectTransform); // Use a FillHatchPrimitive2D with necessary attributes diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx index 5df0fc85f8f9..35fe4351981b 100644 --- a/svx/source/sdr/overlay/overlayobjectcell.cxx +++ b/svx/source/sdr/overlay/overlayobjectcell.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include using namespace ::basegfx; @@ -87,12 +87,12 @@ namespace sdr if(mePaintType == CELL_OVERLAY_TRANSPARENT) { // embed in 50% transparent paint - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aRetval, 0.5)); - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1); } else // CELL_OVERLAY_INVERT { diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index b788de195903..6b449699a51d 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include @@ -144,8 +144,8 @@ namespace sdr { // embed all rectangles in transparent paint const double fTransparence(mnLastTransparence / 100.0); - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aRetval, fTransparence)); @@ -159,13 +159,13 @@ namespace sdr // add both to result aRetval.realloc(2); - aRetval[0] = aUnifiedAlpha; + aRetval[0] = aUnifiedTransparence; aRetval[1] = aSelectionOutline; } else { // just add transparent part - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1); } } } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index d657e6b9a8d7..a1ef5d8f0957 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -58,14 +58,11 @@ #include #include #include -#include #include #include -#include #include #include #include -#include #include #include #include @@ -73,13 +70,22 @@ #include #include #include -#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -221,9 +227,8 @@ namespace drawinglayer { namespace primitive2d { - attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet) + attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet) { - attribute::SdrLineAttribute* pRetval(0L); const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue()); if(XLINE_NONE != eStyle) @@ -253,7 +258,7 @@ namespace drawinglayer } } - pRetval = new attribute::SdrLineAttribute( + return attribute::SdrLineAttribute( XLineJointtoB2DLineJoin(eJoint), (double)nWidth, (double)nTransparence * 0.01, @@ -263,12 +268,13 @@ namespace drawinglayer } } - return pRetval; + return attribute::SdrLineAttribute(); } - attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth) + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth) { - attribute::SdrLineStartEndAttribute* pRetval(0L); const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue()); const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue()); basegfx::B2DPolyPolygon aStartPolyPolygon; @@ -328,15 +334,16 @@ namespace drawinglayer if(bStartActive || bEndActive) { - pRetval = new attribute::SdrLineStartEndAttribute(aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered); + return attribute::SdrLineStartEndAttribute( + aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, + bStartActive, bEndActive, bStartCentered, bEndCentered); } - return pRetval; + return attribute::SdrLineStartEndAttribute(); } - attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet) + attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet) { - attribute::SdrShadowAttribute* pRetval(0L); const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue()); if(bShadow) @@ -374,16 +381,15 @@ namespace drawinglayer (double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue()); - pRetval = new attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); + return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); } } - return pRetval; + return attribute::SdrShadowAttribute(); } - attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet) + attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet) { - attribute::SdrFillAttribute* pRetval(0L); const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue()); if(XFILL_NONE != eStyle) @@ -398,9 +404,9 @@ namespace drawinglayer if(100 != nTransparence) { const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue()); - attribute::FillGradientAttribute* pGradient(0L); - attribute::FillHatchAttribute* pHatch(0L); - attribute::SdrFillBitmapAttribute* pBitmap(0L); + attribute::FillGradientAttribute aGradient; + attribute::FillHatchAttribute aHatch; + attribute::SdrFillBitmapAttribute aBitmap; switch(eStyle) { @@ -412,10 +418,10 @@ namespace drawinglayer } case XFILL_GRADIENT : { - XGradient aGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue()); + XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue()); - const Color aStartColor(aGradient.GetStartColor()); - const sal_uInt16 nStartIntens(aGradient.GetStartIntens()); + const Color aStartColor(aXGradient.GetStartColor()); + const sal_uInt16 nStartIntens(aXGradient.GetStartIntens()); basegfx::BColor aStart(aStartColor.getBColor()); if(nStartIntens != 100) @@ -424,8 +430,8 @@ namespace drawinglayer aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01); } - const Color aEndColor(aGradient.GetEndColor()); - const sal_uInt16 nEndIntens(aGradient.GetEndIntens()); + const Color aEndColor(aXGradient.GetEndColor()); + const sal_uInt16 nEndIntens(aXGradient.GetEndIntens()); basegfx::BColor aEnd(aEndColor.getBColor()); if(nEndIntens != 100) @@ -434,12 +440,12 @@ namespace drawinglayer aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01); } - pGradient = new attribute::FillGradientAttribute( - XGradientStyleToGradientStyle(aGradient.GetGradientStyle()), - (double)aGradient.GetBorder() * 0.01, - (double)aGradient.GetXOffset() * 0.01, - (double)aGradient.GetYOffset() * 0.01, - (double)aGradient.GetAngle() * F_PI1800, + aGradient = attribute::FillGradientAttribute( + XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()), + (double)aXGradient.GetBorder() * 0.01, + (double)aXGradient.GetXOffset() * 0.01, + (double)aXGradient.GetYOffset() * 0.01, + (double)aXGradient.GetAngle() * F_PI1800, aStart, aEnd, ((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue()); @@ -451,7 +457,7 @@ namespace drawinglayer const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue()); const Color aColorB(rHatch.GetColor()); - pHatch = new attribute::FillHatchAttribute( + aHatch = attribute::FillHatchAttribute( XHatchStyleToHatchStyle(rHatch.GetHatchStyle()), (double)rHatch.GetDistance(), (double)rHatch.GetAngle() * F_PI1800, @@ -462,23 +468,25 @@ namespace drawinglayer } case XFILL_BITMAP : { - pBitmap = createNewSdrFillBitmapAttribute(rSet); + aBitmap = createNewSdrFillBitmapAttribute(rSet); break; } } - pRetval = new attribute::SdrFillAttribute( + return attribute::SdrFillAttribute( (double)nTransparence * 0.01, aColor.getBColor(), - pGradient, pHatch, pBitmap); + aGradient, + aHatch, + aBitmap); } } - return pRetval; + return attribute::SdrFillAttribute(); } // #i101508# Support handing over given text-to-border distances - attribute::SdrTextAttribute* createNewSdrTextAttribute( + attribute::SdrTextAttribute createNewSdrTextAttribute( const SfxItemSet& rSet, const SdrText& rText, const sal_Int32* pLeft, @@ -486,7 +494,6 @@ namespace drawinglayer const sal_Int32* pRight, const sal_Int32* pLower) { - attribute::SdrTextAttribute* pRetval(0); const SdrTextObj& rTextObj = rText.GetObject(); if(rText.GetOutlinerParaObject() && rText.GetModel()) @@ -530,7 +537,7 @@ namespace drawinglayer const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj); const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING); - pRetval = new attribute::SdrTextAttribute( + return attribute::SdrTextAttribute( rText, aOutlinerParaObject, ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), @@ -550,15 +557,15 @@ namespace drawinglayer bWrongSpell); } - return pRetval; + return attribute::SdrTextAttribute(); } - attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet) + attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet) { - attribute::FillGradientAttribute* pRetval = 0L; const SfxPoolItem* pGradientItem; - if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) + if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) + && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) { // test if float transparence is completely transparent const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); @@ -571,7 +578,7 @@ namespace drawinglayer const double fStartLum(nStartLuminance / 255.0); const double fEndLum(nEndLuminance / 255.0); - pRetval = new attribute::FillGradientAttribute( + return attribute::FillGradientAttribute( XGradientStyleToGradientStyle(rGradient.GetGradientStyle()), (double)rGradient.GetBorder() * 0.01, (double)rGradient.GetXOffset() * 0.01, @@ -583,12 +590,11 @@ namespace drawinglayer } } - return pRetval; + return attribute::FillGradientAttribute(); } - attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet) + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute(const SfxItemSet& rSet) { - attribute::SdrFillBitmapAttribute* pRetval(0L); Bitmap aBitmap((((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetBitmapValue()).GetBitmap()); // make sure it's not empty, use default instead @@ -635,7 +641,7 @@ namespace drawinglayer (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(), (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue()); - pRetval = new attribute::SdrFillBitmapAttribute( + return attribute::SdrFillBitmapAttribute( aBitmap, aSize, aOffset, @@ -644,252 +650,174 @@ namespace drawinglayer ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(), ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(), ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue()); - - return pRetval; } - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText, bool bSuppressText) + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText, + bool bSuppressText) { - attribute::SdrShadowTextAttribute* pRetval(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrTextAttribute aText; // #i98072# added option to suppress text // look for text first - if(!bSuppressText) + if(!bSuppressText && pText) { - pText = createNewSdrTextAttribute(rSet, rText); + aText = createNewSdrTextAttribute(rSet, *pText); } // try shadow - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet)); - if(pText || pShadow) - { - pRetval = new attribute::SdrShadowTextAttribute(pShadow, pText); - } - - return pRetval; + return attribute::SdrShadowTextAttribute(aShadow, aText); } - attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText) { - attribute::SdrLineShadowTextAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrLineAttribute aLine; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - pText = createNewSdrTextAttribute(rSet, rText); - - // when object has text and text is fontwork and hide contour is set for fontwork, force - // line and fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) + if(pText) { - bFontworkHideContour = true; + aText = createNewSdrTextAttribute(rSet, *pText); + + // when object has text and text is fontwork and hide contour is set for fontwork, force + // line and fill style to empty + if(!aText.isDefault() + && !aText.getSdrFormTextAttribute().isDefault() + && aText.isHideContour()) + { + bFontworkHideContour = true; + } } // try line style if(!bFontworkHideContour) { - pLine = createNewSdrLineAttribute(rSet); + aLine = createNewSdrLineAttribute(rSet); - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } - - if(pLine) + if(!aLine.isDefault()) { // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } } - // try shadow - if(pLine || pText) + if(!aLine.isDefault() || !aText.isDefault()) { - pShadow = createNewSdrShadowAttribute(rSet); + // try shadow + const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet)); - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText); } - if(pLine || pText) - { - pRetval = new attribute::SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pText); - } - - return pRetval; + return attribute::SdrLineShadowTextAttribute(); } - attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText) { - attribute::SdrLineFillShadowTextAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrLineAttribute aLine; + attribute::SdrFillAttribute aFill; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrShadowAttribute aShadow; + attribute::FillGradientAttribute aFillFloatTransGradient; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - pText = createNewSdrTextAttribute(rSet, rText); - - // when object has text and text is fontwork and hide contour is set for fontwork, force - // line and fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) + if(pText) { - bFontworkHideContour = true; - } - - // try line style - if(!bFontworkHideContour) - { - pLine = createNewSdrLineAttribute(rSet); + aText = createNewSdrTextAttribute(rSet, *pText); - if(pLine && !pLine->isVisible()) + // when object has text and text is fontwork and hide contour is set for fontwork, force + // line and fill style to empty + if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()) { - delete pLine; - pLine = 0L; - } - - if(pLine) - { - // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + bFontworkHideContour = true; } } - // try fill style if(!bFontworkHideContour) { - pFill = createNewSdrFillAttribute(rSet); + // try line style + aLine = createNewSdrLineAttribute(rSet); - if(pFill && !pFill->isVisible()) + if(!aLine.isDefault()) { - delete pFill; - pFill = 0L; + // try LineStartEnd + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } - if(pFill) + // try fill style + aFill = createNewSdrFillAttribute(rSet); + + if(!aFill.isDefault()) { // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - // try shadow - if(pLine || pFill || pText) + if(!aLine.isDefault() || !aFill.isDefault() || !aText.isDefault()) { - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } - } + // try shadow + aShadow = createNewSdrShadowAttribute(rSet); - if(pLine || pFill || pText) - { - pRetval = new attribute::SdrLineFillShadowTextAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient, pText); + return attribute::SdrLineFillShadowTextAttribute( + aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText); } - return pRetval; + return attribute::SdrLineFillShadowTextAttribute(); } - attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill) + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill) { - attribute::SdrLineFillShadowAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); + attribute::SdrFillAttribute aFill; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrShadowAttribute aShadow; + attribute::FillGradientAttribute aFillFloatTransGradient; // try line style - pLine = createNewSdrLineAttribute(rSet); + const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet)); - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } - - if(pLine) + if(!aLine.isDefault()) { // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } // try fill style - pFill = bSuppressFill ? 0 : createNewSdrFillAttribute(rSet); - - if(pFill && !pFill->isVisible()) + if(!bSuppressFill) { - delete pFill; - pFill = 0L; - } - - if(pFill) - { - // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); - } + aFill = createNewSdrFillAttribute(rSet); - // try shadow - if(pLine || pFill) - { - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) + if(!aFill.isDefault()) { - delete pShadow; - pShadow = 0L; + // try fillfloattransparence + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - if(pLine || pFill) + if(!aLine.isDefault() || !aFill.isDefault()) { - pRetval = new attribute::SdrLineFillShadowAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient); + // try shadow + aShadow = createNewSdrShadowAttribute(rSet); + + return attribute::SdrLineFillShadowAttribute3D( + aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient); } - return pRetval; + return attribute::SdrLineFillShadowAttribute3D(); } - attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet) + attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet) { // get perspective ::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL); @@ -926,10 +854,10 @@ namespace drawinglayer // get two sided lighting const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue()); - return new attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting); + return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting); } - attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet) + attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet) { // extract lights from given SfxItemSet (from scene) ::std::vector< attribute::Sdr3DLightAttribute > aLightVector; @@ -994,7 +922,7 @@ namespace drawinglayer const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue()); const basegfx::BColor aAmbientLight(aAmbientValue.getBColor()); - return new attribute::SdrLightingAttribute(aAmbientLight, aLightVector); + return attribute::SdrLightingAttribute(aAmbientLight, aLightVector); } void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY) @@ -1051,57 +979,50 @@ namespace drawinglayer } // #i101508# Support handing over given text-to-border distances - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( const SfxItemSet& rSet, - const SdrText* pSdrText, + const SdrText* pText, const sal_Int32* pLeft, const sal_Int32* pUpper, const sal_Int32* pRight, const sal_Int32* pLower) { - attribute::SdrFillTextAttribute* pRetval(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrFillAttribute aFill; + attribute::FillGradientAttribute aFillFloatTransGradient; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - if(pSdrText) + if(pText) { - pText = createNewSdrTextAttribute(rSet, *pSdrText, pLeft, pUpper, pRight, pLower); - } + aText = createNewSdrTextAttribute(rSet, *pText, pLeft, pUpper, pRight, pLower); - // when object has text and text is fontwork and hide contour is set for fontwork, force - // fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) - { - bFontworkHideContour = true; + // when object has text and text is fontwork and hide contour is set for fontwork, force + // fill style to empty + if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()) + { + bFontworkHideContour = true; + } } - // try fill style if(!bFontworkHideContour) { - pFill = createNewSdrFillAttribute(rSet); - - if(pFill && !pFill->isVisible()) - { - delete pFill; - pFill = 0L; - } + // try fill style + aFill = createNewSdrFillAttribute(rSet); - if(pFill) + if(!aFill.isDefault()) { // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - if(pFill || pText) + if(!aFill.isDefault() || !aText.isDefault()) { - pRetval = new attribute::SdrFillTextAttribute(pFill, pFillFloatTransGradient, pText); + return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText); } - return pRetval; + return attribute::SdrFillTextAttribute(); } } // end of namespace primitive2d diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index e4967f767299..58017f9d01fc 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,6 @@ namespace drawinglayer Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; - Primitive2DSequence aHitTestContent; // create unit outline polygon const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( @@ -59,68 +58,66 @@ namespace drawinglayer getCornerRadiusY())); // add fill - if(getSdrLFSTAttribute().getFill()) + if(getSdrLFSTAttribute().getFill().isDefault()) { + // create invisible fill for HitTest appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive( + createHiddenGeometryPrimitives2D( + true, basegfx::B2DPolyPolygon(aUnitOutline), - getTransform(), - *getSdrLFSTAttribute().getFill(), - getSdrLFSTAttribute().getFillFloatTransGradient())); + getTransform())); } else { - // if no fill, create one for HitTest and BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), + getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { + // create invisible line for HitTest/BoundRect appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolygonLinePrimitive( - aUnitOutline, - getTransform(), - *getSdrLFSTAttribute().getLine())); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolygonLinePrimitive( - getTail(), - getTransform(), - *getSdrLFSTAttribute().getLine(), - getSdrLFSTAttribute().getLineStartEnd())); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(getTail()), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect. It - // is sufficient to use the tail; the body is already ensured with fill creation - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive( - getTail(), + aUnitOutline, getTransform(), - attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); - } + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); - // add HitTest and BoundRect helper geometry (if exists) - if(aHitTestContent.hasElements()) - { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); + createPolygonLinePrimitive( + getTail(), + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - *getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, @@ -128,9 +125,9 @@ namespace drawinglayer } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index 0c39f7a6480f..a729f8fcfc7a 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -35,7 +35,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -51,34 +52,45 @@ namespace drawinglayer { Primitive2DSequence aRetval; - // prepare unit transform - ::basegfx::B2DHomMatrix aEmptyMatrix; - // add line - if(getSdrLSTAttribute().getLine()) + if(getSdrLSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(getUnitPolygon()))); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + getUnitPolygon(), + basegfx::B2DHomMatrix(), + getSdrLSTAttribute().getLine(), + getSdrLSTAttribute().getLineStartEnd())); } // add text - if(getSdrLSTAttribute().getText()) + if(!getSdrLSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(getUnitPolygon()), + basegfx::B2DHomMatrix(), + getSdrLSTAttribute().getText(), + getSdrLSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLSTAttribute().getShadow()) + if(!getSdrLSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index 5b686bb5abae..3cf7b6415725 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -36,6 +36,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -52,21 +53,23 @@ namespace drawinglayer Primitive2DSequence aRetval(getSubPrimitives()); // add text - if(getSdrSTAttribute().getText()) + if(!getSdrSTAttribute().getText().isDefault()) { - const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( - basegfx::B2DPolyPolygon(aUnitOutline), - getTextBox(), - *getSdrSTAttribute().getText(), - 0, - false, - getWordWrap(), - isForceTextClipToTextRange())); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTextBox(), + getSdrSTAttribute().getText(), + attribute::SdrLineAttribute(), + false, + getWordWrap(), + isForceTextClipToTextRange())); } // add shadow - if(aRetval.hasElements() && getSdrSTAttribute().getShadow()) + if(aRetval.hasElements() && !getSdrSTAttribute().getShadow().isDefault()) { // #i105323# add generic shadow only for 2D shapes. For // 3D shapes shadow will be set at the individual created @@ -80,7 +83,7 @@ namespace drawinglayer // shadow will be correct (using ColorModifierStack), but expensive. if(!get3DShape()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow()); } } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 8474b72be2e4..db55e4588fea 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -31,12 +31,10 @@ #include "precompiled_svx.hxx" #include -#include #include -#include #include -#include -#include +#include +#include #include #include #include @@ -55,6 +53,10 @@ #include #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -70,25 +72,25 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rUnitPolyPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient) + const attribute::FillGradientAttribute& rFillGradient) { // prepare fully scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); BasePrimitive2D* pNewFillPrimitive = 0; - if(rFill.isGradient()) + if(!rFill.getGradient().isDefault()) { - pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, *rFill.getGradient()); + pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getGradient()); } - else if(rFill.isHatch()) + else if(!rFill.getHatch().isDefault()) { - pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), *rFill.getHatch()); + pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getHatch()); } - else if(rFill.isBitmap()) + else if(!rFill.getBitmap().isDefault()) { const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap()->getFillBitmapAttribute(aRange)); + pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap().getFillBitmapAttribute(aRange)); } else { @@ -100,9 +102,9 @@ namespace drawinglayer // create simpleTransparencePrimitive, add created fill primitive const Primitive2DReference xRefA(pNewFillPrimitive); const Primitive2DSequence aContent(&xRefA, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rFill.getTransparence())); + return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rFill.getTransparence())); } - else if(pFillGradient) + else if(!rFillGradient.isDefault()) { // create sequence with created fill primitive const Primitive2DReference xRefA(pNewFillPrimitive); @@ -111,11 +113,11 @@ namespace drawinglayer // create FillGradientPrimitive2D for transparence and add to new sequence // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, *pFillGradient)); + const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient)); const Primitive2DSequence aAlpha(&xRefB, 1L); - // create AlphaPrimitive2D using alpha and content - return Primitive2DReference(new AlphaPrimitive2D(aContent, aAlpha)); + // create TransparencePrimitive2D using alpha and content + return Primitive2DReference(new TransparencePrimitive2D(aContent, aAlpha)); } else { @@ -128,7 +130,7 @@ namespace drawinglayer const basegfx::B2DPolygon& rUnitPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, - const attribute::SdrLineStartEndAttribute* pStroke) + const attribute::SdrLineStartEndAttribute& rStroke) { // prepare fully scaled polygon basegfx::B2DPolygon aScaledPolygon(rUnitPolygon); @@ -139,10 +141,10 @@ namespace drawinglayer const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen()); BasePrimitive2D* pNewLinePrimitive = 0L; - if(!rUnitPolygon.isClosed() && pStroke) + if(!rUnitPolygon.isClosed() && !rStroke.isDefault()) { - attribute::LineStartEndAttribute aStart(pStroke->getStartWidth(), pStroke->getStartPolyPolygon(), pStroke->isStartCentered()); - attribute::LineStartEndAttribute aEnd(pStroke->getEndWidth(), pStroke->getEndPolyPolygon(), pStroke->isEndCentered()); + attribute::LineStartEndAttribute aStart(rStroke.getStartWidth(), rStroke.getStartPolyPolygon(), rStroke.isStartCentered()); + attribute::LineStartEndAttribute aEnd(rStroke.getEndWidth(), rStroke.getEndPolyPolygon(), rStroke.isEndCentered()); // create data pNewLinePrimitive = new PolygonStrokeArrowPrimitive2D(aScaledPolygon, aLineAttribute, aStrokeAttribute, aStart, aEnd); @@ -158,7 +160,7 @@ namespace drawinglayer // create simpleTransparencePrimitive, add created fill primitive const Primitive2DReference xRefA(pNewLinePrimitive); const Primitive2DSequence aContent(&xRefA, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rLine.getTransparence())); + return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rLine.getTransparence())); } else { @@ -171,7 +173,7 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rUnitPolyPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, - const attribute::SdrLineAttribute* pStroke, + const attribute::SdrLineAttribute& rStroke, bool bCellText, bool bWordWrap, bool bClipOnBounds) @@ -182,7 +184,7 @@ namespace drawinglayer if(rText.isContour()) { // contour text - if(pStroke && 0.0 != pStroke->getWidth()) + if(!rStroke.isDefault() && 0.0 != rStroke.getWidth()) { // take line width into account and shrink contour polygon accordingly // decompose to get scale @@ -197,7 +199,7 @@ namespace drawinglayer fabs(aScale.getX()), fabs(aScale.getY()))); // grow the polygon. To shrink, use negative value (half width) - aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5)); + aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(rStroke.getWidth() * 0.5)); // scale back to unit polygon aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix( @@ -221,7 +223,7 @@ namespace drawinglayer rObjectTransform); } } - else if(rText.getSdrFormTextAttribute()) + else if(!rText.getSdrFormTextAttribute().isDefault()) { // text on path, use scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); @@ -230,7 +232,7 @@ namespace drawinglayer &rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon, - *rText.getSdrFormTextAttribute()); + rText.getSdrFormTextAttribute()); } else { @@ -327,7 +329,7 @@ namespace drawinglayer if(rText.isScroll()) { // suppress scroll when FontWork - if(!rText.getSdrFormTextAttribute()) + if(rText.getSdrFormTextAttribute().isDefault()) { // get scroll direction const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection()); @@ -468,7 +470,7 @@ namespace drawinglayer const Primitive2DSequence aTempContent(&aRetval[0], 1); aRetval[0] = Primitive2DReference( - new UnifiedAlphaPrimitive2D( + new UnifiedTransparencePrimitive2D( aTempContent, rShadow.getTransparence())); } diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 1327d2a422fa..302eabecbdf9 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -36,10 +36,9 @@ #include #include #include -#include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -59,52 +58,73 @@ namespace drawinglayer // Do use createPolygonFromUnitCircle, but let create from first quadrant to mimic old geometry creation. // This is needed to have the same look when stroke is used since the polygon start point defines the // stroke start, too. - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitCircle(1)); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitCircle(1)); // scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - const basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix( + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); // add fill - if(getSdrLFSTAttribute().getFill()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrEllipsePrimitive2D::SdrEllipsePrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) : BufferedDecompositionPrimitive2D(), maTransform(rTransform), @@ -142,7 +162,7 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); if(mbCloseSegment) { @@ -150,57 +170,77 @@ namespace drawinglayer { // for compatibility, insert the center point at polygon start to get the same // line stroking pattern as the old painting mechanisms. - aUnitOutline.insert(0L, ::basegfx::B2DPoint(0.0, 0.0)); + aUnitOutline.insert(0L, basegfx::B2DPoint(0.0, 0.0)); } aUnitOutline.setClosed(true); } // move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createTranslateB2DHomMatrix(1.0, 1.0)); - aUnitCorrectionMatrix.scale(0.5, 0.5); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix( + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); // add fill - if(getSdrLFSTAttribute().getFill() && aUnitOutline.isClosed()) + if(!getSdrLFSTAttribute().getFill().isDefault() && aUnitOutline.isClosed()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrEllipseSegmentPrimitive2D::SdrEllipseSegmentPrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fStartAngle, double fEndAngle, diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index befff1b0c539..d83fa53f812e 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -36,7 +36,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -49,21 +50,25 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); // add fill, but only when graphic ist transparent - if(getSdrLFSTAttribute().getFill() && isTransparent()) + if(!getSdrLFSTAttribute().getFill().isDefault() && isTransparent()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { // if line width is given, polygon needs to be grown by half of it to make the // outline to be outside of the bitmap - if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) + if(0.0 != getSdrLFSTAttribute().getLine().getWidth()) { // decompose to get scale basegfx::B2DVector aScale, aTranslate; @@ -71,46 +76,61 @@ namespace drawinglayer getTransform().decompose(aScale, aTranslate, fRotate, fShearX); // create expanded range (add relative half line width to unit rectangle) - double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); + double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5); double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aExpandedUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } } - else - { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); - } // add graphic content if(255L != getGraphicAttr().GetTransparency()) { - Primitive2DReference xGraphicContentPrimitive(new GraphicPrimitive2D(getTransform(), getGraphicObject(), getGraphicAttr())); + const Primitive2DReference xGraphicContentPrimitive( + new GraphicPrimitive2D( + getTransform(), + getGraphicObject(), + getGraphicAttr())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index e22e9eb61c5b..ebac828bb9d5 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -39,8 +39,8 @@ #include #include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -60,36 +60,44 @@ namespace drawinglayer bool bLeftActive, bool bRightActive) const { - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); basegfx::B2DPolygon aPolygon; aPolygon.append(rStart); aPolygon.append(rEnd); - if(!pLineStartEnd || (!bLeftActive && !bRightActive)) + if(rLineStartEnd.isDefault() || (!bLeftActive && !bRightActive)) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0); + return createPolygonLinePrimitive( + aPolygon, + rObjectMatrix, + rLineAttribute, + attribute::SdrLineStartEndAttribute()); } if(bLeftActive && bRightActive) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd); + return createPolygonLinePrimitive( + aPolygon, + rObjectMatrix, + rLineAttribute, + rLineStartEnd); } const basegfx::B2DPolyPolygon aEmpty; const attribute::SdrLineStartEndAttribute aLineStartEnd( - bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, - bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0, - bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, - bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); + bLeftActive ? rLineStartEnd.getStartPolyPolygon() : aEmpty, bRightActive ? rLineStartEnd.getEndPolyPolygon() : aEmpty, + bLeftActive ? rLineStartEnd.getStartWidth() : 0.0, bRightActive ? rLineStartEnd.getEndWidth() : 0.0, + bLeftActive ? rLineStartEnd.isStartActive() : false, bRightActive ? rLineStartEnd.isEndActive() : false, + bLeftActive ? rLineStartEnd.isStartCentered() : false, bRightActive? rLineStartEnd.isEndCentered() : false); - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - SdrBlockTextPrimitive2D* pBlockText = 0L; + SdrBlockTextPrimitive2D* pBlockText = 0; basegfx::B2DRange aTextRange; double fTextX((getStart().getX() + getEnd().getX()) * 0.5); double fTextY((getStart().getX() + getEnd().getX()) * 0.5); @@ -97,11 +105,13 @@ namespace drawinglayer const double fDistance(aLine.getLength()); const double fAngle(atan2(aLine.getY(), aLine.getX())); bool bAutoUpsideDown(false); - const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText(); + const attribute::SdrTextAttribute rTextAttribute = getSdrLSTAttribute().getText(); const basegfx::B2DHomMatrix aObjectMatrix( basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart())); - if(pTextAttribute) + // preapare text, but do not add yet; it needs to be aligned to + // the line geometry + if(!rTextAttribute.isDefault()) { basegfx::B2DHomMatrix aTextMatrix; double fTestAngle(fAngle); @@ -127,58 +137,52 @@ namespace drawinglayer // create primitive and get text range pBlockText = new SdrBlockTextPrimitive2D( - &pTextAttribute->getSdrText(), - pTextAttribute->getOutlinerParaObject(), + &rTextAttribute.getSdrText(), + rTextAttribute.getOutlinerParaObject(), aTextMatrix, SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER, - pTextAttribute->isScroll(), + rTextAttribute.isScroll(), false, false, false, false); + aTextRange = pBlockText->getB2DRange(aViewInformation); } // prepare line attribute and result - const attribute::SdrLineAttribute* pLineAttribute(getSdrLSTAttribute().getLine()); - - if(!pLineAttribute) - { - // if initially no line is defined, create one for HitTest and BoundRect - pLineAttribute = new attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)); - } - { + const attribute::SdrLineAttribute rLineAttribute(getSdrLSTAttribute().getLine()); bool bArrowsOutside(false); bool bMainLineSplitted(false); - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); double fStartArrowW(0.0); double fStartArrowH(0.0); double fEndArrowW(0.0); double fEndArrowH(0.0); - if(pLineStartEnd) + if(!rLineStartEnd.isDefault()) { - if(pLineStartEnd->isStartActive()) + if(rLineStartEnd.isStartActive()) { - const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getStartPolyPolygon())); - fStartArrowW = pLineStartEnd->getStartWidth(); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getStartPolyPolygon())); + fStartArrowW = rLineStartEnd.getStartWidth(); fStartArrowH = aArrowRange.getHeight() * fStartArrowW / aArrowRange.getWidth(); - if(pLineStartEnd->isStartCentered()) + if(rLineStartEnd.isStartCentered()) { fStartArrowH *= 0.5; } } - if(pLineStartEnd->isEndActive()) + if(rLineStartEnd.isEndActive()) { - const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getEndPolyPolygon())); - fEndArrowW = pLineStartEnd->getEndWidth(); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getEndPolyPolygon())); + fEndArrowW = rLineStartEnd.getEndWidth(); fEndArrowH = aArrowRange.getHeight() * fEndArrowW / aArrowRange.getWidth(); - if(pLineStartEnd->isEndCentered()) + if(rLineStartEnd.isEndCentered()) { fEndArrowH *= 0.5; } @@ -187,7 +191,7 @@ namespace drawinglayer const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5)); const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5); - const double fHalfLineWidth(pLineAttribute->getWidth() * 0.5); + const double fHalfLineWidth(rLineAttribute.getWidth() * 0.5); if(fSpaceNeededByArrows > fDistance) { @@ -279,12 +283,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); } } else @@ -295,12 +299,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); } } @@ -313,13 +317,13 @@ namespace drawinglayer const basegfx::B2DPoint aLeftUp(0.0, fTopEdge); const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); // right help line const basegfx::B2DPoint aRightUp(fDistance, fTopEdge); const basegfx::B2DPoint aRightDown(fDistance, fBottomRight); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); // text horizontal position if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal) @@ -333,9 +337,9 @@ namespace drawinglayer fTextX -= (fArrowsOutsideLen - fStartArrowH); } - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX -= pTextAttribute->getTextRightDistance(); + fTextX -= rTextAttribute.getTextRightDistance(); } } else if(MEASURETEXTPOSITION_POSITIVE == eHorizontal) @@ -349,9 +353,9 @@ namespace drawinglayer fTextX += (fArrowsOutsideLen - fEndArrowH); } - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX += pTextAttribute->getTextLeftDistance(); + fTextX += rTextAttribute.getTextLeftDistance(); } } else // MEASURETEXTPOSITION_CENTERED @@ -359,9 +363,9 @@ namespace drawinglayer // centered fTextX = aMainLeft.getX() + ((fDistance - aTextRange.getWidth()) * 0.5); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX += (pTextAttribute->getTextLeftDistance() - pTextAttribute->getTextRightDistance()) / 2L; + fTextX += (rTextAttribute.getTextLeftDistance() - rTextAttribute.getTextRightDistance()) / 2L; } } @@ -372,9 +376,9 @@ namespace drawinglayer const double fSmall(fArrowsOutsideLen * 0.10); fTextY = aMainLeft.getY() - (aTextRange.getHeight() + fSmall + fHalfLineWidth); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY -= pTextAttribute->getTextLowerDistance(); + fTextY -= rTextAttribute.getTextLowerDistance(); } } else if(MEASURETEXTPOSITION_POSITIVE == eVertical) @@ -383,9 +387,9 @@ namespace drawinglayer const double fSmall(fArrowsOutsideLen * 0.10); fTextY = aMainLeft.getY() + (fSmall + fHalfLineWidth); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY += pTextAttribute->getTextUpperDistance(); + fTextY += rTextAttribute.getTextUpperDistance(); } } else // MEASURETEXTPOSITION_CENTERED @@ -393,21 +397,19 @@ namespace drawinglayer // centered fTextY = aMainLeft.getY() - (aTextRange.getHeight() * 0.5); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY += (pTextAttribute->getTextUpperDistance() - pTextAttribute->getTextLowerDistance()) / 2L; + fTextY += (rTextAttribute.getTextUpperDistance() - rTextAttribute.getTextLowerDistance()) / 2L; } } } - if(!getSdrLSTAttribute().getLine()) + if(getSdrLSTAttribute().getLine().isDefault()) { - // embed line geometry to invisible line group - const Primitive2DReference xHiddenLines(new HitTestPrimitive2D(aRetval)); - aRetval = Primitive2DSequence(&xHiddenLines, 1); + // embed line geometry to invisible (100% transparent) line group for HitTest + const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(aRetval)); - // delete temporary LineAttribute again - delete pLineAttribute; + aRetval = Primitive2DSequence(&xHiddenLines, 1); } if(pBlockText) @@ -437,9 +439,11 @@ namespace drawinglayer } // add shadow - if(getSdrLSTAttribute().getShadow()) + if(!getSdrLSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index bf2df22fb2e6..cb9cb8bf3546 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -34,7 +34,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -84,23 +85,29 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); // add fill - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getFill()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getFill().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line // #i97981# condition was inverse to purpose. When being compatible to paint version, // border needs to be suppressed - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getLine().isDefault()) { // if line width is given, polygon needs to be grown by half of it to make the // outline to be outside of the bitmap - if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) + if(0.0 != getSdrLFSTAttribute().getLine().getWidth()) { // decompose to get scale basegfx::B2DVector aScale, aTranslate; @@ -108,27 +115,37 @@ namespace drawinglayer getTransform().decompose(aScale, aTranslate, fRotate, fShearX); // create expanded range (add relative half line width to unit rectangle) - double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); + double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5); double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aExpandedUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } } else { // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } // add graphic content @@ -136,15 +153,26 @@ namespace drawinglayer // add text, no need to supress to stay compatible since text was // always supported by the old paints, too - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getShadow()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index d46ab7b4b14d..ea7ed0c808d1 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -138,7 +138,7 @@ namespace drawinglayer if(aColor.bIsVisible) { - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); const Color aVclColor(aColor.nColor); aOutline.transform(getObjectTransform()); const drawinglayer::primitive2d::Primitive2DReference xOutline( diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 39f3efc617f5..6b9da51e3b68 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -52,50 +52,67 @@ namespace drawinglayer Primitive2DSequence aRetval; // add fill - if(getSdrLFSTAttribute().getFill() && getUnitPolyPolygon().isClosed()) + if(!getSdrLFSTAttribute().getFill().isDefault() + && getUnitPolyPolygon().isClosed()) { // take care for orientations - basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(basegfx::tools::correctOrientations(getUnitPolyPolygon())); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(aOrientedUnitPolyPolygon, getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon( + basegfx::tools::correctOrientations(getUnitPolyPolygon())); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aOrientedUnitPolyPolygon, + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - Primitive2DSequence aTemp(getUnitPolyPolygon().count()); - - for(sal_uInt32 a(0L); a < getUnitPolyPolygon().count(); a++) - { - aTemp[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd()); - } - - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); + // if initially no line is defined, create one for HitTest and BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + getUnitPolyPolygon(), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - Primitive2DSequence xHiddenLineSequence(getUnitPolyPolygon().count()); + Primitive2DSequence aTemp(getUnitPolyPolygon().count()); for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++) { - xHiddenLineSequence[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), aBlackHairline); + aTemp[a] = createPolygonLinePrimitive( + getUnitPolyPolygon().getB2DPolygon(a), + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd()); } - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + getUnitPolyPolygon(), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index 25b39ebb07d5..dd3c602266f7 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -33,10 +33,6 @@ #include #include #include -#include -#include -#include -#include #include ////////////////////////////////////////////////////////////////////////////// @@ -177,19 +173,6 @@ namespace drawinglayer return aRetVal.get() ? *aRetVal.get() : BitmapEx(); } - // #i99123# - Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix) - { - // create PolygonHairlinePrimitive2D - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - aUnitOutline.transform(rMatrix); - const basegfx::BColor aBlack(0.0, 0.0, 0.0); - const Primitive2DReference xReference(new PolygonHairlinePrimitive2D(aUnitOutline, aBlack)); - - // create HitTestPrimitive2D with it - const Primitive2DSequence xSequence(&xReference, 1); - return Primitive2DReference(new HitTestPrimitive2D(xSequence)); - } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 93ed597cb0a3..94da69bc7323 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -35,7 +35,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +51,6 @@ namespace drawinglayer Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; - Primitive2DSequence aHitTestContent; // create unit outline polygon const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( @@ -59,64 +59,67 @@ namespace drawinglayer getCornerRadiusY())); // add fill - if(getSdrLFSTAttribute().getFill()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - *getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } else if(getForceFillForHitTest()) { // if no fill and it's a text frame, create a fill for HitTest and // BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, - createPolyPolygonFillPrimitive( + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, basegfx::B2DPolyPolygon(aUnitOutline), - getTransform(), - attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), - getSdrLFSTAttribute().getFillFloatTransGradient())); + getTransform())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive( aUnitOutline, getTransform(), - *getSdrLFSTAttribute().getLine())); + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else if(!getForceFillForHitTest()) { // if initially no line is defined and it's not a text frame, create // a line for HitTest and BoundRect - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, - createPolygonLinePrimitive( - aUnitOutline, - getTransform(), - attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); - } - - // add HitTest and BoundRect helper geometry (if exists) - if(aHitTestContent.hasElements()) - { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx index 6f997a2658ef..038226c2e06d 100644 --- a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx +++ b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx @@ -34,8 +34,11 @@ #include #include #include -#include +#include +#include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx new file mode 100644 index 000000000000..b2a103bd8cfc --- /dev/null +++ b/svx/source/sdr/properties/oleproperties.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: graphicproperties.cxx,v $ + * $Revision: 1.12.76.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace properties + { + OleProperties::OleProperties(SdrObject& rObj) + : RectangleProperties(rObj) + { + } + + OleProperties::OleProperties(const OleProperties& rProps, SdrObject& rObj) + : RectangleProperties(rProps, rObj) + { + } + + OleProperties::~OleProperties() + { + } + + BaseProperties& OleProperties::Clone(SdrObject& rObj) const + { + return *(new OleProperties(*this, rObj)); + } + + void OleProperties::ForceDefaultAttributes() + { + // call parent + RectangleProperties::ForceDefaultAttributes(); + + // force ItemSet + GetObjectItemSet(); + + // #i108221# + mpItemSet->Put( XFillStyleItem(XFILL_NONE) ); + mpItemSet->Put( XLineStyleItem(XLINE_NONE) ); + } + } // end of namespace properties +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 826e87520ce3..dd3006ba9a6d 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -69,7 +69,7 @@ #include #include #include -#include +#include #include #include "svditer.hxx" #include @@ -78,13 +78,14 @@ #include #include #include -#include #include #include #include #include #include #include +#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -726,8 +727,8 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay if(aResultTransparent.hasElements()) { - drawinglayer::primitive2d::Primitive2DReference aUnifiedAlphaPrimitive2D(new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aResultTransparent, 0.5)); - aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlphaPrimitive2D, 1); + drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5)); + aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent); rOverlayManager.add(*pNewOverlayObject); @@ -825,35 +826,22 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla if(getSolidDraggingActive()) { const SfxItemSet& rItemSet = pEdge->GetMergedItemSet(); - drawinglayer::attribute::SdrLineAttribute* pLine = drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet); - drawinglayer::attribute::SdrLineStartEndAttribute* pLineStartEnd = 0; + const drawinglayer::attribute::SdrLineAttribute aLine( + drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet)); - if(pLine && !pLine->isVisible()) + if(!aLine.isDefault()) { - delete pLine; - pLine = 0; - } - - if(pLine) - { - pLineStartEnd = drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(rItemSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0; - } + const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd( + drawinglayer::primitive2d::createNewSdrLineStartEndAttribute( + rItemSet, + aLine.getWidth())); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( aRetval, drawinglayer::primitive2d::createPolygonLinePrimitive( - aEdgePolygon, basegfx::B2DHomMatrix(), *pLine, pLineStartEnd)); - - if(pLineStartEnd) - { - delete pLineStartEnd; - } - - delete pLine; + aEdgePolygon, + basegfx::B2DHomMatrix(), + aLine, + aLineStartEnd)); } } else diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index b95c13864776..5e0dfbced62c 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -808,16 +808,101 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) void SdrEditView::DeleteMarkedObj() { - if (GetMarkedObjectCount()) { - BrkAction(); - //HMHHideMarkHdl(); - BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); + // moved breaking action and undo start outside loop + BrkAction(); + BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); + + // remove as long as something is selected. This allows to schedule objects for + // removal for a next run as needed + while(GetMarkedObjectCount()) + { + // vector to remember the parents which may be empty after object removal + std::vector< SdrObject* > aParents; + + { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const sal_uInt32 nCount(rMarkList.GetMarkCount()); + sal_uInt32 a(0); + + for(a = 0; a < nCount; a++) + { + // in the first run, add all found parents, but only once + SdrMark* pMark = rMarkList.GetMark(a); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + SdrObject* pParent = pObject->GetObjList()->GetOwnerObj(); + + if(pParent) + { + if(aParents.size()) + { + std::vector< SdrObject* >::iterator aFindResult = + std::find(aParents.begin(), aParents.end(), pParent); + + if(aFindResult == aParents.end()) + { + aParents.push_back(pParent); + } + } + else + { + aParents.push_back(pParent); + } + } + } + + if(aParents.size()) + { + // in a 2nd run, remove all objects which may already be scheduled for + // removal. I am not sure if this can happen, but theoretically + // a to-be-removed object may already be the group/3DScene itself + for(a = 0; a < nCount; a++) + { + SdrMark* pMark = rMarkList.GetMark(a); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + + std::vector< SdrObject* >::iterator aFindResult = + std::find(aParents.begin(), aParents.end(), pObject); + + if(aFindResult != aParents.end()) + { + aParents.erase(aFindResult); + } + } + } + } + + // original stuff: remove selected objects. Handle clear will + // do something only once DeleteMarkedList(GetMarkedObjectList()); GetMarkedObjectListWriteAccess().Clear(); aHdl.Clear(); - EndUndo(); - MarkListHasChanged(); + + while(aParents.size() && !GetMarkedObjectCount()) + { + // iterate over remembered parents + SdrObject* pParent = aParents.back(); + aParents.pop_back(); + + if(pParent->GetSubList() && 0 == pParent->GetSubList()->GetObjCount()) + { + // we detected an empty parent, a candidate to leave group/3DScene + // if entered + if(GetSdrPageView()->GetAktGroup() + && GetSdrPageView()->GetAktGroup() == pParent) + { + GetSdrPageView()->LeaveOneGroup(); + } + + // schedule empty parent for removal + GetMarkedObjectListWriteAccess().InsertEntry( + SdrMark(pParent, GetSdrPageView())); + } + } } + + // end undo and change messaging moved at the end + EndUndo(); + MarkListHasChanged(); } void SdrEditView::CopyMarkedObj() diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index be3529ea4818..7c3575e786dd 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -846,7 +846,7 @@ void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons } // geometry access -::basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const +basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const { return aTailPoly.getB2DPolygon(); } diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index ea29c860e8ab..20587f715c81 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -166,6 +166,12 @@ void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const } +void SdrObjGroup::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + UINT16 SdrObjGroup::GetObjIdentifier() const { return UINT16(OBJ_GRUP); diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index dfad9824a8fd..02ec537c19b9 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -79,6 +79,7 @@ inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } #include #include #include +#include using namespace sdr; @@ -2744,13 +2745,10 @@ SdrObject* SdrPathObj::RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index) SdrObject* SdrPathObj::DoConvertToPolyObj(BOOL bBezier) const { // #i89784# check for FontWork with activated HideContour - bool bHideContour(false); - - { - drawinglayer::attribute::SdrTextAttribute* pText = drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0)); - bHideContour = pText && pText->getSdrFormTextAttribute() && pText->isHideContour(); - delete pText; - } + const drawinglayer::attribute::SdrTextAttribute aText( + drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0))); + const bool bHideContour( + !aText.isDefault() && !aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()); SdrObject* pRet = bHideContour ? 0 : diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 6522feb7a2b8..e7fc3d771a5b 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -66,7 +66,7 @@ #include #include #include -#include +#include #include #include #include @@ -230,7 +230,7 @@ namespace { class impPolygonParagraphHandler { - const drawinglayer::attribute::SdrFormTextAttribute& mrSdrFormTextAttribute; // FormText parameters + const drawinglayer::attribute::SdrFormTextAttribute maSdrFormTextAttribute; // FormText parameters std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrDecomposition; // destination primitive list std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow Reference < com::sun::star::i18n::XBreakIterator > mxBreak; // break iterator @@ -273,7 +273,7 @@ namespace const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition) - : mrSdrFormTextAttribute(rSdrFormTextAttribute), + : maSdrFormTextAttribute(rSdrFormTextAttribute), mrDecomposition(rDecomposition), mrShadowDecomposition(rShadowDecomposition) { @@ -297,18 +297,18 @@ namespace double fPolyStart(0.0); double fScaleFactor(1.0); - if(mrSdrFormTextAttribute.getFormTextMirror()) + if(maSdrFormTextAttribute.getFormTextMirror()) { aPolygonCandidate.flip(); } - if(mrSdrFormTextAttribute.getFormTextStart() - && (XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust() - || XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust())) + if(maSdrFormTextAttribute.getFormTextStart() + && (XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust() + || XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust())) { - if(XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust()) { - fPolyStart += mrSdrFormTextAttribute.getFormTextStart(); + fPolyStart += maSdrFormTextAttribute.getFormTextStart(); if(fPolyStart > fPolyEnd) { @@ -317,7 +317,7 @@ namespace } else { - fPolyEnd -= mrSdrFormTextAttribute.getFormTextStart(); + fPolyEnd -= maSdrFormTextAttribute.getFormTextStart(); if(fPolyEnd < fPolyStart) { @@ -326,7 +326,7 @@ namespace } } - if(XFT_LEFT != mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_LEFT != maSdrFormTextAttribute.getFormTextAdjust()) { // calculate total text length of this paragraph, some layout needs to be done const double fParagraphTextLength(getParagraphTextLength(rTextPortions)); @@ -335,7 +335,7 @@ namespace // but still take care of XFT_AUTOSIZE in that case const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart)); - if(XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -343,7 +343,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength); } } - else if(XFT_CENTER == mrSdrFormTextAttribute.getFormTextAdjust()) + else if(XFT_CENTER == maSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -351,7 +351,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0; } } - else if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + else if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // if scale, prepare scale factor between curve length and text length if(0.0 != fParagraphTextLength) @@ -386,7 +386,7 @@ namespace // prepare portion length. Takes RTL sections into account. double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen)); - if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand portion length fPortionLength *= fScaleFactor; @@ -401,27 +401,27 @@ namespace aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY()); // prepare scaling of text primitive - if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand text primitive scaling aNewTransformA.scale(fScaleFactor, fScaleFactor); } // eventually create shadow primitives from aDecomposition and add to rDecomposition - const bool bShadow(XFTSHADOW_NONE != mrSdrFormTextAttribute.getFormTextShadow()); + const bool bShadow(XFTSHADOW_NONE != maSdrFormTextAttribute.getFormTextShadow()); if(bShadow) { - if(XFTSHADOW_NORMAL == mrSdrFormTextAttribute.getFormTextShadow()) + if(XFTSHADOW_NORMAL == maSdrFormTextAttribute.getFormTextShadow()) { aNewShadowTransform.translate( - mrSdrFormTextAttribute.getFormTextShdwXVal(), - -mrSdrFormTextAttribute.getFormTextShdwYVal()); + maSdrFormTextAttribute.getFormTextShdwXVal(), + -maSdrFormTextAttribute.getFormTextShdwYVal()); } else // XFTSHADOW_SLANT { - double fScaleValue(mrSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); - double fShearValue(-mrSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); + double fScaleValue(maSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); + double fShearValue(-maSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); aNewShadowTransform.scale(1.0, fScaleValue); aNewShadowTransform.shearX(sin(fShearValue)); @@ -429,7 +429,7 @@ namespace } } - switch(mrSdrFormTextAttribute.getFormTextStyle()) + switch(maSdrFormTextAttribute.getFormTextStyle()) { case XFT_ROTATE : { @@ -487,7 +487,7 @@ namespace } // distance from path? - if(mrSdrFormTextAttribute.getFormTextDistance()) + if(maSdrFormTextAttribute.getFormTextDistance()) { if(aEndPos.equal(aStartPos)) { @@ -497,7 +497,7 @@ namespace // use back vector (aStartPos - aEndPos) here to get mirrored perpendicular as in old stuff const basegfx::B2DVector aPerpendicular( basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) * - mrSdrFormTextAttribute.getFormTextDistance()); + maSdrFormTextAttribute.getFormTextDistance()); aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY()); } @@ -506,7 +506,7 @@ namespace { if(pCandidate->getText().Len() && nNextGlyphLen) { - const Color aShadowColor(mrSdrFormTextAttribute.getFormTextShdwColor()); + const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor()); const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor()); const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); const ::std::vector< double > aNewDXArray( @@ -627,7 +627,7 @@ namespace { if(rOutlineAttribute.getTransparence()) { - // create UnifiedAlphaPrimitive2D + // create UnifiedTransparencePrimitive2D drawinglayer::primitive2d::Primitive2DSequence aStrokePrimitiveSequence(nStrokeCount); for(sal_uInt32 b(0L); b < nStrokeCount; b++) @@ -635,8 +635,8 @@ namespace aStrokePrimitiveSequence[b] = drawinglayer::primitive2d::Primitive2DReference(aStrokePrimitives[b]); } - drawinglayer::primitive2d::UnifiedAlphaPrimitive2D* pNew2 = - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + drawinglayer::primitive2d::UnifiedTransparencePrimitive2D* pNew2 = + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aStrokePrimitiveSequence, (double)rOutlineAttribute.getTransparence() / 100.0); aNewPrimitives.push_back(pNew2); @@ -716,7 +716,9 @@ void SdrTextObj::impDecomposePathTextPrimitive( std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition; std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition; impPolygonParagraphHandler aPolygonParagraphHandler( - rFormTextAttribute, aRegularDecomposition, aShadowDecomposition); + rFormTextAttribute, + aRegularDecomposition, + aShadowDecomposition); sal_uInt32 a; for(a = 0L; a < nLoopCount; a++) @@ -755,10 +757,14 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add shadow outlines - if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getShadowOutline()) + if(rFormTextAttribute.getFormTextOutline() + && !rFormTextAttribute.getShadowOutline().isDefault()) { const drawinglayer::primitive2d::Primitive2DSequence aOutlines( - impAddPathTextOutlines(aShadowDecomposition, *rFormTextAttribute.getShadowOutline())); + impAddPathTextOutlines( + aShadowDecomposition, + rFormTextAttribute.getShadowOutline())); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalA, aOutlines); } } @@ -774,10 +780,14 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add outlines - if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getOutline()) + if(rFormTextAttribute.getFormTextOutline() + && !rFormTextAttribute.getOutline().isDefault()) { const drawinglayer::primitive2d::Primitive2DSequence aOutlines( - impAddPathTextOutlines(aRegularDecomposition, *rFormTextAttribute.getOutline())); + impAddPathTextOutlines( + aRegularDecomposition, + rFormTextAttribute.getOutline())); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalB, aOutlines); } } diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 72e10e29c336..2c2e1bb9df83 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include namespace sdr { namespace table { @@ -245,10 +245,11 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb } else { - // embed in HitTest primitive to support HitTest of this overlay object + // embed in 100% transparent UnifiedTransparencePrimitive2D to support HitTest + // of this overlay object const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); const drawinglayer::primitive2d::Primitive2DReference aNewReference( - new drawinglayer::primitive2d::HitTestPrimitive2D(aSequence)); + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aSequence, 1.0)); aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index e4e515ed1613..b4a941413e70 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -37,19 +37,20 @@ #include #include #include -#include #include #include #include -#include #include -#include #include #include -#include #include #include #include +#include +#include +#include +#include +#include #include "cell.hxx" #include "tablelayouter.hxx" @@ -99,31 +100,44 @@ namespace drawinglayer { Primitive2DSequence aRetval; - if(getSdrFTAttribute().getFill() || getSdrFTAttribute().getText()) + if(!getSdrFTAttribute().getFill().isDefault() + || !getSdrFTAttribute().getText().isDefault()) { // prepare unit polygon - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createPolygonFromRect(aUnitRange)); + const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); // add fill - if(getSdrFTAttribute().getFill()) + if(!getSdrFTAttribute().getFill().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( - aUnitPolyPolygon, - getTransform(), - *getSdrFTAttribute().getFill(), - getSdrFTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getFill(), + getSdrFTAttribute().getFillFloatTransGradient())); + } + else + { + // if no fill create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, + aUnitPolyPolygon, + getTransform())); } // add text - if(getSdrFTAttribute().getText()) + if(!getSdrFTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( - aUnitPolyPolygon, - getTransform(), - *getSdrFTAttribute().getText(), - 0, - true, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getText(), + attribute::SdrLineAttribute(), + true, + false, + false)); } } @@ -539,14 +553,13 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfTableObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const sdr::table::SdrTableObj& rTableObj = GetTableObj(); const uno::Reference< com::sun::star::table::XTable > xTable = rTableObj.getTable(); - const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); if(xTable.is()) { // create primitive representation for table + drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_Int32 nRowCount(xTable->getRowCount()); const sal_Int32 nColCount(xTable->getColumnCount()); const sal_Int32 nAllCount(nRowCount * nColCount); @@ -599,7 +612,7 @@ namespace sdr const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet(); const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol); const SdrText* pSdrText = rTableObj.getText(nTextIndex); - drawinglayer::attribute::SdrFillTextAttribute* pAttribute = 0; + drawinglayer::attribute::SdrFillTextAttribute aAttribute; if(pSdrText) { @@ -609,7 +622,7 @@ namespace sdr const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance()); const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance()); - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText, &nLeft, @@ -619,21 +632,17 @@ namespace sdr } else { - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText); } - if(pAttribute) + // always create cell primitives for BoundRect and HitTest { - if(pAttribute->isVisible()) - { - const drawinglayer::primitive2d::Primitive2DReference xCellReference(new drawinglayer::primitive2d::SdrCellPrimitive2D( - aCellMatrix, *pAttribute)); - xCellSequence[nCellInsert++] = xCellReference; - } - - delete pAttribute; + const drawinglayer::primitive2d::Primitive2DReference xCellReference( + new drawinglayer::primitive2d::SdrCellPrimitive2D( + aCellMatrix, aAttribute)); + xCellSequence[nCellInsert++] = xCellReference; } // handle cell borders @@ -678,21 +687,46 @@ namespace sdr xRetval = xCellSequence; drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xBorderSequence); } - } - if(xRetval.hasElements()) - { - // check and create evtl. shadow for created content - drawinglayer::attribute::SdrShadowAttribute* pNewShadowAttribute = drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet); - - if(pNewShadowAttribute) + if(xRetval.hasElements()) { - xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, *pNewShadowAttribute); - delete pNewShadowAttribute; + // check and create evtl. shadow for created content + const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); + const drawinglayer::attribute::SdrShadowAttribute aNewShadowAttribute( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet)); + + if(!aNewShadowAttribute.isDefault()) + { + xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, aNewShadowAttribute); + } } - } - return xRetval; + return xRetval; + } + else + { + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rTableObj.GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(rTableObj.GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // credate an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aObjectMatrix)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } ViewContactOfTableObj::ViewContactOfTableObj(::sdr::table::SdrTableObj& rTableObj) -- cgit v1.2.3 From e8b81cd40140a1a5f79f9eb24470ad4891564ef8 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 28 Jan 2010 17:21:44 +0100 Subject: aw079: #i99147# corrected diverse aspects of invisible object visualisation and interaction --- .../source/processor2d/hittestprocessor2d.cxx | 44 ++++++++++++++ svx/inc/svx/cube3d.hxx | 5 +- svx/inc/svx/extrud3d.hxx | 7 +-- svx/inc/svx/lathe3d.hxx | 7 +-- svx/inc/svx/obj3d.hxx | 10 ++-- svx/inc/svx/polygn3d.hxx | 6 +- svx/inc/svx/scene3d.hxx | 9 +-- svx/inc/svx/sdrmasterpagedescriptor.hxx | 5 +- svx/inc/svx/sphere3d.hxx | 7 +-- svx/inc/svx/svdoashp.hxx | 11 ++-- svx/inc/svx/svdoattr.hxx | 5 +- svx/inc/svx/svdobj.hxx | 2 + svx/inc/svx/svdocapt.hxx | 7 +-- svx/inc/svx/svdocirc.hxx | 9 +-- svx/inc/svx/svdoedge.hxx | 7 +-- svx/inc/svx/svdograf.hxx | 10 +--- svx/inc/svx/svdogrp.hxx | 7 +-- svx/inc/svx/svdomeas.hxx | 7 +-- svx/inc/svx/svdomedia.hxx | 3 +- svx/inc/svx/svdoole2.hxx | 5 +- svx/inc/svx/svdopage.hxx | 11 ++-- svx/inc/svx/svdopath.hxx | 5 +- svx/inc/svx/svdorect.hxx | 11 +--- svx/inc/svx/svdotable.hxx | 8 +-- svx/inc/svx/svdotext.hxx | 8 +-- svx/inc/svx/svdovirt.hxx | 4 +- svx/inc/svx/svdpage.hxx | 1 + svx/source/customshapes/EnhancedCustomShape2d.cxx | 13 ---- svx/source/sdr/properties/makefile.mk | 1 + svx/source/svdraw/sdrmasterpagedescriptor.cxx | 3 +- svx/source/svdraw/svddrgmt.cxx | 15 ++++- svx/source/svdraw/svdhdl.cxx | 4 +- svx/source/svdraw/svdobj.cxx | 6 +- svx/source/svdraw/svdogrp.cxx | 2 +- svx/source/svdraw/svdoole2.cxx | 9 +++ svx/source/svdraw/svdpage.cxx | 3 +- svx/source/table/svdotable.cxx | 2 +- svx/source/table/tablehandles.cxx | 8 +-- svx/source/table/viewcontactoftableobj.cxx | 69 ++++++++++------------ 39 files changed, 181 insertions(+), 175 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index e699f1ae8ea4..9be5b5633d1f 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -50,6 +50,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -487,6 +488,49 @@ namespace drawinglayer break; } case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D : + { + if(!getHitTextOnly()) + { + // The recently added BitmapEx::GetTransparency() makes it easy to extend + // the BitmapPrimitive2D HitTest to take the contained BotmapEx and it's + // transparency into account + const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); + + if(!aRange.isEmpty()) + { + const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate)); + const BitmapEx& rBitmapEx = rBitmapCandidate.getBitmapEx(); + const Size& rSizePixel(rBitmapEx.GetSizePixel()); + + if(rSizePixel.Width() && rSizePixel.Height()) + { + basegfx::B2DHomMatrix aBackTransform( + getViewInformation2D().getObjectToViewTransformation() * + rBitmapCandidate.getTransform()); + aBackTransform.invert(); + + const basegfx::B2DPoint aRelativePoint(aBackTransform * getDiscreteHitPosition()); + const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); + + if(aUnitRange.isInside(aRelativePoint)) + { + const sal_Int32 nX(basegfx::fround(aRelativePoint.getX() * rSizePixel.Width())); + const sal_Int32 nY(basegfx::fround(aRelativePoint.getY() * rSizePixel.Height())); + + mbHit = (0xff != rBitmapEx.GetTransparency(nX, nY)); + } + } + else + { + // fallback to standard HitTest + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance()); + } + } + } + + break; + } case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D : case PRIMITIVE2D_ID_CONTROLPRIMITIVE2D : case PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D : diff --git a/svx/inc/svx/cube3d.hxx b/svx/inc/svx/cube3d.hxx index 3985ab6ca594..0661200a9850 100644 --- a/svx/inc/svx/cube3d.hxx +++ b/svx/inc/svx/cube3d.hxx @@ -55,10 +55,6 @@ enum { CUBE_BOTTOM = 0x0001, CUBE_BACK = 0x0002, CUBE_LEFT = 0x0004, class SVX_DLLPUBLIC E3dCubeObj : public E3dCompoundObject { private: - // Zur Geometrieerzeugung eines Cubes notwendige - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // Parameter basegfx::B3DPoint aCubePos; basegfx::B3DVector aCubeSize; @@ -69,6 +65,7 @@ private: protected: void SetDefaultAttributes(E3dDefaultAttributes& rDefault); + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: TYPEINFO(); diff --git a/svx/inc/svx/extrud3d.hxx b/svx/inc/svx/extrud3d.hxx index ee0c38af9fdd..b979a44fce60 100644 --- a/svx/inc/svx/extrud3d.hxx +++ b/svx/inc/svx/extrud3d.hxx @@ -43,11 +43,6 @@ class SVX_DLLPUBLIC E3dExtrudeObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::E3dExtrudeProperties access to SetGeometryValid() friend class sdr::properties::E3dExtrudeProperties; @@ -55,6 +50,8 @@ private: basegfx::B2DPolyPolygon maExtrudePolygon; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/lathe3d.hxx b/svx/inc/svx/lathe3d.hxx index a0474fef522d..2d8e92df6496 100644 --- a/svx/inc/svx/lathe3d.hxx +++ b/svx/inc/svx/lathe3d.hxx @@ -47,16 +47,13 @@ class SVX_DLLPUBLIC E3dLatheObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // Partcodes fuer Wireframe-Generierung: Standard oder Deckelflaeche enum { LATHE_PART_STD = 1, LATHE_PART_COVER = 2 }; basegfx::B2DPolyPolygon maPolyPoly2D; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx index 30a22938f888..8297d727919f 100644 --- a/svx/inc/svx/obj3d.hxx +++ b/svx/inc/svx/obj3d.hxx @@ -109,8 +109,7 @@ public: class SVX_DLLPUBLIC E3dObject : public SdrAttrObj { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dProperties access to StructureChanged() friend class sdr::properties::E3dProperties; @@ -119,6 +118,8 @@ class SVX_DLLPUBLIC E3dObject : public SdrAttrObj friend class E3dDragMethod; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + E3dObjList maSubList; // Subliste (Childobjekte) basegfx::B3DRange maLocalBoundVol; // umschliessendes Volumen des Objekts (aus geometrieerzeugung) @@ -223,8 +224,7 @@ public: class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dCompoundProperties access to SetGeometryValid() friend class sdr::properties::E3dCompoundProperties; friend class sdr::properties::E3dExtrudeProperties; @@ -232,6 +232,8 @@ class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject friend class sdr::properties::E3dSphereProperties; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + // Material des Objektes Color aMaterialAmbientColor; diff --git a/svx/inc/svx/polygn3d.hxx b/svx/inc/svx/polygn3d.hxx index 5bc9f9b8fb15..c24fb765cffb 100644 --- a/svx/inc/svx/polygn3d.hxx +++ b/svx/inc/svx/polygn3d.hxx @@ -37,9 +37,6 @@ class SVX_DLLPUBLIC E3dPolygonObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // Parameter basegfx::B3DPolyPolygon aPolyPoly3D; basegfx::B3DPolyPolygon aPolyNormals3D; @@ -49,6 +46,9 @@ private: SVX_DLLPRIVATE void CreateDefaultNormals(); SVX_DLLPRIVATE void CreateDefaultTexture(); +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + public: void SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx index a4cd8c497cd6..d7bd5e2d809e 100644 --- a/svx/inc/svx/scene3d.hxx +++ b/svx/inc/svx/scene3d.hxx @@ -71,17 +71,14 @@ class Imp3DDepthRemapper; class SVX_DLLPUBLIC E3dScene : public E3dObject { - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dSceneProperties access to StructureChanged() friend class sdr::properties::E3dSceneProperties; - // #110094# DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: // Transformationen B3dCamera aCameraSet; Camera3D aCamera; diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index b0593ab48774..52752945255c 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -52,17 +52,20 @@ namespace sdr { class MasterPageDescriptor : public sdr::PageUser { + private: SdrPage& maOwnerPage; SdrPage& maUsedPage; SetOfByte maVisibleLayers; // ViewContact part sdr::contact::ViewContact* mpViewContact; - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); // assignment operator defined, but not implemented void operator=(const MasterPageDescriptor& rCandidate); + protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + public: MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage); virtual ~MasterPageDescriptor(); diff --git a/svx/inc/svx/sphere3d.hxx b/svx/inc/svx/sphere3d.hxx index 9c11b6537354..1f8e21a032ca 100644 --- a/svx/inc/svx/sphere3d.hxx +++ b/svx/inc/svx/sphere3d.hxx @@ -44,15 +44,12 @@ class SVX_DLLPUBLIC E3dSphereObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - basegfx::B3DPoint aCenter; basegfx::B3DVector aSize; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx index f65afc0b4efe..db7189254b76 100644 --- a/svx/inc/svx/svdoashp.hxx +++ b/svx/inc/svx/svdoashp.hxx @@ -88,15 +88,16 @@ struct SdrCustomShapeInteraction class SVX_DLLPUBLIC SdrObjCustomShape : public SdrTextObj { +private: // fObjectRotation is containing the object rotation in degrees. double fObjectRotation; -private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +public: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + // to allow sdr::properties::CustomShapeProperties access friend class sdr::properties::CustomShapeProperties; @@ -179,7 +180,7 @@ public: virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; - virtual void SetModel(SdrModel* pNewModel); + virtual void SetModel(SdrModel* pNewModel); virtual void RecalcSnapRect(); diff --git a/svx/inc/svx/svdoattr.hxx b/svx/inc/svx/svdoattr.hxx index 3bcce26ea45e..2edc125d88f6 100644 --- a/svx/inc/svx/svdoattr.hxx +++ b/svx/inc/svx/svdoattr.hxx @@ -55,11 +55,12 @@ class SfxItemPool; class SVX_DLLPUBLIC SdrAttrObj : public SdrObject { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: friend class SdrOutliner; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + Rectangle maSnapRect; protected: diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index cc21e645e4d2..fce776ef0abf 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -426,6 +426,7 @@ public: // BaseProperties section private: sdr::properties::BaseProperties* mpProperties; +protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); public: virtual sdr::properties::BaseProperties& GetProperties() const; @@ -434,6 +435,7 @@ public: // #110094# DrawContact section private: sdr::contact::ViewContact* mpViewContact; +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx index 37bfd5ed2f9b..fd6e7dc67789 100644 --- a/svx/inc/svx/svdocapt.hxx +++ b/svx/inc/svx/svdocapt.hxx @@ -63,19 +63,16 @@ public: class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); private: - // to allow sdr::properties::CaptionProperties access to ImpRecalcTail() friend class sdr::properties::CaptionProperties; - friend class SdrTextObj; // fuer ImpRecalcTail() bei AutoGrow protected: - // DrawContact section -private: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +private: Polygon aTailPoly; // das ganze Polygon des Schwanzes sal_Bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE sal_Bool mbFixedTail; // for calc note box fixed tail, default FALSE diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx index 3f6a589d2cd7..866b63379a3e 100644 --- a/svx/inc/svx/svdocirc.hxx +++ b/svx/inc/svx/svdocirc.hxx @@ -61,20 +61,17 @@ public: class SVX_DLLPUBLIC SdrCircObj : public SdrRectObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo() friend class sdr::properties::CircleProperties; // only for SdrCircleAttributes SdrObjKind GetCircleKind() const { return meCircleKind; } - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: - SdrObjKind meCircleKind; + SdrObjKind meCircleKind; long nStartWink; long nEndWink; diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx index 227afd9ab027..a4dfcc322f4e 100644 --- a/svx/inc/svx/svdoedge.hxx +++ b/svx/inc/svx/svdoedge.hxx @@ -160,19 +160,16 @@ public: class SVX_DLLPUBLIC SdrEdgeObj : public SdrTextObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::ConnectorProperties access to ImpSetAttrToEdgeInfo() friend class sdr::properties::ConnectorProperties; friend class SdrCreateView; friend class ImpEdgeHdl; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: SdrObjConnection aCon1; // Verbindungszustand des Linienanfangs SdrObjConnection aCon2; // Verbindungszustand des Linienendes diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 4f00da997361..a8d6a006835e 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -88,22 +88,16 @@ class SdrGraphicLink; class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj { private: - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // to allow sdr::properties::GraphicProperties access to SetXPolyDirty() friend class sdr::properties::GraphicProperties; // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink() friend class sdr::contact::ViewObjectContactOfGraphic; - friend class SdrGraphicLink; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren void ImpSetGrafInfoToAttr(); // Werte in den Pool kopieren diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index db799da81e1d..8d1cf9b4e0b0 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -49,14 +49,11 @@ class SfxItemSet; class SVX_DLLPUBLIC SdrObjGroup : public SdrObject { - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // #110094# DrawContact section private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: SdrObjList* pSub; // Subliste (Kinder) long nDrehWink; long nShearWink; diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx index 406c5badbcb0..eb4c77e80269 100644 --- a/svx/inc/svx/svdomeas.hxx +++ b/svx/inc/svx/svdomeas.hxx @@ -68,18 +68,15 @@ public: class SVX_DLLPUBLIC SdrMeasureObj : public SdrTextObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::MeasureProperties access to SetTextDirty() friend class sdr::properties::MeasureProperties; friend class SdrMeasureField; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: Point aPt1; Point aPt2; FASTBOOL bTextDirty; diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx index 4b612dcf7e9e..8c2d683397ed 100644 --- a/svx/inc/svx/svdomedia.hxx +++ b/svx/inc/svx/svdomedia.hxx @@ -83,11 +83,10 @@ public: protected: virtual void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState ); + virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact(); private: - virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - ::avmedia::MediaItem maMediaProperties; ::std::auto_ptr< Graphic > mapGraphic; }; diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx index 2b5a19f7b60b..b26fbe55d2d6 100644 --- a/svx/inc/svx/svdoole2.hxx +++ b/svx/inc/svx/svdoole2.hxx @@ -62,11 +62,10 @@ private: SVX_DLLPRIVATE void GetObjRef_Impl(); SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf); - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: svt::EmbeddedObjectRef xObjRef; Graphic* pGraphic; String aProgName; diff --git a/svx/inc/svx/svdopage.hxx b/svx/inc/svx/svdopage.hxx index b138b7c12be9..f046a20dbed0 100644 --- a/svx/inc/svx/svdopage.hxx +++ b/svx/inc/svx/svdopage.hxx @@ -44,17 +44,14 @@ public: virtual void PageInDestruction(const SdrPage& rPage); private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // #111111# // To make things more safe, remember the page, not a number SdrPage* mpShownPage; +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + public: TYPEINFO(); SdrPageObj(SdrPage* pNewPage = 0L); diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx index 382f968f19b2..d8157446d0ce 100644 --- a/svx/inc/svx/svdopath.hxx +++ b/svx/inc/svx/svdopath.hxx @@ -65,13 +65,12 @@ public: class SVX_DLLPUBLIC SdrPathObj : public SdrTextObj { +private: friend class ImpPathForDragAndCreate; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: basegfx::B2DPolyPolygon maPathPolygon; SdrObjKind meKind; diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx index d8b0d2767553..eadd5c7490a0 100644 --- a/svx/inc/svx/svdorect.hxx +++ b/svx/inc/svx/svdorect.hxx @@ -54,19 +54,14 @@ namespace sdr { namespace properties { class SVX_DLLPUBLIC SdrRectObj : public SdrTextObj { private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::RectangleProperties access to SetXPolyDirty() friend class sdr::properties::RectangleProperties; - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - friend class SdrTextObj; // wg SetXPolyDirty bei GrowAdjust protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + XPolygon* mpXPoly; protected: diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx index a524ce757898..779087cbe254 100644 --- a/svx/inc/svx/svdotable.hxx +++ b/svx/inc/svx/svdotable.hxx @@ -315,14 +315,10 @@ public: private: void init( sal_Int32 nColumns, sal_Int32 nRows ); - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: virtual SdrObjGeoData* NewGeoData() const; virtual void SaveGeoData(SdrObjGeoData& rGeo) const; virtual void RestGeoData(const SdrObjGeoData& rGeo); diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index 6ffa4ab5bd22..928b1b4580b2 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -145,13 +145,11 @@ private: // CustomShapeproperties need to access the "bTextFrame" member: friend class sdr::properties::CustomShapeProperties; - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +private: // This method is only allowed for sdr::properties::TextProperties SVX_DLLPRIVATE SdrOutliner* GetTextEditOutliner() const { diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx index 190576fc68c6..7451fb582dff 100644 --- a/svx/inc/svx/svdovirt.hxx +++ b/svx/inc/svx/svdovirt.hxx @@ -49,11 +49,9 @@ class SVX_DLLPUBLIC SdrVirtObj : public SdrObject public: virtual sdr::properties::BaseProperties& GetProperties() const; -private: - // AW, OD 2004-05-03 #i27224# +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: SdrObject& rRefObj; // Referenziertes Zeichenobjekt Rectangle aSnapRect; diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 3523308b6e8f..02181afb1674 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -403,6 +403,7 @@ public: // #110094# DrawContact section private: sdr::contact::ViewContact* mpViewContact; +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 940b882f2e7c..d8d66838c3eb 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1709,19 +1709,6 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm if(aNewB2DPolyPolygon.count()) { - if( !bLineGeometryNeededOnly ) - { - // hack aNewB2DPolyPolygon to fill logic rect - this is - // needed to produce gradient fills that look like mso - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(0,0)); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(), - aLogicRect.GetHeight())); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - } // #i37011# bool bForceCreateTwoObjects(false); diff --git a/svx/source/sdr/properties/makefile.mk b/svx/source/sdr/properties/makefile.mk index 04e96dd6c24d..8e0fe5955a03 100644 --- a/svx/source/sdr/properties/makefile.mk +++ b/svx/source/sdr/properties/makefile.mk @@ -51,6 +51,7 @@ SLOFILES=\ $(SLO)$/textproperties.obj \ $(SLO)$/customshapeproperties.obj \ $(SLO)$/rectangleproperties.obj \ + $(SLO)$/oleproperties.obj \ $(SLO)$/captionproperties.obj \ $(SLO)$/circleproperties.obj \ $(SLO)$/connectorproperties.obj \ diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 652327f3ff85..9cee1e344c6a 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -76,7 +76,8 @@ namespace sdr { if(!mpViewContact) { - ((MasterPageDescriptor*)this)->mpViewContact = ((MasterPageDescriptor*)this)->CreateObjectSpecificViewContact(); + const_cast< MasterPageDescriptor* >(this)->mpViewContact = + const_cast< MasterPageDescriptor* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index dd3006ba9a6d..0b34c5cc4e81 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -678,7 +678,7 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay createSdrDragEntries(); } - // if there are entries, derive OverlayObjects fromthe entries, including + // if there are entries, derive OverlayObjects from the entries, including // modification from current interactive state if(maSdrDragEntries.size()) { @@ -823,7 +823,18 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla // this polygon is a temporary calculated connector path, so it is not possible to fetch // the needed primitives directly from the pEdge object which does not get changed. If full // drag is on, use the SdrObjects ItemSet to create a adequate representation - if(getSolidDraggingActive()) + bool bUseSolidDragging(getSolidDraggingActive()); + + if(bUseSolidDragging) + { + // switch off solid dragging if connector is not visible + if(!pEdge->HasLineStyle()) + { + bUseSolidDragging = false; + } + } + + if(bUseSolidDragging) { const SfxItemSet& rItemSet = pEdge->GetMergedItemSet(); const drawinglayer::attribute::SdrLineAttribute aLine( diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index d3202e389f83..7bd47ae80616 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -284,13 +284,13 @@ SdrHdlBitmapSet& getSimpleSet() SdrHdlBitmapSet& getModernSet() { - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS)); return *aModernSet.get(); } SdrHdlBitmapSet& getHighContrastSet() { - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS)); return *aHighContrastSet.get(); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index fb26d7b5fc9c..3ed33e0f20ad 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -329,7 +329,8 @@ sdr::properties::BaseProperties& SdrObject::GetProperties() const { if(!mpProperties) { - ((SdrObject*)this)->mpProperties = ((SdrObject*)this)->CreateObjectSpecificProperties(); + const_cast< SdrObject* >(this)->mpProperties = + const_cast< SdrObject* >(this)->CreateObjectSpecificProperties(); } return *mpProperties; @@ -364,7 +365,8 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const { if(!mpViewContact) { - ((SdrObject*)this)->mpViewContact = ((SdrObject*)this)->CreateObjectSpecificViewContact(); + const_cast< SdrObject* >(this)->mpViewContact = + const_cast< SdrObject* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 20587f715c81..89d9221a8552 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -83,7 +83,7 @@ sdr::properties::BaseProperties* SdrObjGroup::CreateObjectSpecificProperties() { - return new sdr::properties::GroupProperties((SdrObject&)(*this)); + return new sdr::properties::GroupProperties(*this); } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 67505e12ba73..69599790ab1b 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -89,6 +89,7 @@ #include #include #include +#include // #i100710# #include @@ -735,6 +736,14 @@ static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObj } } +////////////////////////////////////////////////////////////////////////////// +// BaseProperties section + +sdr::properties::BaseProperties* SdrOle2Obj::CreateObjectSpecificProperties() +{ + return new sdr::properties::OleProperties(*this); +} + ////////////////////////////////////////////////////////////////////////////// // DrawContact section diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index a8cbfbb24c3d..864cc3d77e8d 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1168,7 +1168,8 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const { if(!mpViewContact) { - ((SdrPage*)this)->mpViewContact = ((SdrPage*)this)->CreateObjectSpecificViewContact(); + const_cast< SdrPage* >(this)->mpViewContact = + const_cast< SdrPage* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 97e06fd4bb61..2fa47ed0b119 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2575,7 +2575,7 @@ basegfx::B2DPolyPolygon SdrTableObj::getSpecialDragPoly(const SdrDragStat& rDrag basegfx::B2DPolyPolygon aRetval; const SdrHdl* pHdl = rDrag.GetHdl(); - if(HDL_USER == pHdl->GetKind()) + if(pHdl && HDL_USER == pHdl->GetKind()) { const TableEdgeHdl* pEdgeHdl = dynamic_cast< const TableEdgeHdl* >( pHdl ); diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 2c2e1bb9df83..b034fafe7994 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include namespace sdr { namespace table { @@ -245,11 +245,11 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb } else { - // embed in 100% transparent UnifiedTransparencePrimitive2D to support HitTest - // of this overlay object + // embed in HiddenGeometryPrimitive2D to support HitTest of this invisible + // overlay object const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); const drawinglayer::primitive2d::Primitive2DReference aNewReference( - new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aSequence, 1.0)); + new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(aSequence)); aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index b4a941413e70..0afa4aa50096 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -98,47 +98,42 @@ namespace drawinglayer Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { + // prepare unit polygon Primitive2DSequence aRetval; + const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); - if(!getSdrFTAttribute().getFill().isDefault() - || !getSdrFTAttribute().getText().isDefault()) + // add fill + if(!getSdrFTAttribute().getFill().isDefault()) { - // prepare unit polygon - const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); - - // add fill - if(!getSdrFTAttribute().getFill().isDefault()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive( - aUnitPolyPolygon, - getTransform(), - getSdrFTAttribute().getFill(), - getSdrFTAttribute().getFillFloatTransGradient())); - } - else - { - // if no fill create one for HitTest and BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createHiddenGeometryPrimitives2D( - true, - aUnitPolyPolygon, - getTransform())); - } + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getFill(), + getSdrFTAttribute().getFillFloatTransGradient())); + } + else + { + // if no fill create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, + aUnitPolyPolygon, + getTransform())); + } - // add text - if(!getSdrFTAttribute().getText().isDefault()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createTextPrimitive( - aUnitPolyPolygon, - getTransform(), - getSdrFTAttribute().getText(), - attribute::SdrLineAttribute(), - true, - false, - false)); - } + // add text + if(!getSdrFTAttribute().getText().isDefault()) + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getText(), + attribute::SdrLineAttribute(), + true, + false, + false)); } return aRetval; -- cgit v1.2.3 From 2bb7512e2923c860fa6d6bb55dcb000737f3a7ec Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 2 Feb 2010 12:16:54 +0100 Subject: aw079 #i108440# Support MetaStretchTextAction in MetafilePrimitive2D decomposition --- .../drawinglayer/primitive2d/textlayoutdevice.hxx | 21 ++- .../source/primitive2d/metafileprimitive2d.cxx | 176 +++++++++++++++++---- .../source/primitive2d/textlayoutdevice.cxx | 69 ++++++-- 3 files changed, 214 insertions(+), 52 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index f3de43c22fd7..2d2f77f34fe5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -101,20 +101,20 @@ namespace drawinglayer double getTextWidth( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const; + sal_uInt32 nIndex, + sal_uInt32 nLength) const; bool getTextOutlines( basegfx::B2DPolyPolygonVector&, const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength, - const ::std::vector< double >& rDXArray); + sal_uInt32 nIndex, + sal_uInt32 nLength, + const ::std::vector< double >& rDXArray) const; basegfx::B2DRange getTextBoundRect( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const; + sal_uInt32 nIndex, + sal_uInt32 nLength) const; double getFontAscent() const; double getFontDescent() const; @@ -123,7 +123,12 @@ namespace drawinglayer const Rectangle& rRectangle, const String& rText, sal_uInt16 nStyle, - GDIMetaFile& rGDIMetaFile); + GDIMetaFile& rGDIMetaFile) const; + + ::std::vector< double > getTextArray( + const String& rText, + sal_uInt32 nIndex, + sal_uInt32 nLength) const; }; } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 4bb123380ee6..e621bed175e8 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -981,7 +981,42 @@ namespace TargetHolders& rTargetHolders, PropertyHolders& rPropertyHolders) { - // process evtl. created primitives which belong to the current region settings + const bool bNewActive(pRegion && !pRegion->IsEmpty()); + + // #i108636# The handlig of new ClipRegions was not done as good as possible + // in the first version of this interpreter; e.g. when a ClipRegion was set + // initially and then using a lot of push/pop actions, the pop always leads + // to setting a 'new' ClipRegion which indeed is the return to the ClipRegion + // of the properties next on the stack. + // This ClipRegion is identical to the current one, so there is no need to + // create a MaskPrimitive2D containing the up-to-now created primitives, but + // this was done before. While this does not lead to wrong primitive + // representations of the metafile data, it creates unneccesarily expensive + // representations. Just detecting when no really 'new' ClipRegion gets set + // solves the problem. + + if(!rPropertyHolders.Current().getRegionActive() && !bNewActive) + { + // no active region exchanged by no new one, done + return; + } + + if(rPropertyHolders.Current().getRegionActive() && bNewActive) + { + // active region and new active region + if(rPropertyHolders.Current().getRegion() == *pRegion) + { + // new region is the same as the old region, done + return; + } + } + + // Here the old region and the new one are definitively different, maybe + // old one and/or new one is not active. + + // Handle deletion of old region.The process evtl. created primitives which + // belong to this active region. These need to be embedded to a + // MaskPrimitive2D accordingly. if(rPropertyHolders.Current().getRegionActive() && rTargetHolders.size() > 1) { drawinglayer::primitive2d::Primitive2DSequence aSubContent; @@ -1001,8 +1036,8 @@ namespace } } - // apply new settings - const bool bNewActive(pRegion && !pRegion->IsEmpty()); + // apply new settings to current properties by setting + // the new region now rPropertyHolders.Current().setRegionActive(bNewActive); if(bNewActive) @@ -1259,13 +1294,12 @@ namespace const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLength, - sal_Int32* pDXArray, + const ::std::vector< double >& rDXArray, TargetHolder& rTarget, PropertyHolder& rProperty) { drawinglayer::primitive2d::BasePrimitive2D* pResult = 0; const Font& rFont = rProperty.getFont(); - std::vector< double > aDXArray; basegfx::B2DVector aAlignmentOffset(0.0, 0.0); if(nTextLength) @@ -1283,17 +1317,6 @@ namespace // add TextStartPosition aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); - // preapare DXArray (if used) - if(pDXArray && nTextLength) - { - aDXArray.reserve(nTextLength); - - for(xub_StrLen a(0); a < nTextLength; a++) - { - aDXArray.push_back((double)(*(pDXArray + a))); - } - } - // prepare FontColor and Locale const basegfx::BColor aFontColor(rProperty.getTextColor()); const com::sun::star::lang::Locale aLocale(MsLangId::convertLanguageToLocale(rProperty.getLanguageType())); @@ -1353,7 +1376,7 @@ namespace rText, nTextStart, nTextLength, - aDXArray, + rDXArray, aFontAttribute, aLocale, aFontColor, @@ -1380,7 +1403,7 @@ namespace rText, nTextStart, nTextLength, - aDXArray, + rDXArray, aFontAttribute, aLocale, aFontColor); @@ -1396,13 +1419,13 @@ namespace // get text width double fTextWidth(0.0); - if(aDXArray.empty()) + if(rDXArray.empty()) { fTextWidth = aTextLayouterDevice.getTextWidth(rText, nTextStart, nTextLength); } else { - fTextWidth = aDXArray.back(); + fTextWidth = rDXArray.back(); } if(basegfx::fTools::more(fTextWidth, 0.0)) @@ -1957,15 +1980,24 @@ namespace { /** CHECKED, WORKS WELL */ const MetaTextAction* pA = (const MetaTextAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); + + if(nTextLength + nTextIndex > nStringLength) + { + nTextLength = nStringLength - nTextIndex; + } - if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive()) + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) { + const std::vector< double > aDXArray; proccessMetaTextAction( pA->GetPoint(), pA->GetText(), - pA->GetIndex(), - pA->GetLen(), - 0, + nTextIndex, + nTextLength, + aDXArray, rTargetHolders.Current(), rPropertyHolders.Current()); } @@ -1976,15 +2008,37 @@ namespace { /** CHECKED, WORKS WELL */ const MetaTextArrayAction* pA = (const MetaTextArrayAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); - if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive()) + if(nTextLength + nTextIndex > nStringLength) { + nTextLength = nStringLength - nTextIndex; + } + + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) + { + // preapare DXArray (if used) + std::vector< double > aDXArray; + sal_Int32* pDXArray = pA->GetDXArray(); + + if(pDXArray) + { + aDXArray.reserve(nTextLength); + + for(sal_uInt32 a(0); a < nTextLength; a++) + { + aDXArray.push_back((double)(*(pDXArray + a))); + } + } + proccessMetaTextAction( pA->GetPoint(), pA->GetText(), - pA->GetIndex(), - pA->GetLen(), - pA->GetDXArray(), + nTextIndex, + nTextLength, + aDXArray, rTargetHolders.Current(), rPropertyHolders.Current()); } @@ -1993,10 +2047,65 @@ namespace } case META_STRETCHTEXT_ACTION : { - /** NEEDS IMPLEMENTATION */ - OSL_ENSURE(false, "META_STRETCHTEXT_ACTION requested (!)"); - // use OutputDevice::GetTextArray() to map the... - // const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; + // #i108440# StarMath uses MetaStretchTextAction, thus support is needed. + // It looks as if it pretty never really uses a width different from + // the default text-layout width, but it's not possible to be sure. + // Implemented getting the DXArray and checking for scale at all. If + // scale is more than 3.5% different, scale the DXArray before usage. + // New status: + + /** CHECKED, WORKS WELL */ + const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); + + if(nTextLength + nTextIndex > nStringLength) + { + nTextLength = nStringLength - nTextIndex; + } + + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) + { + drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; + aTextLayouterDevice.setFont(rPropertyHolders.Current().getFont()); + + ::std::vector< double > aTextArray( + aTextLayouterDevice.getTextArray( + pA->GetText(), + nTextIndex, + nTextLength)); + + if(!aTextArray.empty()) + { + const double fTextLength(aTextArray.back()); + + if(0.0 != fTextLength && pA->GetWidth()) + { + const double fRelative(pA->GetWidth() / fTextLength); + + if(fabs(fRelative - 1.0) >= 0.035) + { + // when derivation is more than 3,5% from default text size, + // scale the DXArray + for(sal_uInt32 a(0); a < aTextArray.size(); a++) + { + aTextArray[a] *= fRelative; + } + } + } + } + + proccessMetaTextAction( + pA->GetPoint(), + pA->GetText(), + nTextIndex, + nTextLength, + aTextArray, + rTargetHolders.Current(), + rPropertyHolders.Current()); + } + break; } case META_TEXTRECT_ACTION : @@ -2005,8 +2114,9 @@ namespace // OSL_ENSURE(false, "META_TEXTRECT_ACTION requested (!)"); const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction; const Rectangle& rRectangle = pA->GetRect(); + const sal_uInt32 nStringLength(pA->GetText().Len()); - if(!rRectangle.IsEmpty() && 0 != pA->GetText().Len()) + if(!rRectangle.IsEmpty() && 0 != nStringLength) { // The problem with this action is that it describes unlayouted text // and the layout capabilities are in EditEngine/Outliner in SVX. The diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 2950427d6b57..c7e2fcebb96f 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -223,8 +223,8 @@ namespace drawinglayer double TextLayouterDevice::getTextWidth( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const + sal_uInt32 nIndex, + sal_uInt32 nLength) const { return mrDevice.GetTextWidth(rText, nIndex, nLength); } @@ -232,15 +232,22 @@ namespace drawinglayer bool TextLayouterDevice::getTextOutlines( basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector, const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength, - const ::std::vector< double >& rDXArray) + sal_uInt32 nIndex, + sal_uInt32 nLength, + const ::std::vector< double >& rDXArray) const { const sal_uInt32 nDXArrayCount(rDXArray.size()); + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } if(nDXArrayCount) { - OSL_ENSURE(nDXArrayCount == nLength, "DXArray size does not correspond to text portion size (!)"); + OSL_ENSURE(nDXArrayCount == nTextLength, "DXArray size does not correspond to text portion size (!)"); std::vector< sal_Int32 > aIntegerDXArray(nDXArrayCount); for(sal_uInt32 a(0); a < nDXArrayCount; a++) @@ -274,10 +281,18 @@ namespace drawinglayer basegfx::B2DRange TextLayouterDevice::getTextBoundRect( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const + sal_uInt32 nIndex, + sal_uInt32 nLength) const { - if(nLength) + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + + if(nTextLength) { Rectangle aRect; @@ -291,7 +306,9 @@ namespace drawinglayer // #i104432#, #i102556# take empty results into account if(!aRect.IsEmpty()) { - return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + return basegfx::B2DRange( + aRect.Left(), aRect.Top(), + aRect.Right(), aRect.Bottom()); } } @@ -314,11 +331,41 @@ namespace drawinglayer const Rectangle& rRectangle, const String& rText, sal_uInt16 nStyle, - GDIMetaFile& rGDIMetaFile) + GDIMetaFile& rGDIMetaFile) const { mrDevice.AddTextRectActions( rRectangle, rText, nStyle, rGDIMetaFile); } + + ::std::vector< double > TextLayouterDevice::getTextArray( + const String& rText, + sal_uInt32 nIndex, + sal_uInt32 nLength) const + { + ::std::vector< double > aRetval; + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + + if(nTextLength) + { + aRetval.reserve(nTextLength); + sal_Int32* pArray = new sal_Int32[nTextLength]; + mrDevice.GetTextArray(rText, pArray, nIndex, nLength); + + for(sal_uInt32 a(0); a < nTextLength; a++) + { + aRetval.push_back(pArray[a]); + } + } + + return aRetval; + } + } // end of namespace primitive2d } // end of namespace drawinglayer -- cgit v1.2.3 From 3497a025cea0fc5fc0a7ca3ad835b17c6ae38573 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 10 Feb 2010 12:16:22 +0100 Subject: aw079: changes after resync (linux) --- drawinglayer/source/primitive2d/metafileprimitive2d.cxx | 2 +- drawinglayer/source/primitive2d/shadowprimitive2d.cxx | 2 +- .../source/primitive2d/unifiedtransparenceprimitive2d.cxx | 2 +- drawinglayer/source/processor2d/canvasprocessor.cxx | 2 +- drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 2 +- drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 2 +- drawinglayer/source/processor2d/vclprocessor2d.cxx | 2 +- drawinglayer/source/processor3d/shadow3dextractor.cxx | 2 +- svx/source/svdraw/svdpage.cxx | 8 +++++--- 9 files changed, 13 insertions(+), 11 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index e621bed175e8..9d497ffe65e8 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index 7d8abd5490fb..c5ca479504a2 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx index b0905b2adf39..6d930e40f5d7 100644 --- a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx @@ -36,7 +36,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_drawinglayer.hxx" -#include +#include #include #include #include diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index d089e6a440de..6bb825a7b476 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -70,7 +70,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 687bb751ca20..f96dccab39b4 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 9161f8d4c59d..e0ba7ae53000 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 1c1865c13f75..8f9fca8286d0 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index 6e7b6a587b1e..a3f75073731b 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index b53606d53aeb..7516148d7a47 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1214,7 +1214,8 @@ void ImpPageChange(SdrPage& rSdrPage) } SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) -: mpSdrPage(&rSdrPage), +: SfxListener(), + mpSdrPage(&rSdrPage), mpStyleSheet(0), mpProperties(new SfxItemSet(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST)) { @@ -1225,7 +1226,8 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) } SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) -: mpSdrPage(rCandidate.mpSdrPage), +: SfxListener(), + mpSdrPage(rCandidate.mpSdrPage), mpStyleSheet(0), mpProperties(new SfxItemSet(*rCandidate.mpProperties)) { @@ -1241,7 +1243,7 @@ SdrPageProperties::~SdrPageProperties() delete mpProperties; } -void SdrPageProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) +void SdrPageProperties::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint); -- cgit v1.2.3