chart2/source/view/axes/VAxisBase.cxx     |    2 +-
 chart2/source/view/inc/ShapeFactory.hxx   |    2 +-
 chart2/source/view/main/DataTableView.cxx |    5 ++++-
 chart2/source/view/main/ShapeFactory.cxx  |    7 ++++---
 4 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit d4450b9a9fe26e03fabb07162e88f742ba2c1f77
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Jun 29 19:25:47 2022 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sun Aug 14 18:16:05 2022 +0200

    chart2: allow to select the data table, fix object CID
    
    Change-Id: I0a8d3643fcaefe8105e935b929947174bd9bdc96
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138247
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/chart2/source/view/axes/VAxisBase.cxx 
b/chart2/source/view/axes/VAxisBase.cxx
index 7d985051a4a7..814d3afd7858 100644
--- a/chart2/source/view/axes/VAxisBase.cxx
+++ b/chart2/source/view/axes/VAxisBase.cxx
@@ -187,7 +187,7 @@ bool VAxisBase::prepareShapeCreation()
     if (m_aAxisProperties.m_bDisplayLabels)
         m_xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget, m_aCID );
     if (m_aAxisProperties.m_bDisplayDataTable)
-        m_xDataTableTarget = ShapeFactory::createGroup2D(m_xFinalTarget, 
m_aCID);
+        m_xDataTableTarget = ShapeFactory::createGroup2D(m_xFinalTarget);
 
     return true;
 }
diff --git a/chart2/source/view/inc/ShapeFactory.hxx 
b/chart2/source/view/inc/ShapeFactory.hxx
index d6c05af04d18..b44612e74a4f 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -217,7 +217,7 @@ public:
                 const css::uno::Reference< css::beans::XPropertySet > & 
xTextProperties,
                 double nRotation, const OUString& aName, sal_Int32 
nTextMaxWidth );
 
-    static rtl::Reference<SvxTableShape> 
createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget);
+    static rtl::Reference<SvxTableShape> 
createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget, OUString const& 
rName = OUString());
 
     static rtl::Reference<SvxShapeRect>
         createInvisibleRectangle(
diff --git a/chart2/source/view/main/DataTableView.cxx 
b/chart2/source/view/main/DataTableView.cxx
index 72b669838435..64c76e5da885 100644
--- a/chart2/source/view/main/DataTableView.cxx
+++ b/chart2/source/view/main/DataTableView.cxx
@@ -12,6 +12,7 @@
 #include <ShapeFactory.hxx>
 #include <ExplicitCategoriesProvider.hxx>
 #include <ChartModel.hxx>
+#include <ObjectIdentifier.hxx>
 
 #include <svx/svdotable.hxx>
 
@@ -191,7 +192,9 @@ void DataTableView::createShapes(basegfx::B2DVector const& 
rStart, basegfx::B2DV
         return;
 
     ShapeFactory::removeSubShapes(m_xTarget);
-    m_xTableShape = ShapeFactory::createTable(m_xTarget);
+    auto sParticle = 
ObjectIdentifier::createParticleForDataTable(m_xChartModel);
+    auto sCID = 
ObjectIdentifier::createClassifiedIdentifierForParticle(sParticle);
+    m_xTableShape = ShapeFactory::createTable(m_xTarget, sCID);
 
     uno::Reference<table::XTable> xTable;
     try
diff --git a/chart2/source/view/main/ShapeFactory.cxx 
b/chart2/source/view/main/ShapeFactory.cxx
index 7fddc5d018d5..8f9f29ced232 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -2533,16 +2533,17 @@ void ShapeFactory::removeSubShapes( const 
rtl::Reference<SvxShapeGroupAnyD>& xSh
 }
 
 rtl::Reference<SvxTableShape>
-ShapeFactory::createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget)
+ShapeFactory::createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget, 
OUString const& rName)
 {
-    if( !xTarget.is() )
+    if (!xTarget.is())
         return nullptr;
 
     //create table shape
     rtl::Reference<SvxTableShape> xShape = new SvxTableShape(nullptr);
     xShape->setShapeKind(SdrObjKind::Table);
     xTarget->addShape(*xShape);
-
+    if (!rName.isEmpty())
+        setShapeName(xShape, rName);
     return xShape;
 }
 

Reply via email to