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 EPUBCSSSink;
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::RVNGPropertyListVector const &colList);
45  void closeTable();
47  std::string getCellClass(librevenge::RVNGPropertyList const &pList);
49  std::string getRowClass(librevenge::RVNGPropertyList const &pList);
51  void send(EPUBCSSSink &out);
52 private:
54  void extractCellProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
56  void extractRowProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
58  bool getColumnsWidth(int i, int numSpanned, double &w) const;
60  ContentNameMap_t m_cellContentNameMap;
62  ContentNameMap_t m_rowContentNameMap;
64  std::vector<std::vector<double> > m_columWitdhsStack;
65 
68 };
69 
70 }
71 
72 #endif
73 
74 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
ContentNameMap_t m_rowContentNameMap
a map row content -> name
Definition: EPUBTableStyleManager.h:62
bool getColumnsWidth(int i, int numSpanned, double &w) const
try to return the col width
Definition: EPUBTableStyleManager.cpp:57
Definition: EPUBCSSSink.h:23
EPUBTableStyleManager operator=(EPUBTableStyleManager const &orig)
Definition: EPUBBinarySink.cpp:12
std::vector< std::vector< double > > m_columWitdhsStack
a stack of column width (in inches )
Definition: EPUBTableStyleManager.h:64
EPUBTableStyleManager()
constructor
Definition: EPUBTableStyleManager.h:35
void extractCellProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBTableStyleManager.cpp:131
std::string getCellClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: EPUBTableStyleManager.cpp:88
Small class to manage the tables style.
Definition: EPUBTableStyleManager.h:29
void openTable(librevenge::RVNGPropertyListVector const &colList)
open a table
Definition: EPUBTableStyleManager.cpp:25
std::map< std::string, std::string > EPUBCSSProperties
Definition: EPUBCSSProperties.h:21
~EPUBTableStyleManager()
destructor
Definition: EPUBTableStyleManager.h:39
void closeTable()
close a table
Definition: EPUBTableStyleManager.cpp:47
ContentNameMap_t m_cellContentNameMap
a map cell content -> name
Definition: EPUBTableStyleManager.h:60
std::string getRowClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition: EPUBTableStyleManager.cpp:101
void extractRowProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition: EPUBTableStyleManager.cpp:183
std::unordered_map< EPUBCSSProperties, std::string, boost::hash< EPUBCSSProperties > > ContentNameMap_t
Definition: EPUBTableStyleManager.h:31
void send(EPUBCSSSink &out)
send the data to the sink
Definition: EPUBTableStyleManager.cpp:114

Generated for libepubgen by doxygen 1.8.11