diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/unodraw/XPropertyTable.cxx | 24 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 17 |
2 files changed, 12 insertions, 29 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); } diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index a2f34c229f4e..abf72bd6d6d4 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -36,6 +36,7 @@ #include <o3tl/any.hxx> #include <svl/itempool.hxx> #include <editeng/memberids.h> +#include <docmodel/uno/UnoGradientTools.hxx> #include <docmodel/uno/UnoComplexColor.hxx> #include <docmodel/color/ComplexColorJSON.hxx> #include <tools/mapunit.hxx> @@ -2252,7 +2253,7 @@ bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c case 0: { // fill values - const css::awt::Gradient2 aGradient2(GetGradientValue().getAsGradient2()); + const css::awt::Gradient2 aGradient2 = model::gradient::createUnoGradient2(GetGradientValue()); // create sequence uno::Sequence< beans::PropertyValue > aPropSeq{ @@ -2266,7 +2267,7 @@ bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c case MID_FILLGRADIENT: { // fill values - const css::awt::Gradient2 aGradient2(GetGradientValue().getAsGradient2()); + const css::awt::Gradient2 aGradient2 = model::gradient::createUnoGradient2(GetGradientValue()); // create sequence rVal <<= aGradient2; @@ -2282,8 +2283,7 @@ bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c case MID_GRADIENT_COLORSTOPSEQUENCE: { // fill values - const css::awt::ColorStopSequence aColorStopSequence( - GetGradientValue().GetColorStops().getAsColorStopSequence()); + const css::awt::ColorStopSequence aColorStopSequence = model::gradient::createColorStopSequence(GetGradientValue().GetColorStops()); // create sequence rVal <<= aColorStopSequence; @@ -2334,8 +2334,7 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId if (aGradientAny.hasValue() && (aGradientAny.has<css::awt::Gradient>() || aGradientAny.has<css::awt::Gradient2>())) { - const basegfx::BGradient aBGradient(aGradientAny); - SetGradientValue(aBGradient); + SetGradientValue(model::gradient::getFromAny(aGradientAny)); } return true; @@ -2357,8 +2356,7 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId { if (rVal.hasValue() && (rVal.has<css::awt::Gradient>() || rVal.has<css::awt::Gradient2>())) { - const basegfx::BGradient aBGradient(rVal); - SetGradientValue(aBGradient); + SetGradientValue(model::gradient::getFromAny(rVal)); } break; @@ -2369,7 +2367,8 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId // check if we have a awt::ColorStopSequence if (rVal.hasValue() && rVal.has<css::awt::ColorStopSequence>()) { - const basegfx::BColorStops aColorStops(rVal); + + const basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromAny(rVal); if (!aColorStops.empty()) { |