| 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 ApvlvPdf.h |
| 23 |
* |
| 24 |
* Author: Alf <[email protected]> |
| 25 |
*/ |
| 26 |
|
| 27 |
#ifndef _APVLV_MUPDF_H_ |
| 28 |
#define _APVLV_MUPDF_H_ |
| 29 |
|
| 30 |
#include <mupdf/fitz.h> |
| 31 |
#include <vector> |
| 32 |
|
| 33 |
#include "ApvlvFile.h" |
| 34 |
|
| 35 |
namespace apvlv |
| 36 |
{ |
| 37 |
|
| 38 |
class ApvlvMuPDF : public File |
| 39 |
{ |
| 40 |
FILE_TYPE_DECLARATION (ApvlvMuPDF); |
| 41 |
|
| 42 |
public: |
| 43 |
ApvlvMuPDF (); |
| 44 |
~ApvlvMuPDF () override; |
| 45 |
|
| 46 |
bool load (const std::string &filename) override; |
| 47 |
|
| 48 |
[[nodiscard]] DISPLAY_TYPE |
| 49 |
getDisplayType () const override |
| 50 |
{ |
| 51 |
return DISPLAY_TYPE::IMAGE; |
| 52 |
} |
| 53 |
|
| 54 |
SizeF pageSizeF (int page, int rot) override; |
| 55 |
|
| 56 |
int sum () override; |
| 57 |
|
| 58 |
bool pageIsOnlyImage (int pn) override; |
| 59 |
|
| 60 |
bool pageRenderToImage (int pn, double zm, int rot, QImage *img) override; |
| 61 |
|
| 62 |
std::optional<std::vector<Rectangle> > |
| 63 |
pageHighlight (int pn, const ApvlvPoint &pa, const ApvlvPoint &pb) override; |
| 64 |
|
| 65 |
bool pageText (int pn, const Rectangle &rect, std::string &text) override; |
| 66 |
|
| 67 |
std::unique_ptr<WordListRectangle> pageSearch (int pn, |
| 68 |
const char *str) override; |
| 69 |
|
| 70 |
private: |
| 71 |
fz_context *mContext; |
| 72 |
fz_document *mDoc; |
| 73 |
|
| 74 |
void pageRenderComments (int pn, fz_pixmap *pixmap, |
| 75 |
const std::vector<Comment> &comments, |
| 76 |
const fz_matrix &mat); |
| 77 |
void generateIndex (); |
| 78 |
void generateIndexRecursively (FileIndex &index, const fz_outline *outline); |
| 79 |
}; |
| 80 |
} |
| 81 |
#endif |
| 82 |
|
| 83 |
/* Local Variables: */ |
| 84 |
/* mode: c++ */ |
| 85 |
/* End: */ |