forked from unruhschuh/MrWriter
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocument.h
107 lines (87 loc) · 2.47 KB
/
document.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef DOCUMENT_H
#define DOCUMENT_H
#include <QMessageBox>
#include <QPushButton>
#include <QObject>
#include <QDir>
#include <QProcess>
#include "page.h"
#include <poppler-qt5.h>
#include <memory>
#include <QVector>
namespace MrDoc
{
class Document
{
public:
Document();
/*Document(const Document &doc);
Document& operator= (const Document& doc);*/
/**
* @brief exportPDF exports the document as pdf using pdftk
* @param fileName is the full path
*/
void exportPDF(QString fileName);
/**
* @brief exportPDFAsImage exports the document as pdf but only as images
* @details It is not possible to search in the document.
* @param fileName is the full path
*/
void exportPDFAsImage(QString fileName);
/**
* @brief loadXOJ loads a .xoj (xournal file)
* @param fileName is the full path
* @return true if successful opening, otherwise false
*/
bool loadXOJ(QString fileName);
/**
* @brief saveXOJ exports the document as .xoj (xournal file)
* @param fileName is the full path
* @return true if saving was successful, otherwise false
*/
bool saveXOJ(QString fileName);
/**
* @brief loadMOJ loads a .moj (MrWriter file)
* @param fileName is the full path
* @return true if opening was successful, otherwise false
*/
bool loadMOJ(QString fileName);
/**
* @brief saveMOJ saves the document (as .moj)
* @param fileName is the full path
* @return true if saving was successful, otherwise false
*/
bool saveMOJ(QString fileName);
/**
* @brief loadPDF loads a .pdf file to annotate it
* @param fileName is the full path
* @return true if opening was successful otherwise false
*/
bool loadPDF(QString fileName);
void paintPage(int pageNum, QPainter &painter, qreal zoom);
bool setDocName(QString docName);
QString docName();
bool setPath(QString path);
QString path();
bool documentChanged();
void setDocumentChanged(bool changed);
QVector<MrDoc::Page> pages;
QString toRGBA(QString argb);
QString toARGB(QString rgba);
QColor stringToColor(QString colorString);
private:
/**
* @brief The pageType enum is for distinguishing between plain pages and pdf pages
*/
enum class pageType {
PDF,
NOPDF
};
bool m_documentChanged;
QString m_docName;
QString m_path;
QString m_pdfPath; /**< path to the underlying pdf file */
std::shared_ptr<Poppler::Document> m_pdfDoc; /**< pointer to the underlying pdf file (opened with poppler) */
};
}
#endif // DOCUMENT_H