EPUBParagraphStyleManager.h Source File documentation

EPUBParagraphStyleManager.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_EPUBPARAGRAPHSTYLEMANAGER_H
11 #define INCLUDED_EPUBPARAGRAPHSTYLEMANAGER_H
12
13 #include <string>
14 #include <map>
15 #include <unordered_map>
16
17 #include <boost/functional/hash.hpp>
18
19 #include <librevenge/librevenge.h>
20
21 #include "EPUBCSSProperties.h"
22
23 namespace libepubgen
24 {
25
26 class EPUBCSSContent;
27
29 class EPUBParagraphStyleManager
30 {
31 typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t;
32
33 public:
35 EPUBParagraphStyleManager() : m_contentNameMap(), m_idNameMap()
36 {
37 }
39 virtual ~EPUBParagraphStyleManager()
40 {
41 }
43 void defineParagraph(librevenge::RVNGPropertyList const &pList);
45 std::string getClass(librevenge::RVNGPropertyList const &pList);
47 std::string getStyle(librevenge::RVNGPropertyList const &pList);
49 void send(EPUBCSSContent &out);
50 protected:
52 void extractProperties(librevenge::RVNGPropertyList const &pList, bool isList, EPUBCSSProperties &cssProps) const;
54 ContentNameMap_t m_contentNameMap;
56 std::map<int, std::string> m_idNameMap;
58 void extractBorders(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
59 private:
60 EPUBParagraphStyleManager(EPUBParagraphStyleManager const &orig);
61 EPUBParagraphStyleManager operator=(EPUBParagraphStyleManager const &orig);
62 };
63
64 }
65
66 #endif
67
68 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libepubgen::EPUBParagraphStyleManager::defineParagraph
void defineParagraph(librevenge::RVNGPropertyList const &pList)
define a paragraph style
Definition: EPUBParagraphStyleManager.cpp:55
libepubgen::EPUBCSSContent
Definition: EPUBCSSContent.h:23
libepubgen::EPUBParagraphStyleManager::extractBorders
void extractBorders(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
add data corresponding to the border
Definition: EPUBParagraphStyleManager.cpp:149
libepubgen::EPUBParagraphStyleManager::send
void send(EPUBCSSContent &out)
send the data to the sink
Definition: EPUBParagraphStyleManager.cpp:68
libepubgen
Definition: EPUBBinaryContent.cpp:14
libepubgen::EPUBParagraphStyleManager
Small class to manage the paragraph style.
Definition: EPUBParagraphStyleManager.h:29
libepubgen::EPUBParagraphStyleManager::m_contentNameMap
ContentNameMap_t m_contentNameMap
a map content -> name
Definition: EPUBParagraphStyleManager.h:54
libepubgen::EPUBParagraphStyleManager::~EPUBParagraphStyleManager
virtual ~EPUBParagraphStyleManager()
destructor
Definition: EPUBParagraphStyleManager.h:39
EPUBCSSProperties.h
libepubgen::EPUBParagraphStyleManager::operator=
EPUBParagraphStyleManager operator=(EPUBParagraphStyleManager const &orig)
libepubgen::EPUBCSSProperties
std::map< std::string, std::string > EPUBCSSProperties
Definition: EPUBCSSProperties.h:21
libepubgen::EPUBParagraphStyleManager::m_idNameMap
std::map< int, std::string > m_idNameMap
a map id -> name
Definition: EPUBParagraphStyleManager.h:56
libepubgen::EPUBParagraphStyleManager::ContentNameMap_t
std::unordered_map< EPUBCSSProperties, std::string, boost::hash< EPUBCSSProperties > > ContentNameMap_t
Definition: EPUBParagraphStyleManager.h:31
libepubgen::EPUBParagraphStyleManager::getClass
std::string getClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: EPUBParagraphStyleManager.cpp:25
libepubgen::EPUBParagraphStyleManager::getStyle
std::string getStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition: EPUBParagraphStyleManager.cpp:44
libepubgen::EPUBParagraphStyleManager::extractProperties
void extractProperties(librevenge::RVNGPropertyList const &pList, bool isList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBParagraphStyleManager.cpp:78
libepubgen::EPUBParagraphStyleManager::EPUBParagraphStyleManager
EPUBParagraphStyleManager()
constructor
Definition: EPUBParagraphStyleManager.h:35