RVNGHTMLTextTextStyle.h Source File documentation

RVNGHTMLTextTextStyle.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* librevenge
3 * Version: MPL 2.0 / LGPLv2.1+
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 * Major Contributor(s):
10 * Copyright (C) 2002-2004 William Lachance (wrlach@gmail.com)
11 * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
12 * Copyright (C) 2004 Fridrich Strba (fridrich.strba@bluewin.ch)
13 * Copyright (C) 2005 Net Integration Technologies (http://www.net-itech.com)
14 *
15 * For minor contributions see the git repository.
16 *
17 * Alternatively, the contents of this file may be used under the terms
18 * of the GNU Lesser General Public License Version 2.1 or later
19 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
20 * applicable instead of those above.
21 */
22
23 #ifndef RVNGHTMLTEXT_TEXTSTYLE_H
24 #define RVNGHTMLTEXT_TEXTSTYLE_H
25
26 #include <ostream>
27 #include <string>
28 #include <map>
29 #include <vector>
30
31 #include <librevenge-generators/librevenge-generators.h>
32
33 namespace librevenge
34 {
36 class RVNGHTMLTextParagraphStyleManager
37 {
38 public:
40 RVNGHTMLTextParagraphStyleManager() : m_contentNameMap(), m_idNameMap()
41 {
42 }
44 virtual ~RVNGHTMLTextParagraphStyleManager()
45 {
46 }
48 void defineParagraph(RVNGPropertyList const &pList);
50 std::string getClass(RVNGPropertyList const &pList);
52 void send(std::ostream &out);
53 protected:
55 std::string getContent(RVNGPropertyList const &pList, bool isList) const;
57 std::map<std::string, std::string> m_contentNameMap;
59 std::map<int, std::string> m_idNameMap;
61 void parseBorders(RVNGPropertyList const &pList, std::ostream &out) const;
62 private:
63 RVNGHTMLTextParagraphStyleManager(RVNGHTMLTextParagraphStyleManager const &orig);
64 RVNGHTMLTextParagraphStyleManager operator=(RVNGHTMLTextParagraphStyleManager const &orig);
65 };
66
68 class RVNGHTMLTextListStyleManager : public RVNGHTMLTextParagraphStyleManager
69 {
70 public:
71 struct List
72 {
74 List() : m_contentsList(), m_level(0)
75 {
76 }
78 ~List()
79 {
80 }
82 void setLevel(int lvl, RVNGPropertyList const &property, bool ordered);
84 void openLevel() const
85 {
86 m_level++;
87 }
89 void closeLevel() const
90 {
91 if (m_level <= 0)
92 return;
93 m_level--;
94 }
95
97 std::string str() const;
98 protected:
100 std::vector<std::string> m_contentsList;
102 mutable int m_level;
103 };
105 RVNGHTMLTextListStyleManager() : RVNGHTMLTextParagraphStyleManager(), m_levelNameMap(),
106 m_idListMap(), m_actualIdStack()
107 {
108 }
110 ~RVNGHTMLTextListStyleManager()
111 {
112 }
114 void defineLevel(RVNGPropertyList const &property, bool ordered);
116 std::string openLevel(RVNGPropertyList const &pList, bool ordered);
118 void closeLevel();
120 std::string getClass(RVNGPropertyList const &pList);
121
123 void send(std::ostream &out);
124 protected:
126 std::map<std::string, std::string> m_levelNameMap;
128 std::map<int, List> m_idListMap;
130 std::vector<int> m_actualIdStack;
131 private:
132 RVNGHTMLTextListStyleManager(RVNGHTMLTextListStyleManager const &orig);
133 RVNGHTMLTextListStyleManager operator=(RVNGHTMLTextListStyleManager const &orig);
134 };
135
137 class RVNGHTMLTextSpanStyleManager
138 {
139 public:
141 RVNGHTMLTextSpanStyleManager() : m_contentNameMap(), m_idNameMap()
142 {
143 }
145 ~RVNGHTMLTextSpanStyleManager()
146 {
147 }
149 void defineSpan(RVNGPropertyList const &pList);
151 std::string getClass(RVNGPropertyList const &pList);
153 void send(std::ostream &out);
154 protected:
156 std::string getContent(RVNGPropertyList const &pList) const;
158 void parseTextPosition(char const *value, std::ostream &out) const;
160 void parseDecorations(RVNGPropertyList const &pList, std::ostream &out) const;
162 std::map<std::string, std::string> m_contentNameMap;
164 std::map<int, std::string> m_idNameMap;
165
166 private:
167 RVNGHTMLTextSpanStyleManager(RVNGHTMLTextSpanStyleManager const &orig);
168 RVNGHTMLTextSpanStyleManager operator=(RVNGHTMLTextSpanStyleManager const &orig);
169 };
170 }
171
172 #endif
173 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
librevenge::RVNGHTMLTextListStyleManager
Small class to manage the list style.
Definition: RVNGHTMLTextTextStyle.h:68
librevenge::RVNGHTMLTextSpanStyleManager::m_contentNameMap
std::map< std::string, std::string > m_contentNameMap
a map content -> name
Definition: RVNGHTMLTextTextStyle.h:162
librevenge::RVNGHTMLTextSpanStyleManager::m_idNameMap
std::map< int, std::string > m_idNameMap
a map id -> name
Definition: RVNGHTMLTextTextStyle.h:164
librevenge
Definition: RVNGBinaryData.cpp:38
librevenge::RVNGHTMLTextListStyleManager::List
Definition: RVNGHTMLTextTextStyle.h:71
librevenge-generators.h
librevenge::RVNGHTMLTextListStyleManager::List::closeLevel
void closeLevel() const
open a new level
Definition: RVNGHTMLTextTextStyle.h:89
librevenge::RVNGHTMLTextParagraphStyleManager::getContent
std::string getContent(RVNGPropertyList const &pList, bool isList) const
convert a property list in a html content string
Definition: RVNGHTMLTextTextStyle.cpp:214
librevenge::RVNGHTMLTextParagraphStyleManager::m_contentNameMap
std::map< std::string, std::string > m_contentNameMap
a map content -> name
Definition: RVNGHTMLTextTextStyle.h:57
librevenge::RVNGHTMLTextParagraphStyleManager::defineParagraph
void defineParagraph(RVNGPropertyList const &pList)
define a paragraph style
Definition: RVNGHTMLTextTextStyle.cpp:191
librevenge::RVNGHTMLTextListStyleManager::List::m_contentsList
std::vector< std::string > m_contentsList
the properties
Definition: RVNGHTMLTextTextStyle.h:100
librevenge::RVNGHTMLTextParagraphStyleManager::getClass
std::string getClass(RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: RVNGHTMLTextTextStyle.cpp:173
librevenge::RVNGHTMLTextSpanStyleManager
Small class to manage the span style.
Definition: RVNGHTMLTextTextStyle.h:137
librevenge::RVNGHTMLTextSpanStyleManager::~RVNGHTMLTextSpanStyleManager
~RVNGHTMLTextSpanStyleManager()
destructor
Definition: RVNGHTMLTextTextStyle.h:145
librevenge::RVNGHTMLTextListStyleManager::m_actualIdStack
std::vector< int > m_actualIdStack
the actual list id
Definition: RVNGHTMLTextTextStyle.h:130
librevenge::RVNGHTMLTextParagraphStyleManager::parseBorders
void parseBorders(RVNGPropertyList const &pList, std::ostream &out) const
add data corresponding to the border
Definition: RVNGHTMLTextTextStyle.cpp:282
librevenge::RVNGHTMLTextSpanStyleManager::RVNGHTMLTextSpanStyleManager
RVNGHTMLTextSpanStyleManager()
constructor
Definition: RVNGHTMLTextTextStyle.h:141
librevenge::RVNGHTMLTextListStyleManager::~RVNGHTMLTextListStyleManager
~RVNGHTMLTextListStyleManager()
destructor
Definition: RVNGHTMLTextTextStyle.h:110
librevenge::RVNGHTMLTextListStyleManager::List::openLevel
void openLevel() const
open a new level
Definition: RVNGHTMLTextTextStyle.h:84
librevenge::RVNGHTMLTextListStyleManager::List::List
List()
constructor
Definition: RVNGHTMLTextTextStyle.h:74
librevenge::RVNGHTMLTextParagraphStyleManager::RVNGHTMLTextParagraphStyleManager
RVNGHTMLTextParagraphStyleManager()
constructor
Definition: RVNGHTMLTextTextStyle.h:40
librevenge::RVNGHTMLTextParagraphStyleManager::~RVNGHTMLTextParagraphStyleManager
virtual ~RVNGHTMLTextParagraphStyleManager()
destructor
Definition: RVNGHTMLTextTextStyle.h:44
librevenge::RVNGHTMLTextParagraphStyleManager::send
void send(std::ostream &out)
send the data to the stream
Definition: RVNGHTMLTextTextStyle.cpp:204
librevenge::RVNGHTMLTextParagraphStyleManager::operator=
RVNGHTMLTextParagraphStyleManager operator=(RVNGHTMLTextParagraphStyleManager const &orig)
librevenge::RVNGHTMLTextParagraphStyleManager
Small class to manage the paragraph style.
Definition: RVNGHTMLTextTextStyle.h:36
librevenge::RVNGHTMLTextListStyleManager::m_idListMap
std::map< int, List > m_idListMap
a map listId -> list
Definition: RVNGHTMLTextTextStyle.h:128
librevenge::RVNGHTMLTextParagraphStyleManager::m_idNameMap
std::map< int, std::string > m_idNameMap
a map id -> name
Definition: RVNGHTMLTextTextStyle.h:59
librevenge::RVNGHTMLTextListStyleManager::List::~List
~List()
destructor
Definition: RVNGHTMLTextTextStyle.h:78
librevenge::RVNGPropertyList
Definition: RVNGPropertyList.h:38
librevenge::RVNGHTMLTextListStyleManager::List::m_level
int m_level
the actual list level
Definition: RVNGHTMLTextTextStyle.h:102
librevenge::RVNGHTMLTextListStyleManager::m_levelNameMap
std::map< std::string, std::string > m_levelNameMap
a map content -> list level name
Definition: RVNGHTMLTextTextStyle.h:126
librevenge::RVNGHTMLTextListStyleManager::RVNGHTMLTextListStyleManager
RVNGHTMLTextListStyleManager()
constructor
Definition: RVNGHTMLTextTextStyle.h:105