5 #ifndef PDFTRON_H_CPPPDFCallback
6 #define PDFTRON_H_CPPPDFCallback
10 #include <C/Common/TRN_Types.h>
33 virtual void RenderBeginEventProc(){}
35 static void StaticRenderBeginEventProc(
void* data)
37 Callback* cb = (Callback*) data;
38 cb->RenderBeginEventProc();
41 virtual void RenderFinishEventProc(
bool cancelled){}
43 static void StaticRenderFinishEventProc(
void* data,
bool cancelled)
45 Callback* cb = (Callback*) data;
46 cb->RenderFinishEventProc(cancelled);
49 virtual void ErrorReportProc (
const char* message) {}
51 static void StaticErrorReportProc (
const char* message,
void* data)
53 Callback* cb = (Callback*) data;
54 cb->ErrorReportProc(message);
57 virtual void CurrentPageProc(
int current_page,
int num_pages) {}
59 static void StaticCurrentPageProc(
int current_page,
int num_pages,
void* data)
61 Callback* cb = (Callback*) data;
62 cb->CurrentPageProc(current_page, num_pages);
65 virtual void JavaScriptEventProc(
const char* event_type,
const char* json) {}
67 static void StaticJavaScriptEventProc(
const char* event_type,
const char* json,
void* data)
69 Callback* cb= (Callback*) data;
70 cb->JavaScriptEventProc(event_type,json);
73 virtual void CurrentZoomProc(
double curr_zoom_proc) {}
75 static void StaticCurrentZoomProc(
double curr_zoom_proc,
void* data)
77 Callback* cb = (Callback*) data;
78 cb->CurrentZoomProc(curr_zoom_proc);
81 virtual void ConnectionErrorProc(
const char* message,
const int error_code,
UChar switch_to_demo) {}
83 static void StaticConnectionErrorProc(
const char* message,
const int error_code,
UChar switch_to_demo,
void* data)
85 Callback* cb = (Callback*)data;
86 cb->ConnectionErrorProc(message, error_code, switch_to_demo);
89 virtual void ThumbAsyncHandler(
int page_num,
bool was_thumb_found,
const char* thumb_buf,
int thumb_width,
int thumb_height) {}
91 static void StaticThumbAsyncHandler(
int page_num,
bool was_thumb_found,
const char* thumb_buf,
int thumb_width,
int thumb_height,
void* custom_data)
93 Callback* cb = (Callback*) custom_data;
94 cb->ThumbAsyncHandler(page_num, was_thumb_found, thumb_buf, thumb_width, thumb_height);
97 virtual void RequestRenderInWorkerThread() {}
99 static void StaticRequestRenderInWorkerThread(
void* custom_data)
101 Callback* cb = (Callback*) custom_data;
102 cb->RequestRenderInWorkerThread();
105 virtual void FindTextHandler(
bool success, PDF::Selection selection) {}
107 static void StaticFindTextHandler(
bool success, PDF::Selection selection,
void* custom_data)
109 Callback* cb = (Callback*) custom_data;
110 cb->FindTextHandler(success, selection);
113 virtual void CreateTileProc(
114 char* buffer,
int originX,
int originY,
int width,
int height,
115 int pagNum,
long long cellNumber,
116 bool finalRender,
bool predictionRender,
117 int tilesRemaining,
bool firstTile,
118 int canvasWidth,
int canvasHeight,
int cellSideLength,
int cellPerRow,
int cellPerCol,
122 static void StaticCreateTileProc(
124 char* buffer,
int originX,
int originY,
int width,
int height,
125 int pageNum,
long long cellNumber,
126 bool finalRender,
bool predictionRender,
127 int tilesRemaining,
bool firstTile,
128 int canvasWidth,
int canvasHeight,
int cellSideLength,
int cellPerRow,
int cellPerCol,
132 Callback* cb = (Callback*) customData;
134 buffer, originX, originY, width, height,
136 finalRender, predictionRender,
137 tilesRemaining, firstTile,
138 canvasWidth, canvasHeight, cellSideLength, cellPerRow, cellPerCol,
143 virtual void AnnotBitmapProc(
int operation_type,
145 UInt32 page_num,
UInt32 annot_index,
const void* annot_key,
146 Int64 x_in_page,
Int64 y_in_page,
int x_offset,
int y_offset,
147 int remaining_tiles,
int sequence_number,
Int64 x_page_size,
Int64 y_page_size) {}
149 static void StaticAnnotBitmapProc(
void* me,
int operation_type,
151 UInt32 page_num,
UInt32 annot_index,
const void* annot_key,
152 Int64 x_in_page,
Int64 y_in_page,
int x_offset,
int y_offset,
153 int remaining_tiles,
int sequence_number,
Int64 x_page_size,
Int64 y_page_size)
155 Callback* cb = (Callback*) me;
156 cb->AnnotBitmapProc(operation_type, buffer,
157 width, height, stride,
158 page_num, annot_index, annot_key,
159 x_in_page, y_in_page, x_offset, y_offset,
160 remaining_tiles, sequence_number, x_page_size, y_page_size);
166 virtual void DeluxeCreateTileProc(
167 char* buffer,
unsigned int width,
unsigned int height,
unsigned int stride,
168 unsigned int page_num,
UInt64 x_page_loc,
UInt64 y_page_loc,
169 unsigned int zoomed_page_width,
unsigned int zoomed_page_height,
170 unsigned int tile_id,
unsigned int x_in_page,
unsigned int y_in_page,
171 int canvas_id,
int remaining_tiles,
int tile_type,
175 static void StaticDeluxeCreateTileProc(
177 char* buffer,
unsigned int width,
unsigned int height,
unsigned int stride,
178 unsigned int page_num,
UInt64 x_page_loc,
UInt64 y_page_loc,
179 unsigned int zoomed_page_width,
unsigned int zoomed_page_height,
180 unsigned int tile_id,
unsigned int x_in_page,
unsigned int y_in_page,
181 int canvas_id,
int remaining_tiles,
int tile_type,
185 Callback* cb = (Callback*) me;
186 cb->DeluxeCreateTileProc(
187 buffer, width, height, stride,
188 page_num, x_page_loc, y_page_loc,
189 zoomed_page_width, zoomed_page_height,
190 tile_id, x_in_page, y_in_page,
191 canvas_id, remaining_tiles, tile_type,
198 virtual void RemoveTileProc(
int canvasNumber,
Int64 cellNumber,
int thumbnailId,
int sequenceNumber) { }
200 static void StaticRemoveTileProc(
void* customData,
int canvasNumber,
Int64 cellNumber,
int thumbnailId,
int sequenceNumber)
202 Callback* cb = (Callback*) customData;
203 cb->RemoveTileProc(canvasNumber, cellNumber, thumbnailId, sequenceNumber);
206 virtual void PartDownloadedProc(
int dlType, TRN_PDFDoc doc,
unsigned int pageNum,
unsigned int objNum,
const char* message) { }
208 static void StaticPartDownloadedProc(
int dlType, TRN_PDFDoc doc,
unsigned int pageNum,
unsigned int objNum,
const char* message,
void* customData)
210 Callback* cb = (Callback*) customData;
211 cb->PartDownloadedProc(dlType, doc, pageNum, objNum, message);
220 #endif // PDFTRON_H_CPPPDFCallback