- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

EPUBListStyleManager.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 libepubgen 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 INCLUDED_EPUBLISTSTYLEMANAGER_H
11 #define INCLUDED_EPUBLISTSTYLEMANAGER_H
12
13 #include <string>
14 #include <map>
15 #include <vector>
16
17 #include <boost/unordered_map.hpp>
18
19 #include <librevenge/librevenge.h>
20
21 #include "EPUBCSSProperties.h"
22 #include "EPUBParagraphStyleManager.h"
23
24 namespace libepubgen
25 {
26
27 class EPUBCSSSink;
28
30 class EPUBListStyleManager : public EPUBParagraphStyleManager
31 {
32 public:
33 struct List
34 {
35 typedef boost::unordered_map<EPUBCSSProperties, std::string> ContentNameMap_t;
36
38 List() : m_contentsList(), m_level(0)
39 {
40 }
42 ~List()
43 {
44 }
46 void setLevel(int lvl, librevenge::RVNGPropertyList const &property, bool ordered);
48 void openLevel() const
49 {
50 m_level++;
51 }
53 void closeLevel() const
54 {
55 if (m_level <= 0)
56 return;
57 m_level--;
58 }
59
61 const EPUBCSSProperties &getCurrentProperties() const;
62
63 protected:
65 std::vector<EPUBCSSProperties> m_contentsList;
67 mutable int m_level;
68 };
70 EPUBListStyleManager() : EPUBParagraphStyleManager(), m_levelNameMap(),
71 m_idListMap(), m_actualIdStack()
72 {
73 }
75 ~EPUBListStyleManager()
76 {
77 }
79 void defineLevel(librevenge::RVNGPropertyList const &property, bool ordered);
81 std::string openLevel(librevenge::RVNGPropertyList const &pList, bool ordered);
83 void closeLevel();
85 std::string getClass(librevenge::RVNGPropertyList const &pList);
86
88 void send(EPUBCSSSink &out);
89 protected:
91 List::ContentNameMap_t m_levelNameMap;
93 std::map<int, List> m_idListMap;
95 std::vector<int> m_actualIdStack;
96 private:
97 EPUBListStyleManager(EPUBListStyleManager const &orig);
98 EPUBListStyleManager operator=(EPUBListStyleManager const &orig);
99 };
100
101 }
102
103 #endif
104
105 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libepubgen::EPUBListStyleManager::m_idListMap
std::map< int, List > m_idListMap
a map listId -> list
Definition: EPUBListStyleManager.h:93
libepubgen::EPUBCSSSink
Definition: EPUBCSSSink.h:23
libepubgen::EPUBListStyleManager::m_levelNameMap
List::ContentNameMap_t m_levelNameMap
a map content -> list level name
Definition: EPUBListStyleManager.h:91
libepubgen
Definition: EPUBBinarySink.cpp:12
libepubgen::EPUBListStyleManager::List::List
List()
constructor
Definition: EPUBListStyleManager.h:38
libepubgen::EPUBListStyleManager::List
Definition: EPUBListStyleManager.h:33
libepubgen::EPUBParagraphStyleManager
Small class to manage the paragraph style.
Definition: EPUBParagraphStyleManager.h:28
libepubgen::EPUBListStyleManager::send
void send(EPUBCSSSink &out)
send the data to the sink
Definition: EPUBListStyleManager.cpp:78
libepubgen::EPUBListStyleManager
Small class to manage the list style.
Definition: EPUBListStyleManager.h:30
libepubgen::EPUBListStyleManager::List::ContentNameMap_t
boost::unordered_map< EPUBCSSProperties, std::string > ContentNameMap_t
Definition: EPUBListStyleManager.h:35
libepubgen::EPUBListStyleManager::EPUBListStyleManager
EPUBListStyleManager()
constructor
Definition: EPUBListStyleManager.h:70
libepubgen::EPUBListStyleManager::List::setLevel
void setLevel(int lvl, librevenge::RVNGPropertyList const &property, bool ordered)
set the property correspond to a level
Definition: EPUBListStyleManager.cpp:25
libepubgen::EPUBListStyleManager::~EPUBListStyleManager
~EPUBListStyleManager()
destructor
Definition: EPUBListStyleManager.h:75
EPUBCSSProperties.h
libepubgen::EPUBListStyleManager::getClass
std::string getClass(librevenge::RVNGPropertyList const &pList)
returns the classname corresponding to a list element
Definition: EPUBListStyleManager.cpp:90
libepubgen::EPUBListStyleManager::defineLevel
void defineLevel(librevenge::RVNGPropertyList const &property, bool ordered)
add a level to the corresponding list
Definition: EPUBListStyleManager.cpp:103
libepubgen::EPUBCSSProperties
std::map< std::string, std::string > EPUBCSSProperties
Definition: EPUBCSSProperties.h:21
libepubgen::EPUBListStyleManager::List::m_level
int m_level
the actual list level
Definition: EPUBListStyleManager.h:67
libepubgen::EPUBListStyleManager::List::openLevel
void openLevel() const
open a new level
Definition: EPUBListStyleManager.h:48
libepubgen::EPUBListStyleManager::operator=
EPUBListStyleManager operator=(EPUBListStyleManager const &orig)
libepubgen::EPUBListStyleManager::openLevel
std::string openLevel(librevenge::RVNGPropertyList const &pList, bool ordered)
returns the class name corresponding to a propertylist
Definition: EPUBListStyleManager.cpp:118
EPUBParagraphStyleManager.h
libepubgen::EPUBListStyleManager::m_actualIdStack
std::vector< int > m_actualIdStack
the actual list id
Definition: EPUBListStyleManager.h:95
libepubgen::EPUBListStyleManager::List::getCurrentProperties
const EPUBCSSProperties & getCurrentProperties() const
return the properties of the current level
Definition: EPUBListStyleManager.cpp:67
libepubgen::EPUBListStyleManager::List::~List
~List()
destructor
Definition: EPUBListStyleManager.h:42
libepubgen::EPUBListStyleManager::List::closeLevel
void closeLevel() const
open a new level
Definition: EPUBListStyleManager.h:53
libepubgen::EPUBListStyleManager::closeLevel
void closeLevel()
close a level
Definition: EPUBListStyleManager.cpp:145
libepubgen::EPUBListStyleManager::List::m_contentsList
std::vector< EPUBCSSProperties > m_contentsList
the properties
Definition: EPUBListStyleManager.h:65