summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-07-22 15:04:15 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-08-05 09:52:00 +0200
commit8a029e4a39d9afda5334bc546338645241f656d6 (patch)
treea6b1770cb1c5a2ec5a36dc5e33f3bfd71a418b4f /include
parentf0390929d3e71ab434f9ce8d88c2dc2f4cc0ea6e (diff)
SmartArt: store diagram data model in SdrObject
It will allow modifying loaded diagram and exporting it. This data is used for regenerating diagram instead of parsing xml fragment every time. Also provided an interface for UI that can be extended to show, add and remove nodes from data model. It is stored as SdrObject field because diagram top-level shape is group shape. Item set doesn't exist for them and storing data in child shapes is not possible here because children are removed and recreated on every diagram reload. Change-Id: I84e5ec955f638b254fef9ef9d1731ca7938982b7 Reviewed-on: https://gerrit.libreoffice.org/76121 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/oox/drawingml/diagram/diagram.hxx10
-rw-r--r--include/oox/drawingml/shape.hxx5
-rw-r--r--include/svx/DiagramDataInterface.hxx38
-rw-r--r--include/svx/svdobj.hxx4
4 files changed, 53 insertions, 4 deletions
diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx
index a449014e4be9..a5f69b4d56bd 100644
--- a/include/oox/drawingml/diagram/diagram.hxx
+++ b/include/oox/drawingml/diagram/diagram.hxx
@@ -23,13 +23,16 @@
#include <rtl/ustring.hxx>
#include <oox/core/xmlfilterbase.hxx>
#include <oox/drawingml/drawingmltypes.hxx>
+#include <svx/svdobj.hxx>
-#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/xml/dom/XDocument.hpp>
namespace oox { namespace drawingml {
+class DiagramData;
+typedef std::shared_ptr<DiagramData> DiagramDataPtr;
+
/** load diagram data, and put resulting graphic into shape
This method loads the diagram data fragments from the given paths,
@@ -45,14 +48,13 @@ void loadDiagram( ShapePtr const & pShape,
const oox::core::Relations& rRelations );
void loadDiagram(ShapePtr const& pShape,
- const css::uno::Reference<css::xml::dom::XDocument>& dataDom,
+ DiagramDataPtr pDiagramData,
const css::uno::Reference<css::xml::dom::XDocument>& layoutDom,
const css::uno::Reference<css::xml::dom::XDocument>& styleDom,
const css::uno::Reference<css::xml::dom::XDocument>& colorDom,
core::XmlFilterBase& rFilter);
-OOX_DLLPUBLIC void reloadDiagram(css::uno::Reference<css::drawing::XShape>& rXShape,
- core::XmlFilterBase& rFilter);
+OOX_DLLPUBLIC void reloadDiagram(SdrObject* pObj, core::XmlFilterBase& rFilter);
} }
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 5aa6f00318a8..d55e92ae5058 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -77,6 +77,9 @@ struct ShapeStyleRef
typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap;
+class DiagramData;
+typedef std::shared_ptr<DiagramData> DiagramDataPtr;
+
/** Additional information for a chart embedded in a drawing shape. */
struct ChartShapeInfo
{
@@ -202,6 +205,7 @@ public:
const css::uno::Sequence<css::beans::PropertyValue> &
getDiagramDoms() { return maDiagramDoms; }
void setDiagramDoms(const css::uno::Sequence<css::beans::PropertyValue>& rDiagramDoms) { maDiagramDoms = rDiagramDoms; }
+ void setDiagramData(const DiagramDataPtr& pDiagramData) { mpDiagramData = pDiagramData; }
css::uno::Sequence< css::uno::Sequence< css::uno::Any > >resolveRelationshipsOfTypeFromOfficeDoc(
core::XmlFilterBase& rFilter, const OUString& sFragment, const OUString& sType );
void setLinkedTxbxAttributes(const LinkedTxbxAttr& rhs){ maLinkedTxbxAttr = rhs; };
@@ -352,6 +356,7 @@ private:
bool mbHasLinkedTxbx; // this text box has linked text box ?
css::uno::Sequence<css::beans::PropertyValue> maDiagramDoms;
+ DiagramDataPtr mpDiagramData;
/// Z-Order.
sal_Int32 mnZOrder = 0;
diff --git a/include/svx/DiagramDataInterface.hxx b/include/svx/DiagramDataInterface.hxx
new file mode 100644
index 000000000000..439f2efeefdb
--- /dev/null
+++ b/include/svx/DiagramDataInterface.hxx
@@ -0,0 +1,38 @@
+/* -*- 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 .
+ */
+#ifndef INCLUDED_SVX_DIAGRAMDATAINTERFACE_HXX
+#define INCLUDED_SVX_DIAGRAMDATAINTERFACE_HXX
+
+#include <rtl/ustring.h>
+#include <sal/types.h>
+
+/// Interface class to access diagram data for UI
+class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI DiagramDataInterface
+{
+public:
+ // get text representation of data tree
+ virtual OUString getString() const = 0;
+
+protected:
+ ~DiagramDataInterface() throw() {}
+};
+
+#endif // INCLUDED_SVX_DIAGRAMDATAINTERFACE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 36f29f9d9fcf..0b1e5c3a832b 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -28,6 +28,7 @@
#include <svl/lstner.hxx>
#include <svl/poolitem.hxx>
#include <svl/typedwhich.hxx>
+#include <svx/DiagramDataInterface.hxx>
#include <svx/svdtypes.hxx>
#include <svx/svxdllapi.h>
#include <svx/shapeproperty.hxx>
@@ -375,6 +376,9 @@ public:
const double* GetRelativeHeight() const;
sal_Int16 GetRelativeHeightRelation() const;
+ void SetDiagramData(std::shared_ptr<DiagramDataInterface> pDiagramData);
+ std::shared_ptr<DiagramDataInterface> GetDiagramData() const;
+
/// @param bNotMyself = true: set only ObjList to dirty, don't mark this object as dirty.
///
/// This is needed for instance for NbcMove, because usually one moves SnapRect and aOutRect