| 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_EPUBGENERATOR_H |
| 11 |
#define INCLUDED_EPUBGENERATOR_H |
| 12 |
|
| 13 |
#include <memory> |
| 14 |
|
| 15 |
#include "EPUBFontManager.h" |
| 16 |
#include "EPUBHTMLManager.h" |
| 17 |
#include "EPUBImageManager.h" |
| 18 |
#include "EPUBListStyleManager.h" |
| 19 |
#include "EPUBManifest.h" |
| 20 |
#include "EPUBParagraphStyleManager.h" |
| 21 |
#include "EPUBPath.h" |
| 22 |
#include "EPUBSpanStyleManager.h" |
| 23 |
#include "EPUBBodyStyleManager.h" |
| 24 |
#include "EPUBSplitGuard.h" |
| 25 |
#include "EPUBTableStyleManager.h" |
| 26 |
|
| 27 |
namespace libepubgen |
| 28 |
{ |
| 29 |
|
| 30 |
class EPUBHTMLGenerator; |
| 31 |
class EPUBPackage; |
| 32 |
|
| 33 |
class EPUBGenerator |
| 34 |
{ |
| 35 |
// disable copying |
| 36 |
EPUBGenerator(const EPUBGenerator &); |
| 37 |
EPUBGenerator &operator=(const EPUBGenerator &); |
| 38 |
|
| 39 |
public: |
| 40 |
EPUBGenerator(EPUBPackage *package, int version); |
| 41 |
virtual ~EPUBGenerator(); |
| 42 |
|
| 43 |
void startDocument(const librevenge::RVNGPropertyList &props); |
| 44 |
void endDocument(); |
| 45 |
|
| 46 |
void setDocumentMetaData(const librevenge::RVNGPropertyList &props); |
| 47 |
|
| 48 |
void startNewHtmlFile(); |
| 49 |
|
| 50 |
const std::shared_ptr<EPUBHTMLGenerator> &getHtml() const; |
| 51 |
|
| 52 |
EPUBHTMLManager &getHtmlManager(); |
| 53 |
|
| 54 |
const EPUBSplitGuard &getSplitGuard() const; |
| 55 |
EPUBSplitGuard &getSplitGuard(); |
| 56 |
int getVersion() const; |
| 57 |
|
| 58 |
void setSplitMethod(EPUBSplitMethod splitMethod); |
| 59 |
|
| 60 |
void setStylesMethod(EPUBStylesMethod stylesMethod); |
| 61 |
|
| 62 |
void setLayoutMethod(EPUBLayoutMethod layoutMethod); |
| 63 |
|
| 64 |
private: |
| 65 |
virtual void startHtmlFile() = 0; |
| 66 |
virtual void endHtmlFile() = 0; |
| 67 |
|
| 68 |
private: |
| 69 |
void writeContainer(); |
| 70 |
void writeNavigation(); |
| 71 |
void writeStylesheet(); |
| 72 |
void writeRoot(); |
| 73 |
|
| 74 |
private: |
| 75 |
EPUBPackage *m_package; |
| 76 |
EPUBManifest m_manifest; |
| 77 |
EPUBHTMLManager m_htmlManager; |
| 78 |
EPUBImageManager m_imageManager; |
| 79 |
EPUBFontManager m_fontManager; |
| 80 |
EPUBListStyleManager m_listStyleManager; |
| 81 |
EPUBParagraphStyleManager m_paragraphStyleManager; |
| 82 |
EPUBSpanStyleManager m_spanStyleManager; |
| 83 |
EPUBBodyStyleManager m_bodyStyleManager; |
| 84 |
EPUBTableStyleManager m_tableStyleManager; |
| 85 |
const EPUBPath m_stylesheetPath; |
| 86 |
|
| 87 |
librevenge::RVNGPropertyList m_documentProps; |
| 88 |
librevenge::RVNGPropertyList m_metadata; |
| 89 |
|
| 90 |
std::shared_ptr<EPUBHTMLGenerator> m_currentHtml; |
| 91 |
|
| 92 |
EPUBSplitGuard m_splitGuard; |
| 93 |
|
| 94 |
int m_version; |
| 95 |
EPUBStylesMethod m_stylesMethod; |
| 96 |
EPUBLayoutMethod m_layoutMethod; |
| 97 |
}; |
| 98 |
|
| 99 |
} |
| 100 |
|
| 101 |
#endif // INCLUDED_EPUBGENERATOR |
| 102 |
|
| 103 |
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |