[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - chart2/inc chart2/source oox/inc oox/source xmloff/source

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 10:14:31 UTC 2020


 chart2/inc/unonames.hxx                                             |    2 
 chart2/source/controller/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(-)

New commits:
commit 8913626938ba731214ed01cc067f8e10fb6a8bd8
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Fri May 8 13:27:54 2020 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jul 15 12:13:57 2020 +0200

    Related: tdf#131175 OOXML chart: import data label fill pattern
    
    (cherry picked from commit 6f752061d5153da50d6f536d506358c8f512a397)
    
    Conflicts:
            oox/source/drawingml/chart/seriesconverter.cxx
    
    Change-Id: I2db64489c86e4381167eb13af4ab5118113960d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98808
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/chart2/inc/unonames.hxx b/chart2/inc/unonames.hxx
index 9bbbf9a27171..b4044c2d689a 100644
--- a/chart2/inc/unonames.hxx
+++ b/chart2/inc/unonames.hxx
@@ -29,6 +29,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 bebd947acbc5..229e6832a11c 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 cc9ed237f44b..ccc9c98ffa89 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -395,6 +395,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(),
@@ -499,6 +509,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 5214b7bcaf9c..75b396c597c8 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 8a949c123fa9..45275ed13b2e 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -342,7 +342,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 1551e2727591..43a6f60f1779 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -22,6 +22,7 @@
 #include <com/sun/star/chart/DataLabelPlacement.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>
@@ -46,6 +47,7 @@
 #include <oox/helper/containerhelper.hxx>
 #include <oox/helper/attributelist.hxx>
 #include <oox/token/namespaces.hxx>
+#include <oox/helper/modelobjecthelper.hxx>
 #include <oox/token/properties.hxx>
 #include <oox/token/tokens.hxx>
 #include <drawingml/lineproperties.hxx>
@@ -53,6 +55,7 @@
 #include <drawingml/textrun.hxx>
 #include <drawingml/textfield.hxx>
 #include <drawingml/textbody.hxx>
+#include <drawingml/hatchmap.hxx>
 
 namespace oox {
 namespace drawingml {
@@ -238,7 +241,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();
 
@@ -250,6 +253,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 )
@@ -312,7 +331,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() )
         {
@@ -399,7 +418,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());
         }
     }
 
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index c64b0862d225..caa54b82ca34 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -39,6 +39,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>
@@ -258,74 +259,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 3dd942df9903..c7e64e6dde81 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -283,6 +283,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 f5fab246c0b5..c1859a9f3620 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -154,6 +154,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 c7adfe787f8a..521addbc1166 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 }
 };
 
 }


More information about the Libreoffice-commits mailing list