chart2/source/view/inc/ShapeFactory.hxx  |    3 +++
 chart2/source/view/main/ShapeFactory.cxx |   14 ++++++++++++++
 2 files changed, 17 insertions(+)

New commits:
commit ed883b92efa9ca8e3006290eb2c28485e9052575
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Thu May 5 21:10:25 2022 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri May 6 11:23:37 2022 +0200

    chart2: add function to create a table shape to ShapeFactory
    
    Change-Id: I18f76c3372504c1d660aa168ee0387f61817f30a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133921
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/chart2/source/view/inc/ShapeFactory.hxx 
b/chart2/source/view/inc/ShapeFactory.hxx
index 89991afaf1b0..d6c05af04d18 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -27,6 +27,7 @@
 #include <rtl/ref.hxx>
 #include <rtl/ustring.hxx>
 #include <svx/unoshape.hxx>
+#include <svx/unodraw/SvxTableShape.hxx>
 #include <svx/unopage.hxx>
 
 namespace chart { struct VLineProperties; }
@@ -216,6 +217,8 @@ 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<SvxShapeRect>
         createInvisibleRectangle(
             const rtl::Reference<SvxShapeGroupAnyD>& xTarget
diff --git a/chart2/source/view/main/ShapeFactory.cxx 
b/chart2/source/view/main/ShapeFactory.cxx
index 86e93fc44394..d145feabbda9 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -2531,6 +2531,20 @@ void ShapeFactory::removeSubShapes( const 
rtl::Reference<SvxShapeGroupAnyD>& xSh
     }
 }
 
+rtl::Reference<SvxTableShape>
+ShapeFactory::createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget)
+{
+    if( !xTarget.is() )
+        return nullptr;
+
+    //create table shape
+    rtl::Reference<SvxTableShape> xShape = new SvxTableShape(nullptr);
+    xShape->setShapeKind(SdrObjKind::Table);
+    xTarget->addShape(*xShape);
+
+    return xShape;
+}
+
 } //namespace chart
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to