summaryrefslogtreecommitdiff
path: root/drawinglayer/source/attribute
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@Sun.COM>2010-01-27 11:51:56 +0100
committerArmin Le Grand <Armin.Le.Grand@Sun.COM>2010-01-27 11:51:56 +0100
commitffe5c97056ab181367e49691d487eb6f6f375200 (patch)
tree552e2d32015f11e023004a4104e15cce886312e0 /drawinglayer/source/attribute
parentde7c998fe9ba5be956bf8a155455ad17985c4f88 (diff)
aw079: #i99147# attribute rework and others
Diffstat (limited to 'drawinglayer/source/attribute')
-rw-r--r--drawinglayer/source/attribute/fillattribute.cxx102
-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.cxx293
-rw-r--r--drawinglayer/source/attribute/sdrattribute3d.cxx219
-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
22 files changed, 3425 insertions, 867 deletions
diff --git a/drawinglayer/source/attribute/fillattribute.cxx b/drawinglayer/source/attribute/fillattribute.cxx
deleted file mode 100644
index 12741e40c5c3..000000000000
--- a/drawinglayer/source/attribute/fillattribute.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: fillattribute.cxx,v $
- *
- * $Revision: 1.4 $
- *
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
- *
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
- *
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <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 99afb234bda5..becd43c24a13 100644
--- a/drawinglayer/source/attribute/fillbitmapattribute.cxx
+++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx
@@ -37,6 +37,7 @@
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <vcl/bitmapex.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -44,25 +45,161 @@ namespace drawinglayer
{
namespace attribute
{
+ class ImpFillBitmapAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // data definitions
+ BitmapEx maBitmapEx;
+ basegfx::B2DPoint maTopLeft;
+ basegfx::B2DVector maSize;
+
+ // bitfield
+ unsigned mbTiling : 1;
+
+ ImpFillBitmapAttribute(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft,
+ const basegfx::B2DVector& rSize,
+ bool bTiling)
+ : mnRefCount(0),
+ maBitmapEx(rBitmapEx),
+ maTopLeft(rTopLeft),
+ maSize(rSize),
+ mbTiling(bTiling)
+ {
+ }
+
+ bool operator==(const ImpFillBitmapAttribute& rCandidate) const
+ {
+ return (maBitmapEx == rCandidate.maBitmapEx
+ && maTopLeft == rCandidate.maTopLeft
+ && maSize == rCandidate.maSize
+ && mbTiling == rCandidate.mbTiling);
+ }
+
+ // data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; }
+ const basegfx::B2DVector& getSize() const { return maSize; }
+ bool getTiling() const { return mbTiling; }
+
+ static ImpFillBitmapAttribute* get_global_default()
+ {
+ static ImpFillBitmapAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpFillBitmapAttribute(
+ BitmapEx(),
+ basegfx::B2DPoint(),
+ basegfx::B2DVector(),
+ false);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
FillBitmapAttribute::FillBitmapAttribute(
const BitmapEx& rBitmapEx,
const basegfx::B2DPoint& rTopLeft,
const basegfx::B2DVector& rSize,
bool bTiling)
- : maBitmapEx(rBitmapEx),
- maTopLeft(rTopLeft),
- maSize(rSize),
- mbTiling(bTiling)
+ : mpFillBitmapAttribute(new ImpFillBitmapAttribute(
+ rBitmapEx, rTopLeft, rSize, bTiling))
{
}
+ FillBitmapAttribute::FillBitmapAttribute()
+ : mpFillBitmapAttribute(ImpFillBitmapAttribute::get_global_default())
+ {
+ mpFillBitmapAttribute->mnRefCount++;
+ }
+
+ FillBitmapAttribute::FillBitmapAttribute(const FillBitmapAttribute& rCandidate)
+ : mpFillBitmapAttribute(rCandidate.mpFillBitmapAttribute)
+ {
+ mpFillBitmapAttribute->mnRefCount++;
+ }
+
+ FillBitmapAttribute::~FillBitmapAttribute()
+ {
+ if(mpFillBitmapAttribute->mnRefCount)
+ {
+ mpFillBitmapAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpFillBitmapAttribute;
+ }
+ }
+
+ bool FillBitmapAttribute::isDefault() const
+ {
+ return mpFillBitmapAttribute == ImpFillBitmapAttribute::get_global_default();
+ }
+
+ FillBitmapAttribute& FillBitmapAttribute::operator=(const FillBitmapAttribute& rCandidate)
+ {
+ if(rCandidate.mpFillBitmapAttribute != mpFillBitmapAttribute)
+ {
+ if(mpFillBitmapAttribute->mnRefCount)
+ {
+ mpFillBitmapAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpFillBitmapAttribute;
+ }
+
+ mpFillBitmapAttribute = rCandidate.mpFillBitmapAttribute;
+ mpFillBitmapAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
bool FillBitmapAttribute::operator==(const FillBitmapAttribute& rCandidate) const
{
- return (getBitmapEx() == rCandidate.getBitmapEx()
- && getTopLeft() == rCandidate.getTopLeft()
- && getSize() == rCandidate.getSize()
- && getTiling() == rCandidate.getTiling());
+ if(rCandidate.mpFillBitmapAttribute == mpFillBitmapAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpFillBitmapAttribute == *mpFillBitmapAttribute);
+ }
+
+ const BitmapEx& FillBitmapAttribute::getBitmapEx() const
+ {
+ return mpFillBitmapAttribute->getBitmapEx();
}
+
+ const basegfx::B2DPoint& FillBitmapAttribute::getTopLeft() const
+ {
+ return mpFillBitmapAttribute->getTopLeft();
+ }
+
+ const basegfx::B2DVector& FillBitmapAttribute::getSize() const
+ {
+ return mpFillBitmapAttribute->getSize();
+ }
+
+ bool FillBitmapAttribute::getTiling() const
+ {
+ return mpFillBitmapAttribute->getTiling();
+ }
+
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx
new file mode 100644
index 000000000000..17e0cd6c098b
--- /dev/null
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fillattribute.cxx,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 000000000000..4a82ef5594ab
--- /dev/null
+++ b/drawinglayer/source/attribute/fillhatchattribute.cxx
@@ -0,0 +1,219 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fillattribute.cxx,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 5163e2f6a59a..2439d9894a70 100644
--- a/drawinglayer/source/attribute/fontattribute.cxx
+++ b/drawinglayer/source/attribute/fontattribute.cxx
@@ -37,6 +37,7 @@
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/attribute/fontattribute.hxx>
+#include <tools/string.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -44,18 +45,215 @@ namespace drawinglayer
{
namespace attribute
{
- bool FontAttribute::operator==(const FontAttribute& rCompare) const
- {
- return (getFamilyName() == rCompare.getFamilyName()
- && getStyleName() == rCompare.getStyleName()
- && getWeight() == rCompare.getWeight()
- && getSymbol() == rCompare.getSymbol()
- && getVertical() == rCompare.getVertical()
- && getItalic() == rCompare.getItalic()
- && getOutline() == rCompare.getOutline()
- && getRTL() == rCompare.getRTL()
- && getBiDiStrong() == rCompare.getBiDiStrong());
+ class ImpFontAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ /// core data
+ String maFamilyName; // Font Family Name
+ String maStyleName; // Font Style Name
+ sal_uInt16 mnWeight; // Font weight
+
+ /// bitfield
+ unsigned mbSymbol : 1; // Symbol Font Flag
+ unsigned mbVertical : 1; // Vertical Text Flag
+ unsigned mbItalic : 1; // Italic Flag
+ unsigned mbOutline : 1; // Outline Flag
+ unsigned mbRTL : 1; // RTL Flag
+ unsigned mbBiDiStrong : 1; // BiDi Flag
+
+ ImpFontAttribute(
+ const String& rFamilyName,
+ const String& rStyleName,
+ sal_uInt16 nWeight,
+ bool bSymbol,
+ bool bVertical,
+ bool bItalic,
+ bool bOutline,
+ bool bRTL,
+ bool bBiDiStrong)
+ : mnRefCount(0),
+ maFamilyName(rFamilyName),
+ maStyleName(rStyleName),
+ mnWeight(nWeight),
+ mbSymbol(bSymbol),
+ mbVertical(bVertical),
+ mbItalic(bItalic),
+ mbOutline(bOutline),
+ mbRTL(bRTL),
+ mbBiDiStrong(bBiDiStrong)
+ {
+ }
+
+ // data read access
+ const String& getFamilyName() const { return maFamilyName; }
+ const String& getStyleName() const { return maStyleName; }
+ sal_uInt16 getWeight() const { return mnWeight; }
+ bool getSymbol() const { return mbSymbol; }
+ bool getVertical() const { return mbVertical; }
+ bool getItalic() const { return mbItalic; }
+ bool getOutline() const { return mbOutline; }
+ bool getRTL() const { return mbRTL; }
+ bool getBiDiStrong() const { return mbBiDiStrong; }
+
+ bool operator==(const ImpFontAttribute& rCompare) const
+ {
+ return (getFamilyName() == rCompare.getFamilyName()
+ && getStyleName() == rCompare.getStyleName()
+ && getWeight() == rCompare.getWeight()
+ && getSymbol() == rCompare.getSymbol()
+ && getVertical() == rCompare.getVertical()
+ && getItalic() == rCompare.getItalic()
+ && getOutline() == rCompare.getOutline()
+ && getRTL() == rCompare.getRTL()
+ && getBiDiStrong() == rCompare.getBiDiStrong());
+ }
+
+ static ImpFontAttribute* get_global_default()
+ {
+ static ImpFontAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpFontAttribute(
+ String(), String(),
+ 0,
+ false, false, false, false, false, false);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
+ FontAttribute::FontAttribute(
+ const String& rFamilyName,
+ const String& rStyleName,
+ sal_uInt16 nWeight,
+ bool bSymbol,
+ bool bVertical,
+ bool bItalic,
+ bool bOutline,
+ bool bRTL,
+ bool bBiDiStrong)
+ : mpFontAttribute(new ImpFontAttribute(
+ rFamilyName, rStyleName, nWeight, bSymbol, bVertical, bItalic, bOutline, bRTL, bBiDiStrong))
+ {
+ }
+
+ FontAttribute::FontAttribute()
+ : mpFontAttribute(ImpFontAttribute::get_global_default())
+ {
+ mpFontAttribute->mnRefCount++;
+ }
+
+ FontAttribute::FontAttribute(const FontAttribute& rCandidate)
+ : mpFontAttribute(rCandidate.mpFontAttribute)
+ {
+ mpFontAttribute->mnRefCount++;
+ }
+
+ FontAttribute::~FontAttribute()
+ {
+ if(mpFontAttribute->mnRefCount)
+ {
+ mpFontAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpFontAttribute;
+ }
+ }
+
+ bool FontAttribute::isDefault() const
+ {
+ return mpFontAttribute == ImpFontAttribute::get_global_default();
+ }
+
+ FontAttribute& FontAttribute::operator=(const FontAttribute& rCandidate)
+ {
+ if(rCandidate.mpFontAttribute != mpFontAttribute)
+ {
+ if(mpFontAttribute->mnRefCount)
+ {
+ mpFontAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpFontAttribute;
+ }
+
+ mpFontAttribute = rCandidate.mpFontAttribute;
+ mpFontAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
+ bool FontAttribute::operator==(const FontAttribute& rCandidate) const
+ {
+ if(rCandidate.mpFontAttribute == mpFontAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpFontAttribute == *mpFontAttribute);
+ }
+
+ const String& FontAttribute::getFamilyName() const
+ {
+ return mpFontAttribute->getFamilyName();
+ }
+
+ const String& FontAttribute::getStyleName() const
+ {
+ return mpFontAttribute->getStyleName();
+ }
+
+ sal_uInt16 FontAttribute::getWeight() const
+ {
+ return mpFontAttribute->getWeight();
}
+
+ bool FontAttribute::getSymbol() const
+ {
+ return mpFontAttribute->getSymbol();
+ }
+
+ bool FontAttribute::getVertical() const
+ {
+ return mpFontAttribute->getVertical();
+ }
+
+ bool FontAttribute::getItalic() const
+ {
+ return mpFontAttribute->getItalic();
+ }
+
+ bool FontAttribute::getOutline() const
+ {
+ return mpFontAttribute->getOutline();
+ }
+
+ bool FontAttribute::getRTL() const
+ {
+ return mpFontAttribute->getRTL();
+ }
+
+ bool FontAttribute::getBiDiStrong() const
+ {
+ return mpFontAttribute->getBiDiStrong();
+ }
+
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx
index 5ab44b73db82..2a346599db8f 100644
--- a/drawinglayer/source/attribute/lineattribute.cxx
+++ b/drawinglayer/source/attribute/lineattribute.cxx
@@ -37,6 +37,7 @@
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/attribute/lineattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -44,6 +45,147 @@ namespace drawinglayer
{
namespace attribute
{
+ class ImpLineAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // data definitions
+ basegfx::BColor maColor; // color
+ double mfWidth; // absolute line width
+ basegfx::B2DLineJoin meLineJoin; // type of LineJoin
+
+ ImpLineAttribute(
+ const basegfx::BColor& rColor,
+ double fWidth,
+ basegfx::B2DLineJoin aB2DLineJoin)
+ : mnRefCount(0),
+ maColor(rColor),
+ mfWidth(fWidth),
+ meLineJoin(aB2DLineJoin)
+ {
+ }
+
+ // data read access
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getWidth() const { return mfWidth; }
+ basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; }
+
+ bool operator==(const ImpLineAttribute& rCandidate) const
+ {
+ return (getColor() == rCandidate.getColor()
+ && getWidth() == rCandidate.getWidth()
+ && getLineJoin() == rCandidate.getLineJoin());
+ }
+
+ static ImpLineAttribute* get_global_default()
+ {
+ static ImpLineAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpLineAttribute(
+ basegfx::BColor(),
+ 0.0,
+ basegfx::B2DLINEJOIN_ROUND);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
+ LineAttribute::LineAttribute(
+ const basegfx::BColor& rColor,
+ double fWidth,
+ basegfx::B2DLineJoin aB2DLineJoin)
+ : mpLineAttribute(new ImpLineAttribute(
+ rColor, fWidth, aB2DLineJoin))
+ {
+ }
+
+ LineAttribute::LineAttribute()
+ : mpLineAttribute(ImpLineAttribute::get_global_default())
+ {
+ mpLineAttribute->mnRefCount++;
+ }
+
+ LineAttribute::LineAttribute(const LineAttribute& rCandidate)
+ : mpLineAttribute(rCandidate.mpLineAttribute)
+ {
+ mpLineAttribute->mnRefCount++;
+ }
+
+ LineAttribute::~LineAttribute()
+ {
+ if(mpLineAttribute->mnRefCount)
+ {
+ mpLineAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpLineAttribute;
+ }
+ }
+
+ bool LineAttribute::isDefault() const
+ {
+ return mpLineAttribute == ImpLineAttribute::get_global_default();
+ }
+
+ LineAttribute& LineAttribute::operator=(const LineAttribute& rCandidate)
+ {
+ if(rCandidate.mpLineAttribute != mpLineAttribute)
+ {
+ if(mpLineAttribute->mnRefCount)
+ {
+ mpLineAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpLineAttribute;
+ }
+
+ mpLineAttribute = rCandidate.mpLineAttribute;
+ mpLineAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
+ bool LineAttribute::operator==(const LineAttribute& rCandidate) const
+ {
+ if(rCandidate.mpLineAttribute == mpLineAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpLineAttribute == *mpLineAttribute);
+ }
+
+ const basegfx::BColor& LineAttribute::getColor() const
+ {
+ return mpLineAttribute->getColor();
+ }
+
+ double LineAttribute::getWidth() const
+ {
+ return mpLineAttribute->getWidth();
+ }
+
+ basegfx::B2DLineJoin LineAttribute::getLineJoin() const
+ {
+ return mpLineAttribute->getLineJoin();
+ }
+
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/attribute/linestartendattribute.cxx b/drawinglayer/source/attribute/linestartendattribute.cxx
index 785819870114..3d93a6471cb7 100644
--- a/drawinglayer/source/attribute/linestartendattribute.cxx
+++ b/drawinglayer/source/attribute/linestartendattribute.cxx
@@ -38,6 +38,7 @@
#include <drawinglayer/attribute/linestartendattribute.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -45,11 +46,154 @@ namespace drawinglayer
{
namespace attribute
{
+ class ImpLineStartEndAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // data definitions
+ double mfWidth; // absolute line StartEndGeometry base width
+ basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon
+
+ // bitfield
+ unsigned mbCentered : 1; // use centered to ineStart/End point?
+
+ ImpLineStartEndAttribute(
+ double fWidth,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ bool bCentered)
+ : mnRefCount(0),
+ mfWidth(fWidth),
+ maPolyPolygon(rPolyPolygon),
+ mbCentered(bCentered)
+ {
+ }
+
+ // data read access
+ double getWidth() const { return mfWidth; }
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ bool isCentered() const { return mbCentered; }
+
+ bool operator==(const ImpLineStartEndAttribute& rCandidate) const
+ {
+ return (basegfx::fTools::equal(getWidth(), rCandidate.getWidth())
+ && getB2DPolyPolygon() == rCandidate.getB2DPolyPolygon()
+ && isCentered() == rCandidate.isCentered());
+ }
+
+ static ImpLineStartEndAttribute* get_global_default()
+ {
+ static ImpLineStartEndAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpLineStartEndAttribute(
+ 0.0,
+ basegfx::B2DPolyPolygon(),
+ false);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
+ LineStartEndAttribute::LineStartEndAttribute(
+ double fWidth,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ bool bCentered)
+ : mpLineStartEndAttribute(new ImpLineStartEndAttribute(
+ fWidth, rPolyPolygon, bCentered))
+ {
+ }
+
+ LineStartEndAttribute::LineStartEndAttribute()
+ : mpLineStartEndAttribute(ImpLineStartEndAttribute::get_global_default())
+ {
+ mpLineStartEndAttribute->mnRefCount++;
+ }
+
+ LineStartEndAttribute::LineStartEndAttribute(const LineStartEndAttribute& rCandidate)
+ : mpLineStartEndAttribute(rCandidate.mpLineStartEndAttribute)
+ {
+ mpLineStartEndAttribute->mnRefCount++;
+ }
+
+ LineStartEndAttribute::~LineStartEndAttribute()
+ {
+ if(mpLineStartEndAttribute->mnRefCount)
+ {
+ mpLineStartEndAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpLineStartEndAttribute;
+ }
+ }
+
+ bool LineStartEndAttribute::isDefault() const
+ {
+ return mpLineStartEndAttribute == ImpLineStartEndAttribute::get_global_default();
+ }
+
+ LineStartEndAttribute& LineStartEndAttribute::operator=(const LineStartEndAttribute& rCandidate)
+ {
+ if(rCandidate.mpLineStartEndAttribute != mpLineStartEndAttribute)
+ {
+ if(mpLineStartEndAttribute->mnRefCount)
+ {
+ mpLineStartEndAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpLineStartEndAttribute;
+ }
+
+ mpLineStartEndAttribute = rCandidate.mpLineStartEndAttribute;
+ mpLineStartEndAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
+ bool LineStartEndAttribute::operator==(const LineStartEndAttribute& rCandidate) const
+ {
+ if(rCandidate.mpLineStartEndAttribute == mpLineStartEndAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpLineStartEndAttribute == *mpLineStartEndAttribute);
+ }
+
+ double LineStartEndAttribute::getWidth() const
+ {
+ return mpLineStartEndAttribute->getWidth();
+ }
+
+ const basegfx::B2DPolyPolygon& LineStartEndAttribute::getB2DPolyPolygon() const
+ {
+ return mpLineStartEndAttribute->getB2DPolyPolygon();
+ }
+
+ bool LineStartEndAttribute::isCentered() const
+ {
+ return mpLineStartEndAttribute->isCentered();
+ }
+
bool LineStartEndAttribute::isActive() const
{
return (0.0 != getWidth()
- && 0.0 != getB2DPolyPolygon().count()
- && 0.0 != getB2DPolyPolygon().getB2DPolygon(0L).count());
+ && 0 != getB2DPolyPolygon().count()
+ && 0 != getB2DPolyPolygon().getB2DPolygon(0).count());
}
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk
index 65f899f67177..83eaa193bb4e 100644
--- a/drawinglayer/source/attribute/makefile.mk
+++ b/drawinglayer/source/attribute/makefile.mk
@@ -45,16 +45,23 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files -------------------------------------
SLOFILES= \
- $(SLO)$/fillattribute.obj \
- $(SLO)$/fillbitmapattribute.obj \
- $(SLO)$/fontattribute.obj \
- $(SLO)$/materialattribute3d.obj \
- $(SLO)$/sdrallattribute3d.obj \
- $(SLO)$/sdrattribute.obj \
- $(SLO)$/sdrattribute3d.obj \
- $(SLO)$/sdrfillbitmapattribute.obj \
- $(SLO)$/lineattribute.obj \
- $(SLO)$/linestartendattribute.obj \
+ $(SLO)$/fillgradientattribute.obj \
+ $(SLO)$/fillhatchattribute.obj \
+ $(SLO)$/fillbitmapattribute.obj \
+ $(SLO)$/fontattribute.obj \
+ $(SLO)$/materialattribute3d.obj \
+ $(SLO)$/sdrallattribute3d.obj \
+ $(SLO)$/sdrlineattribute.obj \
+ $(SLO)$/sdrlinestartendattribute.obj \
+ $(SLO)$/sdrshadowattribute.obj \
+ $(SLO)$/sdrfillattribute.obj \
+ $(SLO)$/sdrobjectattribute3d.obj \
+ $(SLO)$/sdrlightattribute3d.obj \
+ $(SLO)$/sdrlightingattribute3d.obj \
+ $(SLO)$/sdrsceneattribute3d.obj \
+ $(SLO)$/sdrfillbitmapattribute.obj \
+ $(SLO)$/lineattribute.obj \
+ $(SLO)$/linestartendattribute.obj \
$(SLO)$/strokeattribute.obj
# --- Targets ----------------------------------
diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx
index bc3e8f3b317b..27bd5d5a1b1a 100644
--- a/drawinglayer/source/attribute/materialattribute3d.cxx
+++ b/drawinglayer/source/attribute/materialattribute3d.cxx
@@ -48,74 +48,87 @@ namespace drawinglayer
class ImpMaterialAttribute3D
{
public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
// materialAttribute3D definitions
basegfx::BColor maColor; // object color
basegfx::BColor maSpecular; // material specular color
basegfx::BColor maEmission; // material emissive color
- sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128]
-
- // refcounter
- sal_uInt32 mnRefCount;
+ sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128]
ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity)
- : maColor(rColor),
+ : mnRefCount(0),
+ maColor(rColor),
maSpecular(rSpecular),
maEmission(rEmission),
- mnSpecularIntensity(nSpecularIntensity),
- mnRefCount(0L)
+ mnSpecularIntensity(nSpecularIntensity)
{
}
ImpMaterialAttribute3D(const basegfx::BColor& rColor)
- : maColor(rColor),
+ : mnRefCount(0),
+ maColor(rColor),
maSpecular(1.0, 1.0, 1.0),
maEmission(),
- mnSpecularIntensity(15),
- mnRefCount(0L)
+ mnSpecularIntensity(15)
{
}
- ImpMaterialAttribute3D()
- : mnSpecularIntensity(0),
- mnRefCount(0L)
- {
- }
+ // data read access
+ const basegfx::BColor& getColor() const { return maColor; }
+ const basegfx::BColor& getSpecular() const { return maSpecular; }
+ const basegfx::BColor& getEmission() const { return maEmission; }
+ sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; }
bool operator==(const ImpMaterialAttribute3D& rCandidate) const
{
- return (maColor == rCandidate.maColor
- && maSpecular == rCandidate.maSpecular
- && maEmission == rCandidate.maEmission
- && mnSpecularIntensity == rCandidate.mnSpecularIntensity);
+ return (getColor() == rCandidate.getColor()
+ && getSpecular() == rCandidate.getSpecular()
+ && getEmission() == rCandidate.getEmission()
+ && getSpecularIntensity() == rCandidate.getSpecularIntensity());
}
- const basegfx::BColor& getColor() const { return maColor; }
- const basegfx::BColor& getSpecular() const { return maSpecular; }
- const basegfx::BColor& getEmission() const { return maEmission; }
- sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; }
- };
- } // end of anonymous namespace
-} // end of namespace drawinglayer
+ static ImpMaterialAttribute3D* get_global_default()
+ {
+ static ImpMaterialAttribute3D* pDefault = 0;
-//////////////////////////////////////////////////////////////////////////////
+ if(!pDefault)
+ {
+ pDefault = new ImpMaterialAttribute3D(
+ basegfx::BColor(),
+ basegfx::BColor(),
+ basegfx::BColor(),
+ 0);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
-namespace drawinglayer
-{
- namespace attribute
- {
- MaterialAttribute3D::MaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity)
- : mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor, rSpecular, rEmission, nSpecularIntensity))
+ return pDefault;
+ }
+ };
+
+ MaterialAttribute3D::MaterialAttribute3D(
+ const basegfx::BColor& rColor,
+ const basegfx::BColor& rSpecular,
+ const basegfx::BColor& rEmission,
+ sal_uInt16 nSpecularIntensity)
+ : mpMaterialAttribute3D(new ImpMaterialAttribute3D(
+ rColor, rSpecular, rEmission, nSpecularIntensity))
{
}
- MaterialAttribute3D::MaterialAttribute3D(const basegfx::BColor& rColor)
+ MaterialAttribute3D::MaterialAttribute3D(
+ const basegfx::BColor& rColor)
: mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor))
{
}
MaterialAttribute3D::MaterialAttribute3D()
- : mpMaterialAttribute3D(new ImpMaterialAttribute3D())
+ : mpMaterialAttribute3D(ImpMaterialAttribute3D::get_global_default())
{
+ mpMaterialAttribute3D->mnRefCount++;
}
MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D& rCandidate)
@@ -136,6 +149,11 @@ namespace drawinglayer
}
}
+ bool MaterialAttribute3D::isDefault() const
+ {
+ return mpMaterialAttribute3D == ImpMaterialAttribute3D::get_global_default();
+ }
+
MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D& rCandidate)
{
if(rCandidate.mpMaterialAttribute3D != mpMaterialAttribute3D)
@@ -163,6 +181,11 @@ namespace drawinglayer
return true;
}
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
return (*rCandidate.mpMaterialAttribute3D == *mpMaterialAttribute3D);
}
diff --git a/drawinglayer/source/attribute/sdrallattribute3d.cxx b/drawinglayer/source/attribute/sdrallattribute3d.cxx
index 264d8d0432d1..379e38f0e6ed 100644
--- a/drawinglayer/source/attribute/sdrallattribute3d.cxx
+++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx
@@ -37,12 +37,6 @@
#include "precompiled_drawinglayer.hxx"
#include <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))
//////////////////////////////////////////////////////////////////////////////
@@ -50,150 +44,47 @@ namespace drawinglayer
{
namespace attribute
{
- SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(
- SdrLineAttribute* pLine,
- SdrFillAttribute* pFill,
- SdrLineStartEndAttribute* pLineStartEnd,
- SdrShadowAttribute* pShadow,
- FillGradientAttribute* pFillFloatTransGradient)
- : mpShadow(pShadow),
- mpLine(pLine),
- mpLineStartEnd(pLineStartEnd),
- mpFill(pFill),
- mpFillFloatTransGradient(pFillFloatTransGradient)
- {
- }
-
- SdrLineFillShadowAttribute::SdrLineFillShadowAttribute(
- const SdrLineFillShadowAttribute& rCandidate)
- : mpShadow(0),
- mpLine(0),
- mpLineStartEnd(0),
- mpFill(0),
- mpFillFloatTransGradient(0)
+ SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D(
+ const SdrLineAttribute& rLine,
+ const SdrFillAttribute& rFill,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const FillGradientAttribute& rFillFloatTransGradient)
+ : maLine(rLine),
+ maFill(rFill),
+ maLineStartEnd(rLineStartEnd),
+ maShadow(rShadow),
+ maFillFloatTransGradient(rFillFloatTransGradient)
{
- *this = rCandidate;
}
- SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute()
+ SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D()
+ : maLine(),
+ maFill(),
+ maLineStartEnd(),
+ maShadow(),
+ maFillFloatTransGradient()
{
- delete mpShadow;
- delete mpLine;
- delete mpLineStartEnd;
- delete mpFill;
- delete mpFillFloatTransGradient;
}
- SdrLineFillShadowAttribute& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute& rCandidate)
+ bool SdrLineFillShadowAttribute3D::isDefault() const
{
- // handle mpShadow
- {
- // delete local mpShadow if necessary
- if(mpShadow)
- {
- delete mpShadow;
- mpShadow = 0;
- }
-
- // copy mpShadow if necessary
- if(rCandidate.mpShadow)
- {
- mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow);
- }
- }
-
- // handle mpLine
- {
- // delete local mpLine if necessary
- if(mpLine)
- {
- delete mpLine;
- mpLine = 0;
- }
-
- // copy mpLine if necessary
- if(rCandidate.mpLine)
- {
- mpLine = new SdrLineAttribute(*rCandidate.mpLine);
- }
- }
-
- // handle mpLineStartEnd
- {
- // delete local mpLineStartEnd if necessary
- if(mpLineStartEnd)
- {
- delete mpLineStartEnd;
- mpLineStartEnd = 0;
- }
-
- // copy mpLineStartEnd if necessary
- if(rCandidate.mpLineStartEnd)
- {
- mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd);
- }
- }
-
- // handle mpFill
- {
- // delete local mpFill if necessary
- if(mpFill)
- {
- delete mpFill;
- mpFill = 0;
- }
-
- // copy mpFill if necessary
- if(rCandidate.mpFill)
- {
- mpFill = new SdrFillAttribute(*rCandidate.mpFill);
- }
- }
-
- // handle mpFillFloatTransGradient
- {
- // delete local mpFillFloatTransGradient if necessary
- if(mpFillFloatTransGradient)
- {
- delete mpFillFloatTransGradient;
- mpFillFloatTransGradient = 0;
- }
-
- // copy mpFillFloatTransGradient if necessary
- if(rCandidate.mpFillFloatTransGradient)
- {
- mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient);
- }
- }
-
- return *this;
+ return(getLine().isDefault()
+ && getFill().isDefault()
+ && getLineStartEnd().isDefault()
+ && getShadow().isDefault()
+ && getFillFloatTransGradient().isDefault());
}
- bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute& rCandidate) const
+ bool SdrLineFillShadowAttribute3D::operator==(const SdrLineFillShadowAttribute3D& rCandidate) const
{
- // handle mpShadow
- if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow))
- return false;
-
- // handle mpLine
- if(!pointerOrContentEqual(mpLine, rCandidate.mpLine))
- return false;
-
- // handle mpLineStartEnd
- if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd))
- return false;
-
- // handle mpFill
- if(!pointerOrContentEqual(mpFill, rCandidate.mpFill))
- return false;
-
- // handle mpFillFloatTransGradient
- if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient))
- return false;
-
- return true;
+ return(getLine() == rCandidate.getLine()
+ && getFill() == rCandidate.getFill()
+ && getLineStartEnd() == rCandidate.getLineStartEnd()
+ && getShadow() == rCandidate.getShadow()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient());
}
- } // end of namespace attribute
+ } // end of namespace overlay
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/source/attribute/sdrattribute.cxx b/drawinglayer/source/attribute/sdrattribute.cxx
deleted file mode 100644
index 8e55afa6751e..000000000000
--- a/drawinglayer/source/attribute/sdrattribute.cxx
+++ /dev/null
@@ -1,293 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: sdrattribute.cxx,v $
- *
- * $Revision: 1.5 $
- *
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
- *
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
- *
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <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 c130675b9c97..000000000000
--- a/drawinglayer/source/attribute/sdrattribute3d.cxx
+++ /dev/null
@@ -1,219 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: sdrattribute3d.cxx,v $
- *
- * $Revision: 1.5 $
- *
- * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
- *
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
- *
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_drawinglayer.hxx"
-
-#include <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 000000000000..bd99ba2c4ba4
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrfillattribute.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 d7e9090b0f62..8d46fac4a20e 100644
--- a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
@@ -38,8 +38,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>
//////////////////////////////////////////////////////////////////////////////
@@ -47,37 +46,213 @@ namespace drawinglayer
{
namespace attribute
{
+ class ImpSdrFillBitmapAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // data definitions
+ Bitmap maBitmap;
+ basegfx::B2DVector maSize;
+ basegfx::B2DVector maOffset;
+ basegfx::B2DVector maOffsetPosition;
+ basegfx::B2DVector maRectPoint;
+
+ // bitfield
+ unsigned mbTiling : 1;
+ unsigned mbStretch : 1;
+ unsigned mbLogSize : 1;
+
+ ImpSdrFillBitmapAttribute(
+ const Bitmap& rBitmap,
+ const basegfx::B2DVector& rSize,
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rOffsetPosition,
+ const basegfx::B2DVector& rRectPoint,
+ bool bTiling,
+ bool bStretch,
+ bool bLogSize)
+ : mnRefCount(0),
+ maBitmap(rBitmap),
+ maSize(rSize),
+ maOffset(rOffset),
+ maOffsetPosition(rOffsetPosition),
+ maRectPoint(rRectPoint),
+ mbTiling(bTiling),
+ mbStretch(bStretch),
+ mbLogSize(bLogSize)
+ {
+ }
+
+ // data read access
+ const Bitmap& getBitmap() const { return maBitmap; }
+ const basegfx::B2DVector& getSize() const { return maSize; }
+ const basegfx::B2DVector& getOffset() const { return maOffset; }
+ const basegfx::B2DVector& getOffsetPosition() const { return maOffsetPosition; }
+ const basegfx::B2DVector& getRectPoint() const { return maRectPoint; }
+ bool getTiling() const { return mbTiling; }
+ bool getStretch() const { return mbStretch; }
+ bool getLogSize() const { return mbLogSize; }
+
+ bool operator==(const ImpSdrFillBitmapAttribute& rCandidate) const
+ {
+ return (getBitmap() == rCandidate.getBitmap()
+ && getSize() == rCandidate.getSize()
+ && getOffset() == rCandidate.getOffset()
+ && getOffsetPosition() == rCandidate.getOffsetPosition()
+ && getRectPoint() == rCandidate.getRectPoint()
+ && getTiling() == rCandidate.getTiling()
+ && getStretch() == rCandidate.getStretch()
+ && getLogSize() == rCandidate.getLogSize());
+ }
+
+ static ImpSdrFillBitmapAttribute* get_global_default()
+ {
+ static ImpSdrFillBitmapAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpSdrFillBitmapAttribute(
+ Bitmap(),
+ basegfx::B2DVector(),
+ basegfx::B2DVector(),
+ basegfx::B2DVector(),
+ basegfx::B2DVector(),
+ false,
+ false,
+ false);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
SdrFillBitmapAttribute::SdrFillBitmapAttribute(
- const Bitmap& rBitmap, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset,
- const basegfx::B2DVector& rOffsetPosition, const basegfx::B2DVector& rRectPoint,
- bool bTiling, bool bStretch, bool bLogSize)
- : maBitmap(rBitmap),
- maSize(rSize),
- maOffset(rOffset),
- maOffsetPosition(rOffsetPosition),
- maRectPoint(rRectPoint),
- mbTiling(bTiling),
- mbStretch(bStretch),
- mbLogSize(bLogSize)
+ const Bitmap& rBitmap,
+ const basegfx::B2DVector& rSize,
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rOffsetPosition,
+ const basegfx::B2DVector& rRectPoint,
+ bool bTiling,
+ bool bStretch,
+ bool bLogSize)
+ : mpSdrFillBitmapAttribute(new ImpSdrFillBitmapAttribute(
+ rBitmap, rSize, rOffset, rOffsetPosition, rRectPoint, bTiling, bStretch, bLogSize))
{
}
+ SdrFillBitmapAttribute::SdrFillBitmapAttribute()
+ : mpSdrFillBitmapAttribute(ImpSdrFillBitmapAttribute::get_global_default())
+ {
+ mpSdrFillBitmapAttribute->mnRefCount++;
+ }
+
+ SdrFillBitmapAttribute::SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate)
+ : mpSdrFillBitmapAttribute(rCandidate.mpSdrFillBitmapAttribute)
+ {
+ mpSdrFillBitmapAttribute->mnRefCount++;
+ }
+
+ SdrFillBitmapAttribute::~SdrFillBitmapAttribute()
+ {
+ if(mpSdrFillBitmapAttribute->mnRefCount)
+ {
+ mpSdrFillBitmapAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFillBitmapAttribute;
+ }
+ }
+
+ bool SdrFillBitmapAttribute::isDefault() const
+ {
+ return mpSdrFillBitmapAttribute == ImpSdrFillBitmapAttribute::get_global_default();
+ }
+
+ SdrFillBitmapAttribute& SdrFillBitmapAttribute::operator=(const SdrFillBitmapAttribute& rCandidate)
+ {
+ if(rCandidate.mpSdrFillBitmapAttribute != mpSdrFillBitmapAttribute)
+ {
+ if(mpSdrFillBitmapAttribute->mnRefCount)
+ {
+ mpSdrFillBitmapAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFillBitmapAttribute;
+ }
+
+ mpSdrFillBitmapAttribute = rCandidate.mpSdrFillBitmapAttribute;
+ mpSdrFillBitmapAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
bool SdrFillBitmapAttribute::operator==(const SdrFillBitmapAttribute& rCandidate) const
{
- return (maBitmap == rCandidate.maBitmap
- && maSize == rCandidate.maSize
- && maOffset == rCandidate.maOffset
- && maOffsetPosition == rCandidate.maOffsetPosition
- && maRectPoint == rCandidate.maRectPoint
- && mbTiling == rCandidate.mbTiling
- && mbStretch == rCandidate.mbStretch
- && mbLogSize == rCandidate.mbLogSize);
+ if(rCandidate.mpSdrFillBitmapAttribute == mpSdrFillBitmapAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpSdrFillBitmapAttribute == *mpSdrFillBitmapAttribute);
+ }
+
+ const Bitmap& SdrFillBitmapAttribute::getBitmap() const
+ {
+ return mpSdrFillBitmapAttribute->getBitmap();
+ }
+
+ const basegfx::B2DVector& SdrFillBitmapAttribute::getSize() const
+ {
+ return mpSdrFillBitmapAttribute->getSize();
+ }
+
+ const basegfx::B2DVector& SdrFillBitmapAttribute::getOffset() const
+ {
+ return mpSdrFillBitmapAttribute->getOffset();
+ }
+
+ const basegfx::B2DVector& SdrFillBitmapAttribute::getOffsetPosition() const
+ {
+ return mpSdrFillBitmapAttribute->getOffsetPosition();
+ }
+
+ const basegfx::B2DVector& SdrFillBitmapAttribute::getRectPoint() const
+ {
+ return mpSdrFillBitmapAttribute->getRectPoint();
+ }
+
+ bool SdrFillBitmapAttribute::getTiling() const
+ {
+ return mpSdrFillBitmapAttribute->getTiling();
+ }
+
+ bool SdrFillBitmapAttribute::getStretch() const
+ {
+ return mpSdrFillBitmapAttribute->getStretch();
+ }
+
+ bool SdrFillBitmapAttribute::getLogSize() const
+ {
+ return mpSdrFillBitmapAttribute->getLogSize();
}
FillBitmapAttribute SdrFillBitmapAttribute::getFillBitmapAttribute(const basegfx::B2DRange& rRange) const
{
// get logical size of bitmap (before expanding eventually)
- Bitmap aBitmap(maBitmap);
+ Bitmap aBitmap(getBitmap());
const basegfx::B2DVector aLogicalSize(aBitmap.GetPrefSize().getWidth(), aBitmap.GetPrefSize().getHeight());
// get hor/ver shiftings and apply them eventually to the bitmap, but only
@@ -85,17 +260,17 @@ namespace drawinglayer
bool bExpandWidth(false);
bool bExpandHeight(false);
- if(mbTiling)
+ if(getTiling())
{
- if(0.0 != maOffset.getX() || 0.0 != maOffset.getY())
+ if(0.0 != getOffset().getX() || 0.0 != getOffset().getY())
{
const sal_uInt32 nWidth(aBitmap.GetSizePixel().getWidth());
const sal_uInt32 nHeight(aBitmap.GetSizePixel().getHeight());
- if(0.0 != maOffset.getX())
+ if(0.0 != getOffset().getX())
{
bExpandHeight = true;
- const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * maOffset.getX()) / 100.0));
+ const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * getOffset().getX()) / 100.0));
aBitmap.Expand(0L, nHeight);
const Size aSizeA(nOffset, nHeight);
@@ -111,7 +286,7 @@ namespace drawinglayer
else
{
bExpandWidth = true;
- const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * maOffset.getY()) / 100.0));
+ const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * getOffset().getY()) / 100.0));
aBitmap.Expand(nWidth, 0L);
const Size aSize(nWidth, nHeight);
@@ -137,7 +312,7 @@ namespace drawinglayer
basegfx::B2DVector aBitmapTopLeft(0.0, 0.0);
// are canges needed?
- if(mbTiling || !mbStretch)
+ if(getTiling() || !getStretch())
{
// init values with range sizes
const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0);
@@ -145,15 +320,15 @@ namespace drawinglayer
aBitmapSize = basegfx::B2DPoint(fRangeWidth, fRangeHeight);
// size changes
- if(0.0 != maSize.getX())
+ if(0.0 != getSize().getX())
{
- if(maSize.getX() < 0.0)
+ if(getSize().getX() < 0.0)
{
- aBitmapSize.setX(aBitmapSize.getX() * (maSize.getX() * -0.01));
+ aBitmapSize.setX(aBitmapSize.getX() * (getSize().getX() * -0.01));
}
else
{
- aBitmapSize.setX(maSize.getX());
+ aBitmapSize.setX(getSize().getX());
}
}
else
@@ -161,15 +336,15 @@ namespace drawinglayer
aBitmapSize.setX(aLogicalSize.getX());
}
- if(0.0 != maSize.getY())
+ if(0.0 != getSize().getY())
{
- if(maSize.getY() < 0.0)
+ if(getSize().getY() < 0.0)
{
- aBitmapSize.setY(aBitmapSize.getY() * (maSize.getY() * -0.01));
+ aBitmapSize.setY(aBitmapSize.getY() * (getSize().getY() * -0.01));
}
else
{
- aBitmapSize.setY(maSize.getY());
+ aBitmapSize.setY(getSize().getY());
}
}
else
@@ -178,7 +353,7 @@ namespace drawinglayer
}
// get values, force to centered if necessary
- const basegfx::B2DVector aRectPoint(mbTiling ? maRectPoint : basegfx::B2DVector(0.0, 0.0));
+ const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0));
// position changes X
if(0.0 == aRectPoint.getX())
@@ -190,9 +365,9 @@ namespace drawinglayer
aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX());
}
- if(mbTiling && 0.0 != maOffsetPosition.getX())
+ if(getTiling() && 0.0 != getOffsetPosition().getX())
{
- aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (maOffsetPosition.getX() * 0.01)));
+ aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01)));
}
// position changes Y
@@ -205,9 +380,9 @@ namespace drawinglayer
aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY());
}
- if(mbTiling && 0.0 != maOffsetPosition.getY())
+ if(getTiling() && 0.0 != getOffsetPosition().getY())
{
- aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (maOffsetPosition.getY() * 0.01)));
+ aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01)));
}
// apply expand
@@ -228,7 +403,7 @@ namespace drawinglayer
aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight);
}
- return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, mbTiling);
+ return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, getTiling());
}
} // end of namespace attribute
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/attribute/sdrlightattribute3d.cxx b/drawinglayer/source/attribute/sdrlightattribute3d.cxx
new file mode 100644
index 000000000000..bc22d0a5f183
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlightattribute3d.cxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute3d.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 000000000000..25407d52f282
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute3d.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 000000000000..1850d919069f
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlineattribute.cxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 000000000000..ce85bdff5678
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 000000000000..a51e333236bc
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx
@@ -0,0 +1,292 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute3d.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 000000000000..141f4c904873
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute3d.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 000000000000..9b31b5c6d348
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute.cxx,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <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 f3eb4797b832..da1239e53211 100644
--- a/drawinglayer/source/attribute/strokeattribute.cxx
+++ b/drawinglayer/source/attribute/strokeattribute.cxx
@@ -45,16 +45,143 @@ namespace drawinglayer
{
namespace attribute
{
- double StrokeAttribute::getFullDotDashLen() const
+ class ImpStrokeAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // data definitions
+ ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern
+ double mfFullDotDashLen; // sum of maDotDashArray (for convenience)
+
+ ImpStrokeAttribute(
+ const ::std::vector< double >& rDotDashArray,
+ double fFullDotDashLen)
+ : mnRefCount(0),
+ maDotDashArray(rDotDashArray),
+ mfFullDotDashLen(fFullDotDashLen)
+ {
+ }
+
+ // data read access
+ const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; }
+ double getFullDotDashLen() const
+ {
+ if(0.0 == mfFullDotDashLen && maDotDashArray.size())
+ {
+ // calculate length on demand
+ const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0));
+ const_cast< ImpStrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated;
+ }
+
+ return mfFullDotDashLen;
+ }
+
+ bool operator==(const ImpStrokeAttribute& rCandidate) const
+ {
+ return (getDotDashArray() == rCandidate.getDotDashArray()
+ && getFullDotDashLen() == rCandidate.getFullDotDashLen());
+ }
+
+ static ImpStrokeAttribute* get_global_default()
+ {
+ static ImpStrokeAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpStrokeAttribute(
+ std::vector< double >(),
+ 0.0);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
+ StrokeAttribute::StrokeAttribute(
+ const ::std::vector< double >& rDotDashArray,
+ double fFullDotDashLen)
+ : mpStrokeAttribute(new ImpStrokeAttribute(
+ rDotDashArray, fFullDotDashLen))
+ {
+ }
+
+ StrokeAttribute::StrokeAttribute()
+ : mpStrokeAttribute(ImpStrokeAttribute::get_global_default())
+ {
+ mpStrokeAttribute->mnRefCount++;
+ }
+
+ StrokeAttribute::StrokeAttribute(const StrokeAttribute& rCandidate)
+ : mpStrokeAttribute(rCandidate.mpStrokeAttribute)
+ {
+ mpStrokeAttribute->mnRefCount++;
+ }
+
+ StrokeAttribute::~StrokeAttribute()
+ {
+ if(mpStrokeAttribute->mnRefCount)
+ {
+ mpStrokeAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpStrokeAttribute;
+ }
+ }
+
+ bool StrokeAttribute::isDefault() const
+ {
+ return mpStrokeAttribute == ImpStrokeAttribute::get_global_default();
+ }
+
+ StrokeAttribute& StrokeAttribute::operator=(const StrokeAttribute& rCandidate)
+ {
+ if(rCandidate.mpStrokeAttribute != mpStrokeAttribute)
+ {
+ if(mpStrokeAttribute->mnRefCount)
+ {
+ mpStrokeAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpStrokeAttribute;
+ }
+
+ mpStrokeAttribute = rCandidate.mpStrokeAttribute;
+ mpStrokeAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
+ bool StrokeAttribute::operator==(const StrokeAttribute& rCandidate) const
{
- if(0.0 == mfFullDotDashLen && maDotDashArray.size())
+ if(rCandidate.mpStrokeAttribute == mpStrokeAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
{
- // calculate length on demand
- const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0));
- const_cast< StrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated;
+ return false;
}
- return mfFullDotDashLen;
+ return (*rCandidate.mpStrokeAttribute == *mpStrokeAttribute);
+ }
+
+ const ::std::vector< double >& StrokeAttribute::getDotDashArray() const
+ {
+ return mpStrokeAttribute->getDotDashArray();
+ }
+
+ double StrokeAttribute::getFullDotDashLen() const
+ {
+ return mpStrokeAttribute->getFullDotDashLen();
}
} // end of namespace attribute
} // end of namespace drawinglayer