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
33namespace librevenge
34{
36 class RVNGHTMLTextParagraphStyleManager
37{
38public:
40 RVNGHTMLTextParagraphStyleManager() : m_contentNameMap(), m_idNameMap()
41 {
42 }
43
44 virtual ~RVNGHTMLTextParagraphStyleManager()
45 {
46 }
47
48 void defineParagraph(RVNGPropertyList const &pList);
50 std::string getClass(RVNGPropertyList const &pList);
52 void send(std::ostream &out);
53protected:
55 static std::string getContent(RVNGPropertyList const &pList, bool isList);
57 std::map<std::string, std::string> m_contentNameMap;
59 std::map<int, std::string> m_idNameMap;
61 static void parseBorders(RVNGPropertyList const &pList, std::ostream &out);
62private:
63 RVNGHTMLTextParagraphStyleManager(RVNGHTMLTextParagraphStyleManager const &orig);
64 RVNGHTMLTextParagraphStyleManager operator=(RVNGHTMLTextParagraphStyleManager const &orig);
65};
66
68 class RVNGHTMLTextListStyleManager : public RVNGHTMLTextParagraphStyleManager
69{
70public:
71 struct List
72 {
74 List() : m_contentsList(), m_level(0)
75 {
76 }
77
78 ~List()
79 {
80 }
81
82 void setLevel(int lvl, RVNGPropertyList const &property, bool ordered);
84 void openLevel() const
85 {
86 m_level++;
87 }
88
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 };
104
105 RVNGHTMLTextListStyleManager() : RVNGHTMLTextParagraphStyleManager(), m_levelNameMap(),
106 m_idListMap(), m_actualIdStack()
107 {
108 }
109
110 ~RVNGHTMLTextListStyleManager()
111 {
112 }
113
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);
124protected:
126 std::map<std::string, std::string> m_levelNameMap;
128 std::map<int, List> m_idListMap;
130 std::vector<int> m_actualIdStack;
131private:
132 RVNGHTMLTextListStyleManager(RVNGHTMLTextListStyleManager const &orig);
133 RVNGHTMLTextListStyleManager operator=(RVNGHTMLTextListStyleManager const &orig);
134};
135
137 class RVNGHTMLTextSpanStyleManager
138{
139public:
141 RVNGHTMLTextSpanStyleManager() : m_contentNameMap(), m_idNameMap()
142 {
143 }
144
145 ~RVNGHTMLTextSpanStyleManager()
146 {
147 }
148
149 void defineSpan(RVNGPropertyList const &pList);
151 std::string getClass(RVNGPropertyList const &pList);
153 void send(std::ostream &out);
154protected:
156 static std::string getContent(RVNGPropertyList const &pList);
158 static void parseTextPosition(char const *value, std::ostream &out);
160 static void parseDecorations(RVNGPropertyList const &pList, std::ostream &out);
162 std::map<std::string, std::string> m_contentNameMap;
164 std::map<int, std::string> m_idNameMap;
165
166private:
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::operator=
RVNGHTMLTextListStyleManager operator=(RVNGHTMLTextListStyleManager const &orig)
librevenge::RVNGHTMLTextListStyleManager::RVNGHTMLTextListStyleManager
RVNGHTMLTextListStyleManager()
constructor
Definition RVNGHTMLTextTextStyle.h:105
librevenge::RVNGHTMLTextListStyleManager::send
void send(std::ostream &out)
send the data to the stream
Definition RVNGHTMLTextTextStyle.cpp:92
librevenge::RVNGHTMLTextListStyleManager::openLevel
std::string openLevel(RVNGPropertyList const &pList, bool ordered)
returns the class name corresponding to a propertylist
Definition RVNGHTMLTextTextStyle.cpp:130
librevenge::RVNGHTMLTextListStyleManager::~RVNGHTMLTextListStyleManager
~RVNGHTMLTextListStyleManager()
destructor
Definition RVNGHTMLTextTextStyle.h:110
librevenge::RVNGHTMLTextListStyleManager::getClass
std::string getClass(RVNGPropertyList const &pList)
returns the classname corresponding to a list element
Definition RVNGHTMLTextTextStyle.cpp:103
librevenge::RVNGHTMLTextListStyleManager::defineLevel
void defineLevel(RVNGPropertyList const &property, bool ordered)
add a level to the corresponding list
Definition RVNGHTMLTextTextStyle.cpp:115
librevenge::RVNGHTMLTextListStyleManager::m_actualIdStack
std::vector< int > m_actualIdStack
the actual list id
Definition RVNGHTMLTextTextStyle.h:130
librevenge::RVNGHTMLTextListStyleManager::m_idListMap
std::map< int, List > m_idListMap
a map listId -> list
Definition RVNGHTMLTextTextStyle.h:128
librevenge::RVNGHTMLTextListStyleManager::RVNGHTMLTextListStyleManager
RVNGHTMLTextListStyleManager(RVNGHTMLTextListStyleManager const &orig)
librevenge::RVNGHTMLTextListStyleManager::m_levelNameMap
std::map< std::string, std::string > m_levelNameMap
a map content -> list level name
Definition RVNGHTMLTextTextStyle.h:126
librevenge::RVNGHTMLTextListStyleManager::closeLevel
void closeLevel()
close a level
Definition RVNGHTMLTextTextStyle.cpp:155
librevenge::RVNGHTMLTextParagraphStyleManager::parseBorders
static void parseBorders(RVNGPropertyList const &pList, std::ostream &out)
add data corresponding to the border
Definition RVNGHTMLTextTextStyle.cpp:282
librevenge::RVNGHTMLTextParagraphStyleManager::defineParagraph
void defineParagraph(RVNGPropertyList const &pList)
define a paragraph style
Definition RVNGHTMLTextTextStyle.cpp:191
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::~RVNGHTMLTextParagraphStyleManager
virtual ~RVNGHTMLTextParagraphStyleManager()
destructor
Definition RVNGHTMLTextTextStyle.h:44
librevenge::RVNGHTMLTextParagraphStyleManager::RVNGHTMLTextParagraphStyleManager
RVNGHTMLTextParagraphStyleManager()
constructor
Definition RVNGHTMLTextTextStyle.h:40
librevenge::RVNGHTMLTextParagraphStyleManager::getClass
std::string getClass(RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition RVNGHTMLTextTextStyle.cpp:173
librevenge::RVNGHTMLTextParagraphStyleManager::getContent
static std::string getContent(RVNGPropertyList const &pList, bool isList)
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::RVNGHTMLTextParagraphStyleManager
RVNGHTMLTextParagraphStyleManager(RVNGHTMLTextParagraphStyleManager const &orig)
librevenge::RVNGHTMLTextParagraphStyleManager::m_idNameMap
std::map< int, std::string > m_idNameMap
a map id -> name
Definition RVNGHTMLTextTextStyle.h:59
librevenge::RVNGHTMLTextSpanStyleManager::getClass
std::string getClass(RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition RVNGHTMLTextTextStyle.cpp:303
librevenge::RVNGHTMLTextSpanStyleManager::~RVNGHTMLTextSpanStyleManager
~RVNGHTMLTextSpanStyleManager()
destructor
Definition RVNGHTMLTextTextStyle.h:145
librevenge::RVNGHTMLTextSpanStyleManager::RVNGHTMLTextSpanStyleManager
RVNGHTMLTextSpanStyleManager(RVNGHTMLTextSpanStyleManager const &orig)
librevenge::RVNGHTMLTextSpanStyleManager::getContent
static std::string getContent(RVNGPropertyList const &pList)
convert a property list in a html content string
Definition RVNGHTMLTextTextStyle.cpp:345
librevenge::RVNGHTMLTextSpanStyleManager::defineSpan
void defineSpan(RVNGPropertyList const &pList)
define a span style
Definition RVNGHTMLTextTextStyle.cpp:322
librevenge::RVNGHTMLTextSpanStyleManager::m_contentNameMap
std::map< std::string, std::string > m_contentNameMap
a map content -> name
Definition RVNGHTMLTextTextStyle.h:162
librevenge::RVNGHTMLTextSpanStyleManager::operator=
RVNGHTMLTextSpanStyleManager operator=(RVNGHTMLTextSpanStyleManager const &orig)
librevenge::RVNGHTMLTextSpanStyleManager::parseDecorations
static void parseDecorations(RVNGPropertyList const &pList, std::ostream &out)
add data corresponding to the line decoration
Definition RVNGHTMLTextTextStyle.cpp:415
librevenge::RVNGHTMLTextSpanStyleManager::m_idNameMap
std::map< int, std::string > m_idNameMap
a map id -> name
Definition RVNGHTMLTextTextStyle.h:164
librevenge::RVNGHTMLTextSpanStyleManager::RVNGHTMLTextSpanStyleManager
RVNGHTMLTextSpanStyleManager()
constructor
Definition RVNGHTMLTextTextStyle.h:141
librevenge::RVNGHTMLTextSpanStyleManager::parseTextPosition
static void parseTextPosition(char const *value, std::ostream &out)
add data corresponding to a text position in out
Definition RVNGHTMLTextTextStyle.cpp:430
librevenge::RVNGHTMLTextSpanStyleManager::send
void send(std::ostream &out)
send the data to the stream
Definition RVNGHTMLTextTextStyle.cpp:335
librevenge::RVNGPropertyList
Definition RVNGPropertyList.h:39
librevenge-generators.h
librevenge
Definition RVNGBinaryData.cpp:40
librevenge::RVNGHTMLTextListStyleManager::List::m_level
int m_level
the actual list level
Definition RVNGHTMLTextTextStyle.h:102
librevenge::RVNGHTMLTextListStyleManager::List::~List
~List()
destructor
Definition RVNGHTMLTextTextStyle.h:78
librevenge::RVNGHTMLTextListStyleManager::List::closeLevel
void closeLevel() const
open a new level
Definition RVNGHTMLTextTextStyle.h:89
librevenge::RVNGHTMLTextListStyleManager::List::m_contentsList
std::vector< std::string > m_contentsList
the properties
Definition RVNGHTMLTextTextStyle.h:100
librevenge::RVNGHTMLTextListStyleManager::List::str
std::string str() const
return the content string
Definition RVNGHTMLTextTextStyle.cpp:82
librevenge::RVNGHTMLTextListStyleManager::List::List
List()
constructor
Definition RVNGHTMLTextTextStyle.h:74
librevenge::RVNGHTMLTextListStyleManager::List::openLevel
void openLevel() const
open a new level
Definition RVNGHTMLTextTextStyle.h:84
librevenge::RVNGHTMLTextListStyleManager::List::setLevel
void setLevel(int lvl, RVNGPropertyList const &property, bool ordered)
set the property correspond to a level
Definition RVNGHTMLTextTextStyle.cpp:40