chart2/inc/unonames.hxx                                             |    2 
 chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx |   18 
+++++++
 chart2/source/model/main/DataPointProperties.cxx                    |   13 
+++++
 chart2/source/model/main/DataPointProperties.hxx                    |    3 +
 chart2/source/view/main/PropertyMapper.cxx                          |    5 +-
 include/xmloff/xmltoken.hxx                                         |    2 
 oox/source/drawingml/chart/seriesconverter.cxx                      |   23 
+++++++++-
 oox/source/token/properties.txt                                     |    2 
 xmloff/source/chart/PropertyMap.hxx                                 |    4 +
 xmloff/source/chart/PropertyMaps.cxx                                |   10 ++++
 xmloff/source/core/xmltoken.cxx                                     |    2 
 xmloff/source/token/tokens.txt                                      |    2 
 12 files changed, 83 insertions(+), 3 deletions(-)

New commits:
commit 603df08a1e0211099ce2cf258cfe64a74ed6ded9
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Mon May 4 11:48:51 2020 +0300
Commit:     Gülşah Köse <gulsah.k...@collabora.com>
CommitDate: Mon May 4 21:04:39 2020 +0200

    tdf#131175 Import data label solid fill and color.
    
    Change-Id: I8a3ef6e60d4f2a13310bb9a8fc4eb873df3f9b4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93407
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.k...@collabora.com>

diff --git a/chart2/inc/unonames.hxx b/chart2/inc/unonames.hxx
index 8f4c855d3766..d7d56d61a001 100644
--- a/chart2/inc/unonames.hxx
+++ b/chart2/inc/unonames.hxx
@@ -27,6 +27,8 @@
 #define CHART_UNONAME_LABEL_BORDER_DASH     "LabelBorderDash"
 #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_COLOR      "LabelFillColor"
 #define CHART_UNONAME_CUSTOM_LABEL_FIELDS   "CustomLabelFields"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git 
a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx 
b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index a695076a4c13..f30e28115302 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -47,6 +47,7 @@
 #include <com/sun/star/chart/ChartSymbolType.hpp>
 #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/lang/WrappedTargetRuntimeException.hpp>
 #include <comphelper/sequence.hxx>
 #include <cppuhelper/exc_hlp.hxx>
@@ -81,7 +82,9 @@ enum
     PROP_SERIES_DATAPOINT_LABEL_BORDER_STYLE,
     PROP_SERIES_DATAPOINT_LABEL_BORDER_WIDTH,
     PROP_SERIES_DATAPOINT_LABEL_BORDER_COLOR,
-    PROP_SERIES_DATAPOINT_LABEL_BORDER_TRANS
+    PROP_SERIES_DATAPOINT_LABEL_BORDER_TRANS,
+    PROP_SERIES_DATAPOINT_LABEL_FILL_STYLE,
+    PROP_SERIES_DATAPOINT_LABEL_FILL_COLOR
 };
 
 void lcl_AddPropertiesToVector_PointProperties(
@@ -154,6 +157,19 @@ void lcl_AddPropertiesToVector_PointProperties(
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT );
 
+    rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_STYLE,
+                  PROP_SERIES_DATAPOINT_LABEL_FILL_STYLE,
+                  cppu::UnoType<drawing::FillStyle>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT );
+
+    rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_COLOR,
+                  PROP_SERIES_DATAPOINT_LABEL_FILL_COLOR,
+                  cppu::UnoType<sal_Int32>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEVOID
+                  | 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 114fb4355069..be665c606310 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -385,6 +385,17 @@ void DataPointProperties::AddPropertiesToVector(
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEVOID         // "maybe auto"
                   | beans::PropertyAttribute::MAYBEDEFAULT );
+    rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_STYLE,
+                  PROP_DATAPOINT_LABEL_FILL_STYLE,
+                  cppu::UnoType<drawing::FillStyle>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT );
+    rOutProperties.emplace_back( CHART_UNONAME_LABEL_FILL_COLOR,
+                  PROP_DATAPOINT_LABEL_FILL_COLOR,
+                  cppu::UnoType<sal_Int32>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEVOID
+                  | beans::PropertyAttribute::MAYBEDEFAULT );
     rOutProperties.emplace_back( CHART_UNONAME_LABEL_BORDER_WIDTH,
                   PROP_DATAPOINT_LABEL_BORDER_WIDTH,
                   cppu::UnoType<sal_Int32>::get(),
@@ -493,6 +504,8 @@ void DataPointProperties::AddDefaultsToMap(
     PropertyHelper::setPropertyValueDefault< OUString >( rOutMap, 
PROP_DATAPOINT_LABEL_SEPARATOR, " " );
     PropertyHelper::setPropertyValueDefault<sal_Int32>(rOutMap, 
PROP_DATAPOINT_LABEL_BORDER_STYLE, sal_Int32(drawing::LineStyle_NONE));
     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::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 d591f13625f3..259e7a8976eb 100644
--- a/chart2/source/model/main/DataPointProperties.hxx
+++ b/chart2/source/model/main/DataPointProperties.hxx
@@ -35,6 +35,9 @@ namespace DataPointProperties
     // FastProperty Ids for properties
     enum
     {
+        PROP_DATAPOINT_LABEL_FILL_STYLE,
+        PROP_DATAPOINT_LABEL_FILL_COLOR,
+
         // common
         PROP_DATAPOINT_COLOR = FAST_PROPERTY_ID_START_DATA_POINT,
         PROP_DATAPOINT_TRANSPARENCY,
diff --git a/chart2/source/view/main/PropertyMapper.cxx 
b/chart2/source/view/main/PropertyMapper.cxx
index 2658e94ea78a..271c8e378535 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -339,7 +339,10 @@ namespace {
             {"LineStyle", CHART_UNONAME_LABEL_BORDER_STYLE},
             {"LineWidth", CHART_UNONAME_LABEL_BORDER_WIDTH},
             {"LineColor", CHART_UNONAME_LABEL_BORDER_COLOR},
-            {"LineTransparence", CHART_UNONAME_LABEL_BORDER_TRANS}});
+            {"LineTransparence", CHART_UNONAME_LABEL_BORDER_TRANS},
+            {"FillStyle", CHART_UNONAME_LABEL_FILL_STYLE},
+            {"FillColor", CHART_UNONAME_LABEL_FILL_COLOR}
+            });
                 // fix the spelling!
         return map;
     }
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 6acceaeae1a5..fda3f4cf9861 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1092,6 +1092,8 @@ namespace xmloff::token {
         XML_LABEL_ARRANGEMENT,
         XML_LABEL_CELL_ADDRESS,
         XML_LABEL_CELL_RANGE_ADDRESS,
+        XML_LABEL_FILL,
+        XML_LABEL_FILL_COLOR,
         XML_LABEL_RANGE,
         XML_LABEL_RANGES,
         XML_LABEL_STRING,
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index b12f4416100b..6591e7277040 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -32,12 +32,14 @@
 #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
 #include <com/sun/star/chart2/data/XDataSink.hpp>
 #include <com/sun/star/chart2/data/LabeledDataSequence.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include <osl/diagnose.h>
 #include <drawingml/chart/datasourceconverter.hxx>
 #include <drawingml/chart/seriesmodel.hxx>
 #include <drawingml/chart/titleconverter.hxx>
 #include <drawingml/chart/typegroupconverter.hxx>
 #include <drawingml/chart/typegroupmodel.hxx>
+#include <drawingml/fillproperties.hxx>
 #include <oox/core/xmlfilterbase.hxx>
 #include <oox/helper/containerhelper.hxx>
 #include <oox/token/properties.hxx>
@@ -199,6 +201,20 @@ void importBorderProperties( PropertySet& rPropSet, Shape& 
rShape, const Graphic
     rPropSet.setProperty(PROP_LabelBorderColor, uno::makeAny(nColor));
 }
 
+void importFillProperties( PropertySet& rPropSet, Shape& rShape, const 
GraphicHelper& rGraphicHelper )
+{
+    FillProperties& rFP = rShape.getFillProperties();
+
+    if (rFP.moFillType.has() && rFP.moFillType.get() == XML_solidFill)
+    {
+        rPropSet.setProperty(PROP_LabelFillStyle, drawing::FillStyle_SOLID);
+
+        const Color& aColor = rFP.maFillColor;
+        ::Color nColor = aColor.getColor(rGraphicHelper);
+        rPropSet.setProperty(PROP_LabelFillColor, uno::makeAny(nColor));
+    }
+}
+
 DataPointCustomLabelFieldType lcl_ConvertFieldNameToFieldEnum( const OUString& 
rField )
 {
     if (rField == "VALUE")
@@ -246,8 +262,10 @@ void DataLabelConverter::convertFromModel( const 
Reference< XDataSeries >& rxDat
         }
 
         if (mrModel.mxShapeProp)
+        {
             importBorderProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper());
-
+            importFillProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper());
+        }
         if( mrModel.mxText && mrModel.mxText->mxTextBody && 
!mrModel.mxText->mxTextBody->getParagraphs().empty() )
         {
             css::uno::Reference< XComponentContext > xContext = 
getComponentContext();
@@ -330,8 +348,11 @@ void DataLabelsConverter::convertFromModel( const 
Reference< XDataSeries >& rxDa
         lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, 
rTypeGroup, true, bMSO2007Doc );
 
         if (mrModel.mxShapeProp)
+        {
             // Import baseline border properties for these data labels.
             importBorderProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper());
+            importFillProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper());
+        }
     }
     // import leaderline of data labels
     if( !mrModel.mbShowLeaderLines )
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 5c507fab553d..667e479107e5 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -287,6 +287,8 @@ LabelBorderWidth
 LabelPlacement
 LabelPosition
 LabelSeparator
+LabelFillStyle
+LabelFillColor
 CustomLabelFields
 LayoutInfo
 LeftBorder
diff --git a/xmloff/source/chart/PropertyMap.hxx 
b/xmloff/source/chart/PropertyMap.hxx
index 0b8d52c93bce..ef3b3d0a6616 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -53,6 +53,7 @@
 #define XML_SCH_TYPE_TICK_MARK_POSITION     ( XML_SCH_TYPES_START + 16 )
 #define XML_SCH_TYPE_LABEL_BORDER_STYLE     ( XML_SCH_TYPES_START + 17 )
 #define XML_SCH_TYPE_LABEL_BORDER_OPACITY   ( XML_SCH_TYPES_START + 18 )
+#define XML_SCH_TYPE_LABEL_FILL_STYLE       ( XML_SCH_TYPES_START + 19 )
 
 // context ids
 #define XML_SCH_CONTEXT_USER_SYMBOL                 ( XML_SCH_CTF_START + 0 )
@@ -151,6 +152,9 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
     MAP_ENTRY_ODF_EXT( "LabelBorderTransparency", LO_EXT, 
XML_LABEL_STROKE_OPACITY, XML_SCH_TYPE_LABEL_BORDER_OPACITY ),
     MAP_ENTRY_ODF_EXT( "LabelBorderWidth", LO_EXT, XML_LABEL_STROKE_WIDTH, 
XML_TYPE_MEASURE ),
 
+    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( "ScaleText", CHART, XML_SCALE_TEXT, XML_TYPE_BOOL ),
 
     // spline settings
diff --git a/xmloff/source/chart/PropertyMaps.cxx 
b/xmloff/source/chart/PropertyMaps.cxx
index 68658a2b1b06..c7adfe787f8a 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -47,6 +47,7 @@
 
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/chart/ChartAxisMarks.hpp>
 #include <com/sun/star/chart/ChartDataCaption.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
@@ -71,6 +72,12 @@ SvXMLEnumMapEntry<drawing::LineStyle> const aLineStyleMap[] =
     { XML_TOKEN_INVALID, drawing::LineStyle(0) }
 };
 
+SvXMLEnumMapEntry<drawing::FillStyle> const aFillStyleMap[] =
+{
+    { XML_NONE,     drawing::FillStyle_NONE },
+    { XML_SOLID,    drawing::FillStyle_SOLID }
+};
+
 }
 
 // the following class implementations are in this file:
@@ -158,6 +165,9 @@ const XMLPropertyHandler* 
XMLChartPropHdlFactory::GetPropertyHandler( sal_Int32
             case XML_SCH_TYPE_LABEL_BORDER_OPACITY:
                 pHdl = new XMLOpacityPropertyHdl(nullptr);
             break;
+            case XML_SCH_TYPE_LABEL_FILL_STYLE:
+                pHdl = new XMLEnumPropertyHdl( aFillStyleMap );
+            break;
             default:
                 ;
         }
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 253818ccf2df..2888d9f814de 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1097,6 +1097,8 @@ namespace xmloff::token {
         TOKEN( "label-arrangement",               XML_LABEL_ARRANGEMENT ),
         TOKEN( "label-cell-address",              XML_LABEL_CELL_ADDRESS ),
         TOKEN( "label-cell-range-address",        XML_LABEL_CELL_RANGE_ADDRESS 
),
+        TOKEN( "label-fill",                      XML_LABEL_FILL ),
+        TOKEN( "label-fill-color",                XML_LABEL_FILL_COLOR ),
         TOKEN( "label-range",                     XML_LABEL_RANGE ),
         TOKEN( "label-ranges",                    XML_LABEL_RANGES ),
         TOKEN( "label-string",                    XML_LABEL_STRING ),
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index fd3806a7f0f2..103e7eae1091 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1010,6 +1010,8 @@ label
 label-arrangement
 label-cell-address
 label-cell-range-address
+label-fill
+label-fill-color
 label-range
 label-ranges
 label-string
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to