EPUBGenerator.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_EPUBGENERATOR_H
00011 #define INCLUDED_EPUBGENERATOR_H
00012 
00013 #include "EPUBHTMLManager.h"
00014 #include "EPUBHTMLGenerator.h"
00015 #include "EPUBImageManager.h"
00016 #include "EPUBListStyleManager.h"
00017 #include "EPUBManifest.h"
00018 #include "EPUBParagraphStyleManager.h"
00019 #include "EPUBPath.h"
00020 #include "EPUBSpanStyleManager.h"
00021 #include "EPUBSplitGuard.h"
00022 #include "EPUBTableStyleManager.h"
00023 
00024 namespace libepubgen
00025 {
00026 
00027 class EPUBPackage;
00028 
00029 class EPUBGenerator
00030 {
00031   // disable copying
00032   EPUBGenerator(const EPUBGenerator &);
00033   EPUBGenerator &operator=(const EPUBGenerator &);
00034 
00035 public:
00036   EPUBGenerator(EPUBPackage *package, int version);
00037   virtual ~EPUBGenerator();
00038 
00039   void startDocument(const librevenge::RVNGPropertyList &props);
00040   void endDocument();
00041 
00042   void setDocumentMetaData(const librevenge::RVNGPropertyList &props);
00043 
00044   void startNewHtmlFile();
00045 
00046   const EPUBHTMLGeneratorPtr_t &getHtml() const;
00047 
00048   EPUBHTMLManager &getHtmlManager();
00049 
00050   const EPUBSplitGuard &getSplitGuard() const;
00051   EPUBSplitGuard &getSplitGuard();
00052   int getVersion() const;
00053 
00054   void setSplitMethod(EPUBSplitMethod splitMethod);
00055 
00056   void setStylesMethod(EPUBStylesMethod stylesMethod);
00057 
00058   void setLayoutMethod(EPUBLayoutMethod layoutMethod);
00059 
00060 private:
00061   virtual void startHtmlFile() = 0;
00062   virtual void endHtmlFile() = 0;
00063 
00064 private:
00065   void writeContainer();
00066   void writeNavigation();
00067   void writeStylesheet();
00068   void writeRoot();
00069 
00070 private:
00071   EPUBPackage *m_package;
00072   EPUBManifest m_manifest;
00073   EPUBHTMLManager m_htmlManager;
00074   EPUBImageManager m_imageManager;
00075   EPUBFontManager m_fontManager;
00076   EPUBListStyleManager m_listStyleManager;
00077   EPUBParagraphStyleManager m_paragraphStyleManager;
00078   EPUBSpanStyleManager m_spanStyleManager;
00079   EPUBTableStyleManager m_tableStyleManager;
00080   const EPUBPath m_stylesheetPath;
00081 
00082   librevenge::RVNGPropertyList m_documentProps;
00083   librevenge::RVNGPropertyList m_metadata;
00084 
00085   EPUBHTMLGeneratorPtr_t m_currentHtml;
00086 
00087   EPUBSplitGuard m_splitGuard;
00088 
00089   int m_version;
00090   EPUBStylesMethod m_stylesMethod;
00091   EPUBLayoutMethod m_layoutMethod;
00092 };
00093 
00094 }
00095 
00096 #endif // INCLUDED_EPUBGENERATOR
00097 
00098 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */