summaryrefslogtreecommitdiffstats
path: root/svx/source/sdr/attribute
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/sdr/attribute')
-rw-r--r--svx/source/sdr/attribute/sdrallfillattributeshelper.cxx244
-rw-r--r--svx/source/sdr/attribute/sdreffectstextattribute.cxx76
-rw-r--r--svx/source/sdr/attribute/sdrfilltextattribute.cxx65
-rw-r--r--svx/source/sdr/attribute/sdrformtextattribute.cxx372
-rw-r--r--svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx141
-rw-r--r--svx/source/sdr/attribute/sdrlineeffectstextattribute.cxx75
-rw-r--r--svx/source/sdr/attribute/sdrlinefilleffectstextattribute.cxx77
-rw-r--r--svx/source/sdr/attribute/sdrtextattribute.cxx422
8 files changed, 1472 insertions, 0 deletions
diff --git a/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
new file mode 100644
index 000000000..261eef295
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
@@ -0,0 +1,244 @@
+/* -*- 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 <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
+#include <sdr/primitive2d/sdrattributecreator.hxx>
+#include <sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
+#include <vcl/graph.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer::attribute
+{
+ void SdrAllFillAttributesHelper::createPrimitive2DSequence(
+ const basegfx::B2DRange& rPaintRange,
+ const basegfx::B2DRange& rDefineRange)
+ {
+ // reset and remember new target range for object geometry
+ maLastPaintRange = rPaintRange;
+ maLastDefineRange = rDefineRange;
+
+ if(isUsed())
+ {
+ maPrimitives.resize(1);
+ maPrimitives[0] = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(
+ basegfx::utils::createPolygonFromRect(
+ maLastPaintRange)),
+ maLastDefineRange,
+ maFillAttribute ? *maFillAttribute : drawinglayer::attribute::SdrFillAttribute(),
+ maFillGradientAttribute ? *maFillGradientAttribute : drawinglayer::attribute::FillGradientAttribute());
+ }
+ }
+
+ SdrAllFillAttributesHelper::SdrAllFillAttributesHelper(const Color& rColor)
+ {
+ maFillAttribute = drawinglayer::attribute::SdrFillAttribute(
+ 0.0,
+ rColor.GetRGBColor().getBColor(),
+ drawinglayer::attribute::FillGradientAttribute(),
+ drawinglayer::attribute::FillHatchAttribute(),
+ drawinglayer::attribute::SdrFillGraphicAttribute());
+ }
+
+ SdrAllFillAttributesHelper::SdrAllFillAttributesHelper(const SfxItemSet& rSet)
+ : maFillAttribute(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(rSet)),
+ maFillGradientAttribute(
+ drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))
+ {
+ }
+
+ SdrAllFillAttributesHelper::~SdrAllFillAttributesHelper()
+ {
+ }
+
+ bool SdrAllFillAttributesHelper::isUsed() const
+ {
+ // only depends on fill, FillGradientAttribute alone defines no fill
+ return maFillAttribute && !maFillAttribute->isDefault();
+ }
+
+ bool SdrAllFillAttributesHelper::isTransparent() const
+ {
+ if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence())
+ {
+ return true;
+ }
+
+ if(maFillGradientAttribute && !maFillGradientAttribute->isDefault())
+ {
+ return true;
+ }
+
+ if(hasSdrFillAttribute())
+ {
+ const Graphic& rGraphic = getFillAttribute().getFillGraphic().getFillGraphic();
+
+ return rGraphic.IsSupportedGraphic() && rGraphic.IsTransparent();
+ }
+
+ return false;
+ }
+
+ const drawinglayer::attribute::SdrFillAttribute& SdrAllFillAttributesHelper::getFillAttribute() const
+ {
+ if(!maFillAttribute)
+ {
+ const_cast< SdrAllFillAttributesHelper* >(this)->maFillAttribute.emplace();
+ }
+
+ return *maFillAttribute;
+ }
+
+ const drawinglayer::attribute::FillGradientAttribute& SdrAllFillAttributesHelper::getFillGradientAttribute() const
+ {
+ if(!maFillGradientAttribute)
+ {
+ const_cast< SdrAllFillAttributesHelper* >(this)->maFillGradientAttribute.emplace();
+ }
+
+ return *maFillGradientAttribute;
+ }
+
+ const drawinglayer::primitive2d::Primitive2DContainer& SdrAllFillAttributesHelper::getPrimitive2DSequence(
+ const basegfx::B2DRange& rPaintRange,
+ const basegfx::B2DRange& rDefineRange) const
+ {
+ if(!maPrimitives.empty() && (maLastPaintRange != rPaintRange || maLastDefineRange != rDefineRange))
+ {
+ const_cast< SdrAllFillAttributesHelper* >(this)->maPrimitives.clear();
+ }
+
+ if(maPrimitives.empty())
+ {
+ const_cast< SdrAllFillAttributesHelper* >(this)->createPrimitive2DSequence(rPaintRange, rDefineRange);
+ }
+
+ return maPrimitives;
+ }
+
+ basegfx::BColor SdrAllFillAttributesHelper::getAverageColor(const basegfx::BColor& rFallback) const
+ {
+ basegfx::BColor aRetval(rFallback);
+
+ if(maFillAttribute && !maFillAttribute->isDefault())
+ {
+ const drawinglayer::attribute::FillGradientAttribute& rFillGradientAttribute = maFillAttribute->getGradient();
+ const drawinglayer::attribute::FillHatchAttribute& rFillHatchAttribute = maFillAttribute->getHatch();
+ const drawinglayer::attribute::SdrFillGraphicAttribute& rSdrFillGraphicAttribute = maFillAttribute->getFillGraphic();
+ const drawinglayer::attribute::FillGradientAttribute& rFillTransparenceGradientAttribute = getFillGradientAttribute();
+ double fTransparence(maFillAttribute->getTransparence());
+
+ if(!rFillTransparenceGradientAttribute.isDefault())
+ {
+ const double fTransA = rFillTransparenceGradientAttribute.getStartColor().luminance();
+ const double fTransB = rFillTransparenceGradientAttribute.getEndColor().luminance();
+
+ fTransparence = (fTransA + fTransB) * 0.5;
+ }
+
+ if(!rFillGradientAttribute.isDefault())
+ {
+ // gradient fill
+ const basegfx::BColor& rStart = rFillGradientAttribute.getStartColor();
+ const basegfx::BColor& rEnd = rFillGradientAttribute.getEndColor();
+
+ aRetval = basegfx::interpolate(rStart, rEnd, 0.5);
+ }
+ else if(!rFillHatchAttribute.isDefault())
+ {
+ // hatch fill
+ const basegfx::BColor& rColor = rFillHatchAttribute.getColor();
+
+ if(rFillHatchAttribute.isFillBackground())
+ {
+ const basegfx::BColor& rBackgroundColor = maFillAttribute->getColor();
+
+ // mix colors 50%/50%
+ aRetval = basegfx::interpolate(rColor, rBackgroundColor, 0.5);
+ }
+ else
+ {
+ // mix color with fallback color
+ aRetval = basegfx::interpolate(rColor, rFallback, 0.5);
+ }
+ }
+ else if(!rSdrFillGraphicAttribute.isDefault())
+ {
+ // graphic fill
+
+ // not used yet by purpose (see SwPageFrm::GetDrawBackgrdColor()),
+ // use fallback (already set)
+ }
+ else
+ {
+ // color fill
+ aRetval = maFillAttribute->getColor();
+ }
+
+ if(!basegfx::fTools::equalZero(fTransparence))
+ {
+ // blend into transparency
+ aRetval = basegfx::interpolate(aRetval, rFallback, fTransparence);
+ }
+ }
+
+ return aRetval.clamp();
+ }
+
+ bool SdrAllFillAttributesHelper::needCompleteRepaint() const
+ {
+ if(!isUsed() || !hasSdrFillAttribute())
+ {
+ // not used or no fill
+ return false;
+ }
+
+ const drawinglayer::attribute::SdrFillAttribute& rSdrFillAttribute = getFillAttribute();
+
+ if(!rSdrFillAttribute.getHatch().isDefault())
+ {
+ // hatch is always top-left aligned, needs no full refreshes
+ return false;
+ }
+
+ if(!rSdrFillAttribute.getGradient().isDefault())
+ {
+ // gradients always scale with the object
+ return true;
+ }
+
+ if(!rSdrFillAttribute.getFillGraphic().isDefault())
+ {
+ // some graphic constellations may not need this, but since most do
+ // (stretch to fill, all but top-left aligned, ...) claim to do by default
+ return true;
+ }
+
+ // color fill
+ return false;
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/attribute/sdreffectstextattribute.cxx b/svx/source/sdr/attribute/sdreffectstextattribute.cxx
new file mode 100644
index 000000000..3287b8c8e
--- /dev/null
+++ b/svx/source/sdr/attribute/sdreffectstextattribute.cxx
@@ -0,0 +1,76 @@
+/* -*- 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 <sdr/attribute/sdreffectstextattribute.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ SdrEffectsTextAttribute::SdrEffectsTextAttribute(
+ const SdrShadowAttribute& rShadow,
+ const SdrTextAttribute& rTextAttribute,
+ const SdrGlowAttribute& rGlow,
+ sal_Int32 nSoftEdgeRadius)
+ : maShadow(rShadow),
+ maTextAttribute(rTextAttribute),
+ maGlow(rGlow),
+ mnSoftEdgeRadius(nSoftEdgeRadius)
+ {
+ }
+
+ SdrEffectsTextAttribute::SdrEffectsTextAttribute()
+ {
+ }
+
+ SdrEffectsTextAttribute::SdrEffectsTextAttribute(const SdrEffectsTextAttribute& rCandidate)
+ : maShadow(rCandidate.getShadow()),
+ maTextAttribute(rCandidate.getText()),
+ maGlow(rCandidate.maGlow),
+ mnSoftEdgeRadius(rCandidate.mnSoftEdgeRadius)
+ {
+ }
+
+ SdrEffectsTextAttribute& SdrEffectsTextAttribute::operator=(const SdrEffectsTextAttribute& rCandidate)
+ {
+ maShadow = rCandidate.getShadow();
+ maTextAttribute = rCandidate.getText();
+ maGlow = rCandidate.maGlow;
+ mnSoftEdgeRadius = rCandidate.mnSoftEdgeRadius;
+
+ return *this;
+ }
+
+ bool SdrEffectsTextAttribute::isDefault() const
+ {
+ return (getShadow().isDefault()
+ && getText().isDefault() && maGlow.isDefault() && getSoftEdgeRadius() == 0);
+ }
+
+ bool SdrEffectsTextAttribute::operator==(const SdrEffectsTextAttribute& rCandidate) const
+ {
+ return (getShadow() == rCandidate.getShadow()
+ && getText() == rCandidate.getText()
+ && getGlow() == rCandidate.getGlow()
+ && getSoftEdgeRadius() == rCandidate.getSoftEdgeRadius());
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/attribute/sdrfilltextattribute.cxx b/svx/source/sdr/attribute/sdrfilltextattribute.cxx
new file mode 100644
index 000000000..01593c982
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrfilltextattribute.cxx
@@ -0,0 +1,65 @@
+/* -*- 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 <sdr/attribute/sdrfilltextattribute.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ SdrFillTextAttribute::SdrFillTextAttribute(
+ const SdrFillAttribute& rFill,
+ const FillGradientAttribute& rFillFloatTransGradient,
+ const SdrTextAttribute& rTextAttribute)
+ : maFill(rFill),
+ maFillFloatTransGradient(rFillFloatTransGradient),
+ maTextAttribute(rTextAttribute)
+ {
+ }
+
+ SdrFillTextAttribute::SdrFillTextAttribute()
+ {
+ }
+
+ SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate)
+ : maFill(rCandidate.getFill()),
+ maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()),
+ maTextAttribute(rCandidate.getText())
+ {
+ }
+
+ SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate)
+ {
+ maFill = rCandidate.getFill();
+ maFillFloatTransGradient = rCandidate.getFillFloatTransGradient();
+ maTextAttribute = rCandidate.getText();
+
+ return *this;
+ }
+
+ bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const
+ {
+ return(getFill() == rCandidate.getFill()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()
+ && getText() == rCandidate.getText());
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx
new file mode 100644
index 000000000..69fff8a8d
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx
@@ -0,0 +1,372 @@
+/* -*- 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 <sdr/attribute/sdrformtextattribute.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <svl/itemset.hxx>
+#include <svx/sdprcitm.hxx>
+#include <svx/svddef.hxx>
+#include <svx/xftdiit.hxx>
+#include <svx/xftstit.hxx>
+#include <svx/xftshxy.hxx>
+#include <xftshtit.hxx>
+#include <svx/xtextit0.hxx>
+#include <svx/xftadit.hxx>
+#include <svx/xftshit.hxx>
+#include <svx/xftshcit.hxx>
+#include <svx/xftmrit.hxx>
+#include <svx/xftouit.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/xlncapit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xdash.hxx>
+#include <svx/xlndsit.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <sdr/attribute/sdrformtextoutlineattribute.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+
+// helper to get line, stroke and transparence attributes from SfxItemSet
+
+namespace
+{
+ basegfx::B2DLineJoin impGetB2DLineJoin(css::drawing::LineJoint eLineJoint)
+ {
+ switch(eLineJoint)
+ {
+ case css::drawing::LineJoint_BEVEL :
+ {
+ return basegfx::B2DLineJoin::Bevel;
+ }
+ case css::drawing::LineJoint_MIDDLE :
+ case css::drawing::LineJoint_MITER :
+ {
+ return basegfx::B2DLineJoin::Miter;
+ }
+ case css::drawing::LineJoint_ROUND :
+ {
+ return basegfx::B2DLineJoin::Round;
+ }
+ default : // css::drawing::LineJoint_NONE
+ {
+ return basegfx::B2DLineJoin::NONE; // XLINEJOINT_NONE
+ }
+ }
+ }
+
+ sal_uInt8 impGetStrokeTransparence(bool bShadow, const SfxItemSet& rSet)
+ {
+ sal_uInt8 nRetval;
+
+ if(bShadow)
+ {
+ nRetval = static_cast<sal_uInt8>((rSet.Get(SDRATTR_SHADOWTRANSPARENCE).GetValue() * 255) / 100);
+ }
+ else
+ {
+ nRetval = static_cast<sal_uInt8>((rSet.Get(XATTR_LINETRANSPARENCE).GetValue() * 255) / 100);
+ }
+
+ return nRetval;
+ }
+
+ drawinglayer::attribute::LineAttribute impGetLineAttribute(bool bShadow, const SfxItemSet& rSet)
+ {
+ basegfx::BColor aColorAttribute;
+
+ if(bShadow)
+ {
+ const Color aShadowColor(rSet.Get(SDRATTR_SHADOWCOLOR).GetColorValue());
+ aColorAttribute = aShadowColor.getBColor();
+ }
+ else
+ {
+ const Color aLineColor(rSet.Get(XATTR_LINECOLOR).GetColorValue());
+ aColorAttribute = aLineColor.getBColor();
+ }
+
+ const sal_uInt32 nLineWidth = rSet.Get(XATTR_LINEWIDTH).GetValue();
+ const css::drawing::LineJoint eLineJoint = rSet.Get(XATTR_LINEJOINT).GetValue();
+ const css::drawing::LineCap eLineCap = rSet.Get(XATTR_LINECAP).GetValue();
+
+ return drawinglayer::attribute::LineAttribute(
+ aColorAttribute,
+ static_cast<double>(nLineWidth),
+ impGetB2DLineJoin(eLineJoint),
+ eLineCap);
+ }
+
+ drawinglayer::attribute::StrokeAttribute impGetStrokeAttribute(const SfxItemSet& rSet)
+ {
+ const css::drawing::LineStyle eLineStyle = rSet.Get(XATTR_LINESTYLE).GetValue();
+ double fFullDotDashLen(0.0);
+ ::std::vector< double > aDotDashArray;
+
+ if(css::drawing::LineStyle_DASH == eLineStyle)
+ {
+ const XDash& rDash = rSet.Get(XATTR_LINEDASH).GetDashValue();
+
+ if(rDash.GetDots() || rDash.GetDashes())
+ {
+ const sal_uInt32 nLineWidth = rSet.Get(XATTR_LINEWIDTH).GetValue();
+ fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, static_cast<double>(nLineWidth));
+ }
+ }
+
+ return drawinglayer::attribute::StrokeAttribute(std::move(aDotDashArray), fFullDotDashLen);
+ }
+} // end of anonymous namespace
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrFormTextAttribute
+ {
+ public:
+ // FormText (FontWork) Attributes
+ sal_Int32 mnFormTextDistance; // distance from line in upright direction
+ sal_Int32 mnFormTextStart; // shift from polygon start
+ sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees
+ sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling
+ sal_uInt16 mnFormTextShdwTransp; // shadow transparence
+ XFormTextStyle meFormTextStyle; // on/off and char orientation
+ XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale
+ XFormTextShadow meFormTextShadow; // shadow mode
+ Color maFormTextShdwColor; // shadow color
+
+ // outline attributes; used when getFormTextOutline() is true and (for
+ // shadow) when getFormTextShadow() != XFormTextShadow::NONE
+ SdrFormTextOutlineAttribute maOutline;
+ SdrFormTextOutlineAttribute maShadowOutline;
+
+ bool mbFormTextMirror : 1; // change orientation
+ bool mbFormTextOutline : 1; // show contour of objects
+
+ explicit ImpSdrFormTextAttribute(const SfxItemSet& rSet)
+ : mnFormTextDistance(rSet.Get(XATTR_FORMTXTDISTANCE).GetValue()),
+ mnFormTextStart(rSet.Get(XATTR_FORMTXTSTART).GetValue()),
+ mnFormTextShdwXVal(rSet.Get(XATTR_FORMTXTSHDWXVAL).GetValue()),
+ mnFormTextShdwYVal(rSet.Get(XATTR_FORMTXTSHDWYVAL).GetValue()),
+ mnFormTextShdwTransp(rSet.Get(XATTR_FORMTXTSHDWTRANSP).GetValue()),
+ meFormTextStyle(rSet.Get(XATTR_FORMTXTSTYLE).GetValue()),
+ meFormTextAdjust(rSet.Get(XATTR_FORMTXTADJUST).GetValue()),
+ meFormTextShadow(rSet.Get(XATTR_FORMTXTSHADOW).GetValue()),
+ maFormTextShdwColor(rSet.Get(XATTR_FORMTXTSHDWCOLOR).GetColorValue()),
+ mbFormTextMirror(rSet.Get(XATTR_FORMTXTMIRROR).GetValue()),
+ mbFormTextOutline(rSet.Get(XATTR_FORMTXTOUTLINE).GetValue())
+ {
+ if(!getFormTextOutline())
+ return;
+
+ const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet));
+
+ // also need to prepare attributes for outlines
+ {
+ const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet));
+ const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet));
+
+ maOutline = SdrFormTextOutlineAttribute(
+ aLineAttribute, aStrokeAttribute, nTransparence);
+ }
+
+ if(XFormTextShadow::NONE != getFormTextShadow())
+ {
+ // also need to prepare attributes for shadow outlines
+ const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet));
+ const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet));
+
+ maShadowOutline = SdrFormTextOutlineAttribute(
+ aLineAttribute, aStrokeAttribute, nTransparence);
+ }
+ }
+
+ ImpSdrFormTextAttribute()
+ : mnFormTextDistance(0),
+ mnFormTextStart(0),
+ mnFormTextShdwXVal(0),
+ mnFormTextShdwYVal(0),
+ mnFormTextShdwTransp(0),
+ meFormTextStyle(XFormTextStyle::NONE),
+ meFormTextAdjust(XFormTextAdjust::Center),
+ meFormTextShadow(XFormTextShadow::NONE),
+ mbFormTextMirror(false),
+ mbFormTextOutline(false)
+ {
+ }
+
+ // data read access
+ sal_Int32 getFormTextDistance() const { return mnFormTextDistance; }
+ sal_Int32 getFormTextStart() const { return mnFormTextStart; }
+ sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; }
+ sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; }
+ XFormTextStyle getFormTextStyle() const { return meFormTextStyle; }
+ XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; }
+ XFormTextShadow getFormTextShadow() const { return meFormTextShadow; }
+ const Color& getFormTextShdwColor() const { return maFormTextShdwColor; }
+ const SdrFormTextOutlineAttribute& getOutline() const { return maOutline; }
+ const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; }
+ bool getFormTextMirror() const { return mbFormTextMirror; }
+ bool getFormTextOutline() const { return mbFormTextOutline; }
+
+ // compare operator
+ bool operator==(const ImpSdrFormTextAttribute& rCandidate) const
+ {
+ return (getFormTextDistance() == rCandidate.getFormTextDistance()
+ && getFormTextStart() == rCandidate.getFormTextStart()
+ && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal()
+ && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal()
+ && mnFormTextShdwTransp == rCandidate.mnFormTextShdwTransp
+ && getFormTextStyle() == rCandidate.getFormTextStyle()
+ && getFormTextAdjust() == rCandidate.getFormTextAdjust()
+ && getFormTextShadow() == rCandidate.getFormTextShadow()
+ && getFormTextShdwColor() == rCandidate.getFormTextShdwColor()
+ && getOutline() == rCandidate.getOutline()
+ && getShadowOutline() == rCandidate.getShadowOutline()
+ && getFormTextMirror() == rCandidate.getFormTextMirror()
+ && getFormTextOutline() == rCandidate.getFormTextOutline());
+ }
+ };
+
+ namespace
+ {
+ SdrFormTextAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrFormTextAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet)
+ : mpSdrFormTextAttribute(ImpSdrFormTextAttribute(rSet))
+ {
+ }
+
+ SdrFormTextAttribute::SdrFormTextAttribute()
+ : mpSdrFormTextAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate)
+ : mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute)
+ {
+ }
+
+ SdrFormTextAttribute::SdrFormTextAttribute(SdrFormTextAttribute&& rCandidate) noexcept
+ : mpSdrFormTextAttribute(std::move(rCandidate.mpSdrFormTextAttribute))
+ {
+ }
+
+ SdrFormTextAttribute::~SdrFormTextAttribute()
+ {
+ }
+
+ bool SdrFormTextAttribute::isDefault() const
+ {
+ return mpSdrFormTextAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate)
+ {
+ mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute;
+ return *this;
+ }
+
+ SdrFormTextAttribute& SdrFormTextAttribute::operator=(SdrFormTextAttribute&& rCandidate) noexcept
+ {
+ mpSdrFormTextAttribute = std::move(rCandidate.mpSdrFormTextAttribute);
+ return *this;
+ }
+
+ bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
+ return rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute;
+ }
+
+ sal_Int32 SdrFormTextAttribute::getFormTextDistance() const
+ {
+ return mpSdrFormTextAttribute->getFormTextDistance();
+ }
+
+ sal_Int32 SdrFormTextAttribute::getFormTextStart() const
+ {
+ return mpSdrFormTextAttribute->getFormTextStart();
+ }
+
+ sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwXVal();
+ }
+
+ sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwYVal();
+ }
+
+ XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const
+ {
+ return mpSdrFormTextAttribute->getFormTextStyle();
+ }
+
+ XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const
+ {
+ return mpSdrFormTextAttribute->getFormTextAdjust();
+ }
+
+ XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShadow();
+ }
+
+ Color const & SdrFormTextAttribute::getFormTextShdwColor() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwColor();
+ }
+
+ const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const
+ {
+ return mpSdrFormTextAttribute->getOutline();
+ }
+
+ const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const
+ {
+ return mpSdrFormTextAttribute->getShadowOutline();
+ }
+
+ bool SdrFormTextAttribute::getFormTextMirror() const
+ {
+ return mpSdrFormTextAttribute->getFormTextMirror();
+ }
+
+ bool SdrFormTextAttribute::getFormTextOutline() const
+ {
+ return mpSdrFormTextAttribute->getFormTextOutline();
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
new file mode 100644
index 000000000..ec97cf044
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
@@ -0,0 +1,141 @@
+/* -*- 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 <sdr/attribute/sdrformtextoutlineattribute.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrFormTextOutlineAttribute
+ {
+ public:
+ // one set of attributes for FormText (FontWork) outline visualisation
+ LineAttribute maLineAttribute;
+ StrokeAttribute maStrokeAttribute;
+ sal_uInt8 mnTransparence;
+
+ ImpSdrFormTextOutlineAttribute(
+ const LineAttribute& rLineAttribute,
+ const StrokeAttribute& rStrokeAttribute,
+ sal_uInt8 nTransparence)
+ : maLineAttribute(rLineAttribute),
+ maStrokeAttribute(rStrokeAttribute),
+ mnTransparence(nTransparence)
+ {
+ }
+
+ ImpSdrFormTextOutlineAttribute()
+ : mnTransparence(0)
+ {
+ }
+
+ // data read access
+ const LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+ sal_uInt8 getTransparence() const { return mnTransparence; }
+
+ // compare operator
+ bool operator==(const ImpSdrFormTextOutlineAttribute& rCandidate) const
+ {
+ return (getLineAttribute() == rCandidate.getLineAttribute()
+ && getStrokeAttribute() == rCandidate.getStrokeAttribute()
+ && getTransparence() == rCandidate.getTransparence());
+ }
+ };
+
+ namespace
+ {
+ SdrFormTextOutlineAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrFormTextOutlineAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(
+ const LineAttribute& rLineAttribute,
+ const StrokeAttribute& rStrokeAttribute,
+ sal_uInt8 nTransparence)
+ : mpSdrFormTextOutlineAttribute(
+ ImpSdrFormTextOutlineAttribute(
+ rLineAttribute, rStrokeAttribute, nTransparence))
+ {
+ }
+
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute()
+ : mpSdrFormTextOutlineAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate)
+ : mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute)
+ {
+ }
+
+ SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute()
+ {
+ }
+
+ bool SdrFormTextOutlineAttribute::isDefault() const
+ {
+ return mpSdrFormTextOutlineAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate)
+ {
+ mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute;
+ return *this;
+ }
+
+ SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(SdrFormTextOutlineAttribute&& rCandidate) noexcept
+ {
+ mpSdrFormTextOutlineAttribute = std::move(rCandidate.mpSdrFormTextOutlineAttribute);
+ return *this;
+ }
+
+ bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
+ return rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute;
+ }
+
+ const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const
+ {
+ return mpSdrFormTextOutlineAttribute->getLineAttribute();
+ }
+
+ const StrokeAttribute& SdrFormTextOutlineAttribute::getStrokeAttribute() const
+ {
+ return mpSdrFormTextOutlineAttribute->getStrokeAttribute();
+ }
+
+ sal_uInt8 SdrFormTextOutlineAttribute::getTransparence() const
+ {
+ return mpSdrFormTextOutlineAttribute->getTransparence();
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/attribute/sdrlineeffectstextattribute.cxx b/svx/source/sdr/attribute/sdrlineeffectstextattribute.cxx
new file mode 100644
index 000000000..72a3ef032
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrlineeffectstextattribute.cxx
@@ -0,0 +1,75 @@
+/* -*- 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 <sdr/attribute/sdrlineeffectstextattribute.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ SdrLineEffectsTextAttribute::SdrLineEffectsTextAttribute(
+ const SdrLineAttribute& rLine,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const SdrTextAttribute& rTextAttribute,
+ const SdrGlowAttribute& rGlow,
+ sal_Int32 nSoftEdgeRadius)
+ : SdrEffectsTextAttribute(rShadow, rTextAttribute, rGlow, nSoftEdgeRadius),
+ maLine(rLine),
+ maLineStartEnd(rLineStartEnd)
+ {
+ }
+
+ SdrLineEffectsTextAttribute::SdrLineEffectsTextAttribute()
+ {
+ }
+
+ SdrLineEffectsTextAttribute::SdrLineEffectsTextAttribute(const SdrLineEffectsTextAttribute& rCandidate)
+ : SdrEffectsTextAttribute(rCandidate),
+ maLine(rCandidate.getLine()),
+ maLineStartEnd(rCandidate.getLineStartEnd())
+ {
+ }
+
+ SdrLineEffectsTextAttribute& SdrLineEffectsTextAttribute::operator=(const SdrLineEffectsTextAttribute& rCandidate)
+ {
+ SdrEffectsTextAttribute::operator=(rCandidate);
+ maLine = rCandidate.getLine();
+ maLineStartEnd = rCandidate.getLineStartEnd();
+
+ return *this;
+ }
+
+ bool SdrLineEffectsTextAttribute::isDefault() const
+ {
+ return(SdrEffectsTextAttribute::isDefault()
+ && getLine().isDefault()
+ && getLineStartEnd().isDefault());
+ }
+
+ bool SdrLineEffectsTextAttribute::operator==(const SdrLineEffectsTextAttribute& rCandidate) const
+ {
+ return(SdrEffectsTextAttribute::operator==(rCandidate)
+ && getLine() == rCandidate.getLine()
+ && getLineStartEnd() == rCandidate.getLineStartEnd());
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/attribute/sdrlinefilleffectstextattribute.cxx b/svx/source/sdr/attribute/sdrlinefilleffectstextattribute.cxx
new file mode 100644
index 000000000..442b51833
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrlinefilleffectstextattribute.cxx
@@ -0,0 +1,77 @@
+/* -*- 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 <sdr/attribute/sdrlinefilleffectstextattribute.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ SdrLineFillEffectsTextAttribute::SdrLineFillEffectsTextAttribute(
+ const SdrLineAttribute& rLine,
+ const SdrFillAttribute& rFill,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const FillGradientAttribute& rFillFloatTransGradient,
+ const SdrTextAttribute& rTextAttribute,
+ const SdrGlowAttribute& rGlow,
+ sal_Int32 nSoftEdgeRadius)
+ : SdrLineEffectsTextAttribute(rLine, rLineStartEnd, rShadow, rTextAttribute, rGlow, nSoftEdgeRadius),
+ maFill(rFill),
+ maFillFloatTransGradient(rFillFloatTransGradient)
+ {
+ }
+
+ SdrLineFillEffectsTextAttribute::SdrLineFillEffectsTextAttribute()
+ {
+ }
+
+ SdrLineFillEffectsTextAttribute::SdrLineFillEffectsTextAttribute(const SdrLineFillEffectsTextAttribute& rCandidate)
+ : SdrLineEffectsTextAttribute(rCandidate),
+ maFill(rCandidate.getFill()),
+ maFillFloatTransGradient(rCandidate.getFillFloatTransGradient())
+ {
+ }
+
+ SdrLineFillEffectsTextAttribute& SdrLineFillEffectsTextAttribute::operator=(const SdrLineFillEffectsTextAttribute& rCandidate)
+ {
+ SdrLineEffectsTextAttribute::operator=(rCandidate);
+ maFill = rCandidate.getFill();
+ maFillFloatTransGradient = rCandidate.getFillFloatTransGradient();
+
+ return *this;
+ }
+
+ bool SdrLineFillEffectsTextAttribute::isDefault() const
+ {
+ return (SdrLineEffectsTextAttribute::isDefault()
+ && getFill().isDefault()
+ && getFillFloatTransGradient().isDefault());
+ }
+
+ bool SdrLineFillEffectsTextAttribute::operator==(const SdrLineFillEffectsTextAttribute& rCandidate) const
+ {
+ return(SdrLineEffectsTextAttribute::operator==(rCandidate)
+ && getFill() == rCandidate.getFill()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient());
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx
new file mode 100644
index 000000000..5c9ecb34e
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrtextattribute.cxx
@@ -0,0 +1,422 @@
+/* -*- 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 <sdr/attribute/sdrtextattribute.hxx>
+#include <sdr/attribute/sdrformtextattribute.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/sdr/properties/properties.hxx>
+
+
+namespace drawinglayer::attribute
+{
+ class ImpSdrTextAttribute
+ {
+ public:
+ // all-text attributes. The SdrText itself and a copy
+ // of the OPO
+ const SdrText* mpSdrText;
+ std::shared_ptr<OutlinerParaObject> mxOutlinerParaObject;
+
+ // Set when it's a FormText; contains all FormText attributes
+ SdrFormTextAttribute maSdrFormTextAttribute;
+
+ // text distances
+ sal_Int32 maTextLeftDistance;
+ sal_Int32 maTextUpperDistance;
+ sal_Int32 maTextRightDistance;
+ sal_Int32 maTextLowerDistance;
+
+ // #i101556# use versioning from text attributes to detect changes
+ sal_uInt32 maPropertiesVersion;
+
+ // text alignments
+ SdrTextHorzAdjust maSdrTextHorzAdjust;
+ SdrTextVertAdjust maSdrTextVertAdjust;
+
+ bool mbContour : 1;
+ bool mbFitToSize : 1;
+ bool mbAutoFit : 1;
+ bool mbHideContour : 1;
+ bool mbBlink : 1;
+ bool mbScroll : 1;
+ bool mbInEditMode : 1;
+ bool mbFixedCellHeight : 1;
+ bool mbWrongSpell : 1;
+
+ bool mbChainable : 1;
+
+
+ public:
+ ImpSdrTextAttribute(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ XFormTextStyle eFormTextStyle,
+ sal_Int32 aTextLeftDistance,
+ sal_Int32 aTextUpperDistance,
+ sal_Int32 aTextRightDistance,
+ sal_Int32 aTextLowerDistance,
+ SdrTextHorzAdjust aSdrTextHorzAdjust,
+ SdrTextVertAdjust aSdrTextVertAdjust,
+ bool bContour,
+ bool bFitToSize,
+ bool bAutoFit,
+ bool bHideContour,
+ bool bBlink,
+ bool bScroll,
+ bool bInEditMode,
+ bool bFixedCellHeight,
+ bool bWrongSpell,
+ bool bChainable)
+ : mpSdrText(pSdrText),
+ mxOutlinerParaObject(std::make_shared<OutlinerParaObject>(rOutlinerParaObject)),
+ maTextLeftDistance(aTextLeftDistance),
+ maTextUpperDistance(aTextUpperDistance),
+ maTextRightDistance(aTextRightDistance),
+ maTextLowerDistance(aTextLowerDistance),
+ maPropertiesVersion(0),
+ maSdrTextHorzAdjust(aSdrTextHorzAdjust),
+ maSdrTextVertAdjust(aSdrTextVertAdjust),
+ mbContour(bContour),
+ mbFitToSize(bFitToSize),
+ mbAutoFit(bAutoFit),
+ mbHideContour(bHideContour),
+ mbBlink(bBlink),
+ mbScroll(bScroll),
+ mbInEditMode(bInEditMode),
+ mbFixedCellHeight(bFixedCellHeight),
+ mbWrongSpell(bWrongSpell),
+ mbChainable(bChainable)
+ {
+ if(!pSdrText)
+ return;
+
+ if(XFormTextStyle::NONE != eFormTextStyle)
+ {
+ // text on path. Create FormText attribute
+ const SfxItemSet& rSet = pSdrText->GetItemSet();
+ maSdrFormTextAttribute = SdrFormTextAttribute(rSet);
+ }
+
+ // #i101556# init with version number to detect changes of single text
+ // attribute and/or style sheets in primitive data without having to
+ // copy that data locally (which would be better from principle)
+ maPropertiesVersion = pSdrText->GetObject().GetProperties().getVersion();
+ }
+
+ ImpSdrTextAttribute()
+ : mpSdrText(nullptr),
+ maTextLeftDistance(0),
+ maTextUpperDistance(0),
+ maTextRightDistance(0),
+ maTextLowerDistance(0),
+ maPropertiesVersion(0),
+ maSdrTextHorzAdjust(SDRTEXTHORZADJUST_LEFT),
+ maSdrTextVertAdjust(SDRTEXTVERTADJUST_TOP),
+ mbContour(false),
+ mbFitToSize(false),
+ mbAutoFit(false),
+ mbHideContour(false),
+ mbBlink(false),
+ mbScroll(false),
+ mbInEditMode(false),
+ mbFixedCellHeight(false),
+ mbWrongSpell(false),
+ mbChainable(false)
+ {
+ }
+
+ // data read access
+ const SdrText& getSdrText() const
+ {
+ assert(mpSdrText && "Access to text of default version of ImpSdrTextAttribute (!)");
+ return *mpSdrText;
+ }
+
+ const OutlinerParaObject& getOutlinerParaObject() const
+ {
+ assert(mxOutlinerParaObject && "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)");
+ return *mxOutlinerParaObject;
+ }
+
+ bool isContour() const { return mbContour; }
+ bool isFitToSize() const { return mbFitToSize; }
+ bool isAutoFit() const { return mbAutoFit; }
+ bool isHideContour() const { return mbHideContour; }
+ bool isBlink() const { return mbBlink; }
+ bool isScroll() const { return mbScroll; }
+ bool isInEditMode() const { return mbInEditMode; }
+ bool isFixedCellHeight() const { return mbFixedCellHeight; }
+ bool isChainable() const { return mbChainable; }
+ const SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; }
+ sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; }
+ sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; }
+ sal_Int32 getTextRightDistance() const { return maTextRightDistance; }
+ sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; }
+ SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; }
+ SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; }
+
+ // compare operator
+ bool operator==(const ImpSdrTextAttribute& rCandidate) const
+ {
+ if (mxOutlinerParaObject.get() != rCandidate.mxOutlinerParaObject.get())
+ {
+ if (mxOutlinerParaObject && rCandidate.mxOutlinerParaObject)
+ {
+ // compares OPO and it's contents, but traditionally not the RedLining
+ // which is not seen as model, but as temporary information
+ if(getOutlinerParaObject() != rCandidate.getOutlinerParaObject())
+ {
+ return false;
+ }
+
+ // #i102062# for primitive visualisation, the WrongList (SpellChecking)
+ // is important, too, so use isWrongListEqual since there is no WrongList
+ // comparison in the regular OutlinerParaObject compare (since it's
+ // not-persistent data)
+ if(!(getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject())))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // only one is zero; not equal
+ return false;
+ }
+ }
+
+ return (
+ getSdrFormTextAttribute() == rCandidate.getSdrFormTextAttribute()
+ && getTextLeftDistance() == rCandidate.getTextLeftDistance()
+ && getTextUpperDistance() == rCandidate.getTextUpperDistance()
+ && getTextRightDistance() == rCandidate.getTextRightDistance()
+ && getTextLowerDistance() == rCandidate.getTextLowerDistance()
+ && maPropertiesVersion == rCandidate.maPropertiesVersion
+
+ && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust()
+ && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust()
+
+ && isContour() == rCandidate.isContour()
+ && isFitToSize() == rCandidate.isFitToSize()
+ && isAutoFit() == rCandidate.isAutoFit()
+ && isHideContour() == rCandidate.isHideContour()
+ && isBlink() == rCandidate.isBlink()
+ && isScroll() == rCandidate.isScroll()
+ && isInEditMode() == rCandidate.isInEditMode()
+ && isFixedCellHeight() == rCandidate.isFixedCellHeight()
+ && mbWrongSpell == rCandidate.mbWrongSpell );
+ }
+ };
+
+ namespace
+ {
+ SdrTextAttribute::ImplType& theGlobalDefault()
+ {
+ static SdrTextAttribute::ImplType SINGLETON;
+ return SINGLETON;
+ }
+ }
+
+ SdrTextAttribute::SdrTextAttribute(
+ const SdrText& rSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ XFormTextStyle eFormTextStyle,
+ sal_Int32 aTextLeftDistance,
+ sal_Int32 aTextUpperDistance,
+ sal_Int32 aTextRightDistance,
+ sal_Int32 aTextLowerDistance,
+ SdrTextHorzAdjust aSdrTextHorzAdjust,
+ SdrTextVertAdjust aSdrTextVertAdjust,
+ bool bContour,
+ bool bFitToSize,
+ bool bAutoFit,
+ bool bHideContour,
+ bool bBlink,
+ bool bScroll,
+ bool bInEditMode,
+ bool bFixedCellHeight,
+ bool bWrongSpell,
+ bool bChainable)
+ : mpSdrTextAttribute(
+ ImpSdrTextAttribute(
+ &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance,
+ aTextUpperDistance, aTextRightDistance, aTextLowerDistance,
+ aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour, bFitToSize, bAutoFit,
+ bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell,
+ bChainable))
+ {
+ }
+
+ SdrTextAttribute::SdrTextAttribute()
+ : mpSdrTextAttribute(theGlobalDefault())
+ {
+ }
+
+ SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate)
+ : mpSdrTextAttribute(rCandidate.mpSdrTextAttribute)
+ {
+ }
+
+ SdrTextAttribute::SdrTextAttribute(SdrTextAttribute&& rCandidate) noexcept
+ : mpSdrTextAttribute(std::move(rCandidate.mpSdrTextAttribute))
+ {
+ }
+
+ SdrTextAttribute::~SdrTextAttribute()
+ {
+ }
+
+ bool SdrTextAttribute::isDefault() const
+ {
+ return mpSdrTextAttribute.same_object(theGlobalDefault());
+ }
+
+ SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate)
+ {
+ mpSdrTextAttribute = rCandidate.mpSdrTextAttribute;
+ return *this;
+ }
+
+ SdrTextAttribute& SdrTextAttribute::operator=(SdrTextAttribute&& rCandidate) noexcept
+ {
+ mpSdrTextAttribute = std::move(rCandidate.mpSdrTextAttribute);
+ return *this;
+ }
+
+ bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const
+ {
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
+ return rCandidate.mpSdrTextAttribute == mpSdrTextAttribute;
+ }
+
+ const SdrText& SdrTextAttribute::getSdrText() const
+ {
+ return mpSdrTextAttribute->getSdrText();
+ }
+
+ const OutlinerParaObject& SdrTextAttribute::getOutlinerParaObject() const
+ {
+ return mpSdrTextAttribute->getOutlinerParaObject();
+ }
+
+ bool SdrTextAttribute::isContour() const
+ {
+ return mpSdrTextAttribute->isContour();
+ }
+
+ bool SdrTextAttribute::isFitToSize() const
+ {
+ return mpSdrTextAttribute->isFitToSize();
+ }
+
+ bool SdrTextAttribute::isAutoFit() const
+ {
+ return mpSdrTextAttribute->isAutoFit();
+ }
+
+ bool SdrTextAttribute::isHideContour() const
+ {
+ return mpSdrTextAttribute->isHideContour();
+ }
+
+ bool SdrTextAttribute::isBlink() const
+ {
+ return mpSdrTextAttribute->isBlink();
+ }
+
+ bool SdrTextAttribute::isScroll() const
+ {
+ return mpSdrTextAttribute->isScroll();
+ }
+
+ bool SdrTextAttribute::isInEditMode() const
+ {
+ return mpSdrTextAttribute->isInEditMode();
+ }
+
+ bool SdrTextAttribute::isChainable() const
+ {
+ return mpSdrTextAttribute->isChainable();
+ }
+
+
+ bool SdrTextAttribute::isFixedCellHeight() const
+ {
+ return mpSdrTextAttribute->isFixedCellHeight();
+ }
+
+ const SdrFormTextAttribute& SdrTextAttribute::getSdrFormTextAttribute() const
+ {
+ return mpSdrTextAttribute->getSdrFormTextAttribute();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextLeftDistance() const
+ {
+ return mpSdrTextAttribute->getTextLeftDistance();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextUpperDistance() const
+ {
+ return mpSdrTextAttribute->getTextUpperDistance();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextRightDistance() const
+ {
+ return mpSdrTextAttribute->getTextRightDistance();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextLowerDistance() const
+ {
+ return mpSdrTextAttribute->getTextLowerDistance();
+ }
+
+ SdrTextHorzAdjust SdrTextAttribute::getSdrTextHorzAdjust() const
+ {
+ return mpSdrTextAttribute->getSdrTextHorzAdjust();
+ }
+
+ SdrTextVertAdjust SdrTextAttribute::getSdrTextVertAdjust() const
+ {
+ return mpSdrTextAttribute->getSdrTextVertAdjust();
+ }
+
+ void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const
+ {
+ if(isBlink())
+ {
+ getSdrText().GetObject().impGetBlinkTextTiming(rAnimList);
+ }
+ }
+
+ void SdrTextAttribute::getScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const
+ {
+ if(isScroll())
+ {
+ getSdrText().GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength);
+ }
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */