IWORKStyle.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 IWORKSTYLE_H_INCLUDED
11#define IWORKSTYLE_H_INCLUDED
12
13#include "IWORKStyle_fwd.h"
14
15#include <boost/any.hpp>
16#include <boost/optional.hpp>
17
18#include "IWORKPropertyMap.h"
19#include "IWORKStylesheet.h"
20
21namespace libetonyek
22{
23
24class IWORKStyleStack;
25
29{
30public:
31 IWORKStyle(const IWORKPropertyMap &props, const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent);
32 IWORKStyle(const IWORKPropertyMap &props, const boost::optional<std::string> &ident, const IWORKStylePtr_t &parent);
34
41
46 void flatten();
47
50 const IWORKPropertyMap &getPropertyMap() const;
51
55
60 template<class Property>
61 bool has() const
62 {
63 return m_props.has<Property>(true);
64 }
65
70 template<class Property>
72 {
73 return m_props.get<Property>(true);
74 }
75
76 const boost::optional<std::string> &getIdent() const;
77
78 void setParent(const IWORKStylePtr_t parent);
79
82
83protected:
84 const boost::optional<std::string> &getParentIdent() const;
85 const IWORKStylePtr_t getParent() const;
86
87private:
89 bool reaches(const IWORKStyle *style) const;
90
92
93 const boost::optional<std::string> m_ident;
94 const boost::optional<std::string> m_parentIdent;
96};
97
98}
99
100#endif // IWORKSTYLE_H_INCLUDED
101
102/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Represents a (hierarchical) property map.
Definition IWORKPropertyMap.h:27
Representation of a dynamic inheritance of styles.
Definition IWORKStyleStack.h:35
Represents a hierarchical style.
Definition IWORKStyle.h:29
IWORKStylePtr_t m_parent
Definition IWORKStyle.h:95
const boost::optional< std::string > & getIdent() const
Definition IWORKStyle.cpp:113
const boost::optional< std::string > m_ident
Definition IWORKStyle.h:93
void flatten()
Copy attributes from parent style (recursively).
Definition IWORKStyle.cpp:98
const IWORKStylePtr_t getParent() const
Definition IWORKStyle.cpp:123
void setParent(const IWORKStylePtr_t parent)
Definition IWORKStyle.cpp:128
const boost::optional< std::string > & getParentIdent() const
Definition IWORKStyle.cpp:118
const boost::optional< std::string > m_parentIdent
Definition IWORKStyle.h:94
bool has() const
Check for the presence of a property.
Definition IWORKStyle.h:61
IWORKPropertyMap m_props
Definition IWORKStyle.h:91
const IWORKPropertyMap & getPropertyMap() const
Get the style's property map.
Definition IWORKStyle.cpp:103
void createListLevelStyles()
Creates the list level properties of a list style if it does not exists.
Definition IWORKStyle.cpp:135
const IWORKPropertyInfo< Property >::ValueType & get() const
Retrieve the value of a property.
Definition IWORKStyle.h:71
bool reaches(const IWORKStyle *style) const
Returns true if style is this style, or one this style holds through parents or properties.
Definition IWORKStyle.cpp:80
IWORKStyle(const IWORKPropertyMap &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent)
Definition IWORKStyle.cpp:24
~IWORKStyle()
Definition IWORKStyle.cpp:42
@ ident
Definition IWORKToken.h:566
@ stylesheet
Definition IWORKToken.h:424
@ link
Definition IWORKToken.h:308
@ style
Definition IWORKToken.h:421
Definition IWORKBezierElement.cpp:21
std::shared_ptr< IWORKStylesheet > IWORKStylesheetPtr_t
Definition IWORKStylesheet.h:20
std::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition IWORKStyle_fwd.h:23
Definition IWORKPropertyInfo.h:22

Generated for libetonyek by doxygen 1.16.1