summaryrefslogtreecommitdiff
path: root/drawinglayer/source/attribute
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/attribute')
-rw-r--r--drawinglayer/source/attribute/fillbitmapattribute.cxx202
-rw-r--r--drawinglayer/source/attribute/fillgradientattribute.cxx247
-rw-r--r--drawinglayer/source/attribute/fillhatchattribute.cxx216
-rw-r--r--drawinglayer/source/attribute/fontattribute.cxx268
-rw-r--r--drawinglayer/source/attribute/lineattribute.cxx188
-rw-r--r--drawinglayer/source/attribute/linestartendattribute.cxx197
-rwxr-xr-xdrawinglayer/source/attribute/makefile.mk61
-rw-r--r--drawinglayer/source/attribute/materialattribute3d.cxx210
-rw-r--r--drawinglayer/source/attribute/sdrallattribute3d.cxx86
-rw-r--r--drawinglayer/source/attribute/sdrfillattribute.cxx218
-rw-r--r--drawinglayer/source/attribute/sdrfillbitmapattribute.cxx407
-rw-r--r--drawinglayer/source/attribute/sdrlightattribute3d.cxx193
-rw-r--r--drawinglayer/source/attribute/sdrlightingattribute3d.cxx232
-rw-r--r--drawinglayer/source/attribute/sdrlineattribute.cxx247
-rw-r--r--drawinglayer/source/attribute/sdrlinestartendattribute.cxx251
-rw-r--r--drawinglayer/source/attribute/sdrobjectattribute3d.cxx289
-rw-r--r--drawinglayer/source/attribute/sdrsceneattribute3d.cxx215
-rw-r--r--drawinglayer/source/attribute/sdrshadowattribute.cxx190
-rw-r--r--drawinglayer/source/attribute/strokeattribute.cxx185
19 files changed, 4102 insertions, 0 deletions
diff --git a/drawinglayer/source/attribute/fillbitmapattribute.cxx b/drawinglayer/source/attribute/fillbitmapattribute.cxx
new file mode 100644
index 000000000000..89e5b721eae1
--- /dev/null
+++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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)
+ : 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
+ {
+ 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
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx
new file mode 100644
index 000000000000..8e50e7ae0028
--- /dev/null
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx b/drawinglayer/source/attribute/fillhatchattribute.cxx
new file mode 100644
index 000000000000..1f2b5892f401
--- /dev/null
+++ b/drawinglayer/source/attribute/fillhatchattribute.cxx
@@ -0,0 +1,216 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/fontattribute.cxx b/drawinglayer/source/attribute/fontattribute.cxx
new file mode 100644
index 000000000000..2554a6bb0d0c
--- /dev/null
+++ b/drawinglayer/source/attribute/fontattribute.cxx
@@ -0,0 +1,268 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <tools/string.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ 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
+ unsigned mbMonospaced : 1;
+
+ ImpFontAttribute(
+ const String& rFamilyName,
+ const String& rStyleName,
+ sal_uInt16 nWeight,
+ bool bSymbol,
+ bool bVertical,
+ bool bItalic,
+ bool bMonospaced,
+ 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),
+ mbMonospaced(bMonospaced)
+ {
+ }
+
+ // 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 getMonospaced() const { return mbMonospaced; }
+
+ 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()
+ && getMonospaced() == rCompare.getMonospaced());
+ }
+
+ static ImpFontAttribute* get_global_default()
+ {
+ static ImpFontAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpFontAttribute(
+ String(), String(),
+ 0,
+ false, 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 bMonospaced,
+ bool bOutline,
+ bool bRTL,
+ bool bBiDiStrong)
+ : mpFontAttribute(new ImpFontAttribute(
+ rFamilyName, rStyleName, nWeight, bSymbol, bVertical, bItalic, bMonospaced, 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();
+ }
+
+ bool FontAttribute::getMonospaced() const
+ {
+ return mpFontAttribute->getMonospaced();
+ }
+
+
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx
new file mode 100644
index 000000000000..20fd9308ff06
--- /dev/null
+++ b/drawinglayer/source/attribute/lineattribute.cxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/linestartendattribute.cxx b/drawinglayer/source/attribute/linestartendattribute.cxx
new file mode 100644
index 000000000000..0f022b8c9d1b
--- /dev/null
+++ b/drawinglayer/source/attribute/linestartendattribute.cxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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 != getB2DPolyPolygon().count()
+ && 0 != getB2DPolyPolygon().getB2DPolygon(0).count());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk
new file mode 100755
index 000000000000..32cef7c7b49c
--- /dev/null
+++ b/drawinglayer/source/attribute/makefile.mk
@@ -0,0 +1,61 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=drawinglayer
+TARGET=attribute
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files -------------------------------------
+
+SLOFILES= \
+ $(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 ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx
new file mode 100644
index 000000000000..0b56ace5df24
--- /dev/null
+++ b/drawinglayer/source/attribute/materialattribute3d.cxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ 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]
+
+ ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity)
+ : mnRefCount(0),
+ maColor(rColor),
+ maSpecular(rSpecular),
+ maEmission(rEmission),
+ mnSpecularIntensity(nSpecularIntensity)
+ {
+ }
+
+ ImpMaterialAttribute3D(const basegfx::BColor& rColor)
+ : mnRefCount(0),
+ maColor(rColor),
+ maSpecular(1.0, 1.0, 1.0),
+ maEmission(),
+ mnSpecularIntensity(15)
+ {
+ }
+
+ // 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 (getColor() == rCandidate.getColor()
+ && getSpecular() == rCandidate.getSpecular()
+ && getEmission() == rCandidate.getEmission()
+ && getSpecularIntensity() == rCandidate.getSpecularIntensity());
+ }
+
+ 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++;
+ }
+
+ 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)
+ : mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor))
+ {
+ }
+
+ MaterialAttribute3D::MaterialAttribute3D()
+ : mpMaterialAttribute3D(ImpMaterialAttribute3D::get_global_default())
+ {
+ mpMaterialAttribute3D->mnRefCount++;
+ }
+
+ MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D& rCandidate)
+ : mpMaterialAttribute3D(rCandidate.mpMaterialAttribute3D)
+ {
+ mpMaterialAttribute3D->mnRefCount++;
+ }
+
+ MaterialAttribute3D::~MaterialAttribute3D()
+ {
+ if(mpMaterialAttribute3D->mnRefCount)
+ {
+ mpMaterialAttribute3D->mnRefCount--;
+ }
+ else
+ {
+ delete mpMaterialAttribute3D;
+ }
+ }
+
+ bool MaterialAttribute3D::isDefault() const
+ {
+ return mpMaterialAttribute3D == ImpMaterialAttribute3D::get_global_default();
+ }
+
+ 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;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrallattribute3d.cxx b/drawinglayer/source/attribute/sdrallattribute3d.cxx
new file mode 100644
index 000000000000..33b5a3155089
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/sdrallattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ 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)
+ {
+ }
+
+ SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D()
+ : maLine(),
+ maFill(),
+ maLineStartEnd(),
+ maShadow(),
+ maFillFloatTransGradient()
+ {
+ }
+
+ bool SdrLineFillShadowAttribute3D::isDefault() const
+ {
+ return(getLine().isDefault()
+ && getFill().isDefault()
+ && getLineStartEnd().isDefault()
+ && getShadow().isDefault()
+ && getFillFloatTransGradient().isDefault());
+ }
+
+ bool SdrLineFillShadowAttribute3D::operator==(const SdrLineFillShadowAttribute3D& rCandidate) const
+ {
+ return(getLine() == rCandidate.getLine()
+ && getFill() == rCandidate.getFill()
+ && getLineStartEnd() == rCandidate.getLineStartEnd()
+ && getShadow() == rCandidate.getShadow()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient());
+ }
+ } // end of namespace overlay
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrfillattribute.cxx b/drawinglayer/source/attribute/sdrfillattribute.cxx
new file mode 100644
index 000000000000..abe6f7e40539
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrfillattribute.cxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
new file mode 100644
index 000000000000..f718ce8f81ab
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx
@@ -0,0 +1,407 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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)
+ : 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
+ {
+ 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(getBitmap());
+ 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(getTiling())
+ {
+ 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 != getOffset().getX())
+ {
+ bExpandHeight = true;
+ const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * getOffset().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 * getOffset().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(getTiling() || !getStretch())
+ {
+ // 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 != getSize().getX())
+ {
+ if(getSize().getX() < 0.0)
+ {
+ aBitmapSize.setX(aBitmapSize.getX() * (getSize().getX() * -0.01));
+ }
+ else
+ {
+ aBitmapSize.setX(getSize().getX());
+ }
+ }
+ else
+ {
+ aBitmapSize.setX(aLogicalSize.getX());
+ }
+
+ if(0.0 != getSize().getY())
+ {
+ if(getSize().getY() < 0.0)
+ {
+ aBitmapSize.setY(aBitmapSize.getY() * (getSize().getY() * -0.01));
+ }
+ else
+ {
+ aBitmapSize.setY(getSize().getY());
+ }
+ }
+ else
+ {
+ aBitmapSize.setY(aLogicalSize.getY());
+ }
+
+ // get values, force to centered if necessary
+ const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : 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(getTiling() && 0.0 != getOffsetPosition().getX())
+ {
+ aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().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(getTiling() && 0.0 != getOffsetPosition().getY())
+ {
+ aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().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(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, getTiling());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrlightattribute3d.cxx b/drawinglayer/source/attribute/sdrlightattribute3d.cxx
new file mode 100644
index 000000000000..e9cfcaae13e1
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlightattribute3d.cxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrlightingattribute3d.cxx b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx
new file mode 100644
index 000000000000..06d814b72d9d
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrlineattribute.cxx b/drawinglayer/source/attribute/sdrlineattribute.cxx
new file mode 100644
index 000000000000..f466709e859d
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlineattribute.cxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrlinestartendattribute.cxx b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx
new file mode 100644
index 000000000000..1a1fe39be3b0
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx
@@ -0,0 +1,251 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrobjectattribute3d.cxx b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx
new file mode 100644
index 000000000000..a6c80cc0f674
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx
@@ -0,0 +1,289 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrsceneattribute3d.cxx b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx
new file mode 100644
index 000000000000..c9d9f88ff4ff
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx b/drawinglayer/source/attribute/sdrshadowattribute.cxx
new file mode 100644
index 000000000000..6dc30f743266
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/strokeattribute.cxx b/drawinglayer/source/attribute/strokeattribute.cxx
new file mode 100644
index 000000000000..667f6e1b463e
--- /dev/null
+++ b/drawinglayer/source/attribute/strokeattribute.cxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_drawinglayer.hxx"
+
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <numeric>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ 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(rCandidate.mpStrokeAttribute == mpStrokeAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpStrokeAttribute == *mpStrokeAttribute);
+ }
+
+ const ::std::vector< double >& StrokeAttribute::getDotDashArray() const
+ {
+ return mpStrokeAttribute->getDotDashArray();
+ }
+
+ double StrokeAttribute::getFullDotDashLen() const
+ {
+ return mpStrokeAttribute->getFullDotDashLen();
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */