| 1 |
/* |
| 2 |
* This file is part of the apvlv package |
| 3 |
* Copyright (C) <2010> <Alf> |
| 4 |
* |
| 5 |
* Contact: Alf <[email protected]> |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License along |
| 18 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 |
* |
| 21 |
*/ |
| 22 |
/* @CPPFILE ApvlvEpub.h |
| 23 |
* |
| 24 |
* Author: Alf <[email protected]> |
| 25 |
*/ |
| 26 |
|
| 27 |
#ifndef _APVLV_EPUB_H_ |
| 28 |
#define _APVLV_EPUB_H_ |
| 29 |
|
| 30 |
#include <QXmlStreamReader> |
| 31 |
#include <map> |
| 32 |
#include <memory> |
| 33 |
#include <quazip.h> |
| 34 |
#include <string> |
| 35 |
|
| 36 |
#include "ApvlvFile.h" |
| 37 |
|
| 38 |
namespace apvlv |
| 39 |
{ |
| 40 |
class ApvlvEPUB : public File |
| 41 |
{ |
| 42 |
FILE_TYPE_DECLARATION (ApvlvEPUB); |
| 43 |
|
| 44 |
public: |
| 45 |
bool load (const std::string &filename) override; |
| 46 |
~ApvlvEPUB () override; |
| 47 |
|
| 48 |
int sum () override; |
| 49 |
|
| 50 |
bool pageRenderToWebView (int pn, double zm, int rot, |
| 51 |
WebView *widget) override; |
| 52 |
|
| 53 |
std::unique_ptr<WordListRectangle> pageSearch (int pn, |
| 54 |
const char *s) override; |
| 55 |
|
| 56 |
std::optional<QByteArray> pathContent (const std::string &path) override; |
| 57 |
|
| 58 |
private: |
| 59 |
std::optional<QByteArray> getZipFileContents (const QString &name); |
| 60 |
|
| 61 |
static std::string containerGetContentfile (const char *container, int len); |
| 62 |
|
| 63 |
bool contentGetMedia (const std::string &contentfile); |
| 64 |
|
| 65 |
bool ncxSetIndex (const std::string &ncxfile); |
| 66 |
|
| 67 |
void ncxNodeSetIndex (QXmlStreamReader *xml, const std::string &element_name, |
| 68 |
const std::string &ncxfile, FileIndex &index); |
| 69 |
|
| 70 |
std::unique_ptr<QuaZip> mQuaZip; |
| 71 |
std::map<std::string, std::string> idSrcs; |
| 72 |
}; |
| 73 |
|
| 74 |
} |
| 75 |
|
| 76 |
#endif |
| 77 |
|
| 78 |
/* Local Variables: */ |
| 79 |
/* mode: c++ */ |
| 80 |
/* End: */ |