EPUBSpanStyleManager.h
Go to the documentation of this file.
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_EPUBSPANSTYLEMANAGER_H
00011 #define INCLUDED_EPUBSPANSTYLEMANAGER_H
00012 
00013 #include <map>
00014 #include <string>
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 EPUBSpanStyleManager
00030 {
00031   typedef std::unordered_map<EPUBCSSProperties, std::string, boost::hash<EPUBCSSProperties>> ContentNameMap_t;
00032 
00033 public:
00035   EPUBSpanStyleManager() : m_contentNameMap(), m_idNameMap()
00036   {
00037   }
00039   ~EPUBSpanStyleManager()
00040   {
00041   }
00043   void defineSpan(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, EPUBCSSProperties &cssProps) const;
00054   void extractTextPosition(char const *value, EPUBCSSProperties &cssProps) const;
00056   void extractDecorations(librevenge::RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const;
00058   ContentNameMap_t m_contentNameMap;
00060   std::map<int, std::string> m_idNameMap;
00061 
00062 private:
00063   EPUBSpanStyleManager(EPUBSpanStyleManager const &orig);
00064   EPUBSpanStyleManager operator=(EPUBSpanStyleManager const &orig);
00065 };
00066 
00067 }
00068 
00069 #endif
00070 
00071 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */