LibreOffice Module oox (master)  1
oox/source/drawingml/diagram/diagram.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_SOURCE_DRAWINGML_DIAGRAM_DIAGRAM_HXX
21 #define INCLUDED_OOX_SOURCE_DRAWINGML_DIAGRAM_DIAGRAM_HXX
22 
23 #include <map>
24 #include <memory>
25 #include <vector>
26 
27 #include <rtl/ustring.hxx>
28 
29 #include "datamodel.hxx"
30 #include <oox/drawingml/shape.hxx>
31 
32 namespace com::sun::star {
33  namespace xml::dom { class XDocument; }
34 }
35 
36 namespace oox::drawingml {
37 
38 class Diagram;
39 class LayoutNode;
40 typedef std::shared_ptr< LayoutNode > LayoutNodePtr;
41 class LayoutAtom;
42 typedef std::shared_ptr<LayoutAtom> LayoutAtomPtr;
43 
44 typedef std::map< OUString, css::uno::Reference<css::xml::dom::XDocument> > DiagramDomMap;
45 
46 typedef std::map<OUString, LayoutAtomPtr> LayoutAtomMap;
47 typedef std::map<const dgm::Point*, ShapePtr> PresPointShapeMap;
48 
50 {
51 public:
53  : mrDgm(rDgm)
54  {
55  }
56  void setDefStyle( const OUString & sDefStyle )
57  { msDefStyle = sDefStyle; }
58  void setMinVer( const OUString & sMinVer )
59  { msMinVer = sMinVer; }
60  void setUniqueId( const OUString & sUniqueId )
61  { msUniqueId = sUniqueId; }
62  void setTitle( const OUString & sTitle )
63  { msTitle = sTitle; }
64  void setDesc( const OUString & sDesc )
65  { msDesc = sDesc; }
66  Diagram& getDiagram() { return mrDgm; }
67  LayoutNodePtr & getNode()
68  { return mpNode; }
69  const LayoutNodePtr & getNode() const
70  { return mpNode; }
72  { return mpSampData; }
73  const DiagramDataPtr & getSampData() const
74  { return mpSampData; }
76  { return mpStyleData; }
77  const DiagramDataPtr & getStyleData() const
78  { return mpStyleData; }
79  LayoutAtomMap & getLayoutAtomMap()
80  { return maLayoutAtomMap; }
81  PresPointShapeMap & getPresPointShapeMap()
82  { return maPresPointShapeMap; }
83 
84 private:
86  OUString msDefStyle;
87  OUString msMinVer;
88  OUString msUniqueId;
89 
90  OUString msTitle;
91  OUString msDesc;
92  LayoutNodePtr mpNode;
95  // TODO
96  // catLst
97  // clrData
98 
99  LayoutAtomMap maLayoutAtomMap;
100  PresPointShapeMap maPresPointShapeMap;
101 };
102 
103 typedef std::shared_ptr< DiagramLayout > DiagramLayoutPtr;
104 
106 {
111 };
112 
113 typedef std::map<OUString,DiagramStyle> DiagramQStyleMap;
114 
116 {
117  std::vector<oox::drawingml::Color> maFillColors;
118  std::vector<oox::drawingml::Color> maLineColors;
119  std::vector<oox::drawingml::Color> maEffectColors;
120  std::vector<oox::drawingml::Color> maTextFillColors;
121  std::vector<oox::drawingml::Color> maTextLineColors;
122  std::vector<oox::drawingml::Color> maTextEffectColors;
123 
124  static const oox::drawingml::Color&
125  getColorByIndex(const std::vector<oox::drawingml::Color>& rColors, sal_Int32 nIndex);
126 };
127 
128 typedef std::map<OUString,DiagramColor> DiagramColorMap;
129 
130 class Diagram
131 {
132 public:
133  explicit Diagram(const ShapePtr& pShape);
134  void setData( const DiagramDataPtr & pData )
135  { mpData = pData; }
136  const DiagramDataPtr& getData() const
137  { return mpData; }
138  void setLayout( const DiagramLayoutPtr & pLayout )
139  { mpLayout = pLayout; }
140  const DiagramLayoutPtr& getLayout() const
141  { return mpLayout; }
142 
143  DiagramQStyleMap& getStyles() { return maStyles; }
144  const DiagramQStyleMap& getStyles() const { return maStyles; }
145  DiagramColorMap& getColors() { return maColors; }
146  const DiagramColorMap& getColors() const { return maColors; }
147  DiagramDomMap & getDomMap() { return maMainDomMap; }
148  css::uno::Sequence< css::uno::Sequence< css::uno::Any > > & getDataRelsMap() { return maDataRelsMap; }
149  void addTo( const ShapePtr & pShape );
150 
151  css::uno::Sequence<css::beans::PropertyValue> getDomsAsPropertyValues() const;
152  const ShapePtr & getShape() const { return mpShape; }
153 
154 private:
157  DiagramLayoutPtr mpLayout;
158  DiagramQStyleMap maStyles;
159  DiagramColorMap maColors;
160  DiagramDomMap maMainDomMap;
161  css::uno::Sequence< css::uno::Sequence< css::uno::Any > > maDataRelsMap;
162 };
163 
164 typedef std::shared_ptr< Diagram > DiagramPtr;
165 
166 }
167 
168 #endif
169 
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< Diagram > DiagramPtr
std::vector< oox::drawingml::Color > maTextLineColors
std::shared_ptr< DiagramData > DiagramDataPtr
Definition: datamodel.hxx:199
const DiagramColorMap & getColors() const
static const oox::drawingml::Color & getColorByIndex(const std::vector< oox::drawingml::Color > &rColors, sal_Int32 nIndex)
Definition: diagram.cxx:459
std::map< OUString, DiagramStyle > DiagramQStyleMap
std::map< const dgm::Point *, ShapePtr > PresPointShapeMap
css::uno::Sequence< css::uno::Sequence< css::uno::Any > > maDataRelsMap
void setLayout(const DiagramLayoutPtr &pLayout)
std::vector< oox::drawingml::Color > maEffectColors
abstract Atom for the layout
const DiagramLayoutPtr & getLayout() const
std::map< OUString, css::uno::Reference< css::xml::dom::XDocument > > DiagramDomMap
css::uno::Sequence< css::uno::Sequence< css::uno::Any > > & getDataRelsMap()
const DiagramQStyleMap & getStyles() const
std::map< OUString, LayoutAtomPtr > LayoutAtomMap
std::shared_ptr< DiagramLayout > DiagramLayoutPtr
css::uno::Sequence< css::beans::PropertyValue > getDomsAsPropertyValues() const
Definition: diagram.cxx:144
std::shared_ptr< LayoutNode > LayoutNodePtr
const DiagramDataPtr & getData() const
std::vector< oox::drawingml::Color > maTextEffectColors
std::shared_ptr< LayoutAtom > LayoutAtomPtr
void setData(const DiagramDataPtr &pData)
std::map< OUString, DiagramColor > DiagramColorMap
std::vector< oox::drawingml::Color > maFillColors
void addTo(const ShapePtr &pShape)
Definition: diagram.cxx:105
Diagram(const ShapePtr &pShape)
Definition: diagram.cxx:139
std::shared_ptr< Shape > ShapePtr
std::vector< oox::drawingml::Color > maTextFillColors
std::vector< oox::drawingml::Color > maLineColors