LibreOffice Module oox (master) 1
diagramhelper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_OOX_DRAWINGML_DIAGRAM_DIAGRAMHELPER_HXX
21#define INCLUDED_OOX_DRAWINGML_DIAGRAM_DIAGRAMHELPER_HXX
22
23#include <rtl/ustring.hxx>
26#include <svx/svdogrp.hxx>
28
29namespace svx { namespace diagram {
30 class DiagramDataState;
31}}
32
33namespace oox::drawingml {
34
35class Diagram;
36
37// Advanced DiagramHelper
38//
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
51{
52 const std::shared_ptr< Diagram > mpDiagramPtr;
53 std::shared_ptr<::oox::drawingml::Theme> mpThemePtr;
54
55 css::awt::Size maImportSize;
56
57 bool hasDiagramData() const;
58
59public:
61 std::shared_ptr< Diagram > xDiagramPtr,
62 std::shared_ptr<::oox::drawingml::Theme> xTheme,
63 css::awt::Size aImportSize);
64 virtual ~AdvancedDiagramHelper();
65
66 // re-create XShapes
67 virtual void reLayout(SdrObjGroup& rTarget) override;
68
69 // get text representation of data tree
70 virtual OUString getString() const override;
71
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;
76
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;
80
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;
84
85 void doAnchor(SdrObjGroup& rTarget, ::oox::drawingml::Shape& rRootShape);
86 const std::shared_ptr< ::oox::drawingml::Theme >& getOrCreateThemePtr(
88};
89
90}
91
92#endif
93
94/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool removeNode(const OUString &rNodeId) override
void doAnchor(SdrObjGroup &rTarget, ::oox::drawingml::Shape &rRootShape)
std::shared_ptr<::oox::drawingml::Theme > mpThemePtr
const std::shared_ptr< Diagram > mpDiagramPtr
virtual std::shared_ptr< svx::diagram::DiagramDataState > extractDiagramDataState() const override
const std::shared_ptr< ::oox::drawingml::Theme > & getOrCreateThemePtr(rtl::Reference< oox::shape::ShapeFilterBase > &rxFilter) const
AdvancedDiagramHelper(std::shared_ptr< Diagram > xDiagramPtr, std::shared_ptr<::oox::drawingml::Theme > xTheme, css::awt::Size aImportSize)
virtual OUString addNode(const OUString &rText) override
virtual void reLayout(SdrObjGroup &rTarget) override
virtual void applyDiagramDataState(const std::shared_ptr< svx::diagram::DiagramDataState > &rState) override
virtual OUString getString() const override
virtual std::vector< std::pair< OUString, OUString > > getChildren(const OUString &rParentId) const override