EPUBTableStyleManager.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_EPUBTABLESTYLEMANAGER_H
11 #define INCLUDED_EPUBTABLESTYLEMANAGER_H
12 
13 #include <librevenge/librevenge.h>
14 
15 #include <string>
16 #include <unordered_map>
17 #include <vector>
18 
19 #include <boost/functional/hash.hpp>
20 
21 #include "EPUBCSSProperties.h"
22 
23 namespace libepubgen
24 {
25 
26 class EPUBCSSContent;
27 
30 {
31  typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t;
32 
33 public:
36  {
37  }
40  {
41  }
43  void openTable(librevenge::RVNGPropertyList const &propList);
45  void closeTable();
47  std::string getCellClass(librevenge::RVNGPropertyList const &pList);
49  std::string getCellStyle(librevenge::RVNGPropertyList const &pList);
51  std::string getRowClass(librevenge::RVNGPropertyList const &pList);
53  std::string getRowStyle(librevenge::RVNGPropertyList const &pList);
55  std::string getTableClass(librevenge::RVNGPropertyList const &pList);
57  std::string getTableStyle(librevenge::RVNGPropertyList const &pList);
59  void send(EPUBCSSContent &out);
60 private:
62  void extractCellProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
64  void extractRowProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
66  void extractTableProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
68  bool getColumnsWidth(int i, int numSpanned, double &w) const;
70  bool getRelColumnsWidth(int i, int numSpanned, double &w) const;
78  std::vector<std::vector<double> > m_columnWidthsStack;
80  std::vector<std::vector<double> > m_relColumnWidthsStack;
81 
84 };
85 
86 }
87 
88 #endif
89 
90 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
void send(EPUBCSSContent &out)
send the data to the sink
Definition: EPUBTableStyleManager.cpp:194
ContentNameMap_t m_rowContentNameMap
a map row content -> name
Definition: EPUBTableStyleManager.h:74
Definition: EPUBCSSContent.h:23
EPUBTableStyleManager operator=(EPUBTableStyleManager const &orig)
Definition: EPUBBinaryContent.cpp:14
std::vector< std::vector< double > > m_columnWidthsStack
a stack of column width (in inches )
Definition: EPUBTableStyleManager.h:78
std::string getTableClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: EPUBTableStyleManager.cpp:170
EPUBTableStyleManager()
constructor
Definition: EPUBTableStyleManager.h:35
std::string getCellClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: EPUBTableStyleManager.cpp:122
Small class to manage the tables style.
Definition: EPUBTableStyleManager.h:29
void extractRowProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBTableStyleManager.cpp:278
std::string getTableStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition: EPUBTableStyleManager.cpp:183
ContentNameMap_t m_tableContentNameMap
a map table content -> name
Definition: EPUBTableStyleManager.h:76
std::map< std::string, std::string > EPUBCSSProperties
Definition: EPUBCSSProperties.h:21
void extractTableProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBTableStyleManager.cpp:286
~EPUBTableStyleManager()
destructor
Definition: EPUBTableStyleManager.h:39
bool getRelColumnsWidth(int i, int numSpanned, double &w) const
try to return the relative col width
Definition: EPUBTableStyleManager.cpp:117
void closeTable()
close a table
Definition: EPUBTableStyleManager.cpp:61
void extractCellProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBTableStyleManager.cpp:218
bool getColumnsWidth(int i, int numSpanned, double &w) const
try to return the col width
Definition: EPUBTableStyleManager.cpp:112
ContentNameMap_t m_cellContentNameMap
a map cell content -> name
Definition: EPUBTableStyleManager.h:72
std::string getCellStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition: EPUBTableStyleManager.cpp:135
std::string getRowClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: EPUBTableStyleManager.cpp:146
std::string getRowStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition: EPUBTableStyleManager.cpp:159
std::vector< std::vector< double > > m_relColumnWidthsStack
a stack of relative column width (in percents )
Definition: EPUBTableStyleManager.h:80
std::unordered_map< EPUBCSSProperties, std::string, boost::hash< EPUBCSSProperties > > ContentNameMap_t
Definition: EPUBTableStyleManager.h:31
void openTable(librevenge::RVNGPropertyList const &propList)
open a table
Definition: EPUBTableStyleManager.cpp:27

Generated for libepubgen by doxygen 1.8.14