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

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


 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 e6dc487a24a4e65794707276e7ca5f9a2ffba191
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Mon May 4 11:48:51 2020 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jul 15 12:05:51 2020 +0200

    tdf#131175 Import data label solid fill and color.
    
    (cherry picked from commit 603df08a1e0211099ce2cf258cfe64a74ed6ded9)
    
    Conflicts:
            oox/source/drawingml/chart/seriesconverter.cxx
    
    Change-Id: I8a3ef6e60d4f2a13310bb9a8fc4eb873df3f9b4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98807
    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 ba8011431809..9bbbf9a27171 100644
--- a/chart2/inc/unonames.hxx
+++ b/chart2/inc/unonames.hxx
@@ -28,6 +28,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"
 
 #endif
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index e632e8fb5db1..bebd947acbc5 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 1cb709d0559c..cc9ed237f44b 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -384,6 +384,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(),
@@ -486,6 +497,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 51f1d81a71b7..5214b7bcaf9c 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 f96c7b101509..8a949c123fa9 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -340,7 +340,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 2a385278a072..daa4a74db6a2 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1093,6 +1093,8 @@ namespace xmloff { namespace 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 02479b80ec46..1551e2727591 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -33,6 +33,7 @@
 #include <com/sun/star/chart2/data/LabeledDataSequence.hpp>
 #include <com/sun/star/chart2/XFormattedString2.hpp>
 #include <com/sun/star/chart2/FormattedString.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include <osl/diagnose.h>
 #include <basegfx/numeric/ftools.hxx>
 #include <drawingml/chart/datasourceconverter.hxx>
@@ -40,6 +41,7 @@
 #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/helper/attributelist.hxx>
@@ -236,6 +238,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")
@@ -294,8 +310,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();
@@ -378,8 +396,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());
+        }
     }
 
     // data point label settings
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index b4ee4ba0f9c4..3dd942df9903 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -283,6 +283,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 aa132990bc3b..f5fab246c0b5 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 9ef0203dedf8..5dea024e336f 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1095,6 +1095,8 @@ namespace xmloff { namespace 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 e0244941123a..8d4fe1b66358 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1013,6 +1013,8 @@ label
 label-arrangement
 label-cell-address
 label-cell-range-address
+label-fill
+label-fill-color
 label-range
 label-ranges
 label-string


More information about the Libreoffice-commits mailing list