chart2/source/view/charttypes/AreaChart.cxx                       |    4 -
 chart2/source/view/charttypes/NetChart.cxx                        |    4 -
 officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs |    8 ++
 oox/inc/drawingml/chart/typegroupconverter.hxx                    |    1 
 oox/source/drawingml/chart/typegroupconverter.cxx                 |   34 
++++------
 5 files changed, 29 insertions(+), 22 deletions(-)

New commits:
commit cbe6c4929c9da28ce5553ce31782027d5111ed16
Author:     Tünde Tóth <tund...@gmail.com>
AuthorDate: Wed Nov 27 10:24:50 2019 +0100
Commit:     Balazs Varga <balazs.varga...@gmail.com>
CommitDate: Tue Apr 28 08:02:59 2020 +0200

    tdf#127811 tdf#127813 Introduce compatibility key for the data series
    
    order of filled net and normal area charts.
    The data series of filled net and normal area charts are drawn in
    reversed order in LibreOffice but not in Microsoft Office.
    
    Default value is true to keep current behavior.
    
    Change-Id: I07adac814597b756878d74610d028f07327f7214
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/83897
    Tested-by: Jenkins
    Reviewed-by: Balazs Varga <balazs.varga...@gmail.com>

diff --git a/chart2/source/view/charttypes/AreaChart.cxx 
b/chart2/source/view/charttypes/AreaChart.cxx
index 74e852533345..0d7e88936d8f 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/drawing/DoubleSequence.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <officecfg/Office/Compatibility.hxx>
 
 namespace chart
 {
@@ -606,7 +607,8 @@ void AreaChart::createShapes()
     if( m_aZSlots.empty() ) //no series
         return;
 
-    if( m_nDimension == 2 && ( m_bArea || !m_bCategoryXAxis ) )
+    //tdf#127813 Don't reverse the series in OOXML-heavy environments
+    if( 
officecfg::Office::Compatibility::View::ReverseSeriesOrderAreaAndNetChart::get()
 && m_nDimension == 2 && ( m_bArea || !m_bCategoryXAxis ) )
         lcl_reorderSeries( m_aZSlots );
 
     
OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart 
is not proper initialized");
diff --git a/chart2/source/view/charttypes/NetChart.cxx 
b/chart2/source/view/charttypes/NetChart.cxx
index 3fea8f9ac403..2205351dfd0d 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -36,6 +36,7 @@
 #include <osl/diagnose.h>
 
 #include <com/sun/star/drawing/XShapes.hpp>
+#include <officecfg/Office/Compatibility.hxx>
 
 namespace chart
 {
@@ -318,7 +319,8 @@ void NetChart::createShapes()
     if( m_aZSlots.empty() ) //no series
         return;
 
-    if( m_bArea )
+    //tdf#127813 Don't reverse the series in OOXML-heavy environments
+    if 
(officecfg::Office::Compatibility::View::ReverseSeriesOrderAreaAndNetChart::get()
 && m_bArea)
         lcl_reorderSeries( m_aZSlots );
 
     
OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"NetChart 
is not proper initialized");
diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
index 71007f80c22e..a2d4a8dc4c53 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
@@ -171,6 +171,14 @@
         </info>
         <value>true</value>
       </prop>
+      <prop oor:name="ReverseSeriesOrderAreaAndNetChart" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+          <!-- See tdf#127813 for rationale -->
+          <desc>Specifies the data series order of filled net and normal area 
charts.</desc>
+          <label>Reverse the data series order of filled net and normal area 
charts. Disable for better OOXML interoperability.</label>
+        </info>
+        <value>true</value>
+      </prop>
     </group>
   </component>
 </oor:component-schema>
diff --git a/oox/inc/drawingml/chart/typegroupconverter.hxx 
b/oox/inc/drawingml/chart/typegroupconverter.hxx
index 65ac44313936..c57c7eaa8fd0 100644
--- a/oox/inc/drawingml/chart/typegroupconverter.hxx
+++ b/oox/inc/drawingml/chart/typegroupconverter.hxx
@@ -86,7 +86,6 @@ struct TypeGroupInfo
     bool                mbCategoryAxis;         /// True = X axis contains 
categories.
     bool                mbSwappedAxesSet;       /// True = X axis and Y axis 
are swapped.
     bool                mbSupportsStacking;     /// True = data points can be 
stacked on each other.
-    bool                mbReverseSeries;        /// True = insert unstacked 
series in reverse order.
     bool                mbPictureOptions;       /// True = bitmaps support 
options from c:pictureOptions.
 };
 
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx 
b/oox/source/drawingml/chart/typegroupconverter.cxx
index 4667afdeae02..621d768caa26 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -69,24 +69,24 @@ namespace csscd = 
::com::sun::star::chart::DataLabelPlacement;
 
 static const TypeGroupInfo spTypeInfos[] =
 {
-    // type-id          type-category         service                   
varied-point-color   default label pos     polar  area2d 1stvis xcateg swap   
stack  revers picopt
-    { TYPEID_BAR,       TYPECATEGORY_BAR,     SERVICE_CHART2_COLUMN,    
VARPOINTMODE_SINGLE, csscd::OUTSIDE,       false, true,  false, true,  false, 
true,  false, true  },
-    { TYPEID_HORBAR,    TYPECATEGORY_BAR,     SERVICE_CHART2_COLUMN,    
VARPOINTMODE_SINGLE, csscd::OUTSIDE,       false, true,  false, true,  true,  
true,  false, true  },
-    { TYPEID_LINE,      TYPECATEGORY_LINE,    SERVICE_CHART2_LINE,      
VARPOINTMODE_SINGLE, csscd::RIGHT,         false, false, false, true,  false, 
true,  false, false },
-    { TYPEID_AREA,      TYPECATEGORY_LINE,    SERVICE_CHART2_AREA,      
VARPOINTMODE_NONE,   csscd::CENTER,        false, true,  false, true,  false, 
true,  true,  false },
-    { TYPEID_STOCK,     TYPECATEGORY_LINE,    SERVICE_CHART2_CANDLE,    
VARPOINTMODE_NONE,   csscd::RIGHT,         false, false, false, true,  false, 
true,  false, false },
-    { TYPEID_RADARLINE, TYPECATEGORY_RADAR,   SERVICE_CHART2_NET,       
VARPOINTMODE_SINGLE, csscd::OUTSIDE,       true,  false, false, true,  false, 
false, false, false },
-    { TYPEID_RADARAREA, TYPECATEGORY_RADAR,   SERVICE_CHART2_FILLEDNET, 
VARPOINTMODE_NONE,   csscd::OUTSIDE,       true,  true,  false, true,  false, 
false, true,  false },
-    { TYPEID_PIE,       TYPECATEGORY_PIE,     SERVICE_CHART2_PIE,       
VARPOINTMODE_MULTI,  csscd::AVOID_OVERLAP, true,  true,  true,  true,  false, 
false, false, false },
-    { TYPEID_DOUGHNUT,  TYPECATEGORY_PIE,     SERVICE_CHART2_PIE,       
VARPOINTMODE_MULTI,  csscd::AVOID_OVERLAP, true,  true,  false, true,  false, 
false, false, false },
-    { TYPEID_OFPIE,     TYPECATEGORY_PIE,     SERVICE_CHART2_PIE,       
VARPOINTMODE_MULTI,  csscd::AVOID_OVERLAP, true,  true,  true,  true,  false, 
false, false, false },
-    { TYPEID_SCATTER,   TYPECATEGORY_SCATTER, SERVICE_CHART2_SCATTER,   
VARPOINTMODE_SINGLE, csscd::RIGHT,         false, false, false, false, false, 
false, false, false },
-    { TYPEID_BUBBLE,    TYPECATEGORY_SCATTER, SERVICE_CHART2_BUBBLE,    
VARPOINTMODE_SINGLE, csscd::RIGHT,         false, true,  false, false, false, 
false, false, false },
-    { TYPEID_SURFACE,   TYPECATEGORY_SURFACE, SERVICE_CHART2_SURFACE,   
VARPOINTMODE_NONE,   csscd::RIGHT,         false, true,  false, true,  false, 
false, false, false }
+    // type-id          type-category         service                   
varied-point-color   default label pos     polar  area2d 1stvis xcateg swap   
stack  picopt
+    { TYPEID_BAR,       TYPECATEGORY_BAR,     SERVICE_CHART2_COLUMN,    
VARPOINTMODE_SINGLE, csscd::OUTSIDE,       false, true,  false, true,  false, 
true,  true  },
+    { TYPEID_HORBAR,    TYPECATEGORY_BAR,     SERVICE_CHART2_COLUMN,    
VARPOINTMODE_SINGLE, csscd::OUTSIDE,       false, true,  false, true,  true,  
true,  true  },
+    { TYPEID_LINE,      TYPECATEGORY_LINE,    SERVICE_CHART2_LINE,      
VARPOINTMODE_SINGLE, csscd::RIGHT,         false, false, false, true,  false, 
true,  false },
+    { TYPEID_AREA,      TYPECATEGORY_LINE,    SERVICE_CHART2_AREA,      
VARPOINTMODE_NONE,   csscd::CENTER,        false, true,  false, true,  false, 
true,  false },
+    { TYPEID_STOCK,     TYPECATEGORY_LINE,    SERVICE_CHART2_CANDLE,    
VARPOINTMODE_NONE,   csscd::RIGHT,         false, false, false, true,  false, 
true,  false },
+    { TYPEID_RADARLINE, TYPECATEGORY_RADAR,   SERVICE_CHART2_NET,       
VARPOINTMODE_SINGLE, csscd::OUTSIDE,       true,  false, false, true,  false, 
false, false },
+    { TYPEID_RADARAREA, TYPECATEGORY_RADAR,   SERVICE_CHART2_FILLEDNET, 
VARPOINTMODE_NONE,   csscd::OUTSIDE,       true,  true,  false, true,  false, 
false, false },
+    { TYPEID_PIE,       TYPECATEGORY_PIE,     SERVICE_CHART2_PIE,       
VARPOINTMODE_MULTI,  csscd::AVOID_OVERLAP, true,  true,  true,  true,  false, 
false, false },
+    { TYPEID_DOUGHNUT,  TYPECATEGORY_PIE,     SERVICE_CHART2_PIE,       
VARPOINTMODE_MULTI,  csscd::AVOID_OVERLAP, true,  true,  false, true,  false, 
false, false },
+    { TYPEID_OFPIE,     TYPECATEGORY_PIE,     SERVICE_CHART2_PIE,       
VARPOINTMODE_MULTI,  csscd::AVOID_OVERLAP, true,  true,  true,  true,  false, 
false, false },
+    { TYPEID_SCATTER,   TYPECATEGORY_SCATTER, SERVICE_CHART2_SCATTER,   
VARPOINTMODE_SINGLE, csscd::RIGHT,         false, false, false, false, false, 
false, false },
+    { TYPEID_BUBBLE,    TYPECATEGORY_SCATTER, SERVICE_CHART2_BUBBLE,    
VARPOINTMODE_SINGLE, csscd::RIGHT,         false, true,  false, false, false, 
false, false },
+    { TYPEID_SURFACE,   TYPECATEGORY_SURFACE, SERVICE_CHART2_SURFACE,   
VARPOINTMODE_NONE,   csscd::RIGHT,         false, true,  false, true,  false, 
false, false }
 };
 
 static const TypeGroupInfo saUnknownTypeInfo =
-    { TYPEID_UNKNOWN,   TYPECATEGORY_BAR,     SERVICE_CHART2_COLUMN,  
VARPOINTMODE_SINGLE, csscd::OUTSIDE,       false, true,  false, true,  false, 
true,  false, true  };
+    { TYPEID_UNKNOWN,   TYPECATEGORY_BAR,     SERVICE_CHART2_COLUMN,  
VARPOINTMODE_SINGLE, csscd::OUTSIDE,       false, true,  false, true,  false, 
true, true  };
 
 const TypeGroupInfo& lclGetTypeInfoFromTypeId( TypeId eTypeId )
 {
@@ -348,10 +348,6 @@ void TypeGroupConverter::convertFromModel( const 
Reference< XDiagram >& rxDiagra
         for (auto const& elemSeries : mrModel.maSeries)
             aSeries.push_back( std::make_shared<SeriesConverter>(*this, 
*elemSeries) );
 
-        // reverse series order for some unstacked 2D chart types
-        if( maTypeInfo.mbReverseSeries && !mb3dChart && !isStacked() && 
!isPercent() )
-            ::std::reverse( aSeries.begin(), aSeries.end() );
-
         // decide whether to use varying colors for each data point
         bool bVaryColorsByPoint = bSupportsVaryColorsByPoint && 
mrModel.mbVaryColors;
         switch( maTypeInfo.meVarPointMode )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to