summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2020-05-08 13:27:54 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-06-30 13:56:53 +0200
commit6f752061d5153da50d6f536d506358c8f512a397 (patch)
tree16eb6223948e9bd28639f0825cd9c4d33a917b38
parent9b0a0bcc7ef3ae7a127e7d43b001bdb578184949 (diff)
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 <vmiklos@collabora.com>
-rw-r--r--chart2/inc/unonames.hxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx15
-rw-r--r--chart2/source/model/main/DataPointProperties.cxx12
-rw-r--r--chart2/source/model/main/DataPointProperties.hxx2
-rw-r--r--chart2/source/view/main/PropertyMapper.cxx4
-rw-r--r--oox/inc/drawingml/hatchmap.hxx296
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx25
-rw-r--r--oox/source/drawingml/fillproperties.cxx69
-rw-r--r--oox/source/token/properties.txt2
-rw-r--r--xmloff/source/chart/PropertyMap.hxx2
-rw-r--r--xmloff/source/chart/PropertyMaps.cxx3
11 files changed, 358 insertions, 74 deletions
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 <com/sun/star/drawing/LineJoint.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <comphelper/sequence.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -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<sal_Bool>::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<OUString>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_WIDTH,
PROP_SERIES_DATAPOINT_LABEL_BORDER_WIDTH,
cppu::UnoType<sal_Int32>::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<sal_Bool>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
+ rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_HATCH_NAME,
+ PROP_DATAPOINT_LABEL_FILL_HATCH_NAME,
+ cppu::UnoType<OUString>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_WIDTH,
PROP_DATAPOINT_LABEL_BORDER_WIDTH,
cppu::UnoType<sal_Int32>::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<sal_Int32>(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 <com/sun/star/drawing/Hatch.hpp>
+#include <oox/token/tokens.hxx>
+
+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 <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
#include <com/sun/star/chart2/DataPointCustomLabelField.hpp>
@@ -42,6 +43,7 @@
#include <drawingml/fillproperties.hxx>
#include <oox/core/xmlfilterbase.hxx>
#include <oox/helper/containerhelper.hxx>
+#include <oox/helper/modelobjecthelper.hxx>
#include <oox/token/properties.hxx>
#include <oox/token/tokens.hxx>
#include <drawingml/lineproperties.hxx>
@@ -49,6 +51,7 @@
#include <drawingml/textrun.hxx>
#include <drawingml/textfield.hxx>
#include <drawingml/textbody.hxx>
+#include <drawingml/hatchmap.hxx>
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 <oox/helper/graphichelper.hxx>
#include <oox/drawingml/drawingmltypes.hxx>
#include <oox/drawingml/shapepropertymap.hxx>
+#include <drawingml/hatchmap.hxx>
#include <oox/token/namespaces.hxx>
#include <oox/token/properties.hxx>
#include <oox/token/tokens.hxx>
@@ -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<drawing::LineStyle> const aLineStyleMap[] =
SvXMLEnumMapEntry<drawing::FillStyle> const aFillStyleMap[] =
{
{ XML_NONE, drawing::FillStyle_NONE },
- { XML_SOLID, drawing::FillStyle_SOLID }
+ { XML_SOLID, drawing::FillStyle_SOLID },
+ { XML_HATCH, drawing::FillStyle_HATCH }
};
}