00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* 00003 * This file is part of the libepubgen project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 */ 00009 00010 #ifndef INCLUDED_EPUBPARAGRAPHSTYLEMANAGER_H 00011 #define INCLUDED_EPUBPARAGRAPHSTYLEMANAGER_H 00012 00013 #include <string> 00014 #include <map> 00015 #include <unordered_map> 00016 00017 #include <boost/functional/hash.hpp> 00018 00019 #include <librevenge/librevenge.h> 00020 00021 #include "EPUBCSSProperties.h" 00022 00023 namespace libepubgen 00024 { 00025 00026 class EPUBCSSSink; 00027 00029 class EPUBParagraphStyleManager 00030 { 00031 typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t; 00032 00033 public: 00035 EPUBParagraphStyleManager() : m_contentNameMap(), m_idNameMap() 00036 { 00037 } 00039 virtual ~EPUBParagraphStyleManager() 00040 { 00041 } 00043 void defineParagraph(librevenge::RVNGPropertyList const &pList); 00045 std::string getClass(librevenge::RVNGPropertyList const &pList); 00047 std::string getStyle(librevenge::RVNGPropertyList const &pList); 00049 void send(EPUBCSSSink &out); 00050 protected: 00052 void extractProperties(librevenge::RVNGPropertyList const &pList, bool isList, EPUBCSSProperties &cssProps) const; 00054 ContentNameMap_t m_contentNameMap; 00056 std::map<int, std::string> m_idNameMap; 00058 void extractBorders(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const; 00059 private: 00060 EPUBParagraphStyleManager(EPUBParagraphStyleManager const &orig); 00061 EPUBParagraphStyleManager operator=(EPUBParagraphStyleManager const &orig); 00062 }; 00063 00064 } 00065 00066 #endif 00067 00068 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */