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
committerTomaž Vajngerl <quikee@gmail.com>2023-08-21 09:27:12 +0200
commit242bb3fdda5be165bd00701518df47cc1276438f (patch)
treebc61d6d7fa1b3ee628bfe2ff875c03b89728f59f /svx/source/unodraw/XPropertyTable.cxx
parent84b12cd3ea96ee9b02365b5239f391af242f7303 (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>
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);
}