Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef INCLUDED_EPUBTABLESTYLEMANAGER_H
00011 #define INCLUDED_EPUBTABLESTYLEMANAGER_H
00012
00013 #include <librevenge/librevenge.h>
00014
00015 #include <string>
00016 #include <unordered_map>
00017 #include <vector>
00018
00019 #include <boost/functional/hash.hpp>
00020
00021 #include "EPUBCSSProperties.h"
00022
00023 namespace libepubgen
00024 {
00025
00026 class EPUBCSSSink;
00027
00029 class EPUBTableStyleManager
00030 {
00031 typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t;
00032
00033 public:
00035 EPUBTableStyleManager() : m_cellContentNameMap(), m_rowContentNameMap(), m_tableContentNameMap(), m_columnWidthsStack(), m_relColumnWidthsStack()
00036 {
00037 }
00039 ~EPUBTableStyleManager()
00040 {
00041 }
00043 void openTable(librevenge::RVNGPropertyList const &propList);
00045 void closeTable();
00047 std::string getCellClass(librevenge::RVNGPropertyList const &pList);
00049 std::string getCellStyle(librevenge::RVNGPropertyList const &pList);
00051 std::string getRowClass(librevenge::RVNGPropertyList const &pList);
00053 std::string getRowStyle(librevenge::RVNGPropertyList const &pList);
00055 std::string getTableClass(librevenge::RVNGPropertyList const &pList);
00057 std::string getTableStyle(librevenge::RVNGPropertyList const &pList);
00059 void send(EPUBCSSSink &out);
00060 private:
00062 void extractCellProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
00064 void extractRowProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
00066 void extractTableProperties(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
00068 bool getColumnsWidth(int i, int numSpanned, double &w) const;
00070 bool getRelColumnsWidth(int i, int numSpanned, double &w) const;
00072 ContentNameMap_t m_cellContentNameMap;
00074 ContentNameMap_t m_rowContentNameMap;
00076 ContentNameMap_t m_tableContentNameMap;
00078 std::vector<std::vector<double> > m_columnWidthsStack;
00080 std::vector<std::vector<double> > m_relColumnWidthsStack;
00081
00082 EPUBTableStyleManager(EPUBTableStyleManager const &orig);
00083 EPUBTableStyleManager operator=(EPUBTableStyleManager const &orig);
00084 };
00085
00086 }
00087
00088 #endif
00089
00090