summaryrefslogtreecommitdiff
path: root/svx/source/unodraw/XPropertyTable.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/unodraw/XPropertyTable.cxx')
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx24
1 files changed, 4 insertions, 20 deletions
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index 4d47a1290281..ed3bf9d0a697 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -37,6 +37,7 @@
#include <svx/unoapi.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <docmodel/uno/UnoGradientTools.hxx>
using namespace com::sun::star;
using namespace ::cppu;
@@ -533,26 +534,9 @@ uno::Reference< container::XNameContainer > SvxUnoXGradientTable_createInstance(
uno::Any SvxUnoXGradientTable::getAny( const XPropertyEntry* pEntry ) const noexcept
{
const basegfx::BGradient& aBGradient = static_cast<const XGradientEntry*>(pEntry)->GetGradient();
- awt::Gradient2 aGradient;
- assert(aGradient.ColorStops.get() && "cid#1524745 aGradient.ColorStops._pSequence won't be null here");
-
- // standard values
- aGradient.Style = aBGradient.GetGradientStyle();
- aGradient.Angle = static_cast<short>(aBGradient.GetAngle());
- aGradient.Border = aBGradient.GetBorder();
- aGradient.XOffset = aBGradient.GetXOffset();
- aGradient.YOffset = aBGradient.GetYOffset();
- aGradient.StartIntensity = aBGradient.GetStartIntens();
- aGradient.EndIntensity = aBGradient.GetEndIntens();
- aGradient.StepCount = aBGradient.GetSteps();
- // for compatibility, still set StartColor/EndColor
- const basegfx::BColorStops& rBColorStops(aBGradient.GetColorStops());
- aGradient.StartColor = static_cast<sal_Int32>(Color(rBColorStops.front().getStopColor()));
- aGradient.EndColor = static_cast<sal_Int32>(Color(rBColorStops.back().getStopColor()));
-
- // fill ColorStops to extended Gradient2
- aGradient.ColorStops = rBColorStops.getAsColorStopSequence();
+ awt::Gradient2 aGradient = model::gradient::createUnoGradient2(aBGradient);
+ assert(aGradient.ColorStops.get() && "cid#1524745 aGradient.ColorStops._pSequence won't be null here");
return uno::Any(aGradient);
}
@@ -562,7 +546,7 @@ std::unique_ptr<XPropertyEntry> SvxUnoXGradientTable::createEntry(const OUString
if (!rAny.has<css::awt::Gradient>() || !rAny.has<css::awt::Gradient2>())
return std::unique_ptr<XPropertyEntry>();
- const basegfx::BGradient aBGradient(rAny);
+ const basegfx::BGradient aBGradient = model::gradient::getFromAny(rAny);
return std::make_unique<XGradientEntry>(aBGradient, rName);
}