summaryrefslogtreecommitdiffstats
path: root/drawinglayer/source/attribute
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /drawinglayer/source/attribute
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drawinglayer/source/attribute')
-rw-r--r--drawinglayer/source/attribute/fillgradientattribute.cxx186
-rw-r--r--drawinglayer/source/attribute/fillgraphicattribute.cxx156
-rw-r--r--drawinglayer/source/attribute/fillhatchattribute.cxx166
-rw-r--r--drawinglayer/source/attribute/fontattribute.cxx151
-rw-r--r--drawinglayer/source/attribute/lineattribute.cxx152
-rw-r--r--drawinglayer/source/attribute/linestartendattribute.cxx132
-rw-r--r--drawinglayer/source/attribute/materialattribute3d.cxx133
-rw-r--r--drawinglayer/source/attribute/sdrallattribute3d.cxx59
-rw-r--r--drawinglayer/source/attribute/sdrfillattribute.cxx165
-rw-r--r--drawinglayer/source/attribute/sdrfillgraphicattribute.cxx304
-rw-r--r--drawinglayer/source/attribute/sdrglowattribute.cxx37
-rw-r--r--drawinglayer/source/attribute/sdrlightattribute3d.cxx96
-rw-r--r--drawinglayer/source/attribute/sdrlightingattribute3d.cxx172
-rw-r--r--drawinglayer/source/attribute/sdrlineattribute.cxx181
-rw-r--r--drawinglayer/source/attribute/sdrlinestartendattribute.cxx187
-rw-r--r--drawinglayer/source/attribute/sdrobjectattribute3d.cxx184
-rw-r--r--drawinglayer/source/attribute/sdrsceneattribute3d.cxx147
-rw-r--r--drawinglayer/source/attribute/sdrshadowattribute.cxx151
-rw-r--r--drawinglayer/source/attribute/strokeattribute.cxx125
19 files changed, 2884 insertions, 0 deletions
diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx
new file mode 100644
index 000000000..b8b06e20b
--- /dev/null
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpFillGradientAttribute
+ {
+ public:
+ // data definitions
+ double mfBorder;
+ double mfOffsetX;
+ double mfOffsetY;
+ double mfAngle;
+ basegfx::BColor maStartColor;
+ basegfx::BColor maEndColor;
+ GradientStyle meStyle;
+ 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)
+ : mfBorder(fBorder),
+ mfOffsetX(fOffsetX),
+ mfOffsetY(fOffsetY),
+ mfAngle(fAngle),
+ maStartColor(rStartColor),
+ maEndColor(rEndColor),
+ meStyle(eStyle),
+ mnSteps(nSteps)
+ {
+ }
+
+ ImpFillGradientAttribute()
+ : mfBorder(0.0),
+ mfOffsetX(0.0),
+ mfOffsetY(0.0),
+ mfAngle(0.0),
+ meStyle(GradientStyle::Linear),
+ mnSteps(0)
+ {
+ }
+
+ // 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());
+ }
+ };
+
+ namespace
+ {
+ FillGradientAttribute::ImplType& theGlobalDefault()
+ {
+ static FillGradientAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ FillGradientAttribute::FillGradientAttribute(
+ GradientStyle eStyle,
+ double fBorder,
+ double fOffsetX,
+ double fOffsetY,
+ double fAngle,
+ const basegfx::BColor& rStartColor,
+ const basegfx::BColor& rEndColor,
+ sal_uInt16 nSteps)
+ : mpFillGradientAttribute(ImpFillGradientAttribute(
+ eStyle, fBorder, fOffsetX, fOffsetY, fAngle, rStartColor, rEndColor, nSteps))
+ {
+ }
+
+ FillGradientAttribute::FillGradientAttribute()
+ : mpFillGradientAttribute(theGlobalDefault())
+ {
+ }
+
+ FillGradientAttribute::FillGradientAttribute(const FillGradientAttribute&) = default;
+
+ FillGradientAttribute::FillGradientAttribute(FillGradientAttribute&&) = default;
+
+ FillGradientAttribute::~FillGradientAttribute() = default;
+
+ bool FillGradientAttribute::isDefault() const
+ {
+ return mpFillGradientAttribute.same_object(theGlobalDefault());
+ }
+
+ FillGradientAttribute& FillGradientAttribute::operator=(const FillGradientAttribute&) = default;
+
+ FillGradientAttribute& FillGradientAttribute::operator=(FillGradientAttribute&&) = default;
+
+ bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/fillgraphicattribute.cxx b/drawinglayer/source/attribute/fillgraphicattribute.cxx
new file mode 100644
index 000000000..b36520d4f
--- /dev/null
+++ b/drawinglayer/source/attribute/fillgraphicattribute.cxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <algorithm>
+
+#include <drawinglayer/attribute/fillgraphicattribute.hxx>
+#include <vcl/graph.hxx>
+
+namespace drawinglayer::attribute
+{
+ class ImpFillGraphicAttribute
+ {
+ public:
+ // data definitions
+ Graphic maGraphic;
+ basegfx::B2DRange maGraphicRange;
+
+ bool mbTiling : 1;
+
+ // tiling definitions, offsets in X/Y in percent for each 2nd row.
+ // If both are set, Y is ignored (X has precedence)
+ double mfOffsetX;
+ double mfOffsetY;
+
+ ImpFillGraphicAttribute(
+ const Graphic& rGraphic,
+ const basegfx::B2DRange& rGraphicRange,
+ bool bTiling,
+ double fOffsetX,
+ double fOffsetY)
+ : maGraphic(rGraphic),
+ maGraphicRange(rGraphicRange),
+ mbTiling(bTiling),
+ mfOffsetX(fOffsetX),
+ mfOffsetY(fOffsetY)
+ {
+ // access once to ensure that the buffered bitmap exists, else
+ // the SolarMutex may be needed to create it. This may not be
+ // available when a renderer works with multi-threading.
+ // When changing this, please check if it is still possible to
+ // use a metafile as texture for a 3D object
+ maGraphic.GetBitmapEx();
+ }
+
+ ImpFillGraphicAttribute()
+ : mbTiling(false),
+ mfOffsetX(0.0),
+ mfOffsetY(0.0)
+ {
+ }
+
+ // data read access
+ const Graphic& getGraphic() const { return maGraphic; }
+ const basegfx::B2DRange& getGraphicRange() const { return maGraphicRange; }
+ bool getTiling() const { return mbTiling; }
+ double getOffsetX() const { return mfOffsetX; }
+ double getOffsetY() const { return mfOffsetY; }
+
+ bool operator==(const ImpFillGraphicAttribute& rCandidate) const
+ {
+ return (getGraphic() == rCandidate.getGraphic()
+ && getGraphicRange() == rCandidate.getGraphicRange()
+ && getTiling() == rCandidate.getTiling()
+ && getOffsetX() == rCandidate.getOffsetX()
+ && getOffsetY() == rCandidate.getOffsetY());
+ }
+ };
+
+ namespace
+ {
+ FillGraphicAttribute::ImplType& theGlobalDefault()
+ {
+ static FillGraphicAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ FillGraphicAttribute::FillGraphicAttribute(
+ const Graphic& rGraphic,
+ const basegfx::B2DRange& rGraphicRange,
+ bool bTiling,
+ double fOffsetX,
+ double fOffsetY)
+ : mpFillGraphicAttribute(ImpFillGraphicAttribute(
+ rGraphic, rGraphicRange, bTiling,
+ std::clamp(fOffsetX, 0.0, 1.0),
+ std::clamp(fOffsetY, 0.0, 1.0)))
+ {
+ }
+
+ FillGraphicAttribute::FillGraphicAttribute(const FillGraphicAttribute&) = default;
+
+ FillGraphicAttribute::~FillGraphicAttribute() = default;
+
+ bool FillGraphicAttribute::isDefault() const
+ {
+ return mpFillGraphicAttribute.same_object(theGlobalDefault());
+ }
+
+ FillGraphicAttribute& FillGraphicAttribute::operator=(const FillGraphicAttribute&) = default;
+
+ bool FillGraphicAttribute::operator==(const FillGraphicAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
+ return rCandidate.mpFillGraphicAttribute == mpFillGraphicAttribute;
+ }
+
+ const Graphic& FillGraphicAttribute::getGraphic() const
+ {
+ return mpFillGraphicAttribute->getGraphic();
+ }
+
+ const basegfx::B2DRange& FillGraphicAttribute::getGraphicRange() const
+ {
+ return mpFillGraphicAttribute->getGraphicRange();
+ }
+
+ bool FillGraphicAttribute::getTiling() const
+ {
+ return mpFillGraphicAttribute->getTiling();
+ }
+
+ double FillGraphicAttribute::getOffsetX() const
+ {
+ return mpFillGraphicAttribute->getOffsetX();
+ }
+
+ double FillGraphicAttribute::getOffsetY() const
+ {
+ return mpFillGraphicAttribute->getOffsetY();
+ }
+
+} // end of namespace
+
+/* 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 000000000..bc892a024
--- /dev/null
+++ b/drawinglayer/source/attribute/fillhatchattribute.cxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpFillHatchAttribute
+ {
+ public:
+ // data definitions
+ HatchStyle meStyle;
+ double mfDistance;
+ double mfAngle;
+ basegfx::BColor maColor;
+ sal_uInt32 mnMinimalDiscreteDistance;
+
+ bool mbFillBackground : 1;
+
+ ImpFillHatchAttribute(
+ HatchStyle eStyle,
+ double fDistance,
+ double fAngle,
+ const basegfx::BColor& rColor,
+ sal_uInt32 nMinimalDiscreteDistance,
+ bool bFillBackground)
+ : meStyle(eStyle),
+ mfDistance(fDistance),
+ mfAngle(fAngle),
+ maColor(rColor),
+ mnMinimalDiscreteDistance(nMinimalDiscreteDistance),
+ mbFillBackground(bFillBackground)
+ {
+ }
+
+ ImpFillHatchAttribute()
+ : meStyle(HatchStyle::Single),
+ mfDistance(0.0),
+ mfAngle(0.0),
+ mnMinimalDiscreteDistance(3), // same as VCL
+ mbFillBackground(false)
+ {
+ }
+
+ // 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; }
+ sal_uInt32 getMinimalDiscreteDistance() const { return mnMinimalDiscreteDistance; }
+ bool isFillBackground() const { return mbFillBackground; }
+
+ bool operator==(const ImpFillHatchAttribute& rCandidate) const
+ {
+ return (getStyle() == rCandidate.getStyle()
+ && getDistance() == rCandidate.getDistance()
+ && getAngle() == rCandidate.getAngle()
+ && getColor() == rCandidate.getColor()
+ && getMinimalDiscreteDistance() == rCandidate.getMinimalDiscreteDistance()
+ && isFillBackground() == rCandidate.isFillBackground());
+ }
+ };
+
+ namespace
+ {
+ FillHatchAttribute::ImplType& theGlobalDefault()
+ {
+ static FillHatchAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ FillHatchAttribute::FillHatchAttribute(
+ HatchStyle eStyle,
+ double fDistance,
+ double fAngle,
+ const basegfx::BColor& rColor,
+ sal_uInt32 nMinimalDiscreteDistance,
+ bool bFillBackground)
+ : mpFillHatchAttribute(ImpFillHatchAttribute(
+ eStyle, fDistance, fAngle, rColor,
+ nMinimalDiscreteDistance, bFillBackground))
+ {
+ }
+
+ FillHatchAttribute::FillHatchAttribute()
+ : mpFillHatchAttribute(theGlobalDefault())
+ {
+ }
+
+ FillHatchAttribute::FillHatchAttribute(const FillHatchAttribute&) = default;
+
+ FillHatchAttribute::FillHatchAttribute(FillHatchAttribute&&) = default;
+
+ FillHatchAttribute::~FillHatchAttribute() = default;
+
+ bool FillHatchAttribute::isDefault() const
+ {
+ return mpFillHatchAttribute.same_object(theGlobalDefault());
+ }
+
+ FillHatchAttribute& FillHatchAttribute::operator=(const FillHatchAttribute&) = default;
+
+ FillHatchAttribute& FillHatchAttribute::operator=(FillHatchAttribute&&) = default;
+
+ bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ 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();
+ }
+
+ sal_uInt32 FillHatchAttribute::getMinimalDiscreteDistance() const
+ {
+ return mpFillHatchAttribute->getMinimalDiscreteDistance();
+ }
+
+ bool FillHatchAttribute::isFillBackground() const
+ {
+ return mpFillHatchAttribute->isFillBackground();
+ }
+
+} // end of namespace
+
+/* 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 000000000..8ae3836d8
--- /dev/null
+++ b/drawinglayer/source/attribute/fontattribute.cxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <rtl/ustring.hxx>
+
+namespace drawinglayer::attribute
+{
+class ImpFontAttribute
+{
+public:
+ /// core data
+ OUString maFamilyName; // Font Family Name
+ OUString maStyleName; // Font Style Name
+ sal_uInt16 mnWeight; // Font weight
+
+ bool mbSymbol : 1; // Symbol Font Flag
+ bool mbVertical : 1; // Vertical Text Flag
+ bool mbItalic : 1; // Italic Flag
+ bool mbOutline : 1; // Outline Flag
+ bool mbRTL : 1; // RTL Flag
+ bool mbBiDiStrong : 1; // BiDi Flag
+ bool mbMonospaced : 1;
+
+ ImpFontAttribute(const OUString& rFamilyName, const OUString& rStyleName, sal_uInt16 nWeight,
+ bool bSymbol, bool bVertical, bool bItalic, bool bMonospaced, bool bOutline,
+ bool bRTL, bool bBiDiStrong)
+ : maFamilyName(rFamilyName)
+ , maStyleName(rStyleName)
+ , mnWeight(nWeight)
+ , mbSymbol(bSymbol)
+ , mbVertical(bVertical)
+ , mbItalic(bItalic)
+ , mbOutline(bOutline)
+ , mbRTL(bRTL)
+ , mbBiDiStrong(bBiDiStrong)
+ , mbMonospaced(bMonospaced)
+ {
+ }
+
+ ImpFontAttribute()
+ : mnWeight(0)
+ , mbSymbol(false)
+ , mbVertical(false)
+ , mbItalic(false)
+ , mbOutline(false)
+ , mbRTL(false)
+ , mbBiDiStrong(false)
+ , mbMonospaced(false)
+ {
+ }
+
+ // data read access
+ const OUString& getFamilyName() const { return maFamilyName; }
+ const OUString& 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());
+ }
+};
+
+namespace
+{
+FontAttribute::ImplType& theGlobalDefault()
+{
+ static FontAttribute::ImplType SINGLETON;
+ return SINGLETON;
+}
+}
+
+FontAttribute::FontAttribute(const OUString& rFamilyName, const OUString& rStyleName,
+ sal_uInt16 nWeight, bool bSymbol, bool bVertical, bool bItalic,
+ bool bMonospaced, bool bOutline, bool bRTL, bool bBiDiStrong)
+ : mpFontAttribute(ImpFontAttribute(rFamilyName, rStyleName, nWeight, bSymbol, bVertical,
+ bItalic, bMonospaced, bOutline, bRTL, bBiDiStrong))
+{
+}
+
+FontAttribute::FontAttribute()
+ : mpFontAttribute(theGlobalDefault())
+{
+}
+
+FontAttribute::FontAttribute(const FontAttribute&) = default;
+
+FontAttribute::FontAttribute(FontAttribute&&) = default;
+
+FontAttribute::~FontAttribute() = default;
+
+FontAttribute& FontAttribute::operator=(const FontAttribute&) = default;
+
+FontAttribute& FontAttribute::operator=(FontAttribute&&) = default;
+
+bool FontAttribute::operator==(const FontAttribute& rCandidate) const
+{
+ return rCandidate.mpFontAttribute == mpFontAttribute;
+}
+
+const OUString& FontAttribute::getFamilyName() const { return mpFontAttribute->getFamilyName(); }
+
+const OUString& 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
+
+/* 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 000000000..d4f2418c1
--- /dev/null
+++ b/drawinglayer/source/attribute/lineattribute.cxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpLineAttribute
+ {
+ public:
+ // data definitions
+ basegfx::BColor maColor; // color
+ double mfWidth; // absolute line width
+ basegfx::B2DLineJoin meLineJoin; // type of LineJoin
+ css::drawing::LineCap meLineCap; // BUTT, ROUND, or SQUARE
+ double mfMiterMinimumAngle; // as needed for createAreaGeometry
+
+ ImpLineAttribute(
+ const basegfx::BColor& rColor,
+ double fWidth,
+ basegfx::B2DLineJoin aB2DLineJoin,
+ css::drawing::LineCap aLineCap,
+ double fMiterMinimumAngle)
+ : maColor(rColor),
+ mfWidth(fWidth),
+ meLineJoin(aB2DLineJoin),
+ meLineCap(aLineCap),
+ mfMiterMinimumAngle(fMiterMinimumAngle)
+ {
+ }
+
+ ImpLineAttribute()
+ : mfWidth(0.0),
+ meLineJoin(basegfx::B2DLineJoin::Round),
+ meLineCap(css::drawing::LineCap_BUTT),
+ mfMiterMinimumAngle(basegfx::deg2rad(15.0))
+ {
+ }
+
+ // data read access
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getWidth() const { return mfWidth; }
+ basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; }
+ css::drawing::LineCap getLineCap() const { return meLineCap; }
+ double getMiterMinimumAngle() const { return mfMiterMinimumAngle; }
+
+ bool operator==(const ImpLineAttribute& rCandidate) const
+ {
+ return (getColor() == rCandidate.getColor()
+ && getWidth() == rCandidate.getWidth()
+ && getLineJoin() == rCandidate.getLineJoin()
+ && getLineCap() == rCandidate.getLineCap()
+ && getMiterMinimumAngle() == rCandidate.getMiterMinimumAngle());
+ }
+ };
+
+ namespace
+ {
+ LineAttribute::ImplType& theGlobalDefault()
+ {
+ static LineAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ LineAttribute::LineAttribute(
+ const basegfx::BColor& rColor,
+ double fWidth,
+ basegfx::B2DLineJoin aB2DLineJoin,
+ css::drawing::LineCap aLineCap,
+ double fMiterMinimumAngle)
+ : mpLineAttribute(
+ ImpLineAttribute(
+ rColor,
+ fWidth,
+ aB2DLineJoin,
+ aLineCap,
+ fMiterMinimumAngle))
+ {
+ }
+
+ LineAttribute::LineAttribute()
+ : mpLineAttribute(theGlobalDefault())
+ {
+ }
+
+ LineAttribute::LineAttribute(const LineAttribute&) = default;
+
+ LineAttribute::~LineAttribute() = default;
+
+ bool LineAttribute::isDefault() const
+ {
+ return mpLineAttribute.same_object(theGlobalDefault());
+ }
+
+ LineAttribute& LineAttribute::operator=(const LineAttribute&) = default;
+
+ bool LineAttribute::operator==(const LineAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ 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();
+ }
+
+ css::drawing::LineCap LineAttribute::getLineCap() const
+ {
+ return mpLineAttribute->getLineCap();
+ }
+
+ double LineAttribute::getMiterMinimumAngle() const
+ {
+ return mpLineAttribute->getMiterMinimumAngle();
+ }
+
+} // end of namespace
+
+/* 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 000000000..57a680db3
--- /dev/null
+++ b/drawinglayer/source/attribute/linestartendattribute.cxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpLineStartEndAttribute
+ {
+ public:
+ // data definitions
+ double mfWidth; // absolute line StartEndGeometry base width
+ basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon
+
+ bool mbCentered : 1; // use centered to lineStart/End point?
+
+ ImpLineStartEndAttribute(
+ double fWidth,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ bool bCentered)
+ : mfWidth(fWidth),
+ maPolyPolygon(rPolyPolygon),
+ mbCentered(bCentered)
+ {
+ }
+
+ ImpLineStartEndAttribute()
+ : mfWidth(0.0),
+ mbCentered(false)
+ {
+ }
+
+ // 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());
+ }
+ };
+
+ namespace
+ {
+ LineStartEndAttribute::ImplType& theGlobalDefault()
+ {
+ static LineStartEndAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ LineStartEndAttribute::LineStartEndAttribute(
+ double fWidth,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ bool bCentered)
+ : mpLineStartEndAttribute(ImpLineStartEndAttribute(
+ fWidth, rPolyPolygon, bCentered))
+ {
+ }
+
+ LineStartEndAttribute::LineStartEndAttribute()
+ : mpLineStartEndAttribute(theGlobalDefault())
+ {
+ }
+
+ LineStartEndAttribute::LineStartEndAttribute(const LineStartEndAttribute&) = default;
+
+ LineStartEndAttribute::~LineStartEndAttribute() = default;
+
+ bool LineStartEndAttribute::isDefault() const
+ {
+ return mpLineStartEndAttribute.same_object(theGlobalDefault());
+ }
+
+ LineStartEndAttribute& LineStartEndAttribute::operator=(const LineStartEndAttribute&) = default;
+
+ bool LineStartEndAttribute::operator==(const LineStartEndAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx
new file mode 100644
index 000000000..7206ad54b
--- /dev/null
+++ b/drawinglayer/source/attribute/materialattribute3d.cxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpMaterialAttribute3D
+ {
+ public:
+ // materialAttribute3D definitions
+ basegfx::BColor maColor; // object color
+ basegfx::BColor maSpecular; // material specular color
+ basegfx::BColor maEmission; // material emissive color
+ sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128]
+
+ ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity)
+ : maColor(rColor),
+ maSpecular(rSpecular),
+ maEmission(rEmission),
+ mnSpecularIntensity(nSpecularIntensity)
+ {
+ }
+
+ explicit ImpMaterialAttribute3D(const basegfx::BColor& rColor)
+ : maColor(rColor),
+ maSpecular(1.0, 1.0, 1.0),
+ mnSpecularIntensity(15)
+ {
+ }
+
+ ImpMaterialAttribute3D()
+ : mnSpecularIntensity(0)
+ {
+ }
+
+ // 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());
+ }
+ };
+
+ namespace
+ {
+ MaterialAttribute3D::ImplType& theGlobalDefault()
+ {
+ static MaterialAttribute3D::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ MaterialAttribute3D::MaterialAttribute3D(
+ const basegfx::BColor& rColor,
+ const basegfx::BColor& rSpecular,
+ const basegfx::BColor& rEmission,
+ sal_uInt16 nSpecularIntensity)
+ : mpMaterialAttribute3D(ImpMaterialAttribute3D(
+ rColor, rSpecular, rEmission, nSpecularIntensity))
+ {
+ }
+
+ MaterialAttribute3D::MaterialAttribute3D(
+ const basegfx::BColor& rColor)
+ : mpMaterialAttribute3D(ImpMaterialAttribute3D(rColor))
+ {
+ }
+
+ MaterialAttribute3D::MaterialAttribute3D()
+ : mpMaterialAttribute3D(theGlobalDefault())
+ {
+ }
+
+ MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D&) = default;
+
+ MaterialAttribute3D::~MaterialAttribute3D() = default;
+
+ MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D&) = default;
+
+ bool MaterialAttribute3D::operator==(const MaterialAttribute3D& rCandidate) const
+ {
+ 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
+
+/* 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 000000000..079f65579
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrallattribute3d.hxx>
+
+
+namespace drawinglayer::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::operator==(const SdrLineFillShadowAttribute3D& rCandidate) const
+ {
+ return(getLine() == rCandidate.getLine()
+ && getFill() == rCandidate.getFill()
+ && maLineStartEnd == rCandidate.maLineStartEnd
+ && getShadow() == rCandidate.getShadow()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient());
+ }
+
+} // end of namespace
+
+/* 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 000000000..131061099
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrfillattribute.cxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrFillAttribute
+ {
+ public:
+ // 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)
+ SdrFillGraphicAttribute maFillGraphic; // fill graphic (if used)
+
+ public:
+ ImpSdrFillAttribute(
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ const FillGradientAttribute& rGradient,
+ const FillHatchAttribute& rHatch,
+ const SdrFillGraphicAttribute& rFillGraphic)
+ : mfTransparence(fTransparence),
+ maColor(rColor),
+ maGradient(rGradient),
+ maHatch(rHatch),
+ maFillGraphic(rFillGraphic)
+ {
+ }
+
+ ImpSdrFillAttribute()
+ : mfTransparence(0.0)
+ {
+ }
+
+ // 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 SdrFillGraphicAttribute& getFillGraphic() const { return maFillGraphic; }
+
+ // compare operator
+ bool operator==(const ImpSdrFillAttribute& rCandidate) const
+ {
+ return(getTransparence() == rCandidate.getTransparence()
+ && getColor() == rCandidate.getColor()
+ && getGradient() == rCandidate.getGradient()
+ && getHatch() == rCandidate.getHatch()
+ && getFillGraphic() == rCandidate.getFillGraphic());
+ }
+ };
+
+ namespace
+ {
+ SdrFillAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrFillAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ SdrFillAttribute::ImplType& slideBackgroundFillGlobalDefault()
+ {
+ static SdrFillAttribute::ImplType SINGLETON2;
+ return SINGLETON2;
+ }
+ }
+
+ SdrFillAttribute::SdrFillAttribute(
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ const FillGradientAttribute& rGradient,
+ const FillHatchAttribute& rHatch,
+ const SdrFillGraphicAttribute& rFillGraphic)
+ : mpSdrFillAttribute(ImpSdrFillAttribute(
+ fTransparence, rColor, rGradient, rHatch, rFillGraphic))
+ {
+ }
+
+ SdrFillAttribute::SdrFillAttribute(bool bSlideBackgroundFill)
+ : mpSdrFillAttribute(bSlideBackgroundFill
+ ? slideBackgroundFillGlobalDefault()
+ : theGlobalDefault())
+ {
+ }
+
+ SdrFillAttribute::SdrFillAttribute(const SdrFillAttribute&) = default;
+
+ SdrFillAttribute::SdrFillAttribute(SdrFillAttribute&&) = default;
+
+ SdrFillAttribute::~SdrFillAttribute() = default;
+
+ bool SdrFillAttribute::isDefault() const
+ {
+ return mpSdrFillAttribute.same_object(theGlobalDefault());
+ }
+
+ bool SdrFillAttribute::isSlideBackgroundFill() const
+ {
+ return mpSdrFillAttribute.same_object(slideBackgroundFillGlobalDefault());
+ }
+
+ SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute&) = default;
+
+ SdrFillAttribute& SdrFillAttribute::operator=(SdrFillAttribute&&) = default;
+
+ bool SdrFillAttribute::operator==(const SdrFillAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ 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 SdrFillGraphicAttribute& SdrFillAttribute::getFillGraphic() const
+ {
+ return mpSdrFillAttribute->getFillGraphic();
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
new file mode 100644
index 000000000..14f53cf03
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
@@ -0,0 +1,304 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <algorithm>
+
+#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
+#include <drawinglayer/attribute/fillgraphicattribute.hxx>
+#include <vcl/graph.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrFillGraphicAttribute
+ {
+ public:
+ // data definitions
+ Graphic maFillGraphic;
+ basegfx::B2DVector maGraphicLogicSize;
+ basegfx::B2DVector maSize;
+ basegfx::B2DVector maOffset;
+ basegfx::B2DVector maOffsetPosition;
+ basegfx::B2DVector maRectPoint;
+
+ bool mbTiling : 1;
+ bool mbStretch : 1;
+ bool mbLogSize : 1;
+
+ ImpSdrFillGraphicAttribute(
+ const Graphic& rFillGraphic,
+ const basegfx::B2DVector& rGraphicLogicSize,
+ const basegfx::B2DVector& rSize,
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rOffsetPosition,
+ const basegfx::B2DVector& rRectPoint,
+ bool bTiling,
+ bool bStretch,
+ bool bLogSize)
+ : maFillGraphic(rFillGraphic),
+ maGraphicLogicSize(rGraphicLogicSize),
+ maSize(rSize),
+ maOffset(rOffset),
+ maOffsetPosition(rOffsetPosition),
+ maRectPoint(rRectPoint),
+ mbTiling(bTiling),
+ mbStretch(bStretch),
+ mbLogSize(bLogSize)
+ {
+ }
+
+ ImpSdrFillGraphicAttribute()
+ : mbTiling(false),
+ mbStretch(false),
+ mbLogSize(false)
+ {
+ }
+
+ // data read access
+ const Graphic& getFillGraphic() const { return maFillGraphic; }
+ const basegfx::B2DVector& getGraphicLogicSize() const { return maGraphicLogicSize; }
+ 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 operator==(const ImpSdrFillGraphicAttribute& rCandidate) const
+ {
+ return (getFillGraphic() == rCandidate.getFillGraphic()
+ && getGraphicLogicSize() == rCandidate.getGraphicLogicSize()
+ && getSize() == rCandidate.getSize()
+ && getOffset() == rCandidate.getOffset()
+ && getOffsetPosition() == rCandidate.getOffsetPosition()
+ && getRectPoint() == rCandidate.getRectPoint()
+ && getTiling() == rCandidate.getTiling()
+ && getStretch() == rCandidate.getStretch()
+ && mbLogSize == rCandidate.mbLogSize);
+ }
+ };
+
+ namespace
+ {
+ SdrFillGraphicAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrFillGraphicAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ SdrFillGraphicAttribute::SdrFillGraphicAttribute(
+ const Graphic& rFillGraphic,
+ const basegfx::B2DVector& rGraphicLogicSize,
+ const basegfx::B2DVector& rSize,
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rOffsetPosition,
+ const basegfx::B2DVector& rRectPoint,
+ bool bTiling,
+ bool bStretch,
+ bool bLogSize)
+ : mpSdrFillGraphicAttribute(
+ ImpSdrFillGraphicAttribute(
+ rFillGraphic,
+ rGraphicLogicSize,
+ rSize,
+ rOffset,
+ rOffsetPosition,
+ rRectPoint,
+ bTiling,
+ bStretch,
+ bLogSize))
+ {
+ }
+
+ SdrFillGraphicAttribute::SdrFillGraphicAttribute()
+ : mpSdrFillGraphicAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrFillGraphicAttribute::SdrFillGraphicAttribute(const SdrFillGraphicAttribute&) = default;
+
+ SdrFillGraphicAttribute::SdrFillGraphicAttribute(SdrFillGraphicAttribute&&) = default;
+
+ SdrFillGraphicAttribute::~SdrFillGraphicAttribute() = default;
+
+ bool SdrFillGraphicAttribute::isDefault() const
+ {
+ return mpSdrFillGraphicAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrFillGraphicAttribute& SdrFillGraphicAttribute::operator=(const SdrFillGraphicAttribute&) = default;
+
+ SdrFillGraphicAttribute& SdrFillGraphicAttribute::operator=(SdrFillGraphicAttribute&&) = default;
+
+ bool SdrFillGraphicAttribute::operator==(const SdrFillGraphicAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
+ return rCandidate.mpSdrFillGraphicAttribute == mpSdrFillGraphicAttribute;
+ }
+
+ const Graphic& SdrFillGraphicAttribute::getFillGraphic() const
+ {
+ return mpSdrFillGraphicAttribute->getFillGraphic();
+ }
+
+ const basegfx::B2DVector& SdrFillGraphicAttribute::getGraphicLogicSize() const
+ {
+ return mpSdrFillGraphicAttribute->getGraphicLogicSize();
+ }
+
+ const basegfx::B2DVector& SdrFillGraphicAttribute::getSize() const
+ {
+ return mpSdrFillGraphicAttribute->getSize();
+ }
+
+ const basegfx::B2DVector& SdrFillGraphicAttribute::getOffset() const
+ {
+ return mpSdrFillGraphicAttribute->getOffset();
+ }
+
+ const basegfx::B2DVector& SdrFillGraphicAttribute::getOffsetPosition() const
+ {
+ return mpSdrFillGraphicAttribute->getOffsetPosition();
+ }
+
+ const basegfx::B2DVector& SdrFillGraphicAttribute::getRectPoint() const
+ {
+ return mpSdrFillGraphicAttribute->getRectPoint();
+ }
+
+ bool SdrFillGraphicAttribute::getTiling() const
+ {
+ return mpSdrFillGraphicAttribute->getTiling();
+ }
+
+ FillGraphicAttribute SdrFillGraphicAttribute::createFillGraphicAttribute(const basegfx::B2DRange& rRange) const
+ {
+ // get logical size of bitmap (before possibly expanding it)
+ Graphic aGraphic(getFillGraphic());
+
+ // init values with defaults for stretched
+ basegfx::B2DPoint aBitmapSize(1.0, 1.0);
+ basegfx::B2DVector aBitmapTopLeft(0.0, 0.0);
+
+ // are changes needed? When stretched we are already done, all other values will have no influence
+ if(getTiling() || !mpSdrFillGraphicAttribute->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
+ {
+ // #i124002# use GraphicLogicSize directly, do not try to use GetPrefSize
+ // of the graphic, that may not be adapted to the MapMode of the target
+ aBitmapSize.setX(getGraphicLogicSize().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
+ {
+ // #i124002# use GraphicLogicSize directly, do not try to use GetPrefSize
+ // of the graphic, that may not be adapted to the MapMode of the target
+ aBitmapSize.setY(getGraphicLogicSize().getY());
+ }
+
+ // position changes X
+ if(0.0 == getRectPoint().getX())
+ {
+ aBitmapTopLeft.setX((fRangeWidth - aBitmapSize.getX()) * 0.5);
+ }
+ else if(1.0 == getRectPoint().getX())
+ {
+ aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX());
+ }
+
+ // offset positions are only meaningful when tiled
+ if(getTiling() && 0.0 != getOffsetPosition().getX())
+ {
+ aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01)));
+ }
+
+ // position changes Y
+ if(0.0 == getRectPoint().getY())
+ {
+ aBitmapTopLeft.setY((fRangeHeight - aBitmapSize.getY()) * 0.5);
+ }
+ else if(1.0 == getRectPoint().getY())
+ {
+ aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY());
+ }
+
+ // offset positions are only meaningful when tiled
+ if(getTiling() && 0.0 != getOffsetPosition().getY())
+ {
+ aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01)));
+ }
+
+ // 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);
+ }
+
+ // get offset in percent
+ const double fOffsetX(std::clamp(getOffset().getX() * 0.01, 0.0, 1.0));
+ const double fOffsetY(std::clamp(getOffset().getY() * 0.01, 0.0, 1.0));
+
+ // create FillGraphicAttribute
+ return FillGraphicAttribute(
+ aGraphic,
+ basegfx::B2DRange(aBitmapTopLeft, aBitmapTopLeft + aBitmapSize),
+ getTiling(),
+ fOffsetX,
+ fOffsetY);
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/attribute/sdrglowattribute.cxx b/drawinglayer/source/attribute/sdrglowattribute.cxx
new file mode 100644
index 000000000..c27390d64
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrglowattribute.cxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <drawinglayer/attribute/sdrglowattribute.hxx>
+
+namespace drawinglayer::attribute
+{
+SdrGlowAttribute::SdrGlowAttribute(sal_Int32 nRadius, const Color& rColor)
+ : m_nRadius(nRadius)
+ , m_color(rColor)
+{
+}
+
+SdrGlowAttribute::SdrGlowAttribute() = default;
+
+SdrGlowAttribute::SdrGlowAttribute(const SdrGlowAttribute&) = default;
+
+SdrGlowAttribute::SdrGlowAttribute(SdrGlowAttribute&&) = default;
+
+SdrGlowAttribute& SdrGlowAttribute::operator=(const SdrGlowAttribute&) = default;
+
+SdrGlowAttribute& SdrGlowAttribute::operator=(SdrGlowAttribute&&) = default;
+
+bool SdrGlowAttribute::operator==(const SdrGlowAttribute& rCandidate) const
+{
+ return m_nRadius == rCandidate.m_nRadius && m_color == rCandidate.m_color;
+}
+
+} // end of namespace drawinglayer::attribute
+
+/* 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 000000000..511590f5f
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlightattribute3d.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdr3DLightAttribute
+ {
+ public:
+ // 3D light attribute definitions
+ basegfx::BColor maColor;
+ basegfx::B3DVector maDirection;
+
+ bool mbSpecular : 1;
+
+ ImpSdr3DLightAttribute(
+ const basegfx::BColor& rColor,
+ const basegfx::B3DVector& rDirection,
+ bool bSpecular)
+ : 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());
+ }
+ };
+
+ Sdr3DLightAttribute::Sdr3DLightAttribute(
+ const basegfx::BColor& rColor,
+ const basegfx::B3DVector& rDirection,
+ bool bSpecular)
+ : mpSdr3DLightAttribute(ImpSdr3DLightAttribute(
+ rColor, rDirection, bSpecular))
+ {
+ }
+
+ Sdr3DLightAttribute::Sdr3DLightAttribute(const Sdr3DLightAttribute&) = default;
+
+ Sdr3DLightAttribute::~Sdr3DLightAttribute() = default;
+
+ Sdr3DLightAttribute& Sdr3DLightAttribute::operator=(const Sdr3DLightAttribute&) = default;
+
+ bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const
+ {
+ 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
+
+/* 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 000000000..4f9b75cd1
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrLightingAttribute
+ {
+ public:
+ // 3D light attribute definitions
+ basegfx::BColor maAmbientLight;
+ std::vector< Sdr3DLightAttribute > maLightVector;
+
+ ImpSdrLightingAttribute(
+ const basegfx::BColor& rAmbientLight,
+ std::vector< Sdr3DLightAttribute >&& rLightVector)
+ : maAmbientLight(rAmbientLight),
+ maLightVector(std::move(rLightVector))
+ {
+ }
+
+ ImpSdrLightingAttribute()
+ {
+ }
+
+ // 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());
+ }
+ };
+
+ namespace
+ {
+ SdrLightingAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrLightingAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ SdrLightingAttribute::SdrLightingAttribute(
+ const basegfx::BColor& rAmbientLight,
+ std::vector< Sdr3DLightAttribute >&& rLightVector)
+ : mpSdrLightingAttribute(ImpSdrLightingAttribute(
+ rAmbientLight, std::move(rLightVector)))
+ {
+ }
+
+ SdrLightingAttribute::SdrLightingAttribute()
+ : mpSdrLightingAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrLightingAttribute::SdrLightingAttribute(const SdrLightingAttribute&) = default;
+
+ SdrLightingAttribute::SdrLightingAttribute(SdrLightingAttribute&&) = default;
+
+ SdrLightingAttribute::~SdrLightingAttribute() = default;
+
+
+ bool SdrLightingAttribute::isDefault() const
+ {
+ return mpSdrLightingAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrLightingAttribute& SdrLightingAttribute::operator=(const SdrLightingAttribute&) = default;
+
+ SdrLightingAttribute& SdrLightingAttribute::operator=(SdrLightingAttribute&&) = default;
+
+ bool SdrLightingAttribute::operator==(const SdrLightingAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
+ return rCandidate.mpSdrLightingAttribute == mpSdrLightingAttribute;
+ }
+
+ const std::vector< Sdr3DLightAttribute >& SdrLightingAttribute::getLightVector() const
+ {
+ return mpSdrLightingAttribute->getLightVector();
+ }
+
+ const basegfx::BColor& SdrLightingAttribute::getAmbientLightColor() const
+ {
+ return mpSdrLightingAttribute->maAmbientLight;
+ }
+
+ // 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;
+
+ const std::vector<Sdr3DLightAttribute>& rLightVector = mpSdrLightingAttribute->getLightVector();
+
+ // prepare light access. Is there a light?
+ const sal_uInt32 nLightCount(rLightVector.size());
+
+ if(nLightCount && !rNormalInEyeCoordinates.equalZero())
+ {
+ // prepare normal
+ basegfx::B3DVector aEyeNormal(rNormalInEyeCoordinates);
+ aEyeNormal.normalize();
+
+ for(sal_uInt32 a(0); a < nLightCount; a++)
+ {
+ const Sdr3DLightAttribute& rLight(rLightVector[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, static_cast<double>(nSpecularIntensity));
+ aRetval += rSpecular * fCosFac2;
+ }
+ }
+ }
+ }
+ }
+
+ // clamp to color space before usage
+ aRetval.clamp();
+
+ return aRetval;
+ }
+
+} // end of namespace
+
+/* 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 000000000..f8d4aefb0
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlineattribute.cxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrLineAttribute
+ {
+ public:
+ // line definitions
+ double mfWidth; // 1/100th mm, 0.0==hair
+ double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
+ double mfFullDotDashLen; // sum of maDotDashArray (for convenience)
+ basegfx::BColor maColor; // color of line
+ std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern
+ basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines
+ css::drawing::LineCap meCap; // BUTT, ROUND, or SQUARE
+
+ ImpSdrLineAttribute(
+ basegfx::B2DLineJoin eJoin,
+ double fWidth,
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ css::drawing::LineCap eCap,
+ std::vector< double >&& rDotDashArray,
+ double fFullDotDashLen)
+ : mfWidth(fWidth),
+ mfTransparence(fTransparence),
+ mfFullDotDashLen(fFullDotDashLen),
+ maColor(rColor),
+ maDotDashArray(std::move(rDotDashArray)),
+ meJoin(eJoin),
+ meCap(eCap)
+ {
+ }
+
+ ImpSdrLineAttribute()
+ : mfWidth(0.0),
+ mfTransparence(0.0),
+ mfFullDotDashLen(0.0),
+ meJoin(basegfx::B2DLineJoin::Round),
+ meCap(css::drawing::LineCap_BUTT)
+ {
+ }
+
+ // 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; }
+ css::drawing::LineCap getCap() const { return meCap; }
+ 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()
+ && getCap() == rCandidate.getCap()
+ && getDotDashArray() == rCandidate.getDotDashArray());
+ }
+ };
+
+ namespace
+ {
+ SdrLineAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrLineAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ SdrLineAttribute::SdrLineAttribute(
+ basegfx::B2DLineJoin eJoin,
+ double fWidth,
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ css::drawing::LineCap eCap,
+ std::vector< double >&& rDotDashArray,
+ double fFullDotDashLen)
+ : mpSdrLineAttribute(
+ ImpSdrLineAttribute(
+ eJoin,
+ fWidth,
+ fTransparence,
+ rColor,
+ eCap,
+ std::move(rDotDashArray),
+ fFullDotDashLen))
+
+ {
+ }
+
+ SdrLineAttribute::SdrLineAttribute()
+ : mpSdrLineAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrLineAttribute::SdrLineAttribute(const SdrLineAttribute&) = default;
+
+ SdrLineAttribute::SdrLineAttribute(SdrLineAttribute&&) = default;
+
+ SdrLineAttribute::~SdrLineAttribute() = default;
+
+ bool SdrLineAttribute::isDefault() const
+ {
+ return mpSdrLineAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrLineAttribute& SdrLineAttribute::operator=(const SdrLineAttribute&) = default;
+
+ SdrLineAttribute& SdrLineAttribute::operator=(SdrLineAttribute&&) = default;
+
+ bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ 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();
+ }
+
+ css::drawing::LineCap SdrLineAttribute::getCap() const
+ {
+ return mpSdrLineAttribute->getCap();
+ }
+
+} // end of namespace
+
+/* 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 000000000..aa052236c
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrLineStartEndAttribute
+ {
+ public:
+ // 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
+
+ bool mbStartActive : 1; // start of Line is active
+ bool mbEndActive : 1; // end of Line is active
+ bool mbStartCentered : 1; // Line is centered on line start point
+ bool mbEndCentered : 1; // 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)
+ : maStartPolyPolygon(rStartPolyPolygon),
+ maEndPolyPolygon(rEndPolyPolygon),
+ mfStartWidth(fStartWidth),
+ mfEndWidth(fEndWidth),
+ mbStartActive(bStartActive),
+ mbEndActive(bEndActive),
+ mbStartCentered(bStartCentered),
+ mbEndCentered(bEndCentered)
+ {
+ }
+
+ ImpSdrLineStartEndAttribute()
+ : mfStartWidth(0.0),
+ mfEndWidth(0.0),
+ mbStartActive(false),
+ mbEndActive(false),
+ mbStartCentered(false),
+ mbEndCentered(false)
+ {
+ }
+
+ // 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());
+ }
+ };
+
+ namespace
+ {
+ SdrLineStartEndAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrLineStartEndAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ SdrLineStartEndAttribute::SdrLineStartEndAttribute(
+ const basegfx::B2DPolyPolygon& rStartPolyPolygon,
+ const basegfx::B2DPolyPolygon& rEndPolyPolygon,
+ double fStartWidth,
+ double fEndWidth,
+ bool bStartActive,
+ bool bEndActive,
+ bool bStartCentered,
+ bool bEndCentered)
+ : mpSdrLineStartEndAttribute(ImpSdrLineStartEndAttribute(
+ rStartPolyPolygon, rEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered))
+ {
+ }
+
+ SdrLineStartEndAttribute::SdrLineStartEndAttribute()
+ : mpSdrLineStartEndAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrLineStartEndAttribute::SdrLineStartEndAttribute(const SdrLineStartEndAttribute&) = default;
+
+ SdrLineStartEndAttribute::SdrLineStartEndAttribute(SdrLineStartEndAttribute&&) = default;
+
+ SdrLineStartEndAttribute::~SdrLineStartEndAttribute() = default;
+
+ bool SdrLineStartEndAttribute::isDefault() const
+ {
+ return mpSdrLineStartEndAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrLineStartEndAttribute& SdrLineStartEndAttribute::operator=(const SdrLineStartEndAttribute&) = default;
+
+ SdrLineStartEndAttribute& SdrLineStartEndAttribute::operator=(SdrLineStartEndAttribute&&) = default;
+
+ bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ 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
+
+/* 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 000000000..dad8a07ee
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdr3DObjectAttribute
+ {
+ public:
+ // 3D object attribute definitions
+ css::drawing::NormalsKind maNormalsKind; // normals type (0..2)
+ css::drawing::TextureProjectionMode maTextureProjectionX; // texture projection type X (0..2)
+ css::drawing::TextureProjectionMode maTextureProjectionY; // texture projection type Y (0..2)
+ css::drawing::TextureKind2 maTextureKind; // texture kind (see uno API)
+ css::drawing::TextureMode maTextureMode; // texture kind (see uno API)
+ MaterialAttribute3D maMaterial; // object, specular and emissive colors, SpecularIntensity
+
+ bool mbNormalsInvert : 1; // invert normals
+ bool mbDoubleSided : 1; // surfaces are double sided
+ bool mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene
+ bool mbTextureFilter : 1; // filter texture to make more smooth
+ bool mbReducedLineGeometry : 1; // use reduced line geometry (object specific)
+
+ ImpSdr3DObjectAttribute(
+ css::drawing::NormalsKind aNormalsKind,
+ css::drawing::TextureProjectionMode aTextureProjectionX,
+ css::drawing::TextureProjectionMode aTextureProjectionY,
+ css::drawing::TextureKind2 aTextureKind,
+ css::drawing::TextureMode aTextureMode,
+ const MaterialAttribute3D& rMaterial,
+ bool bNormalsInvert,
+ bool bDoubleSided,
+ bool bShadow3D,
+ bool bTextureFilter,
+ bool bReducedLineGeometry)
+ : maNormalsKind(aNormalsKind),
+ maTextureProjectionX(aTextureProjectionX),
+ maTextureProjectionY(aTextureProjectionY),
+ maTextureKind(aTextureKind),
+ maTextureMode(aTextureMode),
+ maMaterial(rMaterial),
+ mbNormalsInvert(bNormalsInvert),
+ mbDoubleSided(bDoubleSided),
+ mbShadow3D(bShadow3D),
+ mbTextureFilter(bTextureFilter),
+ mbReducedLineGeometry(bReducedLineGeometry)
+ {
+ }
+
+ // data read access
+ css::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; }
+ css::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; }
+ css::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; }
+ css::drawing::TextureKind2 getTextureKind() const { return maTextureKind; }
+ css::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());
+ }
+ };
+
+ Sdr3DObjectAttribute::Sdr3DObjectAttribute(
+ css::drawing::NormalsKind aNormalsKind,
+ css::drawing::TextureProjectionMode aTextureProjectionX,
+ css::drawing::TextureProjectionMode aTextureProjectionY,
+ css::drawing::TextureKind2 aTextureKind,
+ css::drawing::TextureMode aTextureMode,
+ const MaterialAttribute3D& rMaterial,
+ bool bNormalsInvert,
+ bool bDoubleSided,
+ bool bShadow3D,
+ bool bTextureFilter,
+ bool bReducedLineGeometry)
+ : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute(
+ aNormalsKind, aTextureProjectionX, aTextureProjectionY, aTextureKind, aTextureMode,
+ rMaterial, bNormalsInvert, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry))
+ {
+ }
+
+ Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute&) = default;
+
+ Sdr3DObjectAttribute::~Sdr3DObjectAttribute() = default;
+
+ Sdr3DObjectAttribute& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute&) = default;
+
+ bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const
+ {
+ return rCandidate.mpSdr3DObjectAttribute == mpSdr3DObjectAttribute;
+ }
+
+ css::drawing::NormalsKind Sdr3DObjectAttribute::getNormalsKind() const
+ {
+ return mpSdr3DObjectAttribute->getNormalsKind();
+ }
+
+ css::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionX() const
+ {
+ return mpSdr3DObjectAttribute->getTextureProjectionX();
+ }
+
+ css::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionY() const
+ {
+ return mpSdr3DObjectAttribute->getTextureProjectionY();
+ }
+
+ css::drawing::TextureKind2 Sdr3DObjectAttribute::getTextureKind() const
+ {
+ return mpSdr3DObjectAttribute->getTextureKind();
+ }
+
+ css::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
+
+/* 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 000000000..840fe2e30
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrSceneAttribute
+ {
+ public:
+ // 3D scene attribute definitions
+ double mfDistance;
+ double mfShadowSlant;
+ css::drawing::ProjectionMode maProjectionMode;
+ css::drawing::ShadeMode maShadeMode;
+
+ bool mbTwoSidedLighting : 1;
+
+ public:
+ ImpSdrSceneAttribute(
+ double fDistance,
+ double fShadowSlant,
+ css::drawing::ProjectionMode aProjectionMode,
+ css::drawing::ShadeMode aShadeMode,
+ bool bTwoSidedLighting)
+ : mfDistance(fDistance),
+ mfShadowSlant(fShadowSlant),
+ maProjectionMode(aProjectionMode),
+ maShadeMode(aShadeMode),
+ mbTwoSidedLighting(bTwoSidedLighting)
+ {
+ }
+
+ ImpSdrSceneAttribute()
+ : mfDistance(0.0),
+ mfShadowSlant(0.0),
+ maProjectionMode(css::drawing::ProjectionMode_PARALLEL),
+ maShadeMode(css::drawing::ShadeMode_FLAT),
+ mbTwoSidedLighting(false)
+ {
+ }
+
+ // data read access
+ double getShadowSlant() const { return mfShadowSlant; }
+ css::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; }
+ css::drawing::ShadeMode getShadeMode() const { return maShadeMode; }
+ bool getTwoSidedLighting() const { return mbTwoSidedLighting; }
+
+ bool operator==(const ImpSdrSceneAttribute& rCandidate) const
+ {
+ return (mfDistance == rCandidate.mfDistance
+ && getShadowSlant() == rCandidate.getShadowSlant()
+ && getProjectionMode() == rCandidate.getProjectionMode()
+ && getShadeMode() == rCandidate.getShadeMode()
+ && getTwoSidedLighting() == rCandidate.getTwoSidedLighting());
+ }
+ };
+
+ namespace
+ {
+ SdrSceneAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrSceneAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ SdrSceneAttribute::SdrSceneAttribute(
+ double fDistance,
+ double fShadowSlant,
+ css::drawing::ProjectionMode aProjectionMode,
+ css::drawing::ShadeMode aShadeMode,
+ bool bTwoSidedLighting)
+ : mpSdrSceneAttribute(ImpSdrSceneAttribute(
+ fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting))
+ {
+ }
+
+ SdrSceneAttribute::SdrSceneAttribute()
+ : mpSdrSceneAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrSceneAttribute::SdrSceneAttribute(const SdrSceneAttribute&) = default;
+
+ SdrSceneAttribute::SdrSceneAttribute(SdrSceneAttribute&&) = default;
+
+ SdrSceneAttribute::~SdrSceneAttribute() = default;
+
+ bool SdrSceneAttribute::isDefault() const
+ {
+ return mpSdrSceneAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrSceneAttribute& SdrSceneAttribute::operator=(const SdrSceneAttribute&) = default;
+
+ SdrSceneAttribute& SdrSceneAttribute::operator=(SdrSceneAttribute&&) = default;
+
+ bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
+ return rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute;
+ }
+
+ double SdrSceneAttribute::getShadowSlant() const
+ {
+ return mpSdrSceneAttribute->getShadowSlant();
+ }
+
+ css::drawing::ProjectionMode SdrSceneAttribute::getProjectionMode() const
+ {
+ return mpSdrSceneAttribute->getProjectionMode();
+ }
+
+ css::drawing::ShadeMode SdrSceneAttribute::getShadeMode() const
+ {
+ return mpSdrSceneAttribute->getShadeMode();
+ }
+
+ bool SdrSceneAttribute::getTwoSidedLighting() const
+ {
+ return mpSdrSceneAttribute->getTwoSidedLighting();
+ }
+
+} // end of namespace
+
+/* 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 000000000..6e046f1f0
--- /dev/null
+++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrShadowAttribute
+ {
+ public:
+ // shadow definitions
+ basegfx::B2DVector maOffset; // shadow offset 1/100th mm
+ basegfx::B2DVector maSize; // [0.0 .. 2.0]
+ double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
+ sal_Int32 mnBlur; // [0 .. 180], radius of the blur
+ basegfx::BColor maColor; // color of shadow
+
+ ImpSdrShadowAttribute(
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rSize,
+ double fTransparence,
+ sal_Int32 nBlur,
+ const basegfx::BColor& rColor)
+ : maOffset(rOffset),
+ maSize(rSize),
+ mfTransparence(fTransparence),
+ mnBlur(nBlur),
+ maColor(rColor)
+ {
+ }
+
+ ImpSdrShadowAttribute()
+ : mfTransparence(0.0),
+ mnBlur(0)
+ {
+ }
+
+ // data read access
+ const basegfx::B2DVector& getOffset() const { return maOffset; }
+ const basegfx::B2DVector& getSize() const { return maSize; }
+ double getTransparence() const { return mfTransparence; }
+ sal_Int32 getBlur() const { return mnBlur; }
+ const basegfx::BColor& getColor() const { return maColor; }
+
+ bool operator==(const ImpSdrShadowAttribute& rCandidate) const
+ {
+ return (getOffset() == rCandidate.getOffset()
+ && getSize() == rCandidate.getSize()
+ && getTransparence() == rCandidate.getTransparence()
+ && getBlur() == rCandidate.getBlur()
+ && getColor() == rCandidate.getColor());
+ }
+ };
+
+ namespace
+ {
+ SdrShadowAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrShadowAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+
+ SdrShadowAttribute::SdrShadowAttribute(
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rSize,
+ double fTransparence,
+ sal_Int32 nBlur,
+ const basegfx::BColor& rColor)
+ : mpSdrShadowAttribute(ImpSdrShadowAttribute(
+ rOffset, rSize, fTransparence,nBlur, rColor))
+ {
+ }
+
+ SdrShadowAttribute::SdrShadowAttribute()
+ : mpSdrShadowAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrShadowAttribute::SdrShadowAttribute(const SdrShadowAttribute&) = default;
+
+ SdrShadowAttribute::SdrShadowAttribute(SdrShadowAttribute&&) = default;
+
+ SdrShadowAttribute::~SdrShadowAttribute() = default;
+
+ bool SdrShadowAttribute::isDefault() const
+ {
+ return mpSdrShadowAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrShadowAttribute& SdrShadowAttribute::operator=(const SdrShadowAttribute&) = default;
+
+ SdrShadowAttribute& SdrShadowAttribute::operator=(SdrShadowAttribute&&) = default;
+
+ bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
+ return mpSdrShadowAttribute == rCandidate.mpSdrShadowAttribute;
+ }
+
+ const basegfx::B2DVector& SdrShadowAttribute::getOffset() const
+ {
+ return mpSdrShadowAttribute->getOffset();
+ }
+
+ const basegfx::B2DVector& SdrShadowAttribute::getSize() const
+ {
+ return mpSdrShadowAttribute->getSize();
+ }
+
+ double SdrShadowAttribute::getTransparence() const
+ {
+ return mpSdrShadowAttribute->getTransparence();
+ }
+
+ sal_Int32 SdrShadowAttribute::getBlur() const
+ {
+ return mpSdrShadowAttribute->getBlur();
+ }
+
+ const basegfx::BColor& SdrShadowAttribute::getColor() const
+ {
+ return mpSdrShadowAttribute->getColor();
+ }
+
+} // end of namespace
+
+/* 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 000000000..d925eb65a
--- /dev/null
+++ b/drawinglayer/source/attribute/strokeattribute.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <numeric>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpStrokeAttribute
+ {
+ public:
+ // data definitions
+ std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern
+ double mfFullDotDashLen; // sum of maDotDashArray (for convenience)
+
+ ImpStrokeAttribute(
+ std::vector< double >&& rDotDashArray,
+ double fFullDotDashLen)
+ : maDotDashArray(std::move(rDotDashArray)),
+ mfFullDotDashLen(fFullDotDashLen)
+ {
+ }
+
+ ImpStrokeAttribute()
+ : mfFullDotDashLen(0.0)
+ {
+ }
+
+ // data read access
+ const std::vector< double >& getDotDashArray() const { return maDotDashArray; }
+ double getFullDotDashLen() const
+ {
+ if(0.0 == mfFullDotDashLen && !maDotDashArray.empty())
+ {
+ // 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());
+ }
+ };
+
+ namespace
+ {
+ StrokeAttribute::ImplType& theGlobalDefault()
+ {
+ static StrokeAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ StrokeAttribute::StrokeAttribute(
+ std::vector< double >&& rDotDashArray,
+ double fFullDotDashLen)
+ : mpStrokeAttribute(ImpStrokeAttribute(
+ std::move(rDotDashArray), fFullDotDashLen))
+ {
+ }
+
+ StrokeAttribute::StrokeAttribute()
+ : mpStrokeAttribute(theGlobalDefault())
+ {
+ }
+
+ StrokeAttribute::StrokeAttribute(const StrokeAttribute&) = default;
+
+ StrokeAttribute::StrokeAttribute(StrokeAttribute&&) = default;
+
+ StrokeAttribute::~StrokeAttribute() = default;
+
+ bool StrokeAttribute::isDefault() const
+ {
+ return mpStrokeAttribute.same_object(theGlobalDefault());
+ }
+
+ StrokeAttribute& StrokeAttribute::operator=(const StrokeAttribute&) = default;
+
+ StrokeAttribute& StrokeAttribute::operator=(StrokeAttribute&&) = default;
+
+ bool StrokeAttribute::operator==(const StrokeAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */