diff options
author | offtkp <parisoplop@gmail.com> | 2023-11-20 22:58:20 +0200 |
---|---|---|
committer | Paris Oplopoios <parisoplop@gmail.com> | 2023-11-21 14:24:42 +0100 |
commit | b5a35f09b3c3ccac26b403e881c799e0d09bf42a (patch) | |
tree | 2368b8631cb600279f18459b26e614e1fb286284 /chart2/source | |
parent | 42edec63fba4a3ddc0dcd83a5affb7913625b42a (diff) |
chart2: Match chart background color with DOCCOLOR in Calc
Chart background color would be hardcoded to white which meant newly inserted charts would have a different background color in Calc (in other components, the background color is later set to transparent)
Change-Id: I6ea55389f195155a96c4c8dcc94a902b2a862178
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159751
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/model/main/PageBackground.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx index 592c24d3e6a2..c866bdbb3f4a 100644 --- a/chart2/source/model/main/PageBackground.cxx +++ b/chart2/source/model/main/PageBackground.cxx @@ -23,6 +23,8 @@ #include <UserDefinedProperties.hxx> #include <PropertyHelper.hxx> #include <ModifyListenerHelper.hxx> +#include <svtools/colorcfg.hxx> +#include <sfx2/viewsh.hxx> #include <com/sun/star/drawing/LineStyle.hpp> #include <cppuhelper/supportsservice.hxx> @@ -48,7 +50,13 @@ const ::chart::tPropertyValueMap& StaticPageBackgroundDefaults() ::chart::FillProperties::AddDefaultsToMap( aTmp ); // override other defaults - ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( aTmp, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); + Color aDocColor = COL_WHITE; + if (SfxViewShell::Current()) { + aDocColor = SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR); + } else { + SAL_WARN("chart2", "SfxViewShell::Current() returned nullptr"); + } + ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::FillProperties::PROP_FILL_COLOR, aDocColor ); ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); return aTmp; }(); |