summaryrefslogtreecommitdiff
path: root/svx/source/unodraw/XPropertyTable.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-08-09 13:27:49 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-09-06 16:56:27 +0200
commiteee4b3f8e46b85b3bb4f7cbe83b8af552594be89 (patch)
treeacfe160d74d0a0622ea439d40b0e96d13c295a18 /svx/source/unodraw/XPropertyTable.cxx
parent850015d1e59490546018f07742f798ecf97bc50d (diff)
move BGradient to awt::Gradient2 UNO conversion into docmodel
This is needed because the module dependencies are an issues if the conversion is done in basegfx. The bigger issue will come when the ComplexColor conversion will be done as basegfx can't depend on docmodel because of circular dependencies. The BGradient is also more suitable for docmodel anyway as the previously it was part of the model and is not a basic (gfx) type - however this doesn't move the whole BGradient into docmodel yet. Change-Id: Id91ce52232f89f00e09b451c13da36e2854ae14b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155674 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 242bb3fdda5be165bd00701518df47cc1276438f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156449 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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);
}