From 7a061d5c8778fee58f966eee7f95917a5a74123e Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Tue, 29 Sep 2020 13:40:41 +0200 Subject: Set correct gradient color for chart background in sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I98dc177494fddc4a975479e99aba7b6318051b1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103618 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104033 Reviewed-by: Szymon Kłos --- sc/source/ui/drawfunc/drawsh2.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index 264f81998af9..e5339cc22940 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -343,6 +344,35 @@ static void setupFillColorForChart(SfxViewShell* pShell, SfxItemSet& rSet) pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, (".uno:FillColor=" + std::to_string(nFillColor)).c_str()); } + + if (comphelper::LibreOfficeKit::isActive() && xInfo->hasPropertyByName("FillGradientName")) + { + OUString aGradientName; + xPropSet->getPropertyValue("FillGradientName") >>= aGradientName; + + ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController(); + if( xChartController.is() ) + { + css::uno::Reference xFact(xChartController->getModel(), css::uno::UNO_QUERY); + + if (xFact.is()) + { + css::uno::Reference xNameAccess( + xFact->createInstance("com.sun.star.drawing.GradientTable"), css::uno::UNO_QUERY); + + if (xNameAccess.is() && xNameAccess->hasByName(aGradientName)) + { + css::uno::Any aAny = xNameAccess->getByName(aGradientName); + + XFillGradientItem aItem; + aItem.SetName(aGradientName); + aItem.PutValue(aAny, MID_FILLGRADIENT); + + rSet.Put(aItem); + } + } + } + } } } } -- cgit