| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 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 |
{ |
| 35 |
|
| 36 |
class RVNGHTMLTextParagraphStyleManager |
| 37 |
{ |
| 38 |
public: |
| 39 |
|
| 40 |
RVNGHTMLTextParagraphStyleManager() : m_contentNameMap(), m_idNameMap() |
| 41 |
{ |
| 42 |
} |
| 43 |
|
| 44 |
virtual ~RVNGHTMLTextParagraphStyleManager() |
| 45 |
{ |
| 46 |
} |
| 47 |
|
| 48 |
void defineParagraph(RVNGPropertyList const &pList); |
| 49 |
|
| 50 |
std::string getClass(RVNGPropertyList const &pList); |
| 51 |
|
| 52 |
void send(std::ostream &out); |
| 53 |
protected: |
| 54 |
|
| 55 |
static std::string getContent(RVNGPropertyList const &pList, bool isList); |
| 56 |
|
| 57 |
std::map<std::string, std::string> m_contentNameMap; |
| 58 |
|
| 59 |
std::map<int, std::string> m_idNameMap; |
| 60 |
|
| 61 |
static void parseBorders(RVNGPropertyList const &pList, std::ostream &out); |
| 62 |
private: |
| 63 |
RVNGHTMLTextParagraphStyleManager(RVNGHTMLTextParagraphStyleManager const &orig); |
| 64 |
RVNGHTMLTextParagraphStyleManager operator=(RVNGHTMLTextParagraphStyleManager const &orig); |
| 65 |
}; |
| 66 |
|
| 67 |
|
| 68 |
class RVNGHTMLTextListStyleManager : public RVNGHTMLTextParagraphStyleManager |
| 69 |
{ |
| 70 |
public: |
| 71 |
struct List |
| 72 |
{ |
| 73 |
|
| 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); |
| 83 |
|
| 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 |
|
| 96 |
|
| 97 |
std::string str() const; |
| 98 |
protected: |
| 99 |
|
| 100 |
std::vector<std::string> m_contentsList; |
| 101 |
|
| 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); |
| 115 |
|
| 116 |
std::string openLevel(RVNGPropertyList const &pList, bool ordered); |
| 117 |
|
| 118 |
void closeLevel(); |
| 119 |
|
| 120 |
std::string getClass(RVNGPropertyList const &pList); |
| 121 |
|
| 122 |
|
| 123 |
void send(std::ostream &out); |
| 124 |
protected: |
| 125 |
|
| 126 |
std::map<std::string, std::string> m_levelNameMap; |
| 127 |
|
| 128 |
std::map<int, List> m_idListMap; |
| 129 |
|
| 130 |
std::vector<int> m_actualIdStack; |
| 131 |
private: |
| 132 |
RVNGHTMLTextListStyleManager(RVNGHTMLTextListStyleManager const &orig); |
| 133 |
RVNGHTMLTextListStyleManager operator=(RVNGHTMLTextListStyleManager const &orig); |
| 134 |
}; |
| 135 |
|
| 136 |
|
| 137 |
class RVNGHTMLTextSpanStyleManager |
| 138 |
{ |
| 139 |
public: |
| 140 |
|
| 141 |
RVNGHTMLTextSpanStyleManager() : m_contentNameMap(), m_idNameMap() |
| 142 |
{ |
| 143 |
} |
| 144 |
|
| 145 |
~RVNGHTMLTextSpanStyleManager() |
| 146 |
{ |
| 147 |
} |
| 148 |
|
| 149 |
void defineSpan(RVNGPropertyList const &pList); |
| 150 |
|
| 151 |
std::string getClass(RVNGPropertyList const &pList); |
| 152 |
|
| 153 |
void send(std::ostream &out); |
| 154 |
protected: |
| 155 |
|
| 156 |
static std::string getContent(RVNGPropertyList const &pList); |
| 157 |
|
| 158 |
static void parseTextPosition(char const *value, std::ostream &out); |
| 159 |
|
| 160 |
static void parseDecorations(RVNGPropertyList const &pList, std::ostream &out); |
| 161 |
|
| 162 |
std::map<std::string, std::string> m_contentNameMap; |
| 163 |
|
| 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 |
|