File: CPdfDocument.h

package info (click to toggle)
gambas3 3.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 51,876 kB
  • sloc: ansic: 149,522; cpp: 90,749; sh: 18,812; makefile: 1,761; perl: 1,536; xml: 482; cs: 342; python: 299
file content (142 lines) | stat: -rw-r--r-- 3,325 bytes parent folder | download
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/***************************************************************************

  CPdfDocument.h

  (C) 2005-2007 Daniel Campos Fernández <dcamposf@gmail.com>

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2, or (at your option)
  any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  MA 02110-1301, USA.

***************************************************************************/

#ifndef __CPDFDOCUMENT_H
#define __CPDFDOCUMENT_H

#include "gambas.h"

#include <PDFDoc.h>
#include <SplashOutputDev.h>
#include <Page.h>
#if POPPLER_VERSION_0_76
#include <vector>
#include <Outline.h>
#else
#include <goo/GooList.h>
#endif
#include <stdint.h>

#if POPPLER_VERSION_0_76
#define const_LinkAction const LinkAction
#define const_LinkDest const LinkDest
#define const_GooList const std::vector<OutlineItem*>
#define GooList std::vector<OutlineItem*>
#define const_GooString const GooString
#elif POPPLER_VERSION_0_64
#define const_LinkAction const LinkAction
#define const_LinkDest const LinkDest
#define const_GooList const GooList
#define const_GooString const GooString
#else
#define const_LinkAction LinkAction
#define const_LinkDest LinkDest
#define const_GooList GooList
#define const_GooString GooString
#endif

#ifndef __CPDFDOCUMENT_C

extern GB_DESC PdfRectDesc[];
extern GB_DESC PdfDocumentDesc[];
extern GB_DESC PdfPageDesc[];
extern GB_DESC PdfResultDesc[];
extern GB_DESC PdfLinkDesc[];
extern GB_DESC PdfLinkDataDesc[];
extern GB_DESC PdfIndexDesc[];
extern GB_DESC PdfDocumentInfo[];
extern GB_DESC PdfLayoutDesc[];
extern GB_DESC PdfModeDesc[];

#else

#define THIS ((CPDFDOCUMENT *)_object)
#define THIS_RECT ((CPDFRECT *)_object)

#endif

#if POPPLER_VERSION_0_76

#define CPDF_list_get(_list, _i) ((_list)->at(_i))
#define CPDF_list_count(_list) ((_list)->size())

#else

#define CPDF_list_get(_list, _i) ((OutlineItem *)(_list)->get(_i))
#define CPDF_list_count(_list) ((_list)->getLength())

#endif

#define CPDF_index_get(_i) CPDF_list_get(THIS->index, _i)
#define CPDF_index_count() CPDF_list_count(THIS->index)


typedef
	struct {
		GB_BASE ob;
		double x, y, w, h;
	}
	CPDFRECT;

typedef 
	struct {
		double x0;
		double y0;
		double x1;
		double y1;
	} 
	CPDFFIND;

typedef
	struct {
		GB_BASE ob;

		char *buf;
		int len;

		PDFDoc *doc;
		SplashOutputDev *dev;
		Page *page;
		uint currpage;

		void **pindex;            // Parent of current index entries
		const_GooList *index;     // Current entries
		
		uint currindex;           // Current entry
		uint *oldindex;           // Parent entry

		Links *links;             // Page bookmarks
		uint lcurrent;            // Current bookmark

		CPDFFIND *Found;          // Found text elements

		const_LinkAction *action; // Current link action

		double scale;
		int rotation;
	}
	CPDFDOCUMENT;



#endif