-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDocument.h
115 lines (83 loc) · 2.22 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
108
109
110
111
112
113
114
#ifndef _CFIELDADD_H
#define _CFIELDADD_H
#include<wx/wx.h>
#include <wx/bitmap.h>
#include<wx/rawbmp.h>
#include<wx/pdfdocument.h>
#include<vector>
#include"Utility.h"
#include"Main.h"
#include <wx/gdicmn.h>
#include"Grid.h"
#include "Appearnce.h"
class Document
{
typedef wxAlphaPixelData PixelData;
//Contains all the fields on a given page
class PageFields
{
public:
//Constructor for initializing the capacity field
PageFields():capacity(10)
{
fieldCount = 0;
pageFields.reserve(capacity);
}
std::vector<Field> pageFields;
int fieldCount;
//Vector Capacity
int capacity;
};
fz_context *ctx;
//Array of Fields on all the pages
PageFields * docFields;
//Units moved by field in the coordinate system of muPDF
int mUnits;
//PDF Dimensions in units
int pdfUnitW,pdfUnitH;
//The Current Page Being Displayed
int curPage;
//The Current Zoom Level
int curZoom;
//Total Page Count of the Document
int pageCount;
//The path of the document
char * filePath;
//The Bitmap to be displayed
wxBitmap * bitmap;
//Convert pixmap to bitmap
wxBitmap *RGBAtoBitmap(unsigned char *rgba, int w, int h);
//Setup temporary pdf for wxPDFDOCUMENT
void SetupPage();
//flag for diplaying values
bool demo;
public:
Document(char*);
~Document();
//Add Field To the Document
void AddField(Field f);
//Render the Document
wxBitmap * renderPDF();
//Loads and prepares the Page in the memory
void LoadPage(int);
//Get Page Count
int getPageCount();
//Get Current Zoom
int getCurZoom();
//Get Current Page
int getCurPage();
//Set Current Page
void setCurPage(int);
//Set Current Zoom
void setCurZoom(int);
//get pdf units
int getPDFWidth();
int getPDFHeight();
void setDemo(bool);
//Moves the field - wxPoint acts as vector specifying direction
void MoveFields(wxPoint,std::vector<SelectedItem> &,float);
//Returns the field selected
Field SelectField(wxPoint pt);
void AlignSelectedField(Grid,std::vector<SelectedItem> &,float);
};
#endif // _CFIELDADD_H