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
23namespace libepubgen
24{
25
26class EPUBCSSContent;
27
30{
31 typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t;
32
33public:
38
42
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);
60private:
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: */
Definition EPUBCSSContent.h:24
std::unordered_map< EPUBCSSProperties, std::string, boost::hash< EPUBCSSProperties > > ContentNameMap_t
Definition EPUBTableStyleManager.h:31
bool getRelColumnsWidth(int i, int numSpanned, double &w) const
try to return the relative col width
Definition EPUBTableStyleManager.cpp:117
void openTable(librevenge::RVNGPropertyList const &propList)
open a table
Definition EPUBTableStyleManager.cpp:27
void extractCellProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition EPUBTableStyleManager.cpp:218
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
void closeTable()
close a table
Definition EPUBTableStyleManager.cpp:61
EPUBTableStyleManager()
constructor
Definition EPUBTableStyleManager.h:35
ContentNameMap_t m_cellContentNameMap
a map cell content -> name
Definition EPUBTableStyleManager.h:72
ContentNameMap_t m_rowContentNameMap
a map row content -> name
Definition EPUBTableStyleManager.h:74
std::string getRowClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition EPUBTableStyleManager.cpp:146
EPUBTableStyleManager operator=(EPUBTableStyleManager const &orig)
std::string getCellStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition EPUBTableStyleManager.cpp:135
ContentNameMap_t m_tableContentNameMap
a map table content -> name
Definition EPUBTableStyleManager.h:76
std::string getTableClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition EPUBTableStyleManager.cpp:170
std::string getTableStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition EPUBTableStyleManager.cpp:183
EPUBTableStyleManager(EPUBTableStyleManager const &orig)
void extractRowProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const
convert a property list into a CSS property map
Definition EPUBTableStyleManager.cpp:278
std::string getCellClass(librevenge::RVNGPropertyList const &pList)
returns the class name corresponding to a propertylist
Definition EPUBTableStyleManager.cpp:122
void send(EPUBCSSContent &out)
send the data to the sink
Definition EPUBTableStyleManager.cpp:194
bool getColumnsWidth(int i, int numSpanned, double &w) const
try to return the col width
Definition EPUBTableStyleManager.cpp:112
std::vector< std::vector< double > > m_relColumnWidthsStack
a stack of relative column width (in percents )
Definition EPUBTableStyleManager.h:80
std::vector< std::vector< double > > m_columnWidthsStack
a stack of column width (in inches )
Definition EPUBTableStyleManager.h:78
std::string getRowStyle(librevenge::RVNGPropertyList const &pList)
returns the style string corresponding to a propertylist
Definition EPUBTableStyleManager.cpp:159
Definition EPUBBinaryContent.cpp:15
std::map< std::string, std::string > EPUBCSSProperties
Definition EPUBCSSProperties.h:21

Generated for libepubgen by doxygen 1.14.0