Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / oox / source / drawingml / diagram / diagramhelper.hxx
blob626d40382d7edf63e7c9b47258f64c8bf60be64b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_OOX_DRAWINGML_DIAGRAM_DIAGRAMHELPER_HXX
21 #define INCLUDED_OOX_DRAWINGML_DIAGRAM_DIAGRAMHELPER_HXX
23 #include <rtl/ustring.hxx>
24 #include <oox/drawingml/theme.hxx>
25 #include <oox/shape/ShapeFilterBase.hxx>
26 #include <svx/svdogrp.hxx>
27 #include <svx/diagram/IDiagramHelper.hxx>
29 namespace svx { namespace diagram {
30 class DiagramDataState;
33 namespace oox::drawingml {
35 class Diagram;
37 // Advanced DiagramHelper
39 // This helper tries to hold all necessary data to re-layout
40 // all XShapes/SdrObjects of an already imported Diagram. The
41 // Diagram holds the SmarArt model data before it gets layouted,
42 // while Theme holds the oox Fill/Line/Style definitions to
43 // apply.
44 // Re-Layouting (re-creating) is rather complex, for detailed
45 // information see ::reLayout implementation.
46 // This helper class may/should be extended to:
47 // - deliver representative data from the Diagram-Model
48 // - modify it eventually
49 // - im/export Diagram model to other representations
50 class AdvancedDiagramHelper final : public svx::diagram::IDiagramHelper
52 const std::shared_ptr< Diagram > mpDiagramPtr;
53 std::shared_ptr<::oox::drawingml::Theme> mpThemePtr;
55 css::awt::Size maImportSize;
57 bool hasDiagramData() const;
59 public:
60 AdvancedDiagramHelper(
61 std::shared_ptr< Diagram > xDiagramPtr,
62 std::shared_ptr<::oox::drawingml::Theme> xTheme,
63 css::awt::Size aImportSize);
64 virtual ~AdvancedDiagramHelper();
66 // re-create XShapes
67 virtual void reLayout(SdrObjGroup& rTarget) override;
69 // get text representation of data tree
70 virtual OUString getString() const override;
72 // get children of provided data node
73 // use empty string for top-level nodes
74 // returns vector of (id, text)
75 virtual std::vector<std::pair<OUString, OUString>> getChildren(const OUString& rParentId) const override;
77 // add/remove new top-level node to data model, returns its id
78 virtual OUString addNode(const OUString& rText) override;
79 virtual bool removeNode(const OUString& rNodeId) override;
81 // Undo/Redo helpers to extract/restore Diagram-defining data
82 virtual std::shared_ptr< svx::diagram::DiagramDataState > extractDiagramDataState() const override;
83 virtual void applyDiagramDataState(const std::shared_ptr< svx::diagram::DiagramDataState >& rState) override;
85 void doAnchor(SdrObjGroup& rTarget, ::oox::drawingml::Shape& rRootShape);
86 const std::shared_ptr< ::oox::drawingml::Theme >& getOrCreateThemePtr(
87 rtl::Reference< oox::shape::ShapeFilterBase>& rxFilter ) const;
92 #endif
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */