summaryrefslogtreecommitdiff
path: root/drawinglayer/source/attribute
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2006-08-09 15:51:16 +0000
committerArmin Weiss <aw@openoffice.org>2006-08-09 15:51:16 +0000
commit4d0a693b85b6191d351f7a6bb0e5c30b2e47eca8 (patch)
treece070c550ee0fb8884592d0be883a48de224ad19 /drawinglayer/source/attribute
parent73679d08d7072f98065007b7014df46e45e2862e (diff)
#i39532#
Diffstat (limited to 'drawinglayer/source/attribute')
-rw-r--r--drawinglayer/source/attribute/fillattribute.cxx104
-rw-r--r--drawinglayer/source/attribute/fillbitmapattribute.cxx65
-rw-r--r--drawinglayer/source/attribute/makefile.mk57
-rw-r--r--drawinglayer/source/attribute/materialattribute3d.cxx194
-rw-r--r--drawinglayer/source/attribute/sdrallattribute3d.cxx207
-rw-r--r--drawinglayer/source/attribute/sdrattribute.cxx285
-rw-r--r--drawinglayer/source/attribute/sdrattribute3d.cxx231
-rw-r--r--drawinglayer/source/attribute/sdrfillbitmapattribute.cxx245
8 files changed, 1388 insertions, 0 deletions
diff --git a/drawinglayer/source/attribute/fillattribute.cxx b/drawinglayer/source/attribute/fillattribute.cxx
new file mode 100644
index 000000000000..197f65071a0f
--- /dev/null
+++ b/drawinglayer/source/attribute/fillattribute.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fillattribute.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX
+#include <drawinglayer/attribute/fillattribute.hxx>
+#endif
+
+#ifndef _BGFX_NUMERIC_FTOOLS_HXX
+#include <basegfx/numeric/ftools.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+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
new file mode 100644
index 000000000000..625657412eaa
--- /dev/null
+++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fillbitmapattribute.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ fillBitmapAttribute::fillBitmapAttribute(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling)
+ : maBitmap(rBitmap),
+ maTopLeft(rTopLeft),
+ maSize(rSize),
+ mbTiling(bTiling)
+ {
+ }
+
+ bool fillBitmapAttribute::operator==(const fillBitmapAttribute& rCandidate) const
+ {
+ return (maBitmap == rCandidate.maBitmap
+ && maTopLeft == rCandidate.maTopLeft
+ && maSize == rCandidate.maSize
+ && mbTiling == rCandidate.mbTiling);
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk
new file mode 100644
index 000000000000..7e4bccd0b959
--- /dev/null
+++ b/drawinglayer/source/attribute/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $
+#
+# 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
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=drawinglayer
+TARGET=attribute
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files -------------------------------------
+
+SLOFILES= \
+ $(SLO)$/fillattribute.obj \
+ $(SLO)$/fillbitmapattribute.obj \
+ $(SLO)$/materialattribute3d.obj \
+ $(SLO)$/sdrallattribute3d.obj \
+ $(SLO)$/sdrattribute.obj \
+ $(SLO)$/sdrattribute3d.obj \
+ $(SLO)$/sdrfillbitmapattribute.obj
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx
new file mode 100644
index 000000000000..4a2c0b30cdbc
--- /dev/null
+++ b/drawinglayer/source/attribute/materialattribute3d.cxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: materialattribute3d.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+#endif
+
+#ifndef _BGFX_COLOR_BCOLOR_HXX
+#include <basegfx/color/bcolor.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace
+ {
+ class impMaterialAttribute3D
+ {
+ public:
+ // 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;
+
+ impMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity)
+ : maColor(rColor),
+ maSpecular(rSpecular),
+ maEmission(rEmission),
+ mnSpecularIntensity(nSpecularIntensity),
+ mnRefCount(0L)
+ {
+ }
+
+ impMaterialAttribute3D(const basegfx::BColor& rColor)
+ : maColor(rColor),
+ maSpecular(1.0, 1.0, 1.0),
+ maEmission(),
+ mnSpecularIntensity(15),
+ mnRefCount(0L)
+ {
+ }
+
+ impMaterialAttribute3D()
+ : mnSpecularIntensity(0),
+ mnRefCount(0L)
+ {
+ }
+
+ bool operator==(const impMaterialAttribute3D& rCandidate) const
+ {
+ return (maColor == rCandidate.maColor
+ && maSpecular == rCandidate.maSpecular
+ && maEmission == rCandidate.maEmission
+ && mnSpecularIntensity == rCandidate.mnSpecularIntensity);
+ }
+
+ 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
+
+//////////////////////////////////////////////////////////////////////////////
+
+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))
+ {
+ }
+
+ materialAttribute3D::materialAttribute3D(const basegfx::BColor& rColor)
+ : mpMaterialAttribute3D(new impMaterialAttribute3D(rColor))
+ {
+ }
+
+ materialAttribute3D::materialAttribute3D()
+ : mpMaterialAttribute3D(new impMaterialAttribute3D())
+ {
+ }
+
+ materialAttribute3D::materialAttribute3D(const materialAttribute3D& rCandidate)
+ : mpMaterialAttribute3D(rCandidate.mpMaterialAttribute3D)
+ {
+ mpMaterialAttribute3D->mnRefCount++;
+ }
+
+ materialAttribute3D::~materialAttribute3D()
+ {
+ if(mpMaterialAttribute3D->mnRefCount)
+ {
+ mpMaterialAttribute3D->mnRefCount--;
+ }
+ else
+ {
+ delete mpMaterialAttribute3D;
+ }
+ }
+
+ materialAttribute3D& materialAttribute3D::operator=(const materialAttribute3D& rCandidate)
+ {
+ if(rCandidate.mpMaterialAttribute3D != mpMaterialAttribute3D)
+ {
+ if(mpMaterialAttribute3D->mnRefCount)
+ {
+ mpMaterialAttribute3D->mnRefCount--;
+ }
+ else
+ {
+ delete mpMaterialAttribute3D;
+ }
+
+ mpMaterialAttribute3D = rCandidate.mpMaterialAttribute3D;
+ mpMaterialAttribute3D->mnRefCount++;
+ }
+
+ return *this;
+ }
+
+ bool materialAttribute3D::operator==(const materialAttribute3D& rCandidate) const
+ {
+ if(rCandidate.mpMaterialAttribute3D == mpMaterialAttribute3D)
+ {
+ return true;
+ }
+
+ return (*rCandidate.mpMaterialAttribute3D == *mpMaterialAttribute3D);
+ }
+
+ const basegfx::BColor& materialAttribute3D::getColor() const
+ {
+ return mpMaterialAttribute3D->getColor();
+ }
+
+ const basegfx::BColor& materialAttribute3D::getSpecular() const
+ {
+ return mpMaterialAttribute3D->getSpecular();
+ }
+
+ const basegfx::BColor& materialAttribute3D::getEmission() const
+ {
+ return mpMaterialAttribute3D->getEmission();
+ }
+
+ sal_uInt16 materialAttribute3D::getSpecularIntensity() const
+ {
+ return mpMaterialAttribute3D->getSpecularIntensity();
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/attribute/sdrallattribute3d.cxx b/drawinglayer/source/attribute/sdrallattribute3d.cxx
new file mode 100644
index 000000000000..1ac32323c7ef
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrallattribute3d.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+#include <drawinglayer/attribute/sdrallattribute3d.hxx>
+#endif
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX
+#include <drawinglayer/attribute/sdrattribute.hxx>
+#endif
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX
+#include <drawinglayer/attribute/fillattribute.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// pointer compare define
+#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q))
+
+//////////////////////////////////////////////////////////////////////////////
+
+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(0L),
+ mpLine(0L),
+ mpLineStartEnd(0L),
+ mpFill(0L),
+ mpFillFloatTransGradient(0L)
+ {
+ if(!(*this == rCandidate))
+ {
+ *this = rCandidate;
+ }
+ }
+
+ sdrLineFillShadowAttribute::~sdrLineFillShadowAttribute()
+ {
+ delete mpShadow;
+ delete mpLine;
+ delete mpLineStartEnd;
+ delete mpFill;
+ delete mpFillFloatTransGradient;
+ }
+
+ sdrLineFillShadowAttribute& sdrLineFillShadowAttribute::operator=(const sdrLineFillShadowAttribute& rCandidate)
+ {
+ // handle mpShadow
+ {
+ // delete local mpShadow if necessary
+ if(mpShadow && ((!rCandidate.mpShadow) || (!(*mpShadow == *rCandidate.mpShadow))))
+ {
+ delete mpShadow;
+ mpShadow = 0L;
+ }
+
+ // copy mpShadow if necessary
+ if(!mpShadow && rCandidate.mpShadow)
+ {
+ mpShadow = new sdrShadowAttribute(*rCandidate.mpShadow);
+ }
+ }
+
+ // handle mpLine
+ {
+ // delete local mpLine if necessary
+ if(mpLine && ((!rCandidate.mpLine) || (!(*mpLine == *rCandidate.mpLine))))
+ {
+ delete mpLine;
+ mpLine = 0L;
+ }
+
+ // copy mpLine if necessary
+ if(!mpLine && rCandidate.mpLine)
+ {
+ mpLine = new sdrLineAttribute(*rCandidate.mpLine);
+ }
+ }
+
+ // handle mpLineStartEnd
+ {
+ // delete local mpLineStartEnd if necessary
+ if(mpLineStartEnd && ((!rCandidate.mpLineStartEnd) || (!(*mpLineStartEnd == *rCandidate.mpLineStartEnd))))
+ {
+ delete mpLineStartEnd;
+ mpLineStartEnd = 0L;
+ }
+
+ // copy mpLineStartEnd if necessary
+ if(!mpLineStartEnd && rCandidate.mpLineStartEnd)
+ {
+ mpLineStartEnd = new sdrLineStartEndAttribute(*rCandidate.mpLineStartEnd);
+ }
+ }
+
+ // handle mpFill
+ {
+ // delete local mpFill if necessary
+ if(mpFill && ((!rCandidate.mpFill) || (!(*mpFill == *rCandidate.mpFill))))
+ {
+ delete mpFill;
+ mpFill = 0L;
+ }
+
+ // copy mpFill if necessary
+ if(!mpFill && rCandidate.mpFill)
+ {
+ mpFill = new sdrFillAttribute(*rCandidate.mpFill);
+ }
+ }
+
+ // handle mpFillFloatTransGradient
+ {
+ // delete local mpFillFloatTransGradient if necessary
+ if(mpFillFloatTransGradient && ((!rCandidate.mpFillFloatTransGradient) || (!(*mpFillFloatTransGradient == *rCandidate.mpFillFloatTransGradient))))
+ {
+ delete mpFillFloatTransGradient;
+ mpFillFloatTransGradient = 0L;
+ }
+
+ // copy mpFillFloatTransGradient if necessary
+ if(!mpFillFloatTransGradient && rCandidate.mpFillFloatTransGradient)
+ {
+ mpFillFloatTransGradient = new fillGradientAttribute(*rCandidate.mpFillFloatTransGradient);
+ }
+ }
+
+ return *this;
+ }
+
+ bool sdrLineFillShadowAttribute::operator==(const sdrLineFillShadowAttribute& rCandidate) const
+ {
+ // handle mpShadow
+ if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow))
+ return false;
+
+ // handle mpLine
+ if(!pointerOrContentEqual(mpLine, rCandidate.mpLine))
+ return false;
+
+ // handle mpLineStartEnd
+ if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd))
+ return false;
+
+ // handle mpFill
+ if(!pointerOrContentEqual(mpFill, rCandidate.mpFill))
+ return false;
+
+ // handle mpFillFloatTransGradient
+ if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient))
+ return false;
+
+ return true;
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/attribute/sdrattribute.cxx b/drawinglayer/source/attribute/sdrattribute.cxx
new file mode 100644
index 000000000000..6c4a8ff84501
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrattribute.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-08-09 16:47:34 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX
+#include <drawinglayer/attribute/sdrattribute.hxx>
+#endif
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX
+#include <drawinglayer/attribute/fillattribute.hxx>
+#endif
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ sdrLineAttribute::sdrLineAttribute(
+ basegfx::tools::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()
+ {
+ }
+
+ 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
new file mode 100644
index 000000000000..ccbe27181256
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrattribute3d.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrattribute3d.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-08-09 16:47:34 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX
+#include <drawinglayer/attribute/sdrattribute3d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+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)
+ : maNormalsKind(aNormalsKind),
+ maTextureProjectionX(aTextureProjectionX),
+ maTextureProjectionY(aTextureProjectionY),
+ maTextureKind(aTextureKind),
+ maTextureMode(aTextureMode),
+ maMaterial(rMaterial),
+ mbNormalsInvert(bNormalsInvert),
+ mbDoubleSided(bDoubleSided),
+ mbShadow3D(bShadow3D),
+ mbTextureFilter(bTextureFilter)
+ {
+ }
+
+ sdr3DObjectAttribute::~sdr3DObjectAttribute()
+ {
+ }
+
+ 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);
+ }
+ } // 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)
+ {
+ }
+
+ sdr3DLightAttribute::~sdr3DLightAttribute()
+ {
+ }
+
+ 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)
+ {
+ }
+
+ sdrLightingAttribute::~sdrLightingAttribute()
+ {
+ }
+
+ 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)
+ {
+ }
+
+ sdrSceneAttribute::~sdrSceneAttribute()
+ {
+ }
+
+ 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/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
new file mode 100644
index 000000000000..4f7e8b5947a2
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrfillbitmapattribute.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: aw $ $Date: 2006-08-09 16:47:34 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
+#endif
+
+#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#endif
+
+#ifndef _BGFX_NUMERIC_FTOOLS_HXX
+#include <basegfx/numeric/ftools.hxx>
+#endif
+
+#ifndef _BGFX_RANGE_B2DRANGE_HXX
+#include <basegfx/range/b2drange.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ 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)
+ {
+ }
+
+ 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);
+ }
+
+ fillBitmapAttribute sdrFillBitmapAttribute::getFillBitmapAttribute(const basegfx::B2DRange& rRange) const
+ {
+ // get logical size of bitmap (before expanding eventually)
+ Bitmap aBitmap(maBitmap);
+ const basegfx::B2DVector aLogicalSize(aBitmap.GetPrefSize().getWidth(), aBitmap.GetPrefSize().getHeight());
+
+ // get hor/ver shiftings and apply them eventually to the bitmap, but only
+ // when tiling is on
+ bool bExpandWidth(false);
+ bool bExpandHeight(false);
+
+ if(mbTiling)
+ {
+ if(0.0 != maOffset.getX() || 0.0 != maOffset.getY())
+ {
+ const sal_uInt32 nWidth(aBitmap.GetSizePixel().getWidth());
+ const sal_uInt32 nHeight(aBitmap.GetSizePixel().getHeight());
+
+ if(0.0 != maOffset.getX())
+ {
+ bExpandHeight = true;
+ const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * maOffset.getX()) / 100.0));
+ aBitmap.Expand(0L, nHeight);
+
+ const Size aSizeA(nOffset, nHeight);
+ const Rectangle aDstA(Point(0L, nHeight), aSizeA);
+ const Rectangle aSrcA(Point(nWidth - nOffset, 0L), aSizeA);
+ aBitmap.CopyPixel(aDstA, aSrcA);
+
+ const Size aSizeB(nWidth - nOffset, nHeight);
+ const Rectangle aDstB(Point(nOffset, nHeight), aSizeB);
+ const Rectangle aSrcB(Point(0L, 0L), aSizeB);
+ aBitmap.CopyPixel(aDstB, aSrcB);
+ }
+ else
+ {
+ bExpandWidth = true;
+ const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * maOffset.getY()) / 100.0));
+ aBitmap.Expand(nWidth, 0L);
+
+ const Size aSize(nWidth, nHeight);
+ const Rectangle aDst(Point(nWidth, 0L), aSize);
+ const Rectangle aSrc(Point(0L, 0L), aSize);
+ aBitmap.CopyPixel(aDst, aSrc);
+
+ const Size aSizeA(nWidth, nOffset);
+ const Rectangle aDstA(Point(0L, 0L), aSizeA);
+ const Rectangle aSrcA(Point(nWidth, nHeight - nOffset), aSizeA);
+ aBitmap.CopyPixel(aDstA, aSrcA);
+
+ const Size aSizeB(nWidth, nHeight - nOffset);
+ const Rectangle aDstB(Point(0L, nOffset), aSizeB);
+ const Rectangle aSrcB(Point(nWidth, 0L), aSizeB);
+ aBitmap.CopyPixel(aDstB, aSrcB);
+ }
+ }
+ }
+
+ // init values with defaults
+ basegfx::B2DPoint aBitmapSize(1.0, 1.0);
+ basegfx::B2DVector aBitmapTopLeft(0.0, 0.0);
+
+ // are canges needed?
+ if(mbTiling || !mbStretch)
+ {
+ // init values with range sizes
+ const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0);
+ const double fRangeHeight(0.0 != rRange.getHeight() ? rRange.getHeight() : 1.0);
+ aBitmapSize = basegfx::B2DPoint(fRangeWidth, fRangeHeight);
+
+ // size changes
+ if(0.0 != maSize.getX())
+ {
+ if(maSize.getX() < 0.0)
+ {
+ aBitmapSize.setX(aBitmapSize.getX() * (maSize.getX() * -0.01));
+ }
+ else
+ {
+ aBitmapSize.setX(maSize.getX());
+ }
+ }
+ else
+ {
+ aBitmapSize.setX(aLogicalSize.getX());
+ }
+
+ if(0.0 != maSize.getY())
+ {
+ if(maSize.getY() < 0.0)
+ {
+ aBitmapSize.setY(aBitmapSize.getY() * (maSize.getY() * -0.01));
+ }
+ else
+ {
+ aBitmapSize.setY(maSize.getY());
+ }
+ }
+ else
+ {
+ aBitmapSize.setY(aLogicalSize.getY());
+ }
+
+ // get values, force to centered if necessary
+ const basegfx::B2DVector aRectPoint(mbTiling ? maRectPoint : basegfx::B2DVector(0.0, 0.0));
+
+ // position changes X
+ if(0.0 == aRectPoint.getX())
+ {
+ aBitmapTopLeft.setX((fRangeWidth - aBitmapSize.getX()) * 0.5);
+ }
+ else if(1.0 == aRectPoint.getX())
+ {
+ aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX());
+ }
+
+ if(mbTiling && 0.0 != maOffsetPosition.getX())
+ {
+ aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (maOffsetPosition.getX() * 0.01)));
+ }
+
+ // position changes Y
+ if(0.0 == aRectPoint.getY())
+ {
+ aBitmapTopLeft.setY((fRangeHeight - aBitmapSize.getY()) * 0.5);
+ }
+ else if(1.0 == aRectPoint.getY())
+ {
+ aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY());
+ }
+
+ if(mbTiling && 0.0 != maOffsetPosition.getY())
+ {
+ aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (maOffsetPosition.getY() * 0.01)));
+ }
+
+ // apply expand
+ if(bExpandWidth)
+ {
+ aBitmapSize.setX(aBitmapSize.getX() * 2.0);
+ }
+
+ if(bExpandHeight)
+ {
+ aBitmapSize.setY(aBitmapSize.getY() * 2.0);
+ }
+
+ // apply bitmap size scaling to unit rectangle
+ aBitmapTopLeft.setX(aBitmapTopLeft.getX() / fRangeWidth);
+ aBitmapTopLeft.setY(aBitmapTopLeft.getY() / fRangeHeight);
+ aBitmapSize.setX(aBitmapSize.getX() / fRangeWidth);
+ aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight);
+ }
+
+ return fillBitmapAttribute(aBitmap, aBitmapTopLeft, aBitmapSize, mbTiling);
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof