chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx |   19 -
 chart2/source/model/main/DataTable.cxx                      |   40 +--
 chart2/source/view/axes/VAxisBase.cxx                       |    3 
 chart2/source/view/axes/VAxisBase.hxx                       |    4 
 chart2/source/view/axes/VCartesianAxis.cxx                  |    6 
 chart2/source/view/axes/VCartesianAxis.hxx                  |    3 
 chart2/source/view/axes/VCartesianCoordinateSystem.cxx      |    2 
 chart2/source/view/inc/DataTableView.hxx                    |   11 
 chart2/source/view/main/DataTableView.cxx                   |  154 ++++++++++--
 oox/source/export/chartexport.cxx                           |   29 +-
 10 files changed, 194 insertions(+), 77 deletions(-)

New commits:
commit dc10d2adbe02c32c689e9760e72a18323cbc8dec
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Sat May 21 10:52:51 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sat May 21 10:52:51 2022 +0900

    chart2: set the char props. to the cells of a data table from model
    
    This copies the char. properties from the model to the cells of
    a data table, so the correct char width, font is used for text
    when the table is rendered. Also add margin to the text, so it
    looks better.
    
    Change-Id: Ib74a8136459a31d64a86dec36a6ba14d2c313cf2

diff --git a/chart2/source/view/main/DataTableView.cxx 
b/chart2/source/view/main/DataTableView.cxx
index 3992ea84d012..c8e2adae6fbe 100644
--- a/chart2/source/view/main/DataTableView.cxx
+++ b/chart2/source/view/main/DataTableView.cxx
@@ -5,7 +5,6 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
  */
 
 #include <DataTableView.hxx>
@@ -59,11 +58,70 @@ void setTopCell(uno::Reference<beans::XPropertySet>& 
xPropertySet)
     xPropertySet->setPropertyValue("TopBorder", uno::Any(aBorderLine));
     xPropertySet->setPropertyValue("LeftBorder", uno::Any(aBorderLine));
 }
+
+void copyProperty(uno::Reference<beans::XPropertySet>& xOut,
+                  uno::Reference<beans::XPropertySet>& xIn, OUString const& 
sPropertyName)
+{
+    xOut->setPropertyValue(sPropertyName, 
xIn->getPropertyValue(sPropertyName));
+}
 }
 
 void DataTableView::setCellDefaults(uno::Reference<beans::XPropertySet>& 
xPropertySet, bool bLeft,
                                     bool bTop, bool bRight, bool bBottom)
 {
+    uno::Reference<beans::XPropertySet> xDataTableProperties = 
m_xDataTableModel.get();
+
+    copyProperty(xPropertySet, xDataTableProperties, "CharColor");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontFamily");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontFamilyAsian");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontFamilyComplex");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSet");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSetAsian");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSetComplex");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontName");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontNameAsian");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontNameComplex");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontPitch");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontPitchAsian");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontPitchComplex");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontStyleName");
+    copyProperty(xPropertySet, xDataTableProperties, "CharFontStyleNameAsian");
+    copyProperty(xPropertySet, xDataTableProperties, 
"CharFontStyleNameComplex");
+
+    copyProperty(xPropertySet, xDataTableProperties, "CharHeight");
+    copyProperty(xPropertySet, xDataTableProperties, "CharHeightAsian");
+    copyProperty(xPropertySet, xDataTableProperties, "CharHeightComplex");
+    copyProperty(xPropertySet, xDataTableProperties, "CharKerning");
+    copyProperty(xPropertySet, xDataTableProperties, "CharLocale");
+    copyProperty(xPropertySet, xDataTableProperties, "CharLocaleAsian");
+    copyProperty(xPropertySet, xDataTableProperties, "CharLocaleComplex");
+    copyProperty(xPropertySet, xDataTableProperties, "CharPosture");
+    copyProperty(xPropertySet, xDataTableProperties, "CharPostureAsian");
+    copyProperty(xPropertySet, xDataTableProperties, "CharPostureComplex");
+    copyProperty(xPropertySet, xDataTableProperties, "CharRelief");
+    copyProperty(xPropertySet, xDataTableProperties, "CharShadowed");
+    copyProperty(xPropertySet, xDataTableProperties, "CharStrikeout");
+    copyProperty(xPropertySet, xDataTableProperties, "CharUnderline");
+    copyProperty(xPropertySet, xDataTableProperties, "CharUnderlineColor");
+    copyProperty(xPropertySet, xDataTableProperties, "CharUnderlineHasColor");
+    copyProperty(xPropertySet, xDataTableProperties, "CharOverline");
+    copyProperty(xPropertySet, xDataTableProperties, "CharOverlineColor");
+    copyProperty(xPropertySet, xDataTableProperties, "CharOverlineHasColor");
+    copyProperty(xPropertySet, xDataTableProperties, "CharWeight");
+    copyProperty(xPropertySet, xDataTableProperties, "CharWeightAsian");
+    copyProperty(xPropertySet, xDataTableProperties, "CharWeightComplex");
+    copyProperty(xPropertySet, xDataTableProperties, "CharWordMode");
+
+    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);
+
     xPropertySet->setPropertyValue("FillColor", uno::Any(Color(0xFFFFFF)));
     xPropertySet->setPropertyValue("TextVerticalAdjust", 
uno::Any(drawing::TextVerticalAdjust_TOP));
     xPropertySet->setPropertyValue("ParaAdjust", 
uno::Any(style::ParagraphAdjust_CENTER));
commit f2e8bac78af654d7b618b8ff505d2fb3b5707be5
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Sat May 21 10:51:55 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sat May 21 10:51:55 2022 +0900

    chart2: add char properties to the DataTable model
    
    Change-Id: Ie4b49f36def7d20f89695157c3b95e6ee5d16d83

diff --git a/chart2/source/model/main/DataTable.cxx 
b/chart2/source/model/main/DataTable.cxx
index 0b7fba3176e2..b57566005e83 100644
--- a/chart2/source/model/main/DataTable.cxx
+++ b/chart2/source/model/main/DataTable.cxx
@@ -95,8 +95,9 @@ private:
     {
         std::vector<beans::Property> aProperties;
         lcl_AddPropertiesToVector(aProperties);
-        chart::LinePropertiesHelper::AddPropertiesToVector(aProperties);
-        chart::FillProperties::AddPropertiesToVector(aProperties);
+        ::chart::LinePropertiesHelper::AddPropertiesToVector(aProperties);
+        ::chart::FillProperties::AddPropertiesToVector(aProperties);
+        ::chart::CharacterProperties::AddPropertiesToVector(aProperties);
         std::sort(aProperties.begin(), aProperties.end(), 
chart::PropertyNameLess());
 
         return comphelper::containerToSequence(aProperties);
@@ -214,7 +215,8 @@ sal_Bool SAL_CALL DataTable::supportsService(const 
OUString& rServiceName)
 uno::Sequence<OUString> SAL_CALL DataTable::getSupportedServiceNames()
 {
     return { "com.sun.star.chart2.DataTable", "com.sun.star.beans.PropertySet",
-             "com.sun.star.drawing.FillProperties", 
"com.sun.star.drawing.LineProperties" };
+             "com.sun.star.drawing.FillProperties", 
"com.sun.star.drawing.LineProperties",
+             "com.sun.star.style.CharacterProperties" };
 }
 
 IMPLEMENT_FORWARD_XINTERFACE2(DataTable, DataTable_Base, 
::property::OPropertySet)
commit 4b7ce665507cc36104f17ccbad08cdc5d65957c6
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Sat May 21 00:00:30 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sat May 21 00:00:30 2022 +0900

    oox export: add export of basic properties of a data table
    
    Change-Id: I2c8b76125fc788a9e4df164171d6cbd351bc1c4a

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 8a6d5fa7d298..988fe4413529 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1732,6 +1732,7 @@ void ChartExport::exportPlotArea(const Reference< 
css::chart::XChartDocument >&
     }
     //Axis Data
     exportAxes( );
+
     // Data Table
     exportDataTable();
 
@@ -2033,35 +2034,41 @@ void ChartExport::exportGradientFill( const Reference< 
XPropertySet >& xPropSet
 
 void ChartExport::exportDataTable( )
 {
+    auto xDataTable = mxNewDiagram->getDataTable();
+    if (!xDataTable.is())
+        return;
+
     FSHelperPtr pFS = GetFS();
-    Reference< beans::XPropertySet > aPropSet( mxDiagram, uno::UNO_QUERY );
+    uno::Reference<beans::XPropertySet> aPropSet(xDataTable, uno::UNO_QUERY);
 
     bool bShowVBorder = false;
     bool bShowHBorder = false;
     bool bShowOutline = false;
+    bool bShowKeys = false;
 
-    if (GetProperty( aPropSet, "DataTableHBorder"))
+    if (GetProperty(aPropSet, "HBorder"))
         mAny >>= bShowHBorder;
-    if (GetProperty( aPropSet, "DataTableVBorder"))
+    if (GetProperty(aPropSet, "VBorder"))
         mAny >>= bShowVBorder;
-    if (GetProperty( aPropSet, "DataTableOutline"))
+    if (GetProperty(aPropSet, "Outline"))
+        mAny >>= bShowOutline;
+    if (GetProperty(aPropSet, "Keys"))
         mAny >>= bShowOutline;
-
-    if (!(bShowVBorder || bShowHBorder || bShowOutline))
-        return;
 
     pFS->startElement(FSNS(XML_c, XML_dTable));
+
     if (bShowHBorder)
-        pFS->singleElement( FSNS( XML_c, XML_showHorzBorder ),
-                        XML_val, "1" );
+        pFS->singleElement(FSNS(XML_c, XML_showHorzBorder), XML_val, "1" );
     if (bShowVBorder)
         pFS->singleElement(FSNS(XML_c, XML_showVertBorder), XML_val, "1");
     if (bShowOutline)
         pFS->singleElement(FSNS(XML_c, XML_showOutline), XML_val, "1");
+    if (bShowKeys)
+        pFS->singleElement(FSNS(XML_c, XML_showKeys), XML_val, "1");
 
-    pFS->endElement(  FSNS( XML_c, XML_dTable));
-
+    pFS->endElement(FSNS(XML_c, XML_dTable));
 }
+
 void ChartExport::exportAreaChart( const Reference< chart2::XChartType >& 
xChartType )
 {
     FSHelperPtr pFS = GetFS();
commit ae40903b703227480b45234b875658786171f144
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Fri May 20 23:55:45 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Fri May 20 23:57:06 2022 +0900

    chart2: apply line props. to borders when rendering a data table
    
    This sets the color, line width, line style to the borders of
    the table when rendering the data table. We also need the
    ChartModel inside DataTableView, so we can access the needed
    line dashes.
    
    Change-Id: Id3bef23b75e88517d6569ad87a716f178ed64343

diff --git a/chart2/source/view/axes/VAxisBase.cxx 
b/chart2/source/view/axes/VAxisBase.cxx
index 95125beed1cf..7d985051a4a7 100644
--- a/chart2/source/view/axes/VAxisBase.cxx
+++ b/chart2/source/view/axes/VAxisBase.cxx
@@ -243,7 +243,8 @@ void VAxisBase::updateUnscaledValuesAtTicks( TickIter& 
rIter )
 }
 
 void 
VAxisBase::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& 
/*rSeriesPlotterList*/,
-                                    
uno::Reference<util::XNumberFormatsSupplier> const& /*xNumberFormatsSupplier*/)
+                                    
uno::Reference<util::XNumberFormatsSupplier> const& /*xNumberFormatsSupplier*/,
+                                    rtl::Reference<::chart::ChartModel> const& 
/*xChartDoc*/)
 {
 }
 
diff --git a/chart2/source/view/axes/VAxisBase.hxx 
b/chart2/source/view/axes/VAxisBase.hxx
index 4da1936a452b..2c4123ba951d 100644
--- a/chart2/source/view/axes/VAxisBase.hxx
+++ b/chart2/source/view/axes/VAxisBase.hxx
@@ -29,6 +29,7 @@ namespace chart
 
 class VSeriesPlotter;
 class DataTableView;
+class ChartModel;
 
 class VAxisBase : public VAxisOrGridBase
 {
@@ -63,7 +64,8 @@ public:
     void setExtraLinePositionAtOtherAxis( double fCrossingAt );
 
     virtual void 
createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& 
rSeriesPlotterList,
-                                     
css::uno::Reference<css::util::XNumberFormatsSupplier> const& 
xNumberFormatsSupplier);
+                                     
css::uno::Reference<css::util::XNumberFormatsSupplier> const& 
xNumberFormatsSupplier,
+                                     rtl::Reference<::chart::ChartModel> 
const& xChartDoc);
 
     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 bb7f0090eb93..9e6c877a4bb0 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -36,6 +36,7 @@
 #include <svx/unoshtxt.hxx>
 #include <VSeriesPlotter.hxx>
 #include <DataTableView.hxx>
+#include <ChartModel.hxx>
 
 #include <comphelper/scopeguard.hxx>
 
@@ -1992,11 +1993,12 @@ void VCartesianAxis::createShapes()
 }
 
 void 
VCartesianAxis::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>&
 rSeriesPlotterList,
-                                         
Reference<util::XNumberFormatsSupplier> const& xNumberFormatsSupplier)
+                                         
Reference<util::XNumberFormatsSupplier> const& xNumberFormatsSupplier,
+                                         rtl::Reference<::chart::ChartModel> 
const& xChartDoc)
 {
     if (m_aAxisProperties.m_bDisplayDataTable)
     {
-        m_pDataTableView.reset(new 
DataTableView(m_aAxisProperties.m_xDataTableModel));
+        m_pDataTableView.reset(new DataTableView(xChartDoc, 
m_aAxisProperties.m_xDataTableModel));
         m_pDataTableView->initializeValues(rSeriesPlotterList);
         m_xNumberFormatsSupplier = xNumberFormatsSupplier;
     }
diff --git a/chart2/source/view/axes/VCartesianAxis.hxx 
b/chart2/source/view/axes/VCartesianAxis.hxx
index 9f396fef43b8..a9baca907bdd 100644
--- a/chart2/source/view/axes/VCartesianAxis.hxx
+++ b/chart2/source/view/axes/VCartesianAxis.hxx
@@ -100,7 +100,8 @@ public:
     };
 
     void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& 
rSeriesPlotterList,
-                             
css::uno::Reference<css::util::XNumberFormatsSupplier> const& 
xNumberFormatsSupplier) override;
+                             
css::uno::Reference<css::util::XNumberFormatsSupplier> const& 
xNumberFormatsSupplier,
+                             rtl::Reference<::chart::ChartModel> const& 
xChartDoc) 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 cd0d49188a1c..3ea42cb087a0 100644
--- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
@@ -166,7 +166,7 @@ void VCartesianCoordinateSystem::createVAxisList(
             apVAxis->set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, 
m_eBottomPos );
 
             
apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
-            apVAxis->createDataTableView(rSeriesPlotterList, 
xNumberFormatsSupplier);
+            apVAxis->createDataTableView(rSeriesPlotterList, 
xNumberFormatsSupplier, xChartDoc);
         }
     }
 }
diff --git a/chart2/source/view/inc/DataTableView.hxx 
b/chart2/source/view/inc/DataTableView.hxx
index 3f4d97629035..0967768af93e 100644
--- a/chart2/source/view/inc/DataTableView.hxx
+++ b/chart2/source/view/inc/DataTableView.hxx
@@ -13,23 +13,32 @@
 #include <svx/unodraw/SvxTableShape.hxx>
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <DataTable.hxx>
+#include <VLineProperties.hxx>
 
 namespace chart
 {
 class VSeriesPlotter;
+class ChartModel;
 
 class DataTableView final
 {
+private:
+    rtl::Reference<::chart::ChartModel> const& m_xChartModel;
     rtl::Reference<SvxShapeGroupAnyD> m_xTarget;
     rtl::Reference<SvxTableShape> m_xTableShape;
     rtl::Reference<DataTable> m_xDataTableModel;
+    VLineProperties m_aLineProperties;
 
     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);
+
 public:
-    DataTableView(rtl::Reference<DataTable> const& rDataTableModel);
+    DataTableView(rtl::Reference<::chart::ChartModel> const& xChartDoc,
+                  rtl::Reference<DataTable> const& rDataTableModel);
     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/main/DataTableView.cxx 
b/chart2/source/view/main/DataTableView.cxx
index 92714a8a85ba..3992ea84d012 100644
--- a/chart2/source/view/main/DataTableView.cxx
+++ b/chart2/source/view/main/DataTableView.cxx
@@ -12,6 +12,7 @@
 #include <VSeriesPlotter.hxx>
 #include <ShapeFactory.hxx>
 #include <ExplicitCategoriesProvider.hxx>
+#include <ChartModel.hxx>
 
 #include <svx/svdotable.hxx>
 
@@ -19,10 +20,14 @@
 #include <com/sun/star/table/BorderLine.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/table/BorderLineStyle.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
 #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
 #include <com/sun/star/util/XBroadcaster.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
 
 #include <o3tl/unit_conversion.hxx>
 
@@ -30,48 +35,97 @@ using namespace css;
 
 namespace chart
 {
-DataTableView::DataTableView(rtl::Reference<DataTable> const& rDataTableModel)
-    : m_xDataTableModel(rDataTableModel)
+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 setCellDefaults(uno::Reference<beans::XPropertySet>& xPropertySet, bool 
bLeft, bool bTop,
-                     bool bRight, bool bBottom)
+void setTopCell(uno::Reference<beans::XPropertySet>& xPropertySet)
 {
     xPropertySet->setPropertyValue("FillColor", uno::Any(Color(0xFFFFFF)));
     xPropertySet->setPropertyValue("TextVerticalAdjust", 
uno::Any(drawing::TextVerticalAdjust_TOP));
     xPropertySet->setPropertyValue("ParaAdjust", 
uno::Any(style::ParagraphAdjust_CENTER));
 
     table::BorderLine2 aBorderLine;
-    aBorderLine.LineWidth = o3tl::convert(0.5, o3tl::Length::pt, 
o3tl::Length::mm100);
+    aBorderLine.LineWidth = 0;
     aBorderLine.Color = 0x000000;
 
-    if (bLeft)
-        xPropertySet->setPropertyValue("LeftBorder", uno::Any(aBorderLine));
-    if (bTop)
-        xPropertySet->setPropertyValue("TopBorder", uno::Any(aBorderLine));
-    if (bRight)
-        xPropertySet->setPropertyValue("RightBorder", uno::Any(aBorderLine));
-    if (bBottom)
-        xPropertySet->setPropertyValue("BottomBorder", uno::Any(aBorderLine));
+    xPropertySet->setPropertyValue("TopBorder", uno::Any(aBorderLine));
+    xPropertySet->setPropertyValue("LeftBorder", uno::Any(aBorderLine));
+}
 }
 
-void setTopCell(uno::Reference<beans::XPropertySet>& xPropertySet)
+void DataTableView::setCellDefaults(uno::Reference<beans::XPropertySet>& 
xPropertySet, bool bLeft,
+                                    bool bTop, bool bRight, bool bBottom)
 {
     xPropertySet->setPropertyValue("FillColor", uno::Any(Color(0xFFFFFF)));
     xPropertySet->setPropertyValue("TextVerticalAdjust", 
uno::Any(drawing::TextVerticalAdjust_TOP));
     xPropertySet->setPropertyValue("ParaAdjust", 
uno::Any(style::ParagraphAdjust_CENTER));
 
-    table::BorderLine2 aBorderLine;
-    aBorderLine.LineWidth = 0;
-    aBorderLine.Color = 0x000000;
+    drawing::LineStyle eStyle = drawing::LineStyle_NONE;
+    m_aLineProperties.LineStyle >>= eStyle;
 
-    xPropertySet->setPropertyValue("TopBorder", uno::Any(aBorderLine));
-    xPropertySet->setPropertyValue("LeftBorder", uno::Any(aBorderLine));
-}
+    if (eStyle != drawing::LineStyle_NONE)
+    {
+        table::BorderLine2 aBorderLine;
+
+        sal_Int32 nWidth = 0;
+        m_aLineProperties.Width >>= nWidth;
+        aBorderLine.LineWidth = o3tl::convert(nWidth, o3tl::Length::mm100, 
o3tl::Length::twip);
+
+        sal_Int32 nColor = 0;
+        m_aLineProperties.Color >>= nColor;
+        aBorderLine.Color = nColor;
+
+        aBorderLine.LineStyle = table::BorderLineStyle::SOLID;
+
+        if (eStyle == drawing::LineStyle_DASH)
+        {
+            OUString aDashName;
+            m_aLineProperties.DashName >>= aDashName;
+            if (!aDashName.isEmpty())
+            {
+                uno::Reference<container::XNameContainer> xDashTable(
+                    
m_xChartModel->createInstance("com.sun.star.drawing.DashTable"),
+                    uno::UNO_QUERY);
+                if (xDashTable.is() && xDashTable->hasByName(aDashName))
+                {
+                    drawing::LineDash aLineDash;
+                    xDashTable->getByName(aDashName) >>= aLineDash;
+
+                    if (aLineDash.Dots == 0 && aLineDash.Dashes == 0)
+                        aBorderLine.LineStyle = table::BorderLineStyle::SOLID;
+                    else if (aLineDash.Dots == 1 && aLineDash.Dashes == 0)
+                        aBorderLine.LineStyle = table::BorderLineStyle::DOTTED;
+                    else if (aLineDash.Dots == 0 && aLineDash.Dashes == 1)
+                        aBorderLine.LineStyle = table::BorderLineStyle::DASHED;
+                    else if (aLineDash.Dots == 1 && aLineDash.Dashes == 1)
+                        aBorderLine.LineStyle = 
table::BorderLineStyle::DASH_DOT;
+                    else if (aLineDash.Dots == 2 && aLineDash.Dashes == 1)
+                        aBorderLine.LineStyle = 
table::BorderLineStyle::DASH_DOT_DOT;
+                    else
+                        aBorderLine.LineStyle = table::BorderLineStyle::DASHED;
+                }
+            }
+        }
+
+        if (bLeft)
+            xPropertySet->setPropertyValue("LeftBorder", 
uno::Any(aBorderLine));
+        if (bTop)
+            xPropertySet->setPropertyValue("TopBorder", uno::Any(aBorderLine));
+        if (bRight)
+            xPropertySet->setPropertyValue("RightBorder", 
uno::Any(aBorderLine));
+        if (bBottom)
+            xPropertySet->setPropertyValue("BottomBorder", 
uno::Any(aBorderLine));
+    }
 }
+
 void DataTableView::createShapes(basegfx::B2DVector const& rStart, 
basegfx::B2DVector const& rEnd,
                                  sal_Int32 nColumnWidth)
 {
commit e0b4997211a1a922574aa230f39f2213c08de10c
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Fri May 20 18:39:34 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Fri May 20 18:39:34 2022 +0900

    chart2: better readable DataTable properties definition
    
    Change-Id: Ib9cadee39f58b73782e6a3268d86b688183de1fb

diff --git a/chart2/source/model/main/DataTable.cxx 
b/chart2/source/model/main/DataTable.cxx
index 12e08e28b3e4..0b7fba3176e2 100644
--- a/chart2/source/model/main/DataTable.cxx
+++ b/chart2/source/model/main/DataTable.cxx
@@ -34,23 +34,21 @@ enum
     DataTableProperty_Keys,
 };
 
-void lcl_AddPropertiesToVector(std::vector<beans::Property>& rOutProperties)
-{
-    rOutProperties.emplace_back("Show", DataTableProperty_Show, 
cppu::UnoType<bool>::get(),
-                                beans::PropertyAttribute::BOUND
-                                    | beans::PropertyAttribute::MAYBEDEFAULT);
-    rOutProperties.emplace_back(
-        "HBorder", DataTableProperty_HorizontalBorder, 
cppu::UnoType<bool>::get(),
-        beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::MAYBEDEFAULT);
-    rOutProperties.emplace_back(
-        "VBorder", DataTableProperty_VerticalBorder, 
cppu::UnoType<bool>::get(),
-        beans::PropertyAttribute::BOUND | 
beans::PropertyAttribute::MAYBEDEFAULT);
-    rOutProperties.emplace_back("Outline", DataTableProperty_Outilne, 
cppu::UnoType<bool>::get(),
-                                beans::PropertyAttribute::BOUND
-                                    | beans::PropertyAttribute::MAYBEDEFAULT);
-    rOutProperties.emplace_back("Keys", DataTableProperty_Keys, 
cppu::UnoType<bool>::get(),
-                                beans::PropertyAttribute::BOUND
-                                    | beans::PropertyAttribute::MAYBEDEFAULT);
+void lcl_AddPropertiesToVector(std::vector<beans::Property>& rProps)
+{
+    auto const nBound = beans::PropertyAttribute::BOUND;
+    auto const nMaybeDefault = beans::PropertyAttribute::MAYBEDEFAULT;
+
+    rProps.emplace_back("Show", DataTableProperty_Show, 
cppu::UnoType<bool>::get(),
+                        nBound | nMaybeDefault);
+    rProps.emplace_back("HBorder", DataTableProperty_HorizontalBorder, 
cppu::UnoType<bool>::get(),
+                        nBound | nMaybeDefault);
+    rProps.emplace_back("VBorder", DataTableProperty_VerticalBorder, 
cppu::UnoType<bool>::get(),
+                        nBound | nMaybeDefault);
+    rProps.emplace_back("Outline", DataTableProperty_Outilne, 
cppu::UnoType<bool>::get(),
+                        nBound | nMaybeDefault);
+    rProps.emplace_back("Keys", DataTableProperty_Keys, 
cppu::UnoType<bool>::get(),
+                        nBound | nMaybeDefault);
 }
 
 struct StaticLegendDefaults_Initializer
commit a79e372477db512dee0e8599573427ea1df919b5
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Fri May 20 18:20:51 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Fri May 20 18:20:51 2022 +0900

    chart2: remove setting DataTable* props. from old chart::XDialog
    
    No API change needed as the properties were not officialy part
    of the API in the first place.
    
    Change-Id: I8682087d13ab2e9eb1c619646b87cde59c3a8e45

diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx 
b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 563982ec2af4..56a51a8d97e6 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -136,9 +136,6 @@ enum
     PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
 
     PROP_DIAGRAM_AUTOMATIC_SIZE,
-    PROP_DIAGRAM_DATATABLEHBORDER,
-    PROP_DIAGRAM_DATATABLEVBORDER,
-    PROP_DIAGRAM_DATATABLEOUTLINE,
     PROP_DIAGRAM_EXTERNALDATA
 };
 
@@ -380,21 +377,7 @@ void lcl_AddPropertiesToVector(
                   cppu::UnoType<bool>::get(),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT );
-    rOutProperties.emplace_back( "DataTableHBorder",
-                PROP_DIAGRAM_DATATABLEHBORDER,
-                  cppu::UnoType<bool>::get(),
-                  beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEDEFAULT );
-    rOutProperties.emplace_back( "DataTableVBorder",
-                PROP_DIAGRAM_DATATABLEVBORDER,
-                  cppu::UnoType<bool>::get(),
-                  beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEDEFAULT );
-    rOutProperties.emplace_back( "DataTableOutline",
-                PROP_DIAGRAM_DATATABLEOUTLINE,
-                  cppu::UnoType<bool>::get(),
-                  beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEDEFAULT );
+
     rOutProperties.emplace_back( "ExternalData",
                   PROP_DIAGRAM_EXTERNALDATA,
                   cppu::UnoType<OUString>::get(),

Reply via email to