summaryrefslogtreecommitdiff
path: root/drawinglayer/source
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source')
-rw-r--r--drawinglayer/source/attribute/fillattribute.cxx94
-rw-r--r--drawinglayer/source/attribute/fillbitmapattribute.cxx153
-rw-r--r--drawinglayer/source/attribute/fillgradientattribute.cxx250
-rw-r--r--drawinglayer/source/attribute/fillhatchattribute.cxx219
-rw-r--r--drawinglayer/source/attribute/fontattribute.cxx220
-rw-r--r--drawinglayer/source/attribute/lineattribute.cxx142
-rw-r--r--drawinglayer/source/attribute/linestartendattribute.cxx148
-rw-r--r--drawinglayer/source/attribute/makefile.mk27
-rw-r--r--drawinglayer/source/attribute/materialattribute3d.cxx93
-rw-r--r--drawinglayer/source/attribute/sdrallattribute3d.cxx169
-rw-r--r--drawinglayer/source/attribute/sdrattribute.cxx285
-rw-r--r--drawinglayer/source/attribute/sdrattribute3d.cxx211
-rw-r--r--drawinglayer/source/attribute/sdrfillattribute.cxx221
-rw-r--r--drawinglayer/source/attribute/sdrfillbitmapattribute.cxx259
-rw-r--r--drawinglayer/source/attribute/sdrlightattribute3d.cxx196
-rw-r--r--drawinglayer/source/attribute/sdrlightingattribute3d.cxx235
-rw-r--r--drawinglayer/source/attribute/sdrlineattribute.cxx250
-rw-r--r--drawinglayer/source/attribute/sdrlinestartendattribute.cxx254
-rw-r--r--drawinglayer/source/attribute/sdrobjectattribute3d.cxx292
-rw-r--r--drawinglayer/source/attribute/sdrsceneattribute3d.cxx218
-rw-r--r--drawinglayer/source/attribute/sdrshadowattribute.cxx193
-rw-r--r--drawinglayer/source/attribute/strokeattribute.cxx139
-rw-r--r--drawinglayer/source/geometry/viewinformation2d.cxx47
-rw-r--r--drawinglayer/source/geometry/viewinformation3d.cxx47
-rw-r--r--drawinglayer/source/primitive2d/alphaprimitive2d.cxx70
-rw-r--r--drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx78
-rw-r--r--drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx46
-rw-r--r--drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx109
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx6
-rw-r--r--drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx75
-rw-r--r--drawinglayer/source/primitive2d/hittestprimitive2d.cxx68
-rw-r--r--drawinglayer/source/primitive2d/makefile.mk89
-rw-r--r--drawinglayer/source/primitive2d/mediaprimitive2d.cxx17
-rw-r--r--drawinglayer/source/primitive2d/metafileprimitive2d.cxx207
-rw-r--r--drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx5
-rw-r--r--drawinglayer/source/primitive2d/polygonprimitive2d.cxx31
-rw-r--r--drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx105
-rw-r--r--drawinglayer/source/primitive2d/sceneprimitive2d.cxx14
-rw-r--r--drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx130
-rw-r--r--drawinglayer/source/primitive2d/shadowprimitive2d.cxx4
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx69
-rw-r--r--drawinglayer/source/primitive2d/transparenceprimitive2d.cxx78
-rw-r--r--drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx121
-rw-r--r--drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx136
-rw-r--r--drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx3
-rw-r--r--drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx6
-rw-r--r--drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx76
-rw-r--r--drawinglayer/source/primitive3d/hittestprimitive3d.cxx68
-rw-r--r--drawinglayer/source/primitive3d/makefile.mk2
-rw-r--r--drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx4
-rw-r--r--drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx37
-rw-r--r--drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx88
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx45
-rw-r--r--drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx47
-rw-r--r--drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx44
-rw-r--r--drawinglayer/source/primitive3d/sdrprimitive3d.cxx16
-rw-r--r--drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx38
-rw-r--r--drawinglayer/source/primitive3d/textureprimitive3d.cxx28
-rw-r--r--drawinglayer/source/processor2d/canvasprocessor.cxx141
-rw-r--r--drawinglayer/source/processor2d/contourextractor2d.cxx10
-rw-r--r--drawinglayer/source/processor2d/hittestprocessor2d.cxx73
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.cxx4
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.hxx2
-rw-r--r--drawinglayer/source/processor2d/vclhelpergradient.cxx16
-rw-r--r--drawinglayer/source/processor2d/vclhelpergradient.hxx3
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx262
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx76
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx201
-rw-r--r--drawinglayer/source/processor3d/cutfindprocessor3d.cxx50
-rw-r--r--drawinglayer/source/processor3d/defaultprocessor3d.cxx64
-rw-r--r--drawinglayer/source/processor3d/geometry2dextractor.cxx4
-rw-r--r--drawinglayer/source/processor3d/shadow3dextractor.cxx4
-rw-r--r--drawinglayer/source/processor3d/zbufferprocessor3d.cxx335
-rw-r--r--drawinglayer/source/texture/texture.cxx130
-rw-r--r--drawinglayer/source/texture/texture3d.cxx3
75 files changed, 5512 insertions, 2188 deletions
diff --git a/drawinglayer/source/attribute/fillattribute.cxx b/drawinglayer/source/attribute/fillattribute.cxx
deleted file mode 100644
index 431ee7b127..0000000000
--- a/drawinglayer/source/attribute/fillattribute.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <drawinglayer/attribute/fillattribute.hxx>
-#include <basegfx/numeric/ftools.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-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 6d39298335..a34e529e29 100644
--- a/drawinglayer/source/attribute/fillbitmapattribute.cxx
+++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx
@@ -29,6 +29,7 @@
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <vcl/bitmapex.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -36,25 +37,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 0000000000..0d38b27c91
--- /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 <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 0000000000..cc8b19edf0
--- /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 <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 9a85110e56..46ec067fec 100644
--- a/drawinglayer/source/attribute/fontattribute.cxx
+++ b/drawinglayer/source/attribute/fontattribute.cxx
@@ -29,6 +29,7 @@
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/attribute/fontattribute.hxx>
+#include <tools/string.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -36,18 +37,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 2bf289bdcc..7b4fb98db3 100644
--- a/drawinglayer/source/attribute/lineattribute.cxx
+++ b/drawinglayer/source/attribute/lineattribute.cxx
@@ -29,6 +29,7 @@
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/attribute/lineattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -36,6 +37,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 8609864f5b..0ff284d9a2 100644
--- a/drawinglayer/source/attribute/linestartendattribute.cxx
+++ b/drawinglayer/source/attribute/linestartendattribute.cxx
@@ -30,6 +30,7 @@
#include <drawinglayer/attribute/linestartendattribute.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -37,11 +38,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 291cf313a6..32cef7c7b4 100644
--- a/drawinglayer/source/attribute/makefile.mk
+++ b/drawinglayer/source/attribute/makefile.mk
@@ -37,16 +37,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 fefec06829..615a951d67 100644
--- a/drawinglayer/source/attribute/materialattribute3d.cxx
+++ b/drawinglayer/source/attribute/materialattribute3d.cxx
@@ -40,74 +40,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)
@@ -128,6 +141,11 @@ namespace drawinglayer
}
}
+ bool MaterialAttribute3D::isDefault() const
+ {
+ return mpMaterialAttribute3D == ImpMaterialAttribute3D::get_global_default();
+ }
+
MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D& rCandidate)
{
if(rCandidate.mpMaterialAttribute3D != mpMaterialAttribute3D)
@@ -155,6 +173,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 e7838f2a4b..ca8cb2d679 100644
--- a/drawinglayer/source/attribute/sdrallattribute3d.cxx
+++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx
@@ -29,12 +29,6 @@
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/attribute/sdrallattribute3d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-// pointer compare define
-#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
//////////////////////////////////////////////////////////////////////////////
@@ -42,150 +36,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)
+ 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)
{
}
- SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(
- const SdrLineFillShadowAttribute& rCandidate)
- : mpShadow(0),
- mpLine(0),
- mpLineStartEnd(0),
- mpFill(0),
- mpFillFloatTransGradient(0)
+ SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D()
+ : maLine(),
+ maFill(),
+ maLineStartEnd(),
+ maShadow(),
+ maFillFloatTransGradient()
{
- *this = rCandidate;
}
- SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute()
+ bool SdrLineFillShadowAttribute3D::isDefault() const
{
- delete mpShadow;
- delete mpLine;
- delete mpLineStartEnd;
- delete mpFill;
- delete mpFillFloatTransGradient;
+ return(getLine().isDefault()
+ && getFill().isDefault()
+ && getLineStartEnd().isDefault()
+ && getShadow().isDefault()
+ && getFillFloatTransGradient().isDefault());
}
- SdrLineFillShadowAttribute& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute& rCandidate)
+ bool SdrLineFillShadowAttribute3D::operator==(const SdrLineFillShadowAttribute3D& rCandidate) 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;
- }
-
- bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute& 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 b33c8176ca..0000000000
--- a/drawinglayer/source/attribute/sdrattribute.cxx
+++ /dev/null
@@ -1,285 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <drawinglayer/attribute/sdrattribute.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
-#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-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 f85892c9c0..0000000000
--- a/drawinglayer/source/attribute/sdrattribute3d.cxx
+++ /dev/null
@@ -1,211 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-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 0000000000..1953a1d292
--- /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 <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 f177345342..7614e83c12 100644
--- a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
@@ -30,8 +30,7 @@
#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
-#include <basegfx/numeric/ftools.hxx>
-#include <basegfx/range/b2drange.hxx>
+#include <vcl/bitmapex.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -39,37 +38,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
@@ -77,17 +252,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);
@@ -103,7 +278,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);
@@ -129,7 +304,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);
@@ -137,15 +312,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
@@ -153,15 +328,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
@@ -170,7 +345,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())
@@ -182,9 +357,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
@@ -197,9 +372,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
@@ -220,7 +395,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 0000000000..c54f3490b1
--- /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 <drawinglayer/attribute/sdrlightattribute3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 0000000000..e5002fd261
--- /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 <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 0000000000..4490176a3e
--- /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 <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 0000000000..4f73f8654d
--- /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 <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 0000000000..09ec55cb0f
--- /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 <drawinglayer/attribute/sdrobjectattribute3d.hxx>
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 0000000000..ffd774c89c
--- /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 <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 0000000000..429d920030
--- /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 <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 3f3fd47ab0..67d90e951b 100644
--- a/drawinglayer/source/attribute/strokeattribute.cxx
+++ b/drawinglayer/source/attribute/strokeattribute.cxx
@@ -37,16 +37,143 @@ namespace drawinglayer
{
namespace attribute
{
- double StrokeAttribute::getFullDotDashLen() const
+ class ImpStrokeAttribute
{
- if(0.0 == mfFullDotDashLen && maDotDashArray.size())
+ 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
{
- // calculate length on demand
- const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0));
- const_cast< StrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated;
+ 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(rCandidate.mpStrokeAttribute == mpStrokeAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpStrokeAttribute == *mpStrokeAttribute);
+ }
+
+ const ::std::vector< double >& StrokeAttribute::getDotDashArray() const
+ {
+ return mpStrokeAttribute->getDotDashArray();
+ }
- return mfFullDotDashLen;
+ 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 8bcb3ccc14..cb8bcdc143 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -305,6 +305,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;
@@ -402,6 +418,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
@@ -434,6 +465,12 @@ namespace drawinglayer
{
}
+ ViewInformation2D::ViewInformation2D()
+ : mpViewInformation2D(ImpViewInformation2D::get_global_default())
+ {
+ mpViewInformation2D->mnRefCount++;
+ }
+
ViewInformation2D::ViewInformation2D(const ViewInformation2D& rCandidate)
: mpViewInformation2D(rCandidate.mpViewInformation2D)
{
@@ -455,6 +492,11 @@ namespace drawinglayer
}
}
+ bool ViewInformation2D::isDefault() const
+ {
+ return mpViewInformation2D == ImpViewInformation2D::get_global_default();
+ }
+
ViewInformation2D& ViewInformation2D::operator=(const ViewInformation2D& rCandidate)
{
::osl::Mutex m_mutex;
@@ -481,6 +523,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 b884c359d0..316d2e4d52 100644
--- a/drawinglayer/source/geometry/viewinformation3d.cxx
+++ b/drawinglayer/source/geometry/viewinformation3d.cxx
@@ -387,6 +387,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; }
@@ -432,6 +444,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
@@ -449,7 +476,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))
{
}
@@ -458,6 +487,12 @@ namespace drawinglayer
{
}
+ ViewInformation3D::ViewInformation3D()
+ : mpViewInformation3D(ImpViewInformation3D::get_global_default())
+ {
+ mpViewInformation3D->mnRefCount++;
+ }
+
ViewInformation3D::ViewInformation3D(const ViewInformation3D& rCandidate)
: mpViewInformation3D(rCandidate.mpViewInformation3D)
{
@@ -479,6 +514,11 @@ namespace drawinglayer
}
}
+ bool ViewInformation3D::isDefault() const
+ {
+ return mpViewInformation3D == ImpViewInformation3D::get_global_default();
+ }
+
ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D& rCandidate)
{
::osl::Mutex m_mutex;
@@ -505,6 +545,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 3d0f1ed69d..0000000000
--- a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
-#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-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 74aa857012..1d40970524 100644
--- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx
@@ -48,46 +48,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);
}
}
@@ -119,7 +127,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 d985edae7b..d20952a95d 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -54,10 +54,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)
{
@@ -74,46 +74,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;
@@ -210,15 +210,19 @@ 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);
+ aUnitPolygon = basegfx::tools::createPolygonFromCircle(
+ basegfx::B2DPoint(0,0), 1);
+ }
+ else if(attribute::GRADIENTSTYLE_LINEAR == maFillGradient.getStyle())
+ {
+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0, 0, 1, 1));
}
else
{
- aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0));
+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
}
// get the transform matrices and colors (where colors
@@ -245,7 +249,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(
@@ -264,7 +276,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 2bdfbb30e7..2410764b4a 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -49,65 +49,72 @@ 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;
-
- // get hatch transformations
- switch(maFillHatch.getStyle())
+ Primitive2DSequence aRetval;
+ 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;
@@ -131,8 +138,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 ff5e38af4d..fd4467d449 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -764,9 +764,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(
@@ -872,7 +870,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 0000000000..6e913a07d3
--- /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 <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 b299349c1e..0000000000
--- a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
-#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-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/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index 87c6c15437..bca5805ae6 100644
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -37,50 +37,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 e488aacfa8..2467776ab0 100644
--- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
@@ -38,6 +38,7 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -50,9 +51,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
@@ -79,10 +83,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 ab78bc3456..9d65643a27 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -45,10 +45,10 @@
#include <drawinglayer/primitive2d/discretebitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <vcl/salbtype.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
#include <vcl/svapp.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx>
@@ -581,7 +581,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
@@ -833,7 +840,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)
@@ -966,7 +973,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;
@@ -986,8 +1028,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)
@@ -1244,13 +1286,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)
@@ -1268,17 +1309,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()));
@@ -1338,7 +1368,7 @@ namespace
rText,
nTextStart,
nTextLength,
- aDXArray,
+ rDXArray,
aFontAttribute,
aLocale,
aFontColor,
@@ -1365,7 +1395,7 @@ namespace
rText,
nTextStart,
nTextLength,
- aDXArray,
+ rDXArray,
aFontAttribute,
aLocale,
aFontColor);
@@ -1381,13 +1411,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))
@@ -1942,15 +1972,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());
}
@@ -1961,15 +2000,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(nTextLength + nTextIndex > nStringLength)
+ {
+ nTextLength = nStringLength - nTextIndex;
+ }
- if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive())
+ 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());
}
@@ -1978,10 +2039,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 :
@@ -1990,8 +2106,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
@@ -2720,7 +2837,7 @@ namespace
if(aSubContent.hasElements())
{
rTargetHolders.Current().append(
- new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
aSubContent,
nTransparence * 0.01));
}
@@ -2831,9 +2948,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()));
}
@@ -2845,17 +2962,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 f5f2b393e3..e7bd3e45b4 100644
--- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
@@ -69,7 +69,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 ffe14e9738..43adc24a17 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -35,6 +35,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <basegfx/polygon/b2dlinegeometry.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -235,7 +236,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);
@@ -243,12 +244,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);
@@ -285,7 +288,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);
}
}
@@ -511,7 +518,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(
@@ -522,7 +529,7 @@ namespace drawinglayer
fStart *= 0.8;
}
- if(getEnd().isActive())
+ if(!getEnd().isDefault() && getEnd().isActive())
{
// create end arrow primitive and consume
aArrowB = basegfx::tools::createAreaGeometryForLineStartEnd(
@@ -545,18 +552,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 accad5c51e..8a2e6dce75 100644
--- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
@@ -188,7 +188,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;
@@ -276,11 +278,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()));
}
}
@@ -398,16 +403,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(
@@ -445,16 +458,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(
@@ -495,21 +516,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 b5305c32ed..f213162b71 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -148,8 +148,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))
{
@@ -162,6 +164,7 @@ namespace drawinglayer
basegfx::B2DRange aDiscreteRange;
basegfx::B2DRange aVisibleDiscreteRange;
basegfx::B2DRange aUnitVisibleRange;
+
calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange);
if(!aVisibleDiscreteRange.isEmpty())
@@ -227,8 +230,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());
@@ -254,7 +258,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 0000000000..e142deafdb
--- /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 <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 fd537460c6..862f5cc5e3 100644
--- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
@@ -33,8 +33,8 @@
#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <basegfx/tools/canvastools.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 0f5b70e1ee..8d39dd2d55 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -215,8 +215,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);
}
@@ -224,15 +224,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++)
@@ -266,10 +273,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;
@@ -283,7 +298,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());
}
}
@@ -306,11 +323,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
diff --git a/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx
new file mode 100644
index 0000000000..0923234e67
--- /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 <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 6417d4a37d..0000000000
--- a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/color/bcolor.hxx>
-#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
-#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-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 0000000000..a97a921637
--- /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 <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 0e416b7993..2461a0496c 100644
--- a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx
@@ -215,7 +215,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/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
index e582adfa52..c3ccab34c7 100644
--- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
@@ -147,7 +147,7 @@ namespace drawinglayer
// get 2d range of texture coordinates
const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(aTexPolyPolygon));
const basegfx::BColor aHatchColor(getHatch().getColor());
- const double fAngle(-getHatch().getAngle());
+ const double fAngle(getHatch().getAngle());
::std::vector< basegfx::B2DHomMatrix > aMatrices;
// get hatch transformations
@@ -156,13 +156,13 @@ namespace drawinglayer
case attribute::HATCHSTYLE_TRIPLE:
{
// rotated 45 degrees
- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle + F_PI4);
+ texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI4);
aHatch.appendTransformations(aMatrices);
}
case attribute::HATCHSTYLE_DOUBLE:
{
// rotated 90 degrees
- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle + F_PI2);
+ texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI2);
aHatch.appendTransformations(aMatrices);
}
case attribute::HATCHSTYLE_SINGLE:
diff --git a/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx
new file mode 100644
index 0000000000..b0163afbfc
--- /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 <drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx>
+#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 8bf457008b..0000000000
--- a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
-#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-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 dfae99b810..afad990c0e 100644
--- a/drawinglayer/source/primitive3d/makefile.mk
+++ b/drawinglayer/source/primitive3d/makefile.mk
@@ -40,7 +40,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 b360c8b817..8a2776815a 100644
--- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
@@ -57,7 +57,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;
@@ -118,7 +118,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 04306b782c..d7bdb41cda 100644
--- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx
@@ -35,8 +35,9 @@
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -55,7 +56,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())
@@ -73,7 +74,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());
@@ -145,7 +146,7 @@ namespace drawinglayer
a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a)));
}
- if(getSdrLFSAttribute().getFill())
+ if(!getSdrLFSAttribute().getFill().isDefault())
{
// add fill
aRetval = create3DPolyPolygonFillPrimitives(
@@ -153,39 +154,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);
}
@@ -195,7 +190,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 e044a47033..9c50f25284 100644
--- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
@@ -31,14 +31,11 @@
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#include <basegfx/polygon/b3dpolygon.hxx>
#include <drawinglayer/attribute/strokeattribute.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#include <basegfx/polygon/b3dpolypolygon.hxx>
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <vcl/vclenum.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
#include <vcl/bmpacc.hxx>
@@ -47,8 +44,12 @@
#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
#include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
#include <drawinglayer/primitive3d/shadowprimitive3d.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <basegfx/range/b2drange.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -167,8 +168,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);
}
@@ -181,7 +182,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;
@@ -209,27 +210,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
@@ -247,14 +266,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);
}
}
@@ -284,6 +303,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 e863d60be4..6a5c743b90 100644
--- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
@@ -36,8 +36,9 @@
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <drawinglayer/geometry/viewinformation3d.hxx>
-#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -68,7 +69,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));
@@ -98,7 +99,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)
{
@@ -116,7 +117,7 @@ namespace drawinglayer
}
// texture coordinates
- if(getSdrLFSAttribute().getFill())
+ if(!getSdrLFSAttribute().getFill().isDefault())
{
applyTextureTo3DGeometry(
getSdr3DObjectAttribute().getTextureProjectionX(),
@@ -126,7 +127,7 @@ namespace drawinglayer
getTextureSize());
}
- if(getSdrLFSAttribute().getFill())
+ if(!getSdrLFSAttribute().getFill().isDefault())
{
// add fill
aRetval = create3DPolyPolygonFillPrimitives(
@@ -134,29 +135,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())
{
@@ -341,7 +334,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);
}
}
@@ -352,19 +346,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);
}
}
@@ -401,7 +398,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 c33fcc96ea..594a0797da 100644
--- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
@@ -36,8 +36,9 @@
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <drawinglayer/geometry/viewinformation3d.hxx>
-#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -69,7 +70,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);
@@ -91,7 +93,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)
{
@@ -109,7 +111,7 @@ namespace drawinglayer
}
// texture coordinates
- if(getSdrLFSAttribute().getFill())
+ if(!getSdrLFSAttribute().getFill().isDefault())
{
applyTextureTo3DGeometry(
getSdr3DObjectAttribute().getTextureProjectionX(),
@@ -119,7 +121,7 @@ namespace drawinglayer
getTextureSize());
}
- if(getSdrLFSAttribute().getFill())
+ if(!getSdrLFSAttribute().getFill().isDefault())
{
// add fill
aRetval = create3DPolyPolygonFillPrimitives(
@@ -127,29 +129,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())
{
@@ -183,7 +177,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);
}
}
@@ -194,19 +189,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);
}
}
@@ -254,7 +253,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 687ae40835..573d40961e 100644
--- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
@@ -32,8 +32,9 @@
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
-#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -58,7 +59,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())
{
@@ -76,7 +77,7 @@ namespace drawinglayer
}
// #i98314# texture coordinates
- if(getSdrLFSAttribute().getFill())
+ if(!getSdrLFSAttribute().getFill().isDefault())
{
applyTextureTo3DGeometry(
getSdr3DObjectAttribute().getTextureProjectionX(),
@@ -86,7 +87,7 @@ namespace drawinglayer
getTextureSize());
}
- if(getSdrLFSAttribute().getFill())
+ if(!getSdrLFSAttribute().getFill().isDefault())
{
// add fill
aRetval = create3DPolyPolygonFillPrimitives(
@@ -94,41 +95,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);
}
}
@@ -140,7 +136,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)
@@ -173,11 +169,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 df0dd80ebe..cd79c78bed 100644
--- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
@@ -29,9 +29,9 @@
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -48,11 +48,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);
@@ -75,11 +75,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);
@@ -93,7 +93,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 06e19603e0..565c258356 100644
--- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
@@ -35,8 +35,9 @@
#include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -60,7 +61,7 @@ namespace drawinglayer
getHorizontalSegments(), getVerticalSegments(), bCreateNormals));
// normal inversion
- if(getSdrLFSAttribute().getFill()
+ if(!getSdrLFSAttribute().getFill().isDefault()
&& bCreateNormals
&& getSdr3DObjectAttribute().getNormalsInvert()
&& aFill.areNormalsUsed())
@@ -70,7 +71,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());
@@ -134,7 +135,7 @@ namespace drawinglayer
a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a)));
}
- if(getSdrLFSAttribute().getFill())
+ if(!getSdrLFSAttribute().getFill().isDefault())
{
// add fill
aRetval = create3DPolyPolygonFillPrimitives(
@@ -142,39 +143,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);
}
@@ -184,7 +180,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 e06cd11895..99814a1dcc 100644
--- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
@@ -30,6 +30,7 @@
#include <drawinglayer/primitive3d/textureprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <basegfx/color/bcolor.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -73,7 +74,7 @@ namespace drawinglayer
{
namespace primitive3d
{
- UnifiedAlphaTexturePrimitive3D::UnifiedAlphaTexturePrimitive3D(
+ UnifiedTransparenceTexturePrimitive3D::UnifiedTransparenceTexturePrimitive3D(
double fTransparence,
const Primitive3DSequence& rChildren)
: TexturePrimitive3D(rChildren, basegfx::B2DVector(), false, false),
@@ -81,11 +82,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());
}
@@ -93,7 +94,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())
{
@@ -102,10 +110,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
@@ -116,7 +124,7 @@ namespace drawinglayer
}
// provide unique ID
- ImplPrimitrive3DIDBlock(UnifiedAlphaTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D)
+ ImplPrimitrive3DIDBlock(UnifiedTransparenceTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D)
} // end of namespace primitive3d
} // end of namespace drawinglayer
@@ -196,7 +204,7 @@ namespace drawinglayer
{
namespace primitive3d
{
- AlphaTexturePrimitive3D::AlphaTexturePrimitive3D(
+ TransparenceTexturePrimitive3D::TransparenceTexturePrimitive3D(
const attribute::FillGradientAttribute& rGradient,
const Primitive3DSequence& rChildren,
const basegfx::B2DVector& rTextureSize)
@@ -204,13 +212,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 561160b8a7..85a99a7741 100644
--- a/drawinglayer/source/processor2d/canvasprocessor.cxx
+++ b/drawinglayer/source/processor2d/canvasprocessor.cxx
@@ -53,7 +53,7 @@
#include <vclhelperbitmaptransform.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <basegfx/tuple/b2i64tuple.hxx>
#include <basegfx/range/b2irange.hxx>
#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
@@ -62,7 +62,7 @@
#include <com/sun/star/rendering/PathJoinType.hpp>
#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
#include <com/sun/star/rendering/TexturingMode.hpp>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <vclhelperbufferdevice.hxx>
#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
#include <helperchartrenderer.hxx>
@@ -380,7 +380,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
@@ -595,8 +595,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
@@ -969,10 +968,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());
@@ -980,7 +979,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 );
@@ -1299,7 +1298,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)
@@ -1372,8 +1371,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);
}
@@ -1578,7 +1577,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,
@@ -1611,12 +1610,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()));
@@ -1680,16 +1679,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;
@@ -1793,7 +1792,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,
@@ -1824,7 +1823,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,
@@ -1852,52 +1851,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())
{
- bool bOutputDone(false);
+ // not transparent at all, directly use content
+ process(rUniTransparenceCandidate.getChildren());
+ }
+ else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0)
+ {
+ 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 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()));
}
- }
-
- 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()));
}
}
}
@@ -2055,10 +2062,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;
}
@@ -2076,10 +2083,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 1d104cebf0..12449b374d 100644
--- a/drawinglayer/source/processor2d/contourextractor2d.cxx
+++ b/drawinglayer/source/processor2d/contourextractor2d.cxx
@@ -35,7 +35,7 @@
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/primitive2d/sceneprimitive2d.hxx>
@@ -95,7 +95,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;
@@ -105,15 +105,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 a8722c6956..9502df95a3 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -35,13 +35,14 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <drawinglayer/primitive2d/sceneprimitive2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx>
#include <drawinglayer/processor3d/cutfindprocessor3d.hxx>
+#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -58,7 +59,7 @@ namespace drawinglayer
mfDiscreteHitTolerance(0.0),
mbHit(false),
mbHitToleranceUsed(false),
- mbUseHitTestPrimitiveContent(true),
+ mbUseInvisiblePrimitiveContent(true),
mbHitTextOnly(bHitTextOnly)
{
// init hit tolerance
@@ -239,7 +240,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());
@@ -412,10 +413,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
@@ -479,6 +480,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 :
@@ -491,7 +535,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()));
@@ -504,15 +548,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 99eb1a401d..da9f2ffe07 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -115,7 +115,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();
}
@@ -162,7 +162,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 d33e5a40a5..4bea345b43 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
@@ -59,7 +59,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 049b1a0a60..f48efbeea0 100644
--- a/drawinglayer/source/processor2d/vclhelpergradient.cxx
+++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx
@@ -210,16 +210,6 @@ namespace drawinglayer
::std::vector< basegfx::BColor > aColors;
basegfx::B2DPolygon aUnitPolygon;
- if(attribute::GRADIENTSTYLE_RADIAL == eGradientStyle || attribute::GRADIENTSTYLE_ELLIPTICAL == eGradientStyle)
- {
- 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));
- }
-
// make sure steps is not too high/low
nSteps = impCalcGradientSteps(rOutDev, nSteps, aOutlineRange, sal_uInt32((rStart.getMaximumDistance(rEnd) * 127.5) + 0.5));
@@ -231,6 +221,7 @@ namespace drawinglayer
texture::GeoTexSvxGradientLinear aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle);
aGradient.appendTransformations(aMatrices);
aGradient.appendColors(aColors);
+ aUnitPolygon = basegfx::tools::createUnitPolygon();
break;
}
case attribute::GRADIENTSTYLE_AXIAL:
@@ -238,6 +229,7 @@ namespace drawinglayer
texture::GeoTexSvxGradientAxial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle);
aGradient.appendTransformations(aMatrices);
aGradient.appendColors(aColors);
+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
break;
}
case attribute::GRADIENTSTYLE_RADIAL:
@@ -245,6 +237,7 @@ namespace drawinglayer
texture::GeoTexSvxGradientRadial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetY);
aGradient.appendTransformations(aMatrices);
aGradient.appendColors(aColors);
+ aUnitPolygon = basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0,0), 1);
break;
}
case attribute::GRADIENTSTYLE_ELLIPTICAL:
@@ -252,6 +245,7 @@ namespace drawinglayer
texture::GeoTexSvxGradientElliptical aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
aGradient.appendTransformations(aMatrices);
aGradient.appendColors(aColors);
+ aUnitPolygon = basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0,0), 1);
break;
}
case attribute::GRADIENTSTYLE_SQUARE:
@@ -259,6 +253,7 @@ namespace drawinglayer
texture::GeoTexSvxGradientSquare aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
aGradient.appendTransformations(aMatrices);
aGradient.appendColors(aColors);
+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
break;
}
case attribute::GRADIENTSTYLE_RECT:
@@ -266,6 +261,7 @@ namespace drawinglayer
texture::GeoTexSvxGradientRect aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
aGradient.appendTransformations(aMatrices);
aGradient.appendColors(aColors);
+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
break;
}
}
diff --git a/drawinglayer/source/processor2d/vclhelpergradient.hxx b/drawinglayer/source/processor2d/vclhelpergradient.hxx
index b430425c54..81c9f03eb7 100644
--- a/drawinglayer/source/processor2d/vclhelpergradient.hxx
+++ b/drawinglayer/source/processor2d/vclhelpergradient.hxx
@@ -28,7 +28,8 @@
#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX
#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX
-#include <drawinglayer/attribute/fillattribute.hxx>
+#include <sal/types.h>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
// predefines
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 2793de9abd..6498ee34f1 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -33,7 +33,6 @@
#include <vcl/virdev.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/gradient.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
@@ -44,8 +43,8 @@
#include <basegfx/polygon/b2dpolygonclipper.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx>
#include <tools/stream.hxx>
@@ -65,8 +64,8 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
#include <helperchartrenderer.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
+#include <basegfx/polygon/b2dlinegeometry.hxx>
//////////////////////////////////////////////////////////////////////////////
// for PDFExtOutDevData Graphic support
@@ -152,7 +151,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()));
}
@@ -436,13 +435,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:
@@ -1475,138 +1474,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();
-
- // 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;
+ // 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);
- // various content, create content-metafile
- GDIMetaFile aContentMetafile;
- const Rectangle aPrimitiveRectangle(impDumpToMetaFile(rContent, aContentMetafile));
+ // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support
+ SvtGraphicFill* pSvtGraphicFill = 0;
- // 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);
-
- // render it to VCL
- mpOutputDevice->DrawTransparent(
- aContentMetafile, aPrimitiveRectangle.TopLeft(),
- aPrimitiveRectangle.GetSize(), aVCLGradient);
+ // set line and fill color
+ const sal_uInt16 nTransPercentVcl((sal_uInt16)basegfx::fround(rUniTransparenceCandidate.getTransparence() * 100.0));
+ mpOutputDevice->SetFillColor(Color(aPolygonColor));
+ mpOutputDevice->SetLineColor();
+
+ // 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());
}
@@ -1638,7 +1665,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()));
@@ -1689,9 +1716,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
@@ -1777,27 +1804,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 e21e0f4d4a..19f415faba 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -39,14 +39,14 @@
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx>
#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
#include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
#include <drawinglayer/primitive2d/controlprimitive2d.hxx>
#include <com/sun/star/awt/XWindow2.hpp>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
#include <helperchartrenderer.hxx>
@@ -259,50 +259,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())
{
- // 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, rUniAlphaCandidate.getAlpha());
- bDrawTransparentUsed = true;
+ // not transparent at all, use content
+ process(rUniTransparenceCandidate.getChildren());
}
- }
+ else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0)
+ {
+ bool bDrawTransparentUsed(false);
- if(!bDrawTransparentUsed)
- {
- // unified sub-transparence. Draw to VDev first.
- RenderUnifiedAlphaPrimitive2D(rUniAlphaCandidate);
+ // 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 && 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.
+ 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 2f1bdc364f..71bb587339 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -40,7 +40,6 @@
#include <vclhelperbitmaprender.hxx>
#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <vclhelpergradient.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
@@ -48,8 +47,8 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <vclhelperbufferdevice.hxx>
#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx>
#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
@@ -75,6 +74,7 @@
// for test, can be removed again
#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <basegfx/polygon/b2dtrapezoid.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -294,17 +294,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
@@ -323,7 +375,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));
@@ -397,7 +449,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));
@@ -529,7 +581,7 @@ namespace drawinglayer
impDrawGradientToOutDev(
*mpOutputDevice, aLocalPolyPolygon, rGradient.getStyle(), rGradient.getSteps(),
aStartColor, aEndColor, rGradient.getBorder(),
- -rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), false);
+ rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), false);
}
}
}
@@ -553,7 +605,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());
@@ -635,53 +687,72 @@ namespace drawinglayer
basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
aLocalPolyPolygon.transform(maCurrentTransformation);
- mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
- if(mnPolygonStrokePrimitive2D
- && getOptionsDrawinglayer().IsAntiAliasing()
- && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW))
+ 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());
-
- for(sal_uInt32 a(0); a < nCount; a++)
+ // clip against discrete ViewPort
+ const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport();
+ aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(
+ aLocalPolyPolygon, rDiscreteViewport, true, false);
+
+ 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
+ basegfx::B2DTrapezoidVector aB2DTrapezoidVector;
+ basegfx::tools::trapezoidSubdivide(aB2DTrapezoidVector, 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()
+ && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW))
{
- 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);
}
}
}
@@ -807,10 +878,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();
@@ -843,7 +914,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);
@@ -856,14 +927,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);
@@ -880,8 +951,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());
}
}
}
@@ -889,7 +960,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())
{
@@ -907,14 +978,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 79a0a31f4f..97e514f5ee 100644
--- a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx
@@ -32,11 +32,11 @@
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
#include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
-#include <drawinglayer/primitive3d/hittestprimitive3d.hxx>
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#include <basegfx/polygon/b3dpolygon.hxx>
#include <basegfx/polygon/b3dpolygontools.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -53,7 +53,8 @@ namespace drawinglayer
maBack(rBack),
maResult(),
maCombinedTransform(),
- mbAnyHit(bAnyHit)
+ mbAnyHit(bAnyHit),
+ mbUseInvisiblePrimitiveContent(true)
{
}
@@ -124,13 +125,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 b76c1b061c..8f2f7c17b9 100644
--- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
@@ -40,9 +40,11 @@
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#include <com/sun/star/drawing/ShadeMode.hpp>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -63,8 +65,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();
@@ -74,7 +76,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)
{
@@ -98,32 +100,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;
}
}
@@ -133,7 +135,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;
}
@@ -150,9 +152,6 @@ namespace drawinglayer
// process sub-list
process(rSubSequence);
- // delete texture
- delete pNewTex;
-
// restore values
mbModulate = bOldModulate;
mbFilter = bOldFilter;
@@ -178,7 +177,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
@@ -198,15 +197,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;
@@ -223,32 +218,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.getFillBitmapAttribute();
if(rFillBitmapAttribute.getTiling())
{
- mpGeoTexSvx = new texture::GeoTexSvxBitmapTiled(
+ mpGeoTexSvx.reset(new texture::GeoTexSvxBitmapTiled(
rFillBitmapAttribute.getBitmapEx().GetBitmap(),
rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(),
- rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize());
+ rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()));
}
else
{
- mpGeoTexSvx = new texture::GeoTexSvxBitmap(
+ mpGeoTexSvx.reset(new texture::GeoTexSvxBitmap(
rFillBitmapAttribute.getBitmapEx().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;
@@ -312,7 +304,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();
}
@@ -495,11 +487,13 @@ 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--;
break;
}
case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D :
@@ -548,8 +542,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/geometry2dextractor.cxx b/drawinglayer/source/processor3d/geometry2dextractor.cxx
index 27eb47eb5f..1950e1ce6d 100644
--- a/drawinglayer/source/processor3d/geometry2dextractor.cxx
+++ b/drawinglayer/source/processor3d/geometry2dextractor.cxx
@@ -127,8 +127,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 28400678f1..83b2d8e8ac 100644
--- a/drawinglayer/source/processor3d/shadow3dextractor.cxx
+++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx
@@ -31,7 +31,7 @@
#include <drawinglayer/processor3d/shadow3dextractor.hxx>
#include <drawinglayer/primitive3d/shadowprimitive3d.hxx>
#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
@@ -91,7 +91,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 7922e16c69..679e918bda 100644
--- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
@@ -35,13 +35,14 @@
#include <basegfx/raster/bzpixelraster.hxx>
#include <drawinglayer/attribute/materialattribute3d.hxx>
#include <drawinglayer/texture/texture.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <drawinglayer/primitive3d/textureprimitive3d.hxx>
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -225,14 +226,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);
@@ -241,7 +242,7 @@ private:
if(basegfx::fTools::more(fOpacity, 0.0))
{
- if(mrProcessor.getGeoTexSvx())
+ if(mrProcessor.getGeoTexSvx().get())
{
if(mbUseNrm)
{
@@ -309,9 +310,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();
@@ -426,7 +427,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);
}
@@ -436,23 +437,23 @@ 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));
rDest.setBlue((sal_uInt8)(((rDest.getBlue() * nTransparence) + ((sal_uInt16)(255.0 * aNewColor.getBlue()) * nOpacity)) >> 8));
-
+
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);
}
}
@@ -470,134 +471,161 @@ 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 getPrimitive3DID() call for switch
- switch(rBasePrimitive.getPrimitive3DID())
+ if(mpBZPixelRaster)
{
- case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D :
+ if(getTransparenceCounter())
{
- // AlphaTexturePrimitive3D
- const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive);
-
- if(mbProcessTransparent)
+ // transparent output; record for later sorting and painting from
+ // back to front
+ if(!mpRasterPrimitive3Ds)
{
- impRenderGradientTexturePrimitive3D(rPrimitive, true);
+ const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds = new std::vector< RasterPrimitive3D >;
}
- else
- {
- mbContainsTransparent = true;
- }
- 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);
- }
}
}
@@ -605,8 +633,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());
+ }
}
}
@@ -624,8 +674,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());
@@ -721,6 +770,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
diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx
index 109409357f..fea376384d 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -158,15 +158,10 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fTop(mfBorder);
- const double fStripeWidth((1.0 - fTop) / maGradientInfo.mnSteps);
-
+ const double fStripeWidth(1.0 / maGradientInfo.mnSteps);
for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
{
- const double fOffsetUpper(fStripeWidth * (double)a);
-
- // create matrix
- const basegfx::B2DRange aRect(0.0, fTop + fOffsetUpper, 1.0, 1.0);
+ const basegfx::B2DRange aRect(0.0, fStripeWidth * a, 1.0, 1.0);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -218,17 +213,10 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder(mfBorder * 0.5);
- double fTop(fHalfBorder);
- double fBottom(1.0 - fHalfBorder);
- const double fStripeWidth((fBottom - fTop) / ((maGradientInfo.mnSteps * 2L) - 1L));
-
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
+ const double fStripeWidth=1.0 / (maGradientInfo.mnSteps - 1L);
+ for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a != 0; a--)
{
- const double fOffset(fStripeWidth * (double)a);
-
- // create matrix
- const basegfx::B2DRange aRect(0.0, fTop + fOffset, 1.0, fBottom - fOffset);
+ const basegfx::B2DRange aRect(0, 0, 1.0, fStripeWidth * a);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -280,34 +268,10 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder((1.0 - mfBorder) * 0.5);
- double fLeft(0.5 - fHalfBorder);
- double fTop(0.5 - fHalfBorder);
- double fRight(0.5 + fHalfBorder);
- double fBottom(0.5 + fHalfBorder);
- double fIncrementX, fIncrementY;
-
- if(maGradientInfo.mfAspectRatio > 1.0)
- {
- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
- fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
- }
- else
+ const double fStepSize=1.0 / maGradientInfo.mnSteps;
+ for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a > 0; a--)
{
- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
- fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
- }
-
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
- // next step
- fLeft += fIncrementX;
- fRight -= fIncrementX;
- fTop += fIncrementY;
- fBottom -= fIncrementY;
-
- // create matrix
- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
+ const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -352,34 +316,29 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder((1.0 - mfBorder) * 0.5);
- double fLeft(0.5 - fHalfBorder);
- double fTop(0.5 - fHalfBorder);
- double fRight(0.5 + fHalfBorder);
- double fBottom(0.5 + fHalfBorder);
+ double fWidth(1);
+ double fHeight(1);
double fIncrementX, fIncrementY;
if(maGradientInfo.mfAspectRatio > 1.0)
{
- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
+ fIncrementY = fHeight / maGradientInfo.mnSteps;
fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
}
else
{
- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
+ fIncrementX = fWidth / maGradientInfo.mnSteps;
fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
}
for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
{
// next step
- fLeft += fIncrementX;
- fRight -= fIncrementX;
- fTop += fIncrementY;
- fBottom -= fIncrementY;
+ fWidth -= fIncrementX;
+ fHeight -= fIncrementY;
// create matrix
- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
+ const basegfx::B2DRange aRect(0, 0, fWidth, fHeight);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -424,42 +383,10 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder((1.0 - mfBorder) * 0.5);
- double fLeft(0.5 - fHalfBorder);
- double fTop(0.5 - fHalfBorder);
- double fRight(0.5 + fHalfBorder);
- double fBottom(0.5 + fHalfBorder);
- double fIncrementX, fIncrementY;
-
- if(maGradientInfo.mfAspectRatio > 1.0)
- {
- const double fWidth(fRight - fLeft);
- const double fHalfAspectExpansion(((maGradientInfo.mfAspectRatio - 1.0) * 0.5) * fWidth);
- fTop -= fHalfAspectExpansion;
- fBottom += fHalfAspectExpansion;
- fIncrementX = fWidth / (double)(maGradientInfo.mnSteps * 2L);
- fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
- }
- else
+ const double fStepSize=1.0 / maGradientInfo.mnSteps;
+ for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a > 0; a--)
{
- const double fHeight(fBottom - fTop);
- const double fHalfAspectExpansion((((1.0 / maGradientInfo.mfAspectRatio) - 1.0) * 0.5) * fHeight);
- fLeft -= fHalfAspectExpansion;
- fRight += fHalfAspectExpansion;
- fIncrementY = fHeight / (double)(maGradientInfo.mnSteps * 2L);
- fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
- }
-
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
- // next step
- fLeft += fIncrementX;
- fRight -= fIncrementX;
- fTop += fIncrementY;
- fBottom -= fIncrementY;
-
- // create matrix
- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
+ const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -504,34 +431,29 @@ namespace drawinglayer
{
if(maGradientInfo.mnSteps)
{
- const double fHalfBorder((1.0 - mfBorder) * 0.5);
- double fLeft(0.5 - fHalfBorder);
- double fTop(0.5 - fHalfBorder);
- double fRight(0.5 + fHalfBorder);
- double fBottom(0.5 + fHalfBorder);
+ double fWidth(1);
+ double fHeight(1);
double fIncrementX, fIncrementY;
if(maGradientInfo.mfAspectRatio > 1.0)
{
- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
+ fIncrementY = fHeight / maGradientInfo.mnSteps;
fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
}
else
{
- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
+ fIncrementX = fWidth / maGradientInfo.mnSteps;
fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
}
for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
{
// next step
- fLeft += fIncrementX;
- fRight -= fIncrementX;
- fTop += fIncrementY;
- fBottom -= fIncrementY;
+ fWidth -= fIncrementX;
+ fHeight -= fIncrementY;
// create matrix
- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
+ const basegfx::B2DRange aRect(0, 0, fWidth, fHeight);
impAppendMatrix(rMatrices, aRect);
}
}
@@ -567,6 +489,8 @@ namespace drawinglayer
double fTargetOffsetX(rTargetRange.getMinX());
double fTargetOffsetY(rTargetRange.getMinY());
+ fAngle = -fAngle;
+
// add object expansion
if(0.0 != fAngle)
{
diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx
index bc1fce2bfb..cec5083b8e 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -30,7 +30,6 @@
#include <drawinglayer/texture/texture3d.hxx>
#include <vcl/bmpacc.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -190,7 +189,7 @@ namespace drawinglayer
{
const attribute::FillHatchAttribute& rHatch(rPrimitive.getHatch());
const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY());
- const double fAngleA(-rHatch.getAngle());
+ const double fAngleA(rHatch.getAngle());
maColor = rHatch.getColor();
mbFillBackground = rHatch.isFillBackground();
mp0 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA);