diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2023-04-18 15:36:35 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2023-04-19 20:43:45 +0200 |
commit | 4409cd197dfb1fab05c0285f3ae17a107c99b77e (patch) | |
tree | c89a73f29f03d4e656042f0b8b88e329b16fd5de /sd | |
parent | 730b329b51797254aca58843ad7937ee7662cf7f (diff) |
MCGR: 2nd corrections/adaptions to MCGR
Adapted handling of 'border' argument from our gradients
for oox export, so that it looks the same.
Also added quite some cases to peserve in-between
GradientStops for current UI implementations to be
able to edit the gradients as usual without losing
the in-between GradientStops.
While we will not be able to modify these, we are
at least able to modify all the other gradient
attributes, including start/endColor.
Done this for TransparencyGradients, too.
Also moved more stuff to the gradient tooling in
basegfx.
Change-Id: I6e94011bbf3715baa1401ab97e5b59811298342f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150577
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.hxx | 6 |
2 files changed, 30 insertions, 4 deletions
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 101b8c6133a3..dc7f8f0fd024 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -403,6 +403,12 @@ void SlideBackground::Update() mxFillGrad1->SelectEntry(aStartColor); const Color aEndColor(xGradient.GetColorStops().back().getStopColor()); mxFillGrad2->SelectEntry(aEndColor); + + // MCGR: preserve in-between ColorStops if given + if (xGradient.GetColorStops().size() > 2) + maColorStops = basegfx::ColorStops(xGradient.GetColorStops().begin() + 1, xGradient.GetColorStops().end() - 1); + else + maColorStops.clear(); } break; @@ -1127,10 +1133,7 @@ IMPL_LINK_NOARG(SlideBackground, FillColorHdl, ColorListBox&, void) break; case drawing::FillStyle_GRADIENT: { - XGradient aGradient( - basegfx::utils::createColorStopsFromStartEndColor( - mxFillGrad1->GetSelectEntryColor().getBColor(), - mxFillGrad2->GetSelectEntryColor().getBColor())); + XGradient aGradient(createColorStops()); // the name doesn't really matter, it'll be converted to unique one eventually, // but it has to be non-empty @@ -1283,6 +1286,23 @@ IMPL_LINK_NOARG( SlideBackground, ModifyMarginHdl, weld::ComboBox&, void ) } } +basegfx::ColorStops SlideBackground::createColorStops() +{ + basegfx::ColorStops aColorStops; + + aColorStops.emplace_back(0.0, mxFillGrad1->GetSelectEntryColor().getBColor()); + + if(!maColorStops.empty()) + { + aColorStops.insert(aColorStops.begin(), maColorStops.begin(), maColorStops.end()); + } + + aColorStops.emplace_back(1.0, mxFillGrad2->GetSelectEntryColor().getBColor()); + + return aColorStops; } +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx index f7599f0c9ab0..5d029296c357 100644 --- a/sd/source/ui/sidebar/SlideBackground.hxx +++ b/sd/source/ui/sidebar/SlideBackground.hxx @@ -139,6 +139,9 @@ private: MapUnit meUnit; + // MCGR: Preserve in-between ColorStops until we have an UI to edit these + basegfx::ColorStops maColorStops; + DECL_LINK(FillBackgroundHdl, weld::ComboBox&, void); DECL_LINK(FillStyleModifyHdl, weld::ComboBox&, void); DECL_LINK(PaperSizeModifyHdl, weld::ComboBox&, void); @@ -173,6 +176,9 @@ private: void updateMasterSlideSelection(); static FieldUnit GetCurrentUnit(SfxItemState eState, const SfxPoolItem* pState); + + // MCGR: Preserve in-between ColorStops until we have an UI to edit these + basegfx::ColorStops createColorStops(); }; } |