Debian Codegraph @

plugins/epub/exp/xp/ie_exp_EPUB.h

raw symbols SCIP
1 /* AbiSource
2 *
3 * Copyright (C) 2011 Volodymyr Rudyj <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301 USA.
19 */
20 #ifndef IE_EXP_EPUB_H_
21 #define IE_EXP_EPUB_H_
22
23 #include "ie_exp_EPUB_EPUB3Writer.h"
24 #include "ap_Dialog_EpubExportOptions.h"
25
26 #include <string>
27 #include <vector>
28 #include <algorithm>
29 // External includes
30 #include <gsf/gsf-output-stdio.h>
31 #include <gsf/gsf-outfile.h>
32 #include <gsf/gsf-outfile-zip.h>
33 #include <gsf/gsf-output.h>
34 #include <gsf/gsf-libxml.h>
35 #include <gsf/gsf-infile-stdio.h>
36 #include <gsf/gsf-infile.h>
37 // Abiword includes
38 #include <ie_exp.h>
39 #include <ie_exp_HTML.h>
40 #include <pd_Document.h>
41 #include <ut_go_file.h>
42 #include <ut_path.h>
43 #include <ie_TOC.h>
44
45 #define EPUB_MIMETYPE "application/epub+zip"
46 #define OPF_MIMETYPE "application/oebps-package+xml"
47 #define OCF201_NAMESPACE "urn:oasis:names:tc:opendocument:xmlns:container"
48 #define OPF201_NAMESPACE "http://www.idpf.org/2007/opf"
49 #define OPS201_NAMESPACE "http://www.idpf.org/2007/ops"
50 #define EPUB3_PACKAGE_PROFILE "http://www.idpf.org/epub/30/profile/package/"
51 #define DC_NAMESPACE "http://purl.org/dc/elements/1.1/"
52 #define NCX_NAMESPACE "http://www.daisy.org/z3986/2005/ncx/"
53 class IE_Exp_EPUB: public IE_Exp
54 {
55
56 public:
57 IE_Exp_EPUB(PD_Document * pDocument);
58 virtual ~IE_Exp_EPUB();
59
60 protected:
61 virtual UT_Error _writeDocument();
62
63 private:
64 UT_Error writeStructure();
65 UT_Error writeNavigation();
66 UT_Error writeContainer();
67 UT_Error package();
68 UT_Error compress();
69
70 // Methods for EPUB 2.0.1 document generation
71 UT_Error EPUB2_writeStructure();
72 UT_Error EPUB2_writeNavigation();
73
74 // Methods for EPUB 3 document generation
75 UT_Error EPUB3_writeStructure();
76 UT_Error EPUB3_writeNavigation();
77
78
79 std::string getAuthor() const;
80 std::string getTitle() const;
81 std::string getLanguage() const;
82
83 UT_Error doOptions();
84 void registerDialogs();
85
86 static std::vector<std::string> getFileList(const std::string &directory);
87 static void closeNTags(GsfXMLOut* xml, int n);
88 static std::string escapeForId(const std::string & src);
89 static std::string getMimeType(const std::string &uri);
90
91 std::string m_baseTempDir;
92 std::string m_oebpsDir;
93 GsfOutfile* m_root;
94 GsfOutput* m_oebps;
95 IE_Exp_HTML *m_pHmtlExporter;
96 // Array with file id`s in linear reading order
97 std::vector<std::string> m_opsId;
98
99 XAP_Dialog_Id m_iDialogExport;
100 XAP_Exp_EpubExportOptions m_exp_opt;
101 };
102
103 #endif /* IE_EXP_EPUB_H_ */