KEYStyles.h Source File documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

KEYStyles.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libetonyek 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
10 #ifndef KEYSTYLES_H_INCLUDED
11 #define KEYSTYLES_H_INCLUDED
12
13 #include <string>
14
15 #include <boost/optional.hpp>
16 #include <boost/shared_ptr.hpp>
17 #include <boost/unordered_map.hpp>
18
19 #include "KEYEnum.h"
20 #include "KEYPropertyMap.h"
21 #include "KEYStyle.h"
22 #include "KEYStyleContext.h"
23 #include "KEYStyles_fwd.h"
24 #include "KEYTypes.h"
25
26 namespace libetonyek
27 {
28
31 class KEYStyleBase : public KEYStyle
32 {
33 public:
34 virtual bool link(const KEYStylesheetPtr_t &stylesheet);
35
36 virtual void flatten();
37
38 // ensure that this class cannot be instantiated
39 protected:
40 KEYStyleBase(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
41 virtual ~KEYStyleBase();
42
43 virtual const KEYPropertyMap &getPropertyMap() const;
44
45 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const = 0;
46
53 boost::any lookup(const char *property, const KEYStyleContext &context = KEYStyleContext()) const;
54
55 private:
56 KEYPropertyMap m_props;
57
58 const boost::optional<std::string> m_ident;
59 const boost::optional<std::string> m_parentIdent;
60 KEYStylePtr_t m_parent;
61 };
62
65 class KEYCellStyle : public KEYStyleBase
66 {
67 public:
68 KEYCellStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
69
70 private:
71 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
72 };
73
76 class KEYCharacterStyle : public KEYStyleBase
77 {
78 public:
79 KEYCharacterStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
80
81 boost::optional<KEYBaseline> getBaseline(const KEYStyleContext &context = KEYStyleContext()) const;
82 boost::optional<double> getBaselineShift(const KEYStyleContext &context = KEYStyleContext()) const;
83 boost::optional<bool> getBold(const KEYStyleContext &context = KEYStyleContext()) const;
84 boost::optional<KEYCapitalization> getCapitalization(const KEYStyleContext &context = KEYStyleContext()) const;
85 boost::optional<bool> getItalic(const KEYStyleContext &context = KEYStyleContext()) const;
86 boost::optional<KEYColor> getFontColor(const KEYStyleContext &context = KEYStyleContext()) const;
87 boost::optional<double> getFontSize(const KEYStyleContext &context = KEYStyleContext()) const;
88 boost::optional<std::string> getFontName(const KEYStyleContext &context = KEYStyleContext()) const;
89 boost::optional<bool> getOutline(const KEYStyleContext &context = KEYStyleContext()) const;
90 boost::optional<bool> getStrikethru(const KEYStyleContext &context = KEYStyleContext()) const;
91 boost::optional<bool> getUnderline(const KEYStyleContext &context = KEYStyleContext()) const;
92
93 private:
94 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
95 };
96
99 class KEYConnectionStyle : public KEYStyleBase
100 {
101 public:
102 KEYConnectionStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
103
104 private:
105 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
106 };
107
110 class KEYGraphicStyle : public KEYStyleBase
111 {
112 public:
113 KEYGraphicStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
114
115 private:
116 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
117 };
118
121 class KEYLayoutStyle : public KEYStyleBase
122 {
123 public:
124 KEYLayoutStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
125
126 private:
127 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
128 };
129
132 class KEYListStyle : public KEYStyleBase
133 {
134 public:
135 KEYListStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
136
137 private:
138 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
139 };
140
143 class KEYParagraphStyle : public KEYCharacterStyle
144 {
145 public:
146 KEYParagraphStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
147
148 boost::optional<KEYAlignment> getAlignment(const KEYStyleContext &context = KEYStyleContext()) const;
149 boost::optional<KEYTabStops_t> getTabs(const KEYStyleContext &context = KEYStyleContext()) const;
150
151 private:
152 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
153 };
154
157 class KEYPlaceholderStyle : public KEYStyleBase
158 {
159 public:
160 KEYPlaceholderStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
161
162 KEYGeometryPtr_t getGeometry(const KEYStyleContext &context = KEYStyleContext()) const;
163
164 private:
165 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
166 };
167
170 class KEYSlideStyle : public KEYStyleBase
171 {
172 public:
173 KEYSlideStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
174
175 private:
176 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
177 };
178
181 class KEYTabularStyle : public KEYStyleBase
182 {
183 public:
184 KEYTabularStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
185
186 private:
187 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
188 };
189
192 class KEYVectorStyle : public KEYStyleBase
193 {
194 public:
195 KEYVectorStyle(const KEYPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
196
197 private:
198 virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const;
199 };
200
201 }
202
203 #endif // KEYSTYLES_H_INCLUDED
204
205 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek::KEYParagraphStyle::getTabs
boost::optional< KEYTabStops_t > getTabs(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:209
libetonyek::KEYConnectionStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:164
libetonyek
Definition: EtonyekDocument.cpp:40
libetonyek::KEYListStyle::KEYListStyle
KEYListStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:189
libetonyek::KEYVectorStyle::KEYVectorStyle
KEYVectorStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:254
libetonyek::KEYStyleBase::m_ident
const boost::optional< std::string > m_ident
Definition: KEYStyles.h:58
libetonyek::KEYStyleBase::KEYStyleBase
KEYStyleBase(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:68
libetonyek::KEYTabularStyle::KEYTabularStyle
KEYTabularStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:244
libetonyek::KEYGraphicStyle::KEYGraphicStyle
KEYGraphicStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:169
libetonyek::KEYPlaceholderStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:229
libetonyek::KEYLayoutStyle::KEYLayoutStyle
KEYLayoutStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:179
libetonyek::KEYStyleBase::m_props
KEYPropertyMap m_props
Definition: KEYStyles.h:56
KEYTypes.h
libetonyek::KEYStyleBase::m_parentIdent
const boost::optional< std::string > m_parentIdent
Definition: KEYStyles.h:59
libetonyek::KEYPropertyMap
Represents a (hierarchical) property map.
Definition: KEYPropertyMap.h:21
libetonyek::KEYCharacterStyle::getFontName
boost::optional< std::string > getFontName(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:134
libetonyek::KEYCharacterStyle::getStrikethru
boost::optional< bool > getStrikethru(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:144
KEYStyleContext.h
KEYEnum.h
libetonyek::KEYListStyle
Represents a list style.
Definition: KEYStyles.h:132
libetonyek::KEYCharacterStyle::getFontSize
boost::optional< double > getFontSize(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:129
libetonyek::KEYLayoutStyle
Represents a layout style.
Definition: KEYStyles.h:121
libetonyek::KEYParagraphStyle::getAlignment
boost::optional< KEYAlignment > getAlignment(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:204
libetonyek::KEYSlideStyle::KEYSlideStyle
KEYSlideStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:234
libetonyek::KEYVectorStyle
Represents a vector style.
Definition: KEYStyles.h:192
libetonyek::KEYStyleBase::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const =0
libetonyek::KEYCharacterStyle::KEYCharacterStyle
KEYCharacterStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:104
libetonyek::KEYStylePtr_t
boost::shared_ptr< KEYStyle > KEYStylePtr_t
Definition: KEYStyle.h:49
libetonyek::KEYTabularStyle
Represents a tabular style.
Definition: KEYStyles.h:181
libetonyek::KEYCharacterStyle::getBaselineShift
boost::optional< double > getBaselineShift(const KEYStyleContext &context=KEYStyleContext()) const
libetonyek::KEYListStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:194
libetonyek::KEYCellStyle
Represents a cell style.
Definition: KEYStyles.h:65
libetonyek::KEYCellStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:99
libetonyek::KEYStyleBase::link
virtual bool link(const KEYStylesheetPtr_t &stylesheet)
Find the parent style by its ID.
Definition: KEYStyles.cpp:43
libetonyek::KEYVectorStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:259
libetonyek::KEYCellStyle::KEYCellStyle
KEYCellStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:94
libetonyek::KEYCharacterStyle::getBaseline
boost::optional< KEYBaseline > getBaseline(const KEYStyleContext &context=KEYStyleContext()) const
libetonyek::KEYCharacterStyle::getFontColor
boost::optional< KEYColor > getFontColor(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:124
KEYPropertyMap.h
libetonyek::KEYStyleBase
A common implementation of a style.
Definition: KEYStyles.h:31
libetonyek::KEYParagraphStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:214
libetonyek::KEY2Token::stylesheet
Definition: KEY2Token.h:800
libetonyek::KEYPlaceholderStyle
Represents a placeholder style.
Definition: KEYStyles.h:157
libetonyek::KEYStyleBase::lookup
boost::any lookup(const char *property, const KEYStyleContext &context=KEYStyleContext()) const
Look up a property in this style.
Definition: KEYStyles.cpp:85
libetonyek::KEYCharacterStyle::getBold
boost::optional< bool > getBold(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:109
libetonyek::PAGToken::property
Definition: PAGToken.h:938
libetonyek::KEYConnectionStyle
Represents a connection style.
Definition: KEYStyles.h:99
libetonyek::KEYStyleBase::m_parent
KEYStylePtr_t m_parent
Definition: KEYStyles.h:60
libetonyek::KEYCharacterStyle::getCapitalization
boost::optional< KEYCapitalization > getCapitalization(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:114
libetonyek::KEYLayoutStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:184
libetonyek::KEYConnectionStyle::KEYConnectionStyle
KEYConnectionStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:159
libetonyek::KEYPlaceholderStyle::KEYPlaceholderStyle
KEYPlaceholderStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:219
libetonyek::KEYStyleBase::getPropertyMap
virtual const KEYPropertyMap & getPropertyMap() const
Get the style's property map.
Definition: KEYStyles.cpp:80
libetonyek::KEYCharacterStyle
Represents a character style.
Definition: KEYStyles.h:76
libetonyek::KEYParagraphStyle
Represents a paragraph style.
Definition: KEYStyles.h:143
libetonyek::KEYGeometryPtr_t
boost::shared_ptr< KEYGeometry > KEYGeometryPtr_t
Definition: KEYTypes_fwd.h:25
libetonyek::KEYStyleBase::flatten
virtual void flatten()
Copy attributes from parent style (recursively).
Definition: KEYStyles.cpp:63
libetonyek::KEYPlaceholderStyle::getGeometry
KEYGeometryPtr_t getGeometry(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:224
libetonyek::KEYTabularStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:249
KEYStyle.h
libetonyek::KEYSlideStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:239
libetonyek::KEYGraphicStyle
Represents a graphic style.
Definition: KEYStyles.h:110
libetonyek::KEYCharacterStyle::getItalic
boost::optional< bool > getItalic(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:119
libetonyek::KEYCharacterStyle::getUnderline
boost::optional< bool > getUnderline(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:149
libetonyek::KEYCharacterStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:154
libetonyek::KEYStyle
Represents a hierarchical style.
Definition: KEYStyle.h:26
libetonyek::KEYStyleBase::~KEYStyleBase
virtual ~KEYStyleBase()
Definition: KEYStyles.cpp:76
libetonyek::KEYCharacterStyle::getOutline
boost::optional< bool > getOutline(const KEYStyleContext &context=KEYStyleContext()) const
Definition: KEYStyles.cpp:139
KEYStyles_fwd.h
libetonyek::KEYStylesheetPtr_t
boost::shared_ptr< KEYStylesheet > KEYStylesheetPtr_t
Definition: KEYStylesheet.h:19
libetonyek::KEY2Token::ident
Definition: KEY2Token.h:997
libetonyek::KEY1Token::string
Definition: KEY1Token.h:75
libetonyek::KEYGraphicStyle::find
virtual KEYStylePtr_t find(const KEYStylesheetPtr_t &stylesheet, const std::string &ident) const
Definition: KEYStyles.cpp:174
libetonyek::KEYStyleContext
Representation of a dynamic inheritance of styles.
Definition: KEYStyleContext.h:34
libetonyek::KEYSlideStyle
Represents a slide style.
Definition: KEYStyles.h:170
libetonyek::KEYParagraphStyle::KEYParagraphStyle
KEYParagraphStyle(const KEYPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition: KEYStyles.cpp:199