diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2023-05-16 15:59:42 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2023-05-19 10:09:11 +0200 |
commit | 428b8a8d23e473fecf2916591615ff38611b93c9 (patch) | |
tree | ed883778d6094cb6d24a30a8fd73df16ae2a17cd /include/basegfx/utils | |
parent | 286a1c03fa10acf60f076a0af987112d24cb2ff5 (diff) |
MCGR: Adaptions to WriteGradientFill and BGradient
Added code to make WriteGradientFill directly use the
available BGradient implementation. The goal is to
never directly work on awt::Gradient2, but use
BGradient & it's tooling methods.
Added constructors and tooling to BGradient and
BColorStops to make that easier (single line
conversions between uno::Any, basesgfx classes
and awt:: incarnations). Directly handle uno::Any
and awt:: classes, changed stuff to make use of
this.
Change-Id: I083a323b9efee8ca4f3becb2966aac0a294b9a60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151842
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'include/basegfx/utils')
-rw-r--r-- | include/basegfx/utils/bgradient.hxx | 6 | ||||
-rw-r--r-- | include/basegfx/utils/gradienttools.hxx | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/include/basegfx/utils/bgradient.hxx b/include/basegfx/utils/bgradient.hxx index d1bd55439a41..a0e853ec7099 100644 --- a/include/basegfx/utils/bgradient.hxx +++ b/include/basegfx/utils/bgradient.hxx @@ -135,6 +135,8 @@ public: { } BColorStops(const css::awt::ColorStopSequence& rColorStops); + + // needs true == rVal.has<css::awt::ColorStopSequence>() BColorStops(const css::uno::Any& rVal); // constructor with two colors to explicitly create a @@ -265,6 +267,7 @@ public: class BASEGFX_DLLPUBLIC BGradient final { +private: css::awt::GradientStyle eStyle; // MCGS: ColorStops in the range [0.0 .. 1.0], including StartColor/EndColor @@ -279,6 +282,7 @@ class BASEGFX_DLLPUBLIC BGradient final sal_uInt16 nStepCount; static std::string GradientStyleToString(css::awt::GradientStyle eStyle); + void setGradient2(const css::awt::Gradient2& rGradient2); public: BGradient(); @@ -288,6 +292,8 @@ public: sal_uInt16 nBorder = 0, sal_uInt16 nStartIntens = 100, sal_uInt16 nEndIntens = 100, sal_uInt16 nSteps = 0); BGradient(const css::awt::Gradient2& rGradient2); + + // needs true == (rVal.has<css::awt::Gradient>() || rVal.has<css::awt::Gradient2>()) BGradient(const css::uno::Any& rVal); bool operator==(const BGradient& rGradient) const; diff --git a/include/basegfx/utils/gradienttools.hxx b/include/basegfx/utils/gradienttools.hxx index d9e685a87fb6..9672259be64b 100644 --- a/include/basegfx/utils/gradienttools.hxx +++ b/include/basegfx/utils/gradienttools.hxx @@ -186,11 +186,6 @@ namespace basegfx namespace utils { - /// Tooling method to fill awt::Gradient2 from data contained in the given Any - BASEGFX_DLLPUBLIC bool fillGradient2FromAny( - com::sun::star::awt::Gradient2& rGradient, - const com::sun::star::uno::Any& rVal); - /* Tooling method to extract data from given awt::Gradient2 to ColorStops, doing some corrections, partially based on given SingleColor. @@ -206,7 +201,7 @@ namespace basegfx directly */ BASEGFX_DLLPUBLIC void prepareColorStops( - const com::sun::star::awt::Gradient2& rGradient, + const basegfx::BGradient& rGradient, BColorStops& rColorStops, BColor& rSingleColor); |