From 6f752061d5153da50d6f536d506358c8f512a397 Mon Sep 17 00:00:00 2001 From: Gülşah Köse Date: Fri, 8 May 2020 13:27:54 +0300 Subject: Related: tdf#131175 OOXML chart: import data label fill pattern Change-Id: I2db64489c86e4381167eb13af4ab5118113960d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93715 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- chart2/inc/unonames.hxx | 2 + .../chartapiwrapper/DataSeriesPointWrapper.cxx | 15 +- chart2/source/model/main/DataPointProperties.cxx | 12 + chart2/source/model/main/DataPointProperties.hxx | 2 + chart2/source/view/main/PropertyMapper.cxx | 4 +- oox/inc/drawingml/hatchmap.hxx | 296 +++++++++++++++++++++ oox/source/drawingml/chart/seriesconverter.cxx | 25 +- oox/source/drawingml/fillproperties.cxx | 69 +---- oox/source/token/properties.txt | 2 + xmloff/source/chart/PropertyMap.hxx | 2 + xmloff/source/chart/PropertyMaps.cxx | 3 +- 11 files changed, 358 insertions(+), 74 deletions(-) create mode 100644 oox/inc/drawingml/hatchmap.hxx diff --git a/chart2/inc/unonames.hxx b/chart2/inc/unonames.hxx index d7d56d61a001..2174f4abb1d7 100644 --- a/chart2/inc/unonames.hxx +++ b/chart2/inc/unonames.hxx @@ -28,6 +28,8 @@ #define CHART_UNONAME_LABEL_BORDER_DASHNAME "LabelBorderDashName" #define CHART_UNONAME_LABEL_BORDER_TRANS "LabelBorderTransparency" #define CHART_UNONAME_LABEL_FILL_STYLE "LabelFillStyle" +#define CHART_UNONAME_LABEL_FILL_BACKGROUND "LabelFillBackground" +#define CHART_UNONAME_LABEL_FILL_HATCH_NAME "LabelFillHatchName" #define CHART_UNONAME_LABEL_FILL_COLOR "LabelFillColor" #define CHART_UNONAME_CUSTOM_LABEL_FIELDS "CustomLabelFields" diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index f30e28115302..e98ebe65bbbd 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -84,7 +85,9 @@ enum PROP_SERIES_DATAPOINT_LABEL_BORDER_COLOR, PROP_SERIES_DATAPOINT_LABEL_BORDER_TRANS, PROP_SERIES_DATAPOINT_LABEL_FILL_STYLE, - PROP_SERIES_DATAPOINT_LABEL_FILL_COLOR + PROP_SERIES_DATAPOINT_LABEL_FILL_COLOR, + PROP_SERIES_DATAPOINT_LABEL_FILL_BACKGROUND, + PROP_SERIES_DATAPOINT_LABEL_FILL_HATCH_NAME }; void lcl_AddPropertiesToVector_PointProperties( @@ -170,6 +173,16 @@ void lcl_AddPropertiesToVector_PointProperties( | beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_BACKGROUND, + PROP_SERIES_DATAPOINT_LABEL_FILL_BACKGROUND, + cppu::UnoType::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_HATCH_NAME, + PROP_SERIES_DATAPOINT_LABEL_FILL_HATCH_NAME, + cppu::UnoType::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT ); rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_WIDTH, PROP_SERIES_DATAPOINT_LABEL_BORDER_WIDTH, cppu::UnoType::get(), diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx index be665c606310..7bc20bbc30e6 100644 --- a/chart2/source/model/main/DataPointProperties.cxx +++ b/chart2/source/model/main/DataPointProperties.cxx @@ -396,6 +396,16 @@ void DataPointProperties::AddPropertiesToVector( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_BACKGROUND, + PROP_DATAPOINT_LABEL_FILL_BACKGROUND, + cppu::UnoType::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_HATCH_NAME, + PROP_DATAPOINT_LABEL_FILL_HATCH_NAME, + cppu::UnoType::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT ); rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_WIDTH, PROP_DATAPOINT_LABEL_BORDER_WIDTH, cppu::UnoType::get(), @@ -506,6 +516,8 @@ void DataPointProperties::AddDefaultsToMap( PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_COLOR); PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_FILL_STYLE); PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_FILL_COLOR); + PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_FILL_BACKGROUND); + PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_FILL_HATCH_NAME); PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_WIDTH, 0); PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_DASH, drawing::LineDash()); PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_DASH_NAME); diff --git a/chart2/source/model/main/DataPointProperties.hxx b/chart2/source/model/main/DataPointProperties.hxx index 0482108b1e6b..1998c4e20369 100644 --- a/chart2/source/model/main/DataPointProperties.hxx +++ b/chart2/source/model/main/DataPointProperties.hxx @@ -37,6 +37,8 @@ namespace DataPointProperties { PROP_DATAPOINT_LABEL_FILL_STYLE, PROP_DATAPOINT_LABEL_FILL_COLOR, + PROP_DATAPOINT_LABEL_FILL_BACKGROUND, + PROP_DATAPOINT_LABEL_FILL_HATCH_NAME, // common PROP_DATAPOINT_COLOR = FAST_PROPERTY_ID_START_DATA_POINT, diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx index 271c8e378535..c062eb2b451a 100644 --- a/chart2/source/view/main/PropertyMapper.cxx +++ b/chart2/source/view/main/PropertyMapper.cxx @@ -341,7 +341,9 @@ namespace { {"LineColor", CHART_UNONAME_LABEL_BORDER_COLOR}, {"LineTransparence", CHART_UNONAME_LABEL_BORDER_TRANS}, {"FillStyle", CHART_UNONAME_LABEL_FILL_STYLE}, - {"FillColor", CHART_UNONAME_LABEL_FILL_COLOR} + {"FillColor", CHART_UNONAME_LABEL_FILL_COLOR}, + {"FillBackground", CHART_UNONAME_LABEL_FILL_BACKGROUND}, + {"FillHatchName", CHART_UNONAME_LABEL_FILL_HATCH_NAME} }); // fix the spelling! return map; diff --git a/oox/inc/drawingml/hatchmap.hxx b/oox/inc/drawingml/hatchmap.hxx new file mode 100644 index 000000000000..f0621f872b0a --- /dev/null +++ b/oox/inc/drawingml/hatchmap.hxx @@ -0,0 +1,296 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include + +using namespace com::sun::star; +using namespace oox; + +static drawing::Hatch createHatch(sal_Int32 nHatchToken, ::Color nColor) +{ + drawing::Hatch aHatch; + aHatch.Color = sal_Int32(nColor); + // best-effort mapping; we do not support all the styles in core + switch (nHatchToken) + { + case XML_pct5: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 250; + aHatch.Angle = 450; + break; + case XML_pct10: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 200; + aHatch.Angle = 450; + break; + case XML_pct20: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_pct25: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 200; + aHatch.Angle = 450; + break; + case XML_pct30: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 175; + aHatch.Angle = 450; + break; + case XML_pct40: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_pct50: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 125; + aHatch.Angle = 450; + break; + case XML_pct60: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_pct70: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 125; + aHatch.Angle = 450; + break; + case XML_pct75: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_pct80: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 75; + aHatch.Angle = 450; + break; + case XML_pct90: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 50; + aHatch.Angle = 450; + break; + case XML_horz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_vert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 900; + break; + case XML_ltHorz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 0; + break; + case XML_ltVert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 900; + break; + case XML_dkHorz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 25; + aHatch.Angle = 0; + break; + case XML_dkVert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 25; + aHatch.Angle = 900; + break; + case XML_narHorz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 0; + break; + case XML_narVert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 900; + break; + case XML_dashHorz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 0; + break; + case XML_dashVert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 900; + break; + case XML_cross: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_dnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 1350; + break; + case XML_upDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_ltDnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 1350; + break; + case XML_ltUpDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 450; + break; + case XML_dkDnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 1350; + break; + case XML_dkUpDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 450; + break; + case XML_wdDnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 1350; + break; + case XML_wdUpDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_dashDnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 1350; + break; + case XML_dashUpDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_diagCross: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_smCheck: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 50; + aHatch.Angle = 450; + break; + case XML_lgCheck: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_smGrid: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 50; + aHatch.Angle = 0; + break; + case XML_lgGrid: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_dotGrid: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 400; + aHatch.Angle = 0; + break; + case XML_smConfetti: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 200; + aHatch.Angle = 600; + break; + case XML_lgConfetti: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 600; + break; + case XML_horzBrick: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 300; + aHatch.Angle = 0; + break; + case XML_diagBrick: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 300; + aHatch.Angle = 450; + break; + case XML_solidDmnd: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_openDmnd: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_dotDmnd: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 300; + aHatch.Angle = 450; + break; + case XML_plaid: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 200; + aHatch.Angle = 900; + break; + case XML_sphere: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_weave: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_divot: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 400; + aHatch.Angle = 450; + break; + case XML_shingle: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 200; + aHatch.Angle = 1350; + break; + case XML_wave: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_trellis: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 75; + aHatch.Angle = 450; + break; + case XML_zigZag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 75; + aHatch.Angle = 0; + break; + } + + return aHatch; +} diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index c55c3891a975..f2df3aebe536 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +51,7 @@ #include #include #include +#include namespace oox::drawingml::chart { @@ -201,7 +204,7 @@ void importBorderProperties( PropertySet& rPropSet, Shape& rShape, const Graphic rPropSet.setProperty(PROP_LabelBorderColor, uno::makeAny(nColor)); } -void importFillProperties( PropertySet& rPropSet, Shape& rShape, const GraphicHelper& rGraphicHelper ) +void importFillProperties( PropertySet& rPropSet, Shape& rShape, const GraphicHelper& rGraphicHelper, ModelObjectHelper& rModelObjHelper ) { FillProperties& rFP = rShape.getFillProperties(); @@ -213,6 +216,22 @@ void importFillProperties( PropertySet& rPropSet, Shape& rShape, const GraphicHe ::Color nColor = aColor.getColor(rGraphicHelper); rPropSet.setProperty(PROP_LabelFillColor, uno::makeAny(nColor)); } + else if(rFP.moFillType.has() && rFP.moFillType.get() == XML_pattFill) + { + rPropSet.setProperty(PROP_LabelFillStyle, drawing::FillStyle_HATCH); + rPropSet.setProperty(PROP_LabelFillBackground, true); + + Color aHatchColor( rFP.maPatternProps.maPattFgColor ); + drawing::Hatch aHatch = createHatch(rFP.maPatternProps.moPattPreset.get(), aHatchColor.getColor(rGraphicHelper, 0)); + + OUString sHatchName = rModelObjHelper.insertFillHatch(aHatch); + rPropSet.setProperty(PROP_LabelFillHatchName, sHatchName); + + const Color& aColor = rFP.maPatternProps.maPattBgColor; + ::Color nColor = aColor.getColor(rGraphicHelper); + rPropSet.setProperty(PROP_LabelFillColor, uno::makeAny(nColor)); + } + } DataPointCustomLabelFieldType lcl_ConvertFieldNameToFieldEnum( const OUString& rField ) @@ -264,7 +283,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat if (mrModel.mxShapeProp) { importBorderProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper()); - importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper()); + importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper(), getFilter().getModelObjectHelper()); } if( mrModel.mxText && mrModel.mxText->mxTextBody && !mrModel.mxText->mxTextBody->getParagraphs().empty() ) { @@ -351,7 +370,7 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa { // Import baseline border properties for these data labels. importBorderProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper()); - importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper()); + importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper(), getFilter().getModelObjectHelper()); } } // import leaderline of data labels diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 023af3bc613f..963c4009becf 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -253,74 +254,6 @@ Color FillProperties::getBestSolidColor() const return aSolidColor; } -/// Maps the hatch token to drawing::Hatch. -static drawing::Hatch createHatch( sal_Int32 nHatchToken, ::Color nColor ) -{ - drawing::Hatch aHatch; - aHatch.Color = sal_Int32(nColor); - - // best-effort mapping; we do not support all the styles in core - switch ( nHatchToken ) - { - case XML_pct5: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 250; aHatch.Angle = 450; break; - case XML_pct10: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 200; aHatch.Angle = 450; break; - case XML_pct20: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 150; aHatch.Angle = 450; break; - case XML_pct25: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 200; aHatch.Angle = 450; break; - case XML_pct30: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 175; aHatch.Angle = 450; break; - case XML_pct40: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 150; aHatch.Angle = 450; break; - case XML_pct50: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 125; aHatch.Angle = 450; break; - case XML_pct60: aHatch.Style = drawing::HatchStyle_TRIPLE; aHatch.Distance = 150; aHatch.Angle = 450; break; - case XML_pct70: aHatch.Style = drawing::HatchStyle_TRIPLE; aHatch.Distance = 125; aHatch.Angle = 450; break; - case XML_pct75: aHatch.Style = drawing::HatchStyle_TRIPLE; aHatch.Distance = 100; aHatch.Angle = 450; break; - case XML_pct80: aHatch.Style = drawing::HatchStyle_TRIPLE; aHatch.Distance = 75; aHatch.Angle = 450; break; - case XML_pct90: aHatch.Style = drawing::HatchStyle_TRIPLE; aHatch.Distance = 50; aHatch.Angle = 450; break; - case XML_horz: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 100; aHatch.Angle = 0; break; - case XML_vert: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 100; aHatch.Angle = 900; break; - case XML_ltHorz: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 50; aHatch.Angle = 0; break; - case XML_ltVert: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 50; aHatch.Angle = 900; break; - case XML_dkHorz: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 25; aHatch.Angle = 0; break; - case XML_dkVert: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 25; aHatch.Angle = 900; break; - case XML_narHorz: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 50; aHatch.Angle = 0; break; - case XML_narVert: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 50; aHatch.Angle = 900; break; - case XML_dashHorz: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 150; aHatch.Angle = 0; break; - case XML_dashVert: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 150; aHatch.Angle = 900; break; - case XML_cross: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 100; aHatch.Angle = 0; break; - case XML_dnDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 100; aHatch.Angle = 1350; break; - case XML_upDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 100; aHatch.Angle = 450; break; - case XML_ltDnDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 50; aHatch.Angle = 1350; break; - case XML_ltUpDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 50; aHatch.Angle = 450; break; - case XML_dkDnDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 50; aHatch.Angle = 1350; break; - case XML_dkUpDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 50; aHatch.Angle = 450; break; - case XML_wdDnDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 100; aHatch.Angle = 1350; break; - case XML_wdUpDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 100; aHatch.Angle = 450; break; - case XML_dashDnDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 150; aHatch.Angle = 1350; break; - case XML_dashUpDiag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 150; aHatch.Angle = 450; break; - case XML_diagCross: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 100; aHatch.Angle = 450; break; - case XML_smCheck: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 50; aHatch.Angle = 450; break; - case XML_lgCheck: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 100; aHatch.Angle = 450; break; - case XML_smGrid: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 50; aHatch.Angle = 0; break; - case XML_lgGrid: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 100; aHatch.Angle = 0; break; - case XML_dotGrid: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 400; aHatch.Angle = 0; break; - case XML_smConfetti: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 200; aHatch.Angle = 600; break; - case XML_lgConfetti: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 100; aHatch.Angle = 600; break; - case XML_horzBrick: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 300; aHatch.Angle = 0; break; - case XML_diagBrick: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 300; aHatch.Angle = 450; break; - case XML_solidDmnd: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 100; aHatch.Angle = 450; break; - case XML_openDmnd: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 100; aHatch.Angle = 450; break; - case XML_dotDmnd: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 300; aHatch.Angle = 450; break; - case XML_plaid: aHatch.Style = drawing::HatchStyle_TRIPLE; aHatch.Distance = 200; aHatch.Angle = 900; break; - case XML_sphere: aHatch.Style = drawing::HatchStyle_TRIPLE; aHatch.Distance = 100; aHatch.Angle = 0; break; - case XML_weave: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 150; aHatch.Angle = 450; break; - case XML_divot: aHatch.Style = drawing::HatchStyle_TRIPLE; aHatch.Distance = 400; aHatch.Angle = 450; break; - case XML_shingle: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 200; aHatch.Angle = 1350; break; - case XML_wave: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 100; aHatch.Angle = 0; break; - case XML_trellis: aHatch.Style = drawing::HatchStyle_DOUBLE; aHatch.Distance = 75; aHatch.Angle = 450; break; - case XML_zigZag: aHatch.Style = drawing::HatchStyle_SINGLE; aHatch.Distance = 75; aHatch.Angle = 0; break; - } - - return aHatch; -} - void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, ::Color nPhClr, bool bFlipH, bool bFlipV ) const diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 3c9ba162f563..fe8d75520077 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -287,6 +287,8 @@ LabelBorderWidth LabelPlacement LabelPosition LabelSeparator +LabelFillBackground +LabelFillHatchName LabelFillStyle LabelFillColor CustomLabelFields diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx index aec009178b76..d1149784771c 100644 --- a/xmloff/source/chart/PropertyMap.hxx +++ b/xmloff/source/chart/PropertyMap.hxx @@ -156,6 +156,8 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = MAP_ENTRY_ODF_EXT( "LabelFillColor", LO_EXT, XML_LABEL_FILL_COLOR, XML_TYPE_COLOR ), MAP_ENTRY_ODF_EXT( "LabelFillStyle", LO_EXT, XML_LABEL_FILL, XML_SCH_TYPE_LABEL_FILL_STYLE ), + MAP_ENTRY_ODF_EXT( "LabelFillBackground", LO_EXT, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL ), + MAP_ENTRY_ODF_EXT( "LabelFillHatchName", LO_EXT, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME), MAP_ENTRY( "ScaleText", CHART, XML_SCALE_TEXT, XML_TYPE_BOOL ), diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 8701c0c0169e..ce3b458ec0dc 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -75,7 +75,8 @@ SvXMLEnumMapEntry const aLineStyleMap[] = SvXMLEnumMapEntry const aFillStyleMap[] = { { XML_NONE, drawing::FillStyle_NONE }, - { XML_SOLID, drawing::FillStyle_SOLID } + { XML_SOLID, drawing::FillStyle_SOLID }, + { XML_HATCH, drawing::FillStyle_HATCH } }; } -- cgit