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 typedef std::map< OUString, css::uno::Reference<css::xml::dom::XDocument> > DiagramDomMap;
44 typedef std::map< OUString, LayoutAtomPtr > LayoutAtomMap;
45 typedef std::map< const svx::diagram::Point*, ShapePtr > PresPointShapeMap;
46 
48 {
49 public:
51  : mrDgm(rDgm)
52  {
53  }
54  void setDefStyle( const OUString & sDefStyle )
55  { msDefStyle = sDefStyle; }
56  void setMinVer( const OUString & sMinVer )
57  { msMinVer = sMinVer; }
58  void setUniqueId( const OUString & sUniqueId )
59  { msUniqueId = sUniqueId; }
60  void setTitle( const OUString & sTitle )
61  { msTitle = sTitle; }
62  void setDesc( const OUString & sDesc )
63  { msDesc = sDesc; }
64  Diagram& getDiagram() { return mrDgm; }
65  LayoutNodePtr & getNode()
66  { return mpNode; }
67  const LayoutNodePtr & getNode() const
68  { return mpNode; }
70  { return mpSampData; }
72  { return mpSampData; }
74  { return mpStyleData; }
76  { return mpStyleData; }
77  LayoutAtomMap & getLayoutAtomMap()
78  { return maLayoutAtomMap; }
79  PresPointShapeMap & getPresPointShapeMap()
80  { return maPresPointShapeMap; }
81 
82 private:
84  OUString msDefStyle;
85  OUString msMinVer;
86  OUString msUniqueId;
87 
88  OUString msTitle;
89  OUString msDesc;
90  LayoutNodePtr mpNode;
93  // TODO
94  // catLst
95  // clrData
96 
97  LayoutAtomMap maLayoutAtomMap;
98  PresPointShapeMap maPresPointShapeMap;
99 };
100 
101 typedef std::shared_ptr< DiagramLayout > DiagramLayoutPtr;
102 
104 {
109 };
110 
111 typedef std::map<OUString,DiagramStyle> DiagramQStyleMap;
112 
114 {
115  std::vector<oox::drawingml::Color> maFillColors;
116  std::vector<oox::drawingml::Color> maLineColors;
117  std::vector<oox::drawingml::Color> maEffectColors;
118  std::vector<oox::drawingml::Color> maTextFillColors;
119  std::vector<oox::drawingml::Color> maTextLineColors;
120  std::vector<oox::drawingml::Color> maTextEffectColors;
121 
122  static const oox::drawingml::Color&
123  getColorByIndex(const std::vector<oox::drawingml::Color>& rColors, sal_Int32 nIndex);
124 };
125 
126 typedef std::map<OUString,DiagramColor> DiagramColorMap;
127 
128 class Diagram
129 {
130 public:
131  explicit Diagram();
132  void setData( OoxDiagramDataPtr& pData )
133  { mpData = pData; }
134  const OoxDiagramDataPtr& getData() const
135  { return mpData; }
136  void setLayout( const DiagramLayoutPtr & pLayout )
137  { mpLayout = pLayout; }
138  const DiagramLayoutPtr& getLayout() const
139  { return mpLayout; }
140 
141  DiagramQStyleMap& getStyles() { return maStyles; }
142  const DiagramQStyleMap& getStyles() const { return maStyles; }
143  DiagramColorMap& getColors() { return maColors; }
144  const DiagramColorMap& getColors() const { return maColors; }
145  DiagramDomMap & getDomMap() { return maMainDomMap; }
146  css::uno::Sequence< css::uno::Sequence< css::uno::Any > > & getDataRelsMap() { return maDataRelsMap; }
147  void addTo( const ShapePtr & pShape );
148 
149  css::uno::Sequence<css::beans::PropertyValue> getDomsAsPropertyValues() const;
151  void syncDiagramFontHeights();
152 
153 private:
154  // This contains groups of shapes: automatic font size is the same in each group.
156 
158  DiagramLayoutPtr mpLayout;
159  DiagramQStyleMap maStyles;
160  DiagramColorMap maColors;
161  DiagramDomMap maMainDomMap;
162  css::uno::Sequence< css::uno::Sequence< css::uno::Any > > maDataRelsMap;
163 };
164 
165 typedef std::shared_ptr< Diagram > DiagramPtr;
166 
167 }
168 
169 #endif
170 
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< Diagram > DiagramPtr
oox::core::NamedShapePairs & getDiagramFontHeights()
std::vector< oox::drawingml::Color > maTextLineColors
const OoxDiagramDataPtr & getStyleData() const
std::map< OUString, ShapePairs > NamedShapePairs
const DiagramColorMap & getColors() const
static const oox::drawingml::Color & getColorByIndex(const std::vector< oox::drawingml::Color > &rColors, sal_Int32 nIndex)
Definition: diagram.cxx:432
std::map< OUString, DiagramStyle > DiagramQStyleMap
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
std::shared_ptr< DiagramData > OoxDiagramDataPtr
Definition: datamodel.hxx:74
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::shared_ptr< DiagramLayout > DiagramLayoutPtr
css::uno::Sequence< css::beans::PropertyValue > getDomsAsPropertyValues() const
Definition: diagram.cxx:152
std::shared_ptr< LayoutNode > LayoutNodePtr
std::vector< oox::drawingml::Color > maTextEffectColors
std::shared_ptr< LayoutAtom > LayoutAtomPtr
std::map< OUString, LayoutAtomPtr > LayoutAtomMap
std::map< OUString, DiagramColor > DiagramColorMap
const OoxDiagramDataPtr & getData() const
std::vector< oox::drawingml::Color > maFillColors
void addTo(const ShapePtr &pShape)
Definition: diagram.cxx:108
const OoxDiagramDataPtr & getSampData() const
std::map< const svx::diagram::Point *, ShapePtr > PresPointShapeMap
std::shared_ptr< Shape > ShapePtr
std::vector< oox::drawingml::Color > maTextFillColors
std::vector< oox::drawingml::Color > maLineColors