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>
This commit is contained in:
offtkp
2023-11-20 22:58:20 +02:00
committed by Paris Oplopoios
parent 42edec63fb
commit b5a35f09b3

View File

@@ -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;
}();