chart2/inc/ChartView.hxx                                    |    8 
 chart2/qa/extras/chart2export2.cxx                          |   52 ++++
 chart2/qa/extras/data/xlsx/ChartDataTable.xlsx              |binary
 chart2/source/controller/main/ChartController_Insert.cxx    |   25 +-
 chart2/source/model/main/DataTable.cxx                      |    6 
 chart2/source/model/main/Diagram.cxx                        |    2 
 chart2/source/view/axes/VAxisBase.cxx                       |    3 
 chart2/source/view/axes/VAxisBase.hxx                       |    5 
 chart2/source/view/axes/VCartesianAxis.cxx                  |    5 
 chart2/source/view/axes/VCartesianAxis.hxx                  |    4 
 chart2/source/view/axes/VCartesianCoordinateSystem.cxx      |    5 
 chart2/source/view/axes/VCartesianCoordinateSystem.hxx      |    3 
 chart2/source/view/axes/VCoordinateSystem.cxx               |    3 
 chart2/source/view/axes/VPolarCoordinateSystem.cxx          |    3 
 chart2/source/view/axes/VPolarCoordinateSystem.hxx          |    3 
 chart2/source/view/charttypes/VSeriesPlotter.cxx            |  140 ++++++++++++
 chart2/source/view/inc/DataTableView.hxx                    |   16 +
 chart2/source/view/inc/LegendEntryProvider.hxx              |    9 
 chart2/source/view/inc/VCoordinateSystem.hxx                |    4 
 chart2/source/view/inc/VSeriesPlotter.hxx                   |   12 +
 chart2/source/view/main/ChartView.cxx                       |   13 -
 chart2/source/view/main/DataTableView.cxx                   |  121 ++++++++--
 include/svx/svdotable.hxx                                   |    2 
 include/xmloff/xmltoken.hxx                                 |    7 
 offapi/com/sun/star/text/NumberingRules.idl                 |    2 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |  113 +++++++--
 svx/source/table/svdotable.cxx                              |   12 +
 xmloff/Library_xo.mk                                        |    1 
 xmloff/source/chart/PropertyMaps.cxx                        |    6 
 xmloff/source/chart/SchXMLChartContext.cxx                  |    4 
 xmloff/source/chart/SchXMLDataTableContext.cxx              |   87 +++++++
 xmloff/source/chart/SchXMLDataTableContext.hxx              |   40 +++
 xmloff/source/chart/SchXMLExport.cxx                        |   38 ++-
 xmloff/source/core/xmltoken.cxx                             |   11 
 xmloff/source/token/tokens.txt                              |    5 
 35 files changed, 677 insertions(+), 93 deletions(-)

New commits:
commit 7d203b23ff94f59d29b2e283dd5866b77a2d137d
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Jul 18 08:12:19 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Wed Aug 10 12:12:51 2022 +0200

    chart2: data table rendering of keys (legend symbols)
    
    Change-Id: Iff13b188df18fe8f9919274869774f53f2ea323b

diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index 3fe2fedcf7e8..5c7e70e97900 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -104,8 +104,7 @@ private:
 
 public:
     ChartView() = delete;
-    ChartView(css::uno::Reference< css::uno::XComponentContext > xContext,
-               ChartModel& rModel);
+    ChartView(css::uno::Reference<css::uno::XComponentContext> xContext, 
ChartModel& rModel);
 
     virtual ~ChartView() override;
 
@@ -185,6 +184,8 @@ public:
 
     void setViewDirty();
 
+    css::uno::Reference<css::uno::XComponentContext> const& 
getComponentContext() { return m_xCC;}
+
     /// See sfx2::XmlDump::dumpAsXml().
     void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
@@ -210,8 +211,7 @@ private: //methods
 private: //member
     ::osl::Mutex m_aMutex;
 
-    css::uno::Reference< css::uno::XComponentContext>
-            m_xCC;
+    css::uno::Reference< css::uno::XComponentContext> m_xCC;
 
     chart::ChartModel& mrChartModel;
 
diff --git a/chart2/source/view/axes/VAxisBase.cxx 
b/chart2/source/view/axes/VAxisBase.cxx
index 814d3afd7858..30aead187dcb 100644
--- a/chart2/source/view/axes/VAxisBase.cxx
+++ b/chart2/source/view/axes/VAxisBase.cxx
@@ -244,7 +244,8 @@ void VAxisBase::updateUnscaledValuesAtTicks( TickIter& 
rIter )
 
 void 
VAxisBase::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& 
/*rSeriesPlotterList*/,
                                     
uno::Reference<util::XNumberFormatsSupplier> const& /*xNumberFormatsSupplier*/,
-                                    rtl::Reference<::chart::ChartModel> const& 
/*xChartDoc*/)
+                                    rtl::Reference<::chart::ChartModel> const& 
/*xChartDoc*/,
+                                    
css::uno::Reference<css::uno::XComponentContext> const& /*rComponentContext*/)
 {
 }
 
diff --git a/chart2/source/view/axes/VAxisBase.hxx 
b/chart2/source/view/axes/VAxisBase.hxx
index 2c4123ba951d..4ee4f5e288ae 100644
--- a/chart2/source/view/axes/VAxisBase.hxx
+++ b/chart2/source/view/axes/VAxisBase.hxx
@@ -23,6 +23,7 @@
 #include "Tickmarks.hxx"
 
 namespace com::sun::star::util { class XNumberFormatsSupplier; }
+namespace com::sun::star::uno { class XComponentContext; }
 
 namespace chart
 {
@@ -30,6 +31,7 @@ namespace chart
 class VSeriesPlotter;
 class DataTableView;
 class ChartModel;
+class LegendEntryProvider;
 
 class VAxisBase : public VAxisOrGridBase
 {
@@ -65,7 +67,8 @@ public:
 
     virtual void 
createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& 
rSeriesPlotterList,
                                      
css::uno::Reference<css::util::XNumberFormatsSupplier> const& 
xNumberFormatsSupplier,
-                                     rtl::Reference<::chart::ChartModel> 
const& xChartDoc);
+                                     rtl::Reference<::chart::ChartModel> 
const& xChartDoc,
+                                     
css::uno::Reference<css::uno::XComponentContext> const& rComponentContext);
 
     std::shared_ptr<DataTableView> getDataTableView() { return 
m_pDataTableView; }
 
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx 
b/chart2/source/view/axes/VCartesianAxis.cxx
index d7e78d5d2e85..293d1f0479a8 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1995,11 +1995,12 @@ void VCartesianAxis::createShapes()
 
 void 
VCartesianAxis::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>&
 rSeriesPlotterList,
                                          
Reference<util::XNumberFormatsSupplier> const& xNumberFormatsSupplier,
-                                         rtl::Reference<::chart::ChartModel> 
const& xChartDoc)
+                                         rtl::Reference<::chart::ChartModel> 
const& xChartDoc,
+                                         
css::uno::Reference<css::uno::XComponentContext> const& rComponentContext)
 {
     if (m_aAxisProperties.m_bDisplayDataTable)
     {
-        m_pDataTableView.reset(new DataTableView(xChartDoc, 
m_aAxisProperties.m_xDataTableModel));
+        m_pDataTableView.reset(new DataTableView(xChartDoc, 
m_aAxisProperties.m_xDataTableModel, rComponentContext));
         m_pDataTableView->initializeValues(rSeriesPlotterList);
         m_xNumberFormatsSupplier = xNumberFormatsSupplier;
     }
diff --git a/chart2/source/view/axes/VCartesianAxis.hxx 
b/chart2/source/view/axes/VCartesianAxis.hxx
index a9baca907bdd..132887510eff 100644
--- a/chart2/source/view/axes/VCartesianAxis.hxx
+++ b/chart2/source/view/axes/VCartesianAxis.hxx
@@ -23,7 +23,6 @@
 
 namespace chart
 {
-
 class VCartesianAxis : public VAxisBase
 {
     // public methods
@@ -101,7 +100,8 @@ public:
 
     void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& 
rSeriesPlotterList,
                              
css::uno::Reference<css::util::XNumberFormatsSupplier> const& 
xNumberFormatsSupplier,
-                             rtl::Reference<::chart::ChartModel> const& 
xChartDoc) override;
+                             rtl::Reference<::chart::ChartModel> const& 
xChartDoc,
+                             css::uno::Reference<css::uno::XComponentContext> 
const& rComponentContext) override;
 private: //methods
     /**
      * Go through all tick label positions and decide which labels to display
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx 
b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
index 3ea42cb087a0..9f765223bf4d 100644
--- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
@@ -104,7 +104,8 @@ void VCartesianCoordinateSystem::createVAxisList(
             const awt::Size& rFontReferenceSize,
             const awt::Rectangle& rMaximumSpaceForLabels,
             bool bLimitSpaceForLabels,
-            std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList)
+            std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+            uno::Reference<uno::XComponentContext> const& rComponentContext)
 {
     // note: using xChartDoc itself as XNumberFormatsSupplier would cause
     // a leak from VCartesianAxis due to cyclic reference
@@ -166,7 +167,7 @@ void VCartesianCoordinateSystem::createVAxisList(
             apVAxis->set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, 
m_eBottomPos );
 
             
apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
-            apVAxis->createDataTableView(rSeriesPlotterList, 
xNumberFormatsSupplier, xChartDoc);
+            apVAxis->createDataTableView(rSeriesPlotterList, 
xNumberFormatsSupplier, xChartDoc, rComponentContext);
         }
     }
 }
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx 
b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
index 4b7acf227867..968d97a21099 100644
--- a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
@@ -35,7 +35,8 @@ public:
             const css::awt::Size& rFontReferenceSize,
             const css::awt::Rectangle& rMaximumSpaceForLabels,
             bool bLimitSpaceForLabels,
-            std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList) 
override;
+            std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+            css::uno::Reference<css::uno::XComponentContext> const& 
rComponentContext) override;
 
     virtual void initVAxisInList() override;
     virtual void updateScalesAndIncrementsOnAxes() override;
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx 
b/chart2/source/view/axes/VCoordinateSystem.cxx
index 1dc9aaac91e4..f8d517fd008a 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -327,7 +327,8 @@ void VCoordinateSystem::createVAxisList(
             const awt::Size& /* rFontReferenceSize */,
             const awt::Rectangle& /* rMaximumSpaceForLabels */,
             bool /* bLimitSpaceForLabels */,
-            std::vector<std::unique_ptr<VSeriesPlotter>>& 
/*rSeriesPlotterList*/)
+            std::vector<std::unique_ptr<VSeriesPlotter>>& 
/*rSeriesPlotterList*/,
+            uno::Reference<uno::XComponentContext> const& 
/*rComponentContext*/)
 {
 }
 
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx 
b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
index 338a1c4ab7ed..600447dd19d5 100644
--- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
@@ -72,7 +72,8 @@ void VPolarCoordinateSystem::createVAxisList(
             const awt::Size& rFontReferenceSize,
             const awt::Rectangle& rMaximumSpaceForLabels,
             bool /*bLimitSpaceForLabels*/,
-            std::vector<std::unique_ptr<VSeriesPlotter>>& 
/*rSeriesPlotterList*/)
+            std::vector<std::unique_ptr<VSeriesPlotter>>& 
/*rSeriesPlotterList*/,
+            css::uno::Reference<css::uno::XComponentContext> const& 
/*rComponentContext*/)
 {
     // note: using xChartDoc itself as XNumberFormatsSupplier would cause
     // a leak from VPolarAxis due to cyclic reference
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.hxx 
b/chart2/source/view/axes/VPolarCoordinateSystem.hxx
index ecfb2ce4d19d..a2ea0220f8bc 100644
--- a/chart2/source/view/axes/VPolarCoordinateSystem.hxx
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.hxx
@@ -39,7 +39,8 @@ public:
             const css::awt::Size& rFontReferenceSize,
             const css::awt::Rectangle& rMaximumSpaceForLabels,
             bool bLimitSpaceForLabels,
-            std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList) 
override;
+            std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+            css::uno::Reference<css::uno::XComponentContext> const& 
rComponentContext) override;
 
     virtual void initVAxisInList() override;
     virtual void updateScalesAndIncrementsOnAxes() override;
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 9f1a49e565b6..cdac64370636 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2482,6 +2482,53 @@ std::vector< ViewLegendEntry > 
VSeriesPlotter::createLegendEntries(
     return aResult;
 }
 
+std::vector<ViewLegendSymbol> VSeriesPlotter::createSymbols(const awt::Size& 
rEntryKeyAspectRatio
+            , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+            , const Reference<uno::XComponentContext>& xContext
+            , ChartModel& rModel)
+{
+    std::vector<ViewLegendSymbol> aResult;
+
+    if( xTarget.is() )
+    {
+        bool bBreak = false;
+        bool bFirstSeries = true;
+
+        for (std::vector<VDataSeriesGroup> const & rGroupVector : m_aZSlots)
+        {
+            for (VDataSeriesGroup const & rGroup : rGroupVector)
+            {
+                for (std::unique_ptr<VDataSeries> const & pSeries : 
rGroup.m_aSeriesVector)
+                {
+                    if (!pSeries)
+                        continue;
+
+                    if 
(!pSeries->getPropertiesOfSeries()->getPropertyValue("ShowLegendEntry").get<sal_Bool>())
+                    {
+                        continue;
+                    }
+
+                    std::vector<ViewLegendSymbol> aSeriesSymbols = 
createSymbolsForSeries(rEntryKeyAspectRatio, *pSeries, xTarget, xContext);
+
+                    //add series entries to the result now
+
+                    // use only the first series if VaryColorsByPoint is set 
for the first series
+                    if (bFirstSeries && pSeries->isVaryColorsByPoint())
+                        bBreak = true;
+
+                    bFirstSeries = false;
+
+                    aResult.insert(aResult.end(), aSeriesSymbols.begin(), 
aSeriesSymbols.end());
+                }
+                if (bBreak)
+                    return aResult;
+            }
+        }
+    }
+
+    return aResult;
+}
+
 namespace
 {
 bool lcl_HasVisibleLine( const uno::Reference< beans::XPropertySet >& xProps, 
bool& rbHasDashedLine )
@@ -2813,6 +2860,99 @@ std::vector< ViewLegendEntry > 
VSeriesPlotter::createLegendEntriesForSeries(
     return aResult;
 }
 
+std::vector<ViewLegendSymbol> VSeriesPlotter::createSymbolsForSeries(
+              const awt::Size& rEntryKeyAspectRatio
+            , const VDataSeries& rSeries
+            , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+            , const Reference<uno::XComponentContext>& xContext)
+{
+    std::vector<ViewLegendSymbol> aResult;
+
+    if (!(xTarget.is() && xContext.is()))
+        return aResult;
+
+    try
+    {
+        ViewLegendSymbol aEntry;
+        bool bVaryColorsByPoint = rSeries.isVaryColorsByPoint();
+        bool bIsPie = 
m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE);
+        try
+        {
+            if (bIsPie)
+            {
+                bool bDonut = false;
+                if ((m_xChartTypeModel->getPropertyValue("UseRings") >>= 
bDonut) && bDonut)
+                    bIsPie = false;
+            }
+        }
+        catch (const uno::Exception&)
+        {
+        }
+
+        if (bVaryColorsByPoint || bIsPie)
+        {
+            Sequence< OUString > aCategoryNames;
+            if (m_pExplicitCategoriesProvider)
+                aCategoryNames = 
m_pExplicitCategoriesProvider->getSimpleCategories();
+            Sequence<sal_Int32> deletedLegendEntries;
+            try
+            {
+                
rSeries.getPropertiesOfSeries()->getPropertyValue("DeletedLegendEntries") >>= 
deletedLegendEntries;
+            }
+            catch (const uno::Exception&)
+            {
+            }
+
+            for (sal_Int32 nIdx=0; nIdx < aCategoryNames.getLength(); ++nIdx)
+            {
+                bool deletedLegendEntry = false;
+                for (const auto& deletedLegendEntryIdx : 
std::as_const(deletedLegendEntries))
+                {
+                    if (nIdx == deletedLegendEntryIdx)
+                    {
+                        deletedLegendEntry = true;
+                        break;
+                    }
+                }
+                if (deletedLegendEntry)
+                    continue;
+
+                // symbol
+                rtl::Reference<SvxShapeGroup> 
xSymbolGroup(ShapeFactory::createGroup2D(xTarget));
+
+                // create the symbol
+                rtl::Reference<SvxShapeGroup> xShape = 
createLegendSymbolForPoint(rEntryKeyAspectRatio, rSeries, nIdx, xSymbolGroup);
+
+                // set CID to symbol for selection
+                if (xShape.is())
+                {
+                    aEntry.xSymbol = xSymbolGroup;
+                }
+            }
+        }
+        else
+        {
+            // symbol
+            rtl::Reference<SvxShapeGroup> 
xSymbolGroup(ShapeFactory::createGroup2D(xTarget));
+
+            // create the symbol
+            rtl::Reference<SvxShapeGroup> xShape = 
createLegendSymbolForSeries(rEntryKeyAspectRatio, rSeries, xSymbolGroup );
+
+            // set CID to symbol for selection
+            if (xShape.is())
+            {
+                aEntry.xSymbol = xSymbolGroup;
+            }
+            aResult.push_back(aEntry);
+        }
+    }
+    catch (const uno::Exception &)
+    {
+        DBG_UNHANDLED_EXCEPTION("chart2" );
+    }
+    return aResult;
+}
+
 VSeriesPlotter* VSeriesPlotter::createSeriesPlotter(
     const rtl::Reference<ChartType>& xChartTypeModel
     , sal_Int32 nDimensionCount
diff --git a/chart2/source/view/inc/DataTableView.hxx 
b/chart2/source/view/inc/DataTableView.hxx
index 0a6ebe06f47d..3e50d35808d7 100644
--- a/chart2/source/view/inc/DataTableView.hxx
+++ b/chart2/source/view/inc/DataTableView.hxx
@@ -12,6 +12,9 @@
 #include <svx/unoshape.hxx>
 #include <svx/unodraw/SvxTableShape.hxx>
 #include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <DataTable.hxx>
 #include <VLineProperties.hxx>
 
@@ -19,6 +22,7 @@ namespace chart
 {
 class VSeriesPlotter;
 class ChartModel;
+class LegendEntryProvider;
 
 class DataTableView final
 {
@@ -27,18 +31,24 @@ private:
     rtl::Reference<SvxShapeGroupAnyD> m_xTarget;
     rtl::Reference<SvxTableShape> m_xTableShape;
     rtl::Reference<DataTable> m_xDataTableModel;
+    css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
     VLineProperties m_aLineProperties;
+    std::vector<VSeriesPlotter*> m_pSeriesPlotterList;
 
     std::vector<OUString> m_aDataSeriesNames;
     std::vector<OUString> m_aXValues;
     std::vector<std::vector<OUString>> m_pDataSeriesValues;
 
-    void setCellDefaults(css::uno::Reference<css::beans::XPropertySet>& 
xPropertySet, bool bLeft,
-                         bool bTop, bool bRight, bool bBottom);
+    void
+    
setCellCharAndParagraphProperties(css::uno::Reference<css::beans::XPropertySet>&
 xPropertySet);
+
+    void setCellProperties(css::uno::Reference<css::beans::XPropertySet>& 
xPropertySet, bool bLeft,
+                           bool bTop, bool bRight, bool bBottom);
 
 public:
     DataTableView(rtl::Reference<::chart::ChartModel> const& xChartDoc,
-                  rtl::Reference<DataTable> const& rDataTableModel);
+                  rtl::Reference<DataTable> const& rDataTableModel,
+                  css::uno::Reference<css::uno::XComponentContext> const& 
rComponentContext);
     void initializeShapes(const rtl::Reference<SvxShapeGroupAnyD>& xTarget);
     void initializeValues(std::vector<std::unique_ptr<VSeriesPlotter>>& 
rSeriesPlotterList);
     void createShapes(basegfx::B2DVector const& rStart, basegfx::B2DVector 
const& rEnd,
diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx 
b/chart2/source/view/inc/LegendEntryProvider.hxx
index e0133771cd27..d89447f38429 100644
--- a/chart2/source/view/inc/LegendEntryProvider.hxx
+++ b/chart2/source/view/inc/LegendEntryProvider.hxx
@@ -66,6 +66,15 @@ struct ViewLegendEntry
         css::uno::Reference< css::chart2::XFormattedString2 > >  aLabel;
 };
 
+
+struct ViewLegendSymbol
+{
+    /** The legend symbol that represents a data series or other
+        information contained in the legend
+     */
+    rtl::Reference<SvxShapeGroup> xSymbol;
+};
+
 class LegendEntryProvider
 {
 public:
diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx 
b/chart2/source/view/inc/VCoordinateSystem.hxx
index a19b73e1154b..c0220926c784 100644
--- a/chart2/source/view/inc/VCoordinateSystem.hxx
+++ b/chart2/source/view/inc/VCoordinateSystem.hxx
@@ -39,6 +39,7 @@ namespace com::sun::star::chart2 { class XChartDocument; }
 namespace com::sun::star::chart2 { class XCoordinateSystem; }
 namespace com::sun::star::drawing { class XShapes; }
 namespace com::sun::star::lang { class XMultiServiceFactory; }
+namespace com::sun::star::uno { class XComponentContext; }
 
 namespace chart
 {
@@ -120,7 +121,8 @@ public:
             const css::awt::Size& rFontReferenceSize,
             const css::awt::Rectangle& rMaximumSpaceForLabels,
             bool bLimitSpaceForLabels,
-            std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList);
+            std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+            css::uno::Reference<css::uno::XComponentContext> const& 
rComponentContext);
 
     virtual void initVAxisInList();
     virtual void updateScalesAndIncrementsOnAxes();
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx 
b/chart2/source/view/inc/VSeriesPlotter.hxx
index 50901bf64a5a..62869e11754e 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -216,6 +216,18 @@ public:
             const css::uno::Reference< css::uno::XComponentContext >& xContext
                 );
 
+    std::vector<ViewLegendSymbol> createSymbols(
+              const css::awt::Size& rEntryKeyAspectRatio
+            , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+            , const css::uno::Reference<css::uno::XComponentContext>& xContext
+            , ChartModel& rModel);
+
+    std::vector<ViewLegendSymbol> createSymbolsForSeries(
+              const css::awt::Size& rEntryKeyAspectRatio
+            , const VDataSeries& rSeries
+            , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+            , const css::uno::Reference<css::uno::XComponentContext>& 
xContext);
+
     std::vector<VDataSeries*> getAllSeries();
     std::vector<VDataSeries const*> getAllSeries() const;
 
diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index 14ec725cadd2..282e76611081 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -536,8 +536,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( 
const CreateShapeParam2D
             CuboidPlanePosition eBottomPos( 
ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( xDiagram ) );
             rpVCooSys->set3DWallPositions( eLeftWallPos, eBackWallPos, 
eBottomPos );
         }
-
-        rpVCooSys->createVAxisList(&mrChartModel, rPageSize, 
rParam.maRemainingSpace, rParam.mbUseFixedInnerSize, rSeriesPlotterList);
+        rpVCooSys->createVAxisList(&mrChartModel, rPageSize, 
rParam.maRemainingSpace,
+            rParam.mbUseFixedInnerSize, rSeriesPlotterList, 
getComponentContext());
     }
 
     // - prepare list of all axis and how they are used
@@ -1376,9 +1376,12 @@ void ChartView::createShapes()
     if(!mxRootShape.is())
         mxRootShape = ShapeFactory::getOrCreateChartRootShape( m_xDrawPage );
 
-    SdrPage* pPage = ChartView::getSdrPage();
-    if(pPage) //it is necessary to use the implementation here as the uno page 
does not provide a propertyset
+    SdrPage* pPage = getSdrPage();
+
+    if (pPage) //it is necessary to use the implementation here as the uno 
page does not provide a propertyset
+    {
         pPage->SetSize(Size(aPageSize.Width,aPageSize.Height));
+    }
     else
     {
         OSL_FAIL("could not set page size correctly");
@@ -1910,7 +1913,7 @@ void ChartView::createShapes2D( const awt::Size& 
rPageSize )
     }
 
     lcl_createLegend(
-        LegendHelper::getLegend( mrChartModel ), mxRootShape, m_xCC,
+        LegendHelper::getLegend( mrChartModel ), mxRootShape, 
getComponentContext(),
         aParam.maRemainingSpace, rPageSize, mrChartModel, 
aParam.mpSeriesPlotterContainer->getLegendEntryProviderList(),
         lcl_getDefaultWritingModeFromPool( m_pDrawModelWrapper ) );
 
diff --git a/chart2/source/view/main/DataTableView.cxx 
b/chart2/source/view/main/DataTableView.cxx
index c5ece1370efb..716284993ece 100644
--- a/chart2/source/view/main/DataTableView.cxx
+++ b/chart2/source/view/main/DataTableView.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/drawing/LineStyle.hpp>
 #include <com/sun/star/util/XBroadcaster.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <o3tl/unit_conversion.hxx>
 
@@ -35,15 +36,6 @@ using namespace css;
 
 namespace chart
 {
-DataTableView::DataTableView(rtl::Reference<::chart::ChartModel> const& 
xChartModel,
-                             rtl::Reference<DataTable> const& rDataTableModel)
-    : m_xChartModel(xChartModel)
-    , m_xDataTableModel(rDataTableModel)
-{
-    uno::Reference<beans::XPropertySet> xProp = m_xDataTableModel.get();
-    m_aLineProperties.initFromPropertySet(xProp);
-}
-
 namespace
 {
 void setTopCell(uno::Reference<beans::XPropertySet>& xPropertySet)
@@ -65,10 +57,22 @@ void copyProperty(uno::Reference<beans::XPropertySet>& xOut,
 {
     xOut->setPropertyValue(sPropertyName, 
xIn->getPropertyValue(sPropertyName));
 }
+} // end anonymous namespace
+
+DataTableView::DataTableView(
+    rtl::Reference<::chart::ChartModel> const& xChartModel,
+    rtl::Reference<DataTable> const& rDataTableModel,
+    css::uno::Reference<css::uno::XComponentContext> const& rComponentContext)
+    : m_xChartModel(xChartModel)
+    , m_xDataTableModel(rDataTableModel)
+    , m_xComponentContext(rComponentContext)
+{
+    uno::Reference<beans::XPropertySet> xProp = m_xDataTableModel.get();
+    m_aLineProperties.initFromPropertySet(xProp);
 }
 
-void DataTableView::setCellDefaults(uno::Reference<beans::XPropertySet>& 
xPropertySet, bool bLeft,
-                                    bool bTop, bool bRight, bool bBottom)
+void DataTableView::setCellCharAndParagraphProperties(
+    uno::Reference<beans::XPropertySet>& xPropertySet)
 {
     uno::Reference<beans::XPropertySet> xDataTableProperties = 
m_xDataTableModel.get();
 
@@ -113,19 +117,27 @@ void 
DataTableView::setCellDefaults(uno::Reference<beans::XPropertySet>& xProper
     copyProperty(xPropertySet, xDataTableProperties, "CharWeightComplex");
     copyProperty(xPropertySet, xDataTableProperties, "CharWordMode");
 
+    xPropertySet->setPropertyValue("ParaAdjust", 
uno::Any(style::ParagraphAdjust_CENTER));
+}
+
+void 
DataTableView::setCellProperties(css::uno::Reference<beans::XPropertySet>& 
xPropertySet,
+                                      bool bLeft, bool bTop, bool bRight, bool 
bBottom)
+{
+    xPropertySet->setPropertyValue("FillColor", uno::Any(Color(0xFFFFFF)));
+
+    uno::Reference<beans::XPropertySet> xDataTableProperties = 
m_xDataTableModel.get();
     float fFontHeight = 0.0;
     xDataTableProperties->getPropertyValue("CharHeight") >>= fFontHeight;
     fFontHeight = o3tl::convert(fFontHeight, o3tl::Length::pt, 
o3tl::Length::mm100);
-    uno::Any aXDistanceAny(sal_Int32(std::round(fFontHeight * 0.18f)));
-    uno::Any aYDistanceAny(sal_Int32(std::round(fFontHeight * 0.30f)));
-    xPropertySet->setPropertyValue("TextLeftDistance", aXDistanceAny);
-    xPropertySet->setPropertyValue("TextRightDistance", aXDistanceAny);
-    xPropertySet->setPropertyValue("TextUpperDistance", aYDistanceAny);
-    xPropertySet->setPropertyValue("TextLowerDistance", aYDistanceAny);
+    sal_Int32 nXDistance = std::round(fFontHeight * 0.18f);
+    sal_Int32 nYDistance = std::round(fFontHeight * 0.30f);
+
+    xPropertySet->setPropertyValue("TextLeftDistance", uno::Any(nXDistance));
+    xPropertySet->setPropertyValue("TextRightDistance", uno::Any(nXDistance));
+    xPropertySet->setPropertyValue("TextUpperDistance", uno::Any(nYDistance));
+    xPropertySet->setPropertyValue("TextLowerDistance", uno::Any(nYDistance));
 
-    xPropertySet->setPropertyValue("FillColor", uno::Any(Color(0xFFFFFF)));
     xPropertySet->setPropertyValue("TextVerticalAdjust", 
uno::Any(drawing::TextVerticalAdjust_TOP));
-    xPropertySet->setPropertyValue("ParaAdjust", 
uno::Any(style::ParagraphAdjust_CENTER));
 
     drawing::LineStyle eStyle = drawing::LineStyle_NONE;
     m_aLineProperties.LineStyle >>= eStyle;
@@ -218,13 +230,19 @@ void DataTableView::createShapes(basegfx::B2DVector 
const& rStart, basegfx::B2DV
 
     xBroadcaster->lockBroadcasts();
 
+    auto* pTableObject = 
static_cast<sdr::table::SdrTableObj*>(m_xTableShape->GetSdrObject());
+
     bool bHBorder = false;
     bool bVBorder = false;
     bool bOutline = false;
+    bool bKeys = false;
+
+    std::vector<ViewLegendSymbol> aSymbols;
 
     m_xDataTableModel->getPropertyValue("HBorder") >>= bHBorder;
     m_xDataTableModel->getPropertyValue("VBorder") >>= bVBorder;
     m_xDataTableModel->getPropertyValue("Outline") >>= bOutline;
+    m_xDataTableModel->getPropertyValue("Keys") >>= bKeys;
 
     sal_Int32 nColumnCount = m_aXValues.size();
     uno::Reference<table::XTableColumns> xTableColumns = xTable->getColumns();
@@ -256,22 +274,50 @@ void DataTableView::createShapes(basegfx::B2DVector 
const& rStart, basegfx::B2DV
         {
             xCellTextRange->setString(rString);
             bool bLeft = bOutline || (bVBorder && nColumn > 1);
-            setCellDefaults(xPropertySet, bLeft, bOutline, bOutline, bOutline);
+            setCellProperties(xPropertySet, bLeft, bOutline, bOutline, 
bOutline);
+            setCellCharAndParagraphProperties(xPropertySet);
         }
         nColumn++;
     }
 
+    if (bKeys)
+    {
+        awt::Size aMaxSymbolExtent(300, 300);
+        for (VSeriesPlotter* pSeriesPlotter : m_pSeriesPlotterList)
+        {
+            if (pSeriesPlotter)
+            {
+                std::vector<ViewLegendSymbol> aNewEntries = 
pSeriesPlotter->createSymbols(
+                    aMaxSymbolExtent, m_xTarget, m_xComponentContext, 
*m_xChartModel);
+                aSymbols.insert(aSymbols.end(), aNewEntries.begin(), 
aNewEntries.end());
+            }
+        }
+    }
+
     nRow = 1;
     for (auto const& rSeriesName : m_aDataSeriesNames)
     {
         uno::Reference<table::XCell> xCell = xTable->getCellByPosition(0, 
nRow);
-        uno::Reference<beans::XPropertySet> xPropertySet(xCell, 
uno::UNO_QUERY);
+        uno::Reference<beans::XPropertySet> xCellPropertySet(xCell, 
uno::UNO_QUERY);
         uno::Reference<text::XTextRange> xCellTextRange(xCell, uno::UNO_QUERY);
         if (xCellTextRange.is())
         {
             bool bTop = bOutline || (bHBorder && nRow > 1);
-            xCellTextRange->setString(rSeriesName);
-            setCellDefaults(xPropertySet, bOutline, bTop, bOutline, bOutline);
+            setCellProperties(xCellPropertySet, bOutline, bTop, bOutline, 
bOutline);
+
+            auto xText = xCellTextRange->getText();
+            xText->insertString(xText->getStart(), rSeriesName, false);
+            uno::Reference<container::XEnumerationAccess> xEnumAccess(xText, 
uno::UNO_QUERY);
+            uno::Reference<container::XEnumeration> 
xEnumeration(xEnumAccess->createEnumeration());
+            uno::Reference<text::XTextRange> 
xParagraph(xEnumeration->nextElement(),
+                                                        uno::UNO_QUERY);
+            uno::Reference<beans::XPropertySet> xTextPropertySet(xParagraph, 
uno::UNO_QUERY);
+
+            setCellCharAndParagraphProperties(xTextPropertySet);
+
+            xCellPropertySet->setPropertyValue("ParaAdjust", 
uno::Any(style::ParagraphAdjust_LEFT));
+            if (bKeys)
+                xCellPropertySet->setPropertyValue("ParaLeftMargin", 
uno::Any(500));
         }
         nRow++;
     }
@@ -306,7 +352,8 @@ void DataTableView::createShapes(basegfx::B2DVector const& 
rStart, basegfx::B2DV
                 if (nColumn == nColumnCount && bOutline)
                     bRight = true;
 
-                setCellDefaults(xPropertySet, bLeft, bTop, bRight, bBottom);
+                setCellProperties(xPropertySet, bLeft, bTop, bRight, bBottom);
+                setCellCharAndParagraphProperties(xPropertySet);
             }
             nColumn++;
         }
@@ -315,21 +362,39 @@ void DataTableView::createShapes(basegfx::B2DVector 
const& rStart, basegfx::B2DV
 
     xBroadcaster->unlockBroadcasts();
 
-    auto* pTableObject = 
static_cast<sdr::table::SdrTableObj*>(m_xTableShape->GetSdrObject());
     pTableObject->DistributeColumns(0, nColumnCount - 1, true, true);
+    pTableObject->DistributeRows(0, nRowCount - 1, true, true);
 
     uno::Reference<beans::XPropertySet> 
xPropertySet(xTableColumns->getByIndex(0), uno::UNO_QUERY);
     sal_Int32 nWidth = 0;
     xPropertySet->getPropertyValue("Width") >>= nWidth;
 
-    m_xTableShape->setPosition(
-        { basegfx::fround(rStart.getX() - nWidth), 
basegfx::fround(rStart.getY()) });
+    sal_Int32 nTableX = basegfx::fround(rStart.getX() - nWidth);
+    sal_Int32 nTableY = basegfx::fround(rStart.getY());
+    m_xTableShape->setPosition({ nTableX, nTableY });
 
     for (sal_Int32 i = 1; i < xTableColumns->getCount(); ++i)
     {
         xPropertySet.set(xTableColumns->getByIndex(i), uno::UNO_QUERY);
         xPropertySet->setPropertyValue("Width", uno::Any(nColumnWidth));
     }
+
+    if (bKeys)
+    {
+        sal_Int32 nTotalHeight = 0;
+        for (sal_Int32 i = 0; i < xTableRows->getCount(); i++)
+        {
+            xPropertySet.set(xTableRows->getByIndex(i), uno::UNO_QUERY);
+            sal_Int32 nHeight = 0;
+            xPropertySet->getPropertyValue("Height") >>= nHeight;
+            if (i > 0)
+            {
+                aSymbols[i - 1].xSymbol->setPosition(
+                    { nTableX + 100, nTableY + nTotalHeight + 100 });
+            }
+            nTotalHeight += nHeight;
+        }
+    }
 }
 
 void DataTableView::initializeShapes(const rtl::Reference<SvxShapeGroupAnyD>& 
xTarget)
@@ -342,6 +407,8 @@ void DataTableView::initializeValues(
 {
     for (auto& rSeriesPlotter : rSeriesPlotterList)
     {
+        m_pSeriesPlotterList.push_back(rSeriesPlotter.get());
+
         for (auto const& rCategory :
              
rSeriesPlotter->getExplicitCategoriesProvider()->getSimpleCategories())
         {
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
index 18497bcc2494..e71c8517bb3f 100644
--- a/include/svx/svdotable.hxx
+++ b/include/svx/svdotable.hxx
@@ -142,6 +142,8 @@ public:
     /** The active table has the focus or is currently edited */
     const sdr::table::CellRef& getActiveCell() const;
 
+    CellRef getCell(const CellPos& rPos) const;
+
     void setActiveCell( const sdr::table::CellPos& rPos );
     void getActiveCellPos( sdr::table::CellPos& rPos ) const;
     sal_Int32 getColumnCount() const;
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 4cfa65900ac1..e6f6a080f990 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1566,6 +1566,18 @@ void SdrTableObj::TakeTextRect( const CellPos& rPos, 
SdrOutliner& rOutliner, too
     rTextRect=tools::Rectangle(aTextPos,aTextSiz);
 }
 
+CellRef SdrTableObj::getCell(const CellPos& rPos) const
+{
+    if (mpImpl.is())
+    {
+        return mpImpl->getCell(rPos);
+    }
+    else
+    {
+        static CellRef xCell;
+        return xCell;
+    }
+}
 
 const CellRef& SdrTableObj::getActiveCell() const
 {
commit 5d270290bbed9401099c6eb608a20e067dbe2708
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Aug 10 12:06:42 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Wed Aug 10 12:10:33 2022 +0200

    chart2: Add undo/redo for the data table
    
    Change-Id: I6b25a7a82957705481952bc3cd181a6d0c1fce0e

diff --git a/chart2/source/controller/main/ChartController_Insert.cxx 
b/chart2/source/controller/main/ChartController_Insert.cxx
index 99b3e74fffac..6fd0dd19025d 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -161,6 +161,10 @@ void ChartController::executeDispatch_InsertGrid()
 void ChartController::executeDispatch_OpenInsertDataTableDialog()
 {
     SolarMutexGuard aGuard;
+
+    auto aUndoDescription = 
ActionDescriptionProvider::createDescription(ActionDescriptionProvider::ActionType::Insert,
 SchResId(STR_OBJECT_DATA_TABLE));
+    UndoGuard aUndoGuard(aUndoDescription, m_xUndoManager);
+
     rtl::Reference<Diagram> xDiagram = getFirstDiagram();
 
     InsertDataTableDialog aDialog(GetChartFrame());
@@ -195,12 +199,14 @@ void 
ChartController::executeDispatch_OpenInsertDataTableDialog()
     // show the dialog
     if (aDialog.run() == RET_OK)
     {
-        auto& rDialogData = aDialog.getDataTableDialogData();
+        bool bChanged = false;
 
+        auto& rDialogData = aDialog.getDataTableDialogData();
         auto xDataTable = xDiagram->getDataTable();
         if (!rDialogData.mbShow && xDataTable.is())
         {
             xDiagram->setDataTable(uno::Reference<chart2::XDataTable>());
+            bChanged = true;
         }
         else if (rDialogData.mbShow && !xDataTable.is())
         {
@@ -208,6 +214,7 @@ void 
ChartController::executeDispatch_OpenInsertDataTableDialog()
             if (xNewDataTable.is())
             {
                 xDiagram->setDataTable(xNewDataTable);
+                bChanged = true;
             }
         }
 
@@ -220,13 +227,20 @@ void 
ChartController::executeDispatch_OpenInsertDataTableDialog()
             xProperties->setPropertyValue("VBorder" , 
uno::Any(rDialogData.mbVerticalBorders));
             xProperties->setPropertyValue("Outline" , 
uno::Any(rDialogData.mbOutline));
             xProperties->setPropertyValue("Keys" , 
uno::Any(rDialogData.mbKeys));
+            bChanged = true;
         }
+
+        if (bChanged)
+            aUndoGuard.commit();
     }
 }
 
 void ChartController::executeDispatch_InsertDataTable()
 {
-    SolarMutexGuard aGuard;
+    auto aUndoDescription = 
ActionDescriptionProvider::createDescription(ActionDescriptionProvider::ActionType::Insert,
 SchResId(STR_OBJECT_DATA_TABLE));
+    UndoGuard aUndoGuard(aUndoDescription, m_xUndoManager);
+
+
     rtl::Reference<Diagram> xDiagram = getFirstDiagram();
     auto xDataTable = xDiagram->getDataTable();
     if (!xDataTable.is())
@@ -235,18 +249,23 @@ void ChartController::executeDispatch_InsertDataTable()
         if (xNewDataTable.is())
         {
             xDiagram->setDataTable(xNewDataTable);
+            aUndoGuard.commit();
         }
     }
 }
 
 void ChartController::executeDispatch_DeleteDataTable()
 {
-    SolarMutexGuard aGuard;
+    auto aUndoDescription = 
ActionDescriptionProvider::createDescription(ActionDescriptionProvider::ActionType::Delete,
 SchResId(STR_OBJECT_DATA_TABLE));
+    UndoGuard aUndoGuard(aUndoDescription, m_xUndoManager);
+
+
     rtl::Reference<Diagram> xDiagram = getFirstDiagram();
     auto xDataTable = xDiagram->getDataTable();
     if (xDataTable.is())
     {
         xDiagram->setDataTable(uno::Reference<chart2::XDataTable>());
+        aUndoGuard.commit();
     }
 }
 
diff --git a/chart2/source/model/main/Diagram.cxx 
b/chart2/source/model/main/Diagram.cxx
index de8244136642..cd83e5191ca0 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -260,6 +260,8 @@ Diagram::Diagram( const Diagram & rOther ) :
     m_xTitle.set( CloneHelper::CreateRefClone< chart2::XTitle >()( 
rOther.m_xTitle ));
     if (rOther.m_xLegend)
         m_xLegend = new Legend(*rOther.m_xLegend);
+    if (rOther.m_xDataTable)
+        m_xDataTable = new DataTable(*rOther.m_xDataTable);
 
     if ( m_xWall )
         m_xWall->addModifyListener( m_xModifyEventForwarder );
commit 9891178dc991bdf29d3e5f2e653eb9a859d1424b
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Aug 10 11:58:34 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Wed Aug 10 12:10:33 2022 +0200

    correct the description of NumberingRules
    
    duplicated text - "@see NumberingLevel"
    
    Change-Id: I210c392dba738e65ed22b8c66e16a6bafb1c4265

diff --git a/offapi/com/sun/star/text/NumberingRules.idl 
b/offapi/com/sun/star/text/NumberingRules.idl
index 97286cd26523..9b12477f8f95 100644
--- a/offapi/com/sun/star/text/NumberingRules.idl
+++ b/offapi/com/sun/star/text/NumberingRules.idl
@@ -31,7 +31,7 @@ published service NumberingRules
 
                 <p>The numbering rules are levels of property values. Each
                 level contains equal properties.</p>
-                @see NumberingLevel;@see NumberingLevel;
+                @see NumberingLevel
      */
         interface com::sun::star::container::XIndexReplace;
 
commit e953662f13703451bdfcddf556d8967d6b670ed3
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jul 29 15:57:42 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Sat Jul 30 22:37:19 2022 +0200

    xmloff: import and export for the chart data table
    
    This change adds import and export code for the the chart's data
    table properties to the ODF format for chart documents. The data
    table properties are exported to a new element "data-table", which
    then references a auto style with all the properties of a data
    table + new data table specific properties: HBorder, VBorder,
    Outline, Keys which are mapped to "show-horizontal-border",
    "show-vertical-border", "show-outline" and "show-keys" chart
    attributes.
    
    Also adds a test for the import and export:
    imports xlsx -> exports to ods -> imports ods
    
    Change-Id: Id45d9369fd619959e4d6eba7ca51c8ddce9c8f56

diff --git a/chart2/qa/extras/chart2export2.cxx 
b/chart2/qa/extras/chart2export2.cxx
index be2902cbb15c..b9b77c0bd112 100644
--- a/chart2/qa/extras/chart2export2.cxx
+++ b/chart2/qa/extras/chart2export2.cxx
@@ -93,6 +93,7 @@ public:
     void testNameRangeXLSX();
     void testTdf143942();
     void testDateCategoriesPPTX();
+    void testDataTableImportExport();
 
     CPPUNIT_TEST_SUITE(Chart2ExportTest2);
     CPPUNIT_TEST(testSetSeriesToSecondaryAxisXLSX);
@@ -158,6 +159,7 @@ public:
     CPPUNIT_TEST(testNameRangeXLSX);
     CPPUNIT_TEST(testTdf143942);
     CPPUNIT_TEST(testDateCategoriesPPTX);
+    CPPUNIT_TEST(testDataTableImportExport);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1630,6 +1632,56 @@ void Chart2ExportTest2::testDateCategoriesPPTX()
     }
 }
 
+void Chart2ExportTest2::testDataTableImportExport()
+{
+    load(u"/chart2/qa/extras/data/xlsx/", u"ChartDataTable.xlsx");
+    {
+        uno::Reference<chart2::XChartDocument> xChartDoc = 
getChartDocFromSheet(0, mxComponent);
+        CPPUNIT_ASSERT(xChartDoc.is());
+        auto xDiagram = xChartDoc->getFirstDiagram();
+        CPPUNIT_ASSERT(xDiagram.is());
+        auto xDataTable = xDiagram->getDataTable();
+        CPPUNIT_ASSERT(xDataTable.is());
+        uno::Reference<beans::XPropertySet> xPropertySet(xDataTable, 
uno::UNO_QUERY);
+        CPPUNIT_ASSERT(xPropertySet.is());
+        bool bHBorder;
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("HBorder") >>= bHBorder);
+        CPPUNIT_ASSERT_EQUAL(true, bHBorder);
+        bool bVBorder;
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("VBorder") >>= bVBorder);
+        CPPUNIT_ASSERT_EQUAL(true, bVBorder);
+        bool bOutline;
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("Outline") >>= bOutline);
+        CPPUNIT_ASSERT_EQUAL(false, bOutline);
+        bool bKeys;
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("Keys") >>= bKeys);
+        CPPUNIT_ASSERT_EQUAL(false, bKeys);
+    }
+    reload("calc8");
+    {
+        uno::Reference<chart2::XChartDocument> xChartDoc = 
getChartDocFromSheet(0, mxComponent);
+        CPPUNIT_ASSERT(xChartDoc.is());
+        auto xDiagram = xChartDoc->getFirstDiagram();
+        CPPUNIT_ASSERT(xDiagram.is());
+        auto xDataTable = xDiagram->getDataTable();
+        CPPUNIT_ASSERT(xDataTable.is());
+        uno::Reference<beans::XPropertySet> xPropertySet(xDataTable, 
uno::UNO_QUERY);
+        CPPUNIT_ASSERT(xPropertySet.is());
+        bool bHBorder;
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("HBorder") >>= bHBorder);
+        CPPUNIT_ASSERT_EQUAL(true, bHBorder);
+        bool bVBorder;
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("VBorder") >>= bVBorder);
+        CPPUNIT_ASSERT_EQUAL(true, bVBorder);
+        bool bOutline;
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("Outline") >>= bOutline);
+        CPPUNIT_ASSERT_EQUAL(false, bOutline);
+        bool bKeys;
+        CPPUNIT_ASSERT(xPropertySet->getPropertyValue("Keys") >>= bKeys);
+        CPPUNIT_ASSERT_EQUAL(false, bKeys);
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/ChartDataTable.xlsx 
b/chart2/qa/extras/data/xlsx/ChartDataTable.xlsx
new file mode 100644
index 000000000000..fff4f00aeafa
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/ChartDataTable.xlsx 
differ
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 58b6329ec71a..15a6e61cd863 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -605,6 +605,7 @@ namespace xmloff::token {
         XML_DATA_STREAM_SOURCE,
         XML_DATA_STYLE,
         XML_DATA_STYLE_NAME,
+        XML_DATA_TABLE,
         XML_DATA_TYPE,
         XML_DATABASE_DISPLAY,
         XML_DATABASE_NAME,
@@ -1747,12 +1748,16 @@ namespace xmloff::token {
         XML_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME,
         XML_SHOW_CHANGES_BY_RANGES,
         XML_SHOW_CHANGES_BY_RANGES_LIST,
+        XML_SHOW_HORIZONTAL_BORDER,
+        XML_SHOW_KEYS,
         XML_SHOW_LOGO,
         XML_SHOW_REJECTED_CHANGES,
         XML_SHOW_SHAPE,
         XML_SHOW_TEXT,
         XML_SHOW_UNIT,
         XML_SHOW_VALUE,
+        XML_SHOW_VERTICAL_BORDER,
+        XML_SHOW_OUTLINE,
         XML_SHOWS,
         XML_SIDE_BY_SIDE,
         XML_SILVER,
@@ -3420,7 +3425,7 @@ namespace xmloff::token {
         XML_RFC_LANGUAGE_TAG,
         XML_RFC_LANGUAGE_TAG_ASIAN,
         XML_RFC_LANGUAGE_TAG_COMPLEX,
-        // Chart data table properties
+        // (Obsolete) Chart data table properties
         XML_DATA_TABLE_SHOW_HORZ_BORDER,
         XML_DATA_TABLE_SHOW_VERT_BORDER,
         XML_DATA_TABLE_SHOW_OUTLINE,
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index 9d84b4ee2343..188591c7f019 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -2,34 +2,34 @@
 <!--
         Open Document Format for Office Applications (OpenDocument) Version 1.3
         OASIS Standard, In progress
-       Relax-NG Schema
+    Relax-NG Schema
         Source: https://tools.oasis-open.org/version-control/svn/office/
         Copyright (c) OASIS Open 2002-2015. All Rights Reserved.
 
-       All capitalized terms in the following text have the meanings assigned 
to them
-       in the OASIS Intellectual Property Rights Policy (the "OASIS IPR 
Policy"). The
-       full Policy may be found at the OASIS website.
-
-       This document and translations of it may be copied and furnished to 
others, and
-       derivative works that comment on or otherwise explain it or assist in 
its
-       implementation may be prepared, copied, published, and distributed, in 
whole or
-       in part, without restriction of any kind, provided that the above 
copyright
-       notice and this section are included on all such copies and derivative 
works.
-       However, this document itself may not be modified in any way, including 
by
-       removing the copyright notice or references to OASIS, except as needed 
for the
-       purpose of developing any document or deliverable produced by an OASIS
-       Technical Committee (in which case the rules applicable to copyrights, 
as set
-       forth in the OASIS IPR Policy, must be followed) or as required to 
translate it
-       into languages other than English.
-
-       The limited permissions granted above are perpetual and will not be 
revoked by
-       OASIS or its successors or assigns.
-
-       This document and the information contained herein is provided on an 
"AS IS"
-       basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 
BUT NOT
-       LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT
-       INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF 
MERCHANTABILITY OR
-       FITNESS FOR A PARTICULAR PURPOSE.
+    All capitalized terms in the following text have the meanings assigned to 
them
+    in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). 
The
+    full Policy may be found at the OASIS website.
+
+    This document and translations of it may be copied and furnished to 
others, and
+    derivative works that comment on or otherwise explain it or assist in its
+    implementation may be prepared, copied, published, and distributed, in 
whole or
+    in part, without restriction of any kind, provided that the above copyright
+    notice and this section are included on all such copies and derivative 
works.
+    However, this document itself may not be modified in any way, including by
+    removing the copyright notice or references to OASIS, except as needed for 
the
+    purpose of developing any document or deliverable produced by an OASIS
+    Technical Committee (in which case the rules applicable to copyrights, as 
set
+    forth in the OASIS IPR Policy, must be followed) or as required to 
translate it
+    into languages other than English.
+
+    The limited permissions granted above are perpetual and will not be 
revoked by
+    OASIS or its successors or assigns.
+
+    This document and the information contained herein is provided on an "AS 
IS"
+    basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 
BUT NOT
+    LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT
+    INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY 
OR
+    FITNESS FOR A PARTICULAR PURPOSE.
 -->
 <rng:grammar xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:db="urn:oasis:names:tc:opendocument:xmlns:database:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" 
xmlns:rng="http://relaxng.org/ns/structure/1.0"; xmlns:script="urn:oa
 sis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes";
 
@@ -1323,6 +1323,36 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
       </rng:choice>
     </rng:define>
 
+    <rng:define name="chart-chart">
+      <rng:element name="chart:chart">
+        <rng:ref name="chart-chart-attlist"/>
+        <rng:optional>
+          <rng:ref name="chart-title"/>
+        </rng:optional>
+        <rng:optional>
+          <rng:ref name="chart-subtitle"/>
+        </rng:optional>
+        <rng:optional>
+          <rng:ref name="chart-footer"/>
+        </rng:optional>
+        <rng:optional>
+          <rng:ref name="chart-legend"/>
+        </rng:optional>
+        <!-- Chart Data Table - TODO no proposal -->
+        <rng:optional>
+          <rng:ref name="chart-data-table"/>
+        </rng:optional>
+        <rng:ref name="chart-plot-area"/>
+        <rng:zeroOrMore>
+          <rng:ref name="shape"/>
+        </rng:zeroOrMore>
+        <!-- https://issues.oasis-open.org/browse/OFFICE-2123 -->
+        <rng:optional>
+          <rng:ref name="table-table"/>
+        </rng:optional>
+      </rng:element>
+    </rng:define>
+
     <rng:define name="chart-axis">
       <rng:element name="chart:axis">
         <rng:ref name="chart-axis-attlist"/>
@@ -2423,6 +2453,39 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
     </rng:optional>
   </rng:define>
 
+    <!-- Chart Data Table - TODO no proposal -->
+  <rng:define name="chart-data-table">
+    <rng:element name="loext:data-table">
+      <rng:attribute name="chart:style-name">
+        <rng:ref name="styleNameRef"/>
+      </rng:attribute>
+    </rng:element>
+  </rng:define>
+
+    <!-- Chart Data Table Stlye Attributes - TODO no proposal -->
+  <rng:define name="style-chart-properties-attlist" combine="interleave">
+    <rng:optional>
+      <rng:attribute name="loext:show-horizontal-border">
+        <rng:ref name="boolean"/>
+      </rng:attribute>
+    </rng:optional>
+    <rng:optional>
+      <rng:attribute name="loext:show-vertical-border">
+        <rng:ref name="boolean"/>
+      </rng:attribute>
+    </rng:optional>
+    <rng:optional>
+      <rng:attribute name="loext:show-outline">
+        <rng:ref name="boolean"/>
+      </rng:attribute>
+    </rng:optional>
+    <rng:optional>
+      <rng:attribute name="loext:show-keys">
+        <rng:ref name="boolean"/>
+      </rng:attribute>
+    </rng:optional>
+  </rng:define>
+
     <!-- TODO no proposal -->
   <rng:define name="table-data-pilot-field-attlist" combine="interleave">
     <rng:optional>
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk
index 50d268b470b1..2c59632c8537 100644
--- a/xmloff/Library_xo.mk
+++ b/xmloff/Library_xo.mk
@@ -74,6 +74,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
     xmloff/source/chart/SchXMLAxisContext \
     xmloff/source/chart/SchXMLCalculationSettingsContext \
     xmloff/source/chart/SchXMLChartContext \
+    xmloff/source/chart/SchXMLDataTableContext \
     xmloff/source/chart/SchXMLEnumConverter \
     xmloff/source/chart/SchXMLExport \
     xmloff/source/chart/SchXMLImport \
diff --git a/xmloff/source/chart/PropertyMaps.cxx 
b/xmloff/source/chart/PropertyMaps.cxx
index e40ac207a284..09a580512199 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -130,6 +130,12 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
     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),
 
+    // Data table
+    MAP_ENTRY_ODF_EXT( "HBorder", LO_EXT, XML_SHOW_HORIZONTAL_BORDER, 
XML_TYPE_BOOL ),
+    MAP_ENTRY_ODF_EXT( "VBorder", LO_EXT, XML_SHOW_VERTICAL_BORDER, 
XML_TYPE_BOOL ),
+    MAP_ENTRY_ODF_EXT( "Outline", LO_EXT, XML_SHOW_OUTLINE, XML_TYPE_BOOL ),
+    MAP_ENTRY_ODF_EXT( "Keys", LO_EXT, XML_SHOW_KEYS, XML_TYPE_BOOL ),
+
     MAP_ENTRY( "ScaleText", CHART, XML_SCALE_TEXT, XML_TYPE_BOOL ),
 
     // spline settings
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx 
b/xmloff/source/chart/SchXMLChartContext.cxx
index 23ea2f780041..c370d5829c1e 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -20,6 +20,7 @@
 #include "SchXMLChartContext.hxx"
 #include <SchXMLImport.hxx>
 #include "SchXMLLegendContext.hxx"
+#include "SchXMLDataTableContext.hxx"
 #include "SchXMLPlotAreaContext.hxx"
 #include "SchXMLParagraphContext.hxx"
 #include "SchXMLTableContext.hxx"
@@ -1069,6 +1070,9 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
SchXMLChartContext::cr
         case XML_ELEMENT(CHART, XML_LEGEND):
             pContext = new SchXMLLegendContext( mrImportHelper, GetImport() );
             break;
+        case XML_ELEMENT(LO_EXT, XML_DATA_TABLE):
+            pContext = new SchXMLDataTableContext(mrImportHelper, GetImport());
+            break;
         case XML_ELEMENT(TABLE, XML_TABLE):
             {
                 SchXMLTableContext * pTableContext =
diff --git a/xmloff/source/chart/SchXMLDataTableContext.cxx 
b/xmloff/source/chart/SchXMLDataTableContext.cxx
new file mode 100644
index 000000000000..4271221ed71f
--- /dev/null
+++ b/xmloff/source/chart/SchXMLDataTableContext.cxx
@@ -0,0 +1,87 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "SchXMLDataTableContext.hxx"
+
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnamespace.hxx>
+#include <xmloff/namespacemap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XDataTable.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+using namespace ::xmloff::token;
+using namespace css;
+
+SchXMLDataTableContext::SchXMLDataTableContext(SchXMLImportHelper& rImpHelper, 
SvXMLImport& rImport)
+    : SvXMLImportContext(rImport)
+    , mrImportHelper(rImpHelper)
+{
+}
+
+void SchXMLDataTableContext::startFastElement(
+    sal_Int32 /*nElement*/, const 
uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+{
+    printf("SchXMLDataTableContext::startFastElement\n");
+    auto xChartDocument = mrImportHelper.GetChartDocument();
+    if (!xChartDocument.is())
+        return;
+
+    uno::Reference<chart2::XChartDocument> xNewChartDocument(xChartDocument, 
uno::UNO_QUERY);
+    if (!xNewChartDocument.is())
+        return;
+
+    uno::Reference<chart2::XDiagram> 
xDiagram(xNewChartDocument->getFirstDiagram());
+    if (!xDiagram.is())
+        return;
+
+    uno::Reference<lang::XMultiServiceFactory> xFactory = 
comphelper::getProcessServiceFactory();
+    uno::Reference<chart2::XDataTable> xDataTable(
+        xFactory->createInstance("com.sun.star.chart2.DataTable"), 
uno::UNO_QUERY);
+    if (!xDataTable.is())
+        return;
+
+    xDiagram->setDataTable(xDataTable);
+
+    OUString sAutoStyleName;
+
+    for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
+    {
+        if (aIter.getToken() == XML_ELEMENT(CHART, XML_STYLE_NAME))
+            sAutoStyleName = aIter.toString();
+        else
+            XMLOFF_WARN_UNKNOWN("xmloff", aIter);
+    }
+
+    // set properties
+    uno::Reference<beans::XPropertySet> xPropertySet(xDataTable, 
uno::UNO_QUERY);
+
+    if (!sAutoStyleName.isEmpty() && xPropertySet.is())
+    {
+        mrImportHelper.FillAutoStyle(sAutoStyleName, xPropertySet);
+    }
+}
+
+SchXMLDataTableContext::~SchXMLDataTableContext() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLDataTableContext.hxx 
b/xmloff/source/chart/SchXMLDataTableContext.hxx
new file mode 100644
index 000000000000..716f445ed61e
--- /dev/null
+++ b/xmloff/source/chart/SchXMLDataTableContext.hxx
@@ -0,0 +1,40 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+
+#include <xmloff/SchXMLImportHelper.hxx>
+#include <xmloff/xmlictxt.hxx>
+
+class SchXMLDataTableContext : public SvXMLImportContext
+{
+public:
+    SchXMLDataTableContext(SchXMLImportHelper& rImpHelper, SvXMLImport& 
rImport);
+    virtual ~SchXMLDataTableContext() override;
+
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& 
xAttrList) override;
+
+private:
+    SchXMLImportHelper& mrImportHelper;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index fc0a24a8e451..3b96592029be 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -1146,6 +1146,8 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< 
chart::XChartDocument >
         return;
     }
 
+    const SvtSaveOptions::ODFSaneDefaultVersion 
nCurrentODFVersion(mrExport.getSaneDefaultVersion());
+
     mxExpPropMapper->setChartDoc(xNewDoc);
 
     awt::Size aPageSize( getPageSize( xNewDoc ));
@@ -1231,8 +1233,6 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< 
chart::XChartDocument >
     if( bExportContent )
     {
         //export data provider in xlink:href attribute
-        const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(
-            mrExport.getSaneDefaultVersion());
 
         if (nCurrentODFVersion >= SvtSaveOptions::ODFSVER_012)
         {
@@ -1406,9 +1406,6 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< 
chart::XChartDocument >
             Reference< beans::XPropertySet > xProp( rChartDoc->getLegend(), 
uno::UNO_QUERY );
             if( xProp.is())
             {
-                const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(
-                    mrExport.getSaneDefaultVersion());
-
                 // export legend anchor position
                 try
                 {
@@ -1495,6 +1492,37 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< 
chart::XChartDocument >
         aPropertyStates.clear();
     }
 
+    // Data table
+    if (xNewDiagram.is() && nCurrentODFVersion & 
SvtSaveOptions::ODFSVER_EXTENDED)
+    {
+        auto xDataTable = xNewDiagram->getDataTable();
+
+        if (xDataTable.is())
+        {
+            // get property states for autostyles
+            if (mxExpPropMapper.is())
+            {
+                uno::Reference<beans::XPropertySet> xPropSet(xDataTable, 
uno::UNO_QUERY);
+                if (xPropSet.is())
+                    aPropertyStates = mxExpPropMapper->Filter(mrExport, 
xPropSet);
+            }
+
+            if (bExportContent)
+            {
+                // add style name attribute
+                AddAutoStyleAttribute(aPropertyStates);
+                SvXMLElementExport aDataTableElement(mrExport, 
XML_NAMESPACE_LO_EXT, XML_DATA_TABLE, true, true);
+            }
+            else
+            {
+                CollectAutoStyle(std::move(aPropertyStates));
+            }
+        }
+
+        // remove property states for autostyles
+        aPropertyStates.clear();
+    }
+
     // plot-area element
     if( xDiagram.is())
         exportPlotArea( xDiagram, xNewDiagram, aPageSize, bExportContent, 
bIncludeTable );
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index a996c4e9fb54..a3137d5736c5 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -617,6 +617,7 @@ namespace xmloff::token {
         TOKEN( "data-stream-source",              XML_DATA_STREAM_SOURCE ),
         TOKEN( "data-style",                      XML_DATA_STYLE ),
         TOKEN( "data-style-name",                 XML_DATA_STYLE_NAME ),
+        TOKEN( "data-table",                      XML_DATA_TABLE ),
         TOKEN( "data-type",                       XML_DATA_TYPE ),
         TOKEN( "database-display",                XML_DATABASE_DISPLAY ),
         TOKEN( "database-name",                   XML_DATABASE_NAME ),
@@ -1760,12 +1761,16 @@ namespace xmloff::token {
         TOKEN( "show-changes-by-datetime-second-datetime",        
XML_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME ),
         TOKEN( "show-changes-by-ranges",          XML_SHOW_CHANGES_BY_RANGES ),
         TOKEN( "show-changes-by-ranges-list",     
XML_SHOW_CHANGES_BY_RANGES_LIST ),
+        TOKEN( "show-horizontal-border",          XML_SHOW_HORIZONTAL_BORDER ),
+        TOKEN( "show-keys",                       XML_SHOW_KEYS ),
         TOKEN( "show-logo",                       XML_SHOW_LOGO ),
         TOKEN( "show-rejected-changes",           XML_SHOW_REJECTED_CHANGES ),
         TOKEN( "show-shape",                      XML_SHOW_SHAPE ),
         TOKEN( "show-text",                       XML_SHOW_TEXT ),
         TOKEN( "show-unit",                       XML_SHOW_UNIT ),
         TOKEN( "show-value",                      XML_SHOW_VALUE ),
+        TOKEN( "show-vertical-border",            XML_SHOW_VERTICAL_BORDER ),
+        TOKEN( "show-outline",                    XML_SHOW_OUTLINE ),
         TOKEN( "shows",                           XML_SHOWS ),
         TOKEN( "side-by-side",                    XML_SIDE_BY_SIDE ),
         TOKEN( "silver",                          XML_SILVER ),
@@ -3427,9 +3432,9 @@ namespace xmloff::token {
         TOKEN( "rfc-language-tag",          XML_RFC_LANGUAGE_TAG ),
         TOKEN( "rfc-language-tag-asian",    XML_RFC_LANGUAGE_TAG_ASIAN ),
         TOKEN( "rfc-language-tag-complex",  XML_RFC_LANGUAGE_TAG_COMPLEX ),
-        TOKEN( "data-table-show-horz-border",     
XML_DATA_TABLE_SHOW_HORZ_BORDER ),
-        TOKEN( "data-table-show-vert-border",     
XML_DATA_TABLE_SHOW_VERT_BORDER ),
-        TOKEN( "data-table-show-outline",     XML_DATA_TABLE_SHOW_OUTLINE ),
+        TOKEN( "data-table-show-horz-border",     
XML_DATA_TABLE_SHOW_HORZ_BORDER ), // obsolete - use XML_SHOW_HORIZONTAL_BORDER
+        TOKEN( "data-table-show-vert-border",     
XML_DATA_TABLE_SHOW_VERT_BORDER ), // obsolete - use XML_SHOW_VERTICAL_BORDER
+        TOKEN( "data-table-show-outline",     XML_DATA_TABLE_SHOW_OUTLINE ), 
// obsolete - use XML_SHOW_OUTLINE
         TOKEN( "display-units",     XML_CHART_DUNITS_DISPLAYUNITS ),
         TOKEN( "display-units-built-in-unit",     XML_CHART_DUNITS_BUILTINUNIT 
),
         TOKEN( "external-data", XML_EXTERNALDATA),
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 849802878614..280636b0c978 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -522,6 +522,7 @@ data-range
 data-stream-source
 data-style
 data-style-name
+data-table
 data-type
 database-display
 database-name
@@ -1660,12 +1661,16 @@ show-changes-by-datetime-mode
 show-changes-by-datetime-second-datetime
 show-changes-by-ranges
 show-changes-by-ranges-list
+show-horizontal-border
+show-keys
 show-logo
 show-rejected-changes
 show-shape
 show-text
 show-unit
 show-value
+show-vertical-border
+show-outline
 shows
 side-by-side
 silver
commit 73cef2c3ee722b380ef076c4ea9acd6a81204df8
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jul 29 15:49:31 2022 +0200
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Fri Jul 29 16:04:31 2022 +0200

    chart2: DataTable set properties to default to false
    
    Change-Id: If8caf59629327b623b2630776b1e650cbe4fbed1

diff --git a/chart2/source/model/main/DataTable.cxx 
b/chart2/source/model/main/DataTable.cxx
index c55dd442fb31..02fbc5e788bb 100644
--- a/chart2/source/model/main/DataTable.cxx
+++ b/chart2/source/model/main/DataTable.cxx
@@ -65,10 +65,10 @@ private:
         ::chart::CharacterProperties::AddDefaultsToMap(aMap);
 
         ::chart::PropertyHelper::setPropertyValueDefault(aMap, 
DataTableProperty_HorizontalBorder,
-                                                         true);
+                                                         false);
         ::chart::PropertyHelper::setPropertyValueDefault(aMap, 
DataTableProperty_VerticalBorder,
-                                                         true);
-        ::chart::PropertyHelper::setPropertyValueDefault(aMap, 
DataTableProperty_Outilne, true);
+                                                         false);
+        ::chart::PropertyHelper::setPropertyValueDefault(aMap, 
DataTableProperty_Outilne, false);
         ::chart::PropertyHelper::setPropertyValueDefault(aMap, 
DataTableProperty_Keys, false);
 
         ::chart::PropertyHelper::setPropertyValue(

Reply via email to