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"
23 
24 namespace libepubgen
25 {
26 
27 class EPUBCSSSink;
28 
31 {
32 public:
33  struct List
34  {
35  typedef boost::unordered_map<EPUBCSSProperties, std::string> ContentNameMap_t;
36 
39  {
40  }
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 
62 
63  protected:
65  std::vector<EPUBCSSProperties> m_contentsList;
67  mutable int m_level;
68  };
72  {
73  }
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:
93  std::map<int, List> m_idListMap;
95  std::vector<int> m_actualIdStack;
96 private:
99 };
100 
101 }
102 
103 #endif
104 
105 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
std::map< int, List > m_idListMap
a map listId -> list
Definition: EPUBListStyleManager.h:93
Definition: EPUBCSSSink.h:23
List::ContentNameMap_t m_levelNameMap
a map content -> list level name
Definition: EPUBListStyleManager.h:91
Definition: EPUBBinarySink.cpp:12
List()
constructor
Definition: EPUBListStyleManager.h:38
Definition: EPUBListStyleManager.h:33
Small class to manage the paragraph style.
Definition: EPUBParagraphStyleManager.h:28
void send(EPUBCSSSink &out)
send the data to the sink
Definition: EPUBListStyleManager.cpp:78
Small class to manage the list style.
Definition: EPUBListStyleManager.h:30
boost::unordered_map< EPUBCSSProperties, std::string > ContentNameMap_t
Definition: EPUBListStyleManager.h:35
EPUBListStyleManager()
constructor
Definition: EPUBListStyleManager.h:70
void setLevel(int lvl, librevenge::RVNGPropertyList const &property, bool ordered)
set the property correspond to a level
Definition: EPUBListStyleManager.cpp:25
~EPUBListStyleManager()
destructor
Definition: EPUBListStyleManager.h:75
std::string getClass(librevenge::RVNGPropertyList const &pList)
returns the classname corresponding to a list element
Definition: EPUBListStyleManager.cpp:90
void defineLevel(librevenge::RVNGPropertyList const &property, bool ordered)
add a level to the corresponding list
Definition: EPUBListStyleManager.cpp:103
std::map< std::string, std::string > EPUBCSSProperties
Definition: EPUBCSSProperties.h:21
int m_level
the actual list level
Definition: EPUBListStyleManager.h:67
void openLevel() const
open a new level
Definition: EPUBListStyleManager.h:48
EPUBListStyleManager operator=(EPUBListStyleManager const &orig)
std::vector< int > m_actualIdStack
the actual list id
Definition: EPUBListStyleManager.h:95
const EPUBCSSProperties & getCurrentProperties() const
return the properties of the current level
Definition: EPUBListStyleManager.cpp:67
~List()
destructor
Definition: EPUBListStyleManager.h:42
void closeLevel() const
open a new level
Definition: EPUBListStyleManager.h:53
std::vector< EPUBCSSProperties > m_contentsList
the properties
Definition: EPUBListStyleManager.h:65

Generated for libepubgen by doxygen 1.8.11