blob: 0027aa4b522618d50f7c5c88ed9d3baa816990f7 [file] [log] [blame]
Tom Sepezcf22eb82015-05-12 17:28:08 -07001// Copyright 2015 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This "C" (not "C++") file ensures that the public headers compile
6// and link for "C" (and not just "C++").
7
8#include <stdio.h>
9
Dan Sinclairf766ad22016-03-14 13:51:24 -040010#include "fpdfsdk/fpdfview_c_api_test.h"
Tom Sepezcf22eb82015-05-12 17:28:08 -070011
Jane Liu4fd9a472017-06-01 18:56:09 -040012#include "public/fpdf_annot.h"
Lei Zhangb4e7f302015-11-06 15:52:32 -080013#include "public/fpdf_dataavail.h"
14#include "public/fpdf_doc.h"
15#include "public/fpdf_edit.h"
16#include "public/fpdf_ext.h"
17#include "public/fpdf_flatten.h"
18#include "public/fpdf_formfill.h"
19#include "public/fpdf_fwlevent.h"
20#include "public/fpdf_ppo.h"
21#include "public/fpdf_progressive.h"
22#include "public/fpdf_save.h"
23#include "public/fpdf_searchex.h"
thestig9067fd62016-11-23 14:10:06 -080024#include "public/fpdf_structtree.h"
Lei Zhangb4e7f302015-11-06 15:52:32 -080025#include "public/fpdf_sysfontinfo.h"
26#include "public/fpdf_text.h"
27#include "public/fpdf_transformpage.h"
28#include "public/fpdfview.h"
Tom Sepezcf22eb82015-05-12 17:28:08 -070029
30// Scheme for avoiding LTO out of existence, warnings, etc.
31typedef void (*fnptr)(void); // Legal generic function type for casts.
32fnptr g_c_api_test_fnptr = NULL; // Extern, so can't know it doesn't change.
33#define CHK(x) if ((fnptr)(x) == g_c_api_test_fnptr) return 0
34
35// Function to call from gtest harness to ensure linker resolution.
36int CheckPDFiumCApi() {
Jane Liu4fd9a472017-06-01 18:56:09 -040037 //fpdf_annot.h
Jane Liu262cf462017-06-09 11:36:37 -040038 CHK(FPDFAnnot_IsSupportedSubtype);
39 CHK(FPDFPage_CreateAnnot);
Jane Liu4fd9a472017-06-01 18:56:09 -040040 CHK(FPDFPage_GetAnnotCount);
41 CHK(FPDFPage_GetAnnot);
Jane Liue10509a2017-06-20 16:47:41 -040042 CHK(FPDFPage_CloseAnnot);
Jane Liu8ce58f52017-06-29 13:40:22 -040043 CHK(FPDFPage_RemoveAnnot);
Jane Liu4fd9a472017-06-01 18:56:09 -040044 CHK(FPDFAnnot_GetSubtype);
Jane Liu36567742017-07-06 11:13:35 -040045 CHK(FPDFAnnot_UpdateObject);
46 CHK(FPDFAnnot_AppendObject);
47 CHK(FPDFAnnot_GetObjectCount);
48 CHK(FPDFAnnot_GetObject);
Jane Liu262cf462017-06-09 11:36:37 -040049 CHK(FPDFAnnot_SetColor);
Jane Liu4fd9a472017-06-01 18:56:09 -040050 CHK(FPDFAnnot_GetColor);
Jane Liu262cf462017-06-09 11:36:37 -040051 CHK(FPDFAnnot_HasAttachmentPoints);
52 CHK(FPDFAnnot_SetAttachmentPoints);
Jane Liu4fd9a472017-06-01 18:56:09 -040053 CHK(FPDFAnnot_GetAttachmentPoints);
Jane Liu262cf462017-06-09 11:36:37 -040054 CHK(FPDFAnnot_SetRect);
Jane Liu4fd9a472017-06-01 18:56:09 -040055 CHK(FPDFAnnot_GetRect);
Jane Liu262cf462017-06-09 11:36:37 -040056 CHK(FPDFAnnot_SetText);
Jane Liu4fd9a472017-06-01 18:56:09 -040057 CHK(FPDFAnnot_GetText);
Jane Liub137e752017-07-05 15:04:33 -040058 CHK(FPDFAnnot_GetFlags);
59 CHK(FPDFAnnot_SetFlags);
Jane Liu4fd9a472017-06-01 18:56:09 -040060
Tom Sepezcf22eb82015-05-12 17:28:08 -070061 // fpdf_dataavail.h
62 CHK(FPDFAvail_Create);
63 CHK(FPDFAvail_Destroy);
64 CHK(FPDFAvail_IsDocAvail);
65 CHK(FPDFAvail_GetDocument);
66 CHK(FPDFAvail_GetFirstPageNum);
67 CHK(FPDFAvail_IsPageAvail);
68 CHK(FPDFAvail_IsFormAvail);
69 CHK(FPDFAvail_IsLinearized);
70
71 // fpdf_doc.h
72 CHK(FPDFBookmark_GetFirstChild);
73 CHK(FPDFBookmark_GetNextSibling);
74 CHK(FPDFBookmark_GetTitle);
75 CHK(FPDFBookmark_Find);
76 CHK(FPDFBookmark_GetDest);
77 CHK(FPDFBookmark_GetAction);
78 CHK(FPDFAction_GetType);
79 CHK(FPDFAction_GetDest);
Lei Zhange0947b32015-09-17 14:51:48 -070080 CHK(FPDFAction_GetFilePath);
Tom Sepezcf22eb82015-05-12 17:28:08 -070081 CHK(FPDFAction_GetURIPath);
82 CHK(FPDFDest_GetPageIndex);
dsinclairc59fa882016-11-08 06:55:40 -080083 CHK(FPDFDest_GetLocationInPage);
Tom Sepezcf22eb82015-05-12 17:28:08 -070084 CHK(FPDFLink_GetLinkAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -070085 CHK(FPDFLink_GetLinkZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -070086 CHK(FPDFLink_GetDest);
87 CHK(FPDFLink_GetAction);
88 CHK(FPDFLink_Enumerate);
89 CHK(FPDFLink_GetAnnotRect);
90 CHK(FPDFLink_CountQuadPoints);
91 CHK(FPDFLink_GetQuadPoints);
92 CHK(FPDF_GetMetaText);
dsinclair6bdb56c2016-12-06 09:53:27 -080093 CHK(FPDF_GetPageLabel);
Tom Sepezcf22eb82015-05-12 17:28:08 -070094
95 // fpdf_edit.h
96 CHK(FPDF_CreateNewDocument);
97 CHK(FPDFPage_New);
98 CHK(FPDFPage_Delete);
99 CHK(FPDFPage_GetRotation);
100 CHK(FPDFPage_SetRotation);
101 CHK(FPDFPage_InsertObject);
102 CHK(FPDFPage_CountObject);
103 CHK(FPDFPage_GetObject);
104 CHK(FPDFPage_HasTransparency);
105 CHK(FPDFPage_GenerateContent);
106 CHK(FPDFPageObj_HasTransparency);
wileyryad9dc9622017-05-31 14:12:49 -0500107 CHK(FPDFPageObj_GetBounds);
Miklos Vajna14233192017-04-03 16:02:39 +0200108 CHK(FPDFPageObj_GetType);
wileyryad9dc9622017-05-31 14:12:49 -0500109 CHK(FPDFPageObj_SetBlendMode);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700110 CHK(FPDFPageObj_Transform);
111 CHK(FPDFPage_TransformAnnots);
Lei Zhangcbd89572017-03-15 17:35:47 -0700112 CHK(FPDFPageObj_NewImageObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700113 CHK(FPDFImageObj_LoadJpegFile);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500114 CHK(FPDFImageObj_LoadJpegFileInline);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700115 CHK(FPDFImageObj_SetMatrix);
116 CHK(FPDFImageObj_SetBitmap);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500117 CHK(FPDFPageObj_CreateNewPath);
118 CHK(FPDFPageObj_CreateNewRect);
119 CHK(FPDFPath_SetStrokeColor);
Jane Liu3b057432017-06-19 10:44:01 -0400120 CHK(FPDFPath_GetStrokeColor);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500121 CHK(FPDFPath_SetStrokeWidth);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500122 CHK(FPDFPath_SetFillColor);
Miklos Vajnaed4705b2017-04-05 09:24:50 +0200123 CHK(FPDFPath_GetFillColor);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500124 CHK(FPDFPath_MoveTo);
125 CHK(FPDFPath_LineTo);
126 CHK(FPDFPath_BezierTo);
127 CHK(FPDFPath_Close);
128 CHK(FPDFPath_SetDrawMode);
wileyryad9dc9622017-05-31 14:12:49 -0500129 CHK(FPDFPath_SetLineCap);
130 CHK(FPDFPath_SetLineJoin);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500131 CHK(FPDFPageObj_NewTextObj);
132 CHK(FPDFText_SetText);
wileyryad9dc9622017-05-31 14:12:49 -0500133 CHK(FPDFText_SetFillColor);
Nicolas Penad03ca422017-03-06 13:54:33 -0500134 CHK(FPDFText_LoadFont);
Nicolas Penab3161852017-05-02 14:12:50 -0400135 CHK(FPDFFont_Close);
136 CHK(FPDFPageObj_CreateTextObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700137
138 // fpdf_ext.h
139 CHK(FSDK_SetUnSpObjProcessHandler);
140 CHK(FPDFDoc_GetPageMode);
141
142 // fpdf_flatten.h
143 CHK(FPDFPage_Flatten);
144
145 // fpdf_fwlevent.h - no exports.
146
147 // fpdf_formfill.h
148 CHK(FPDFDOC_InitFormFillEnvironment);
149 CHK(FPDFDOC_ExitFormFillEnvironment);
150 CHK(FORM_OnAfterLoadPage);
151 CHK(FORM_OnBeforeClosePage);
152 CHK(FORM_DoDocumentJSAction);
153 CHK(FORM_DoDocumentOpenAction);
154 CHK(FORM_DoDocumentAAction);
155 CHK(FORM_DoPageAAction);
156 CHK(FORM_OnMouseMove);
157 CHK(FORM_OnLButtonDown);
158 CHK(FORM_OnLButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800159#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700160 CHK(FORM_OnRButtonDown);
161 CHK(FORM_OnRButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800162#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700163 CHK(FORM_OnKeyDown);
164 CHK(FORM_OnKeyUp);
165 CHK(FORM_OnChar);
Diana Gagedce2d722017-06-20 11:17:11 -0700166 CHK(FORM_GetSelectedText);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700167 CHK(FORM_ForceToKillFocus);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700168 CHK(FPDFPage_HasFormFieldAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700169 CHK(FPDFPage_FormFieldZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700170 CHK(FPDF_SetFormFieldHighlightColor);
171 CHK(FPDF_SetFormFieldHighlightAlpha);
172 CHK(FPDF_RemoveFormFieldHighlight);
173 CHK(FPDF_FFLDraw);
Tom Sepez51da0932015-11-25 16:05:49 -0800174#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700175 CHK(FPDF_HasXFAField);
176 CHK(FPDF_LoadXFA);
177 CHK(FPDF_Widget_Undo);
178 CHK(FPDF_Widget_Redo);
179 CHK(FPDF_Widget_SelectAll);
180 CHK(FPDF_Widget_Copy);
181 CHK(FPDF_Widget_Cut);
182 CHK(FPDF_Widget_Paste);
183 CHK(FPDF_Widget_ReplaceSpellCheckWord);
184 CHK(FPDF_Widget_GetSpellCheckWords);
185 CHK(FPDF_StringHandleCounts);
186 CHK(FPDF_StringHandleGetStringByIndex);
187 CHK(FPDF_StringHandleRelease);
188 CHK(FPDF_StringHandleAddString);
Tom Sepez51da0932015-11-25 16:05:49 -0800189#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700190
191 // fpdf_ppo.h
192 CHK(FPDF_ImportPages);
193 CHK(FPDF_CopyViewerPreferences);
194
195 // fpdf_progressive.h
196 CHK(FPDF_RenderPageBitmap_Start);
197 CHK(FPDF_RenderPage_Continue);
198 CHK(FPDF_RenderPage_Close);
199
200 // fpdf_save.h
201 CHK(FPDF_SaveAsCopy);
202 CHK(FPDF_SaveWithVersion);
203
204 // fpdf_searchex.h
205 CHK(FPDFText_GetCharIndexFromTextIndex);
Nicolas Pena5c1961d2017-03-10 11:59:17 -0500206 CHK(FPDFText_GetTextIndexFromCharIndex);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700207
thestig9067fd62016-11-23 14:10:06 -0800208 // fpdf_structtree.h
209 CHK(FPDF_StructTree_GetForPage);
210 CHK(FPDF_StructTree_Close);
211 CHK(FPDF_StructTree_CountChildren);
212 CHK(FPDF_StructTree_GetChildAtIndex);
213 CHK(FPDF_StructElement_GetAltText);
Dan Sinclair29479f62017-04-04 10:48:19 -0400214 CHK(FPDF_StructElement_GetType);
thestig9067fd62016-11-23 14:10:06 -0800215 CHK(FPDF_StructElement_CountChildren);
216 CHK(FPDF_StructElement_GetChildAtIndex);
217
Tom Sepezcf22eb82015-05-12 17:28:08 -0700218 // fpdf_sysfontinfo.h
219 CHK(FPDF_GetDefaultTTFMap);
220 CHK(FPDF_AddInstalledFont);
221 CHK(FPDF_SetSystemFontInfo);
222 CHK(FPDF_GetDefaultSystemFontInfo);
npm788217d2016-11-08 16:48:36 -0800223 CHK(FPDF_FreeDefaultSystemFontInfo);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700224
225 // fpdf_text.h
226 CHK(FPDFText_LoadPage);
227 CHK(FPDFText_ClosePage);
228 CHK(FPDFText_CountChars);
229 CHK(FPDFText_GetUnicode);
230 CHK(FPDFText_GetFontSize);
231 CHK(FPDFText_GetCharBox);
232 CHK(FPDFText_GetCharIndexAtPos);
233 CHK(FPDFText_GetText);
234 CHK(FPDFText_CountRects);
235 CHK(FPDFText_GetRect);
236 CHK(FPDFText_GetBoundedText);
237 CHK(FPDFText_FindStart);
238 CHK(FPDFText_FindNext);
239 CHK(FPDFText_FindPrev);
240 CHK(FPDFText_GetSchResultIndex);
241 CHK(FPDFText_GetSchCount);
242 CHK(FPDFText_FindClose);
243 CHK(FPDFLink_LoadWebLinks);
244 CHK(FPDFLink_CountWebLinks);
245 CHK(FPDFLink_GetURL);
246 CHK(FPDFLink_CountRects);
247 CHK(FPDFLink_GetRect);
248 CHK(FPDFLink_CloseWebLinks);
249
250 // fpdf_transformpage.h
251 CHK(FPDFPage_SetMediaBox);
252 CHK(FPDFPage_SetCropBox);
253 CHK(FPDFPage_GetMediaBox);
254 CHK(FPDFPage_GetCropBox);
255 CHK(FPDFPage_TransFormWithClip);
256 CHK(FPDFPageObj_TransformClipPath);
257 CHK(FPDF_CreateClipPath);
258 CHK(FPDF_DestroyClipPath);
259 CHK(FPDFPage_InsertClipPath);
260
261 // fpdfview.h
262 CHK(FPDF_InitLibrary);
Lei Zhang6f62d532015-09-23 15:31:44 -0700263 CHK(FPDF_InitLibraryWithConfig);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700264 CHK(FPDF_DestroyLibrary);
265 CHK(FPDF_SetSandBoxPolicy);
266 CHK(FPDF_LoadDocument);
267 CHK(FPDF_LoadMemDocument);
268 CHK(FPDF_LoadCustomDocument);
269 CHK(FPDF_GetFileVersion);
270 CHK(FPDF_GetLastError);
271 CHK(FPDF_GetDocPermissions);
272 CHK(FPDF_GetSecurityHandlerRevision);
273 CHK(FPDF_GetPageCount);
274 CHK(FPDF_LoadPage);
275 CHK(FPDF_GetPageWidth);
276 CHK(FPDF_GetPageHeight);
277 CHK(FPDF_GetPageSizeByIndex);
278 CHK(FPDF_RenderPageBitmap);
thestiga78ba602016-11-23 15:25:48 -0800279 CHK(FPDF_RenderPageBitmapWithMatrix);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700280 CHK(FPDF_ClosePage);
281 CHK(FPDF_CloseDocument);
282 CHK(FPDF_DeviceToPage);
283 CHK(FPDF_PageToDevice);
284 CHK(FPDFBitmap_Create);
285 CHK(FPDFBitmap_CreateEx);
286 CHK(FPDFBitmap_FillRect);
287 CHK(FPDFBitmap_GetBuffer);
288 CHK(FPDFBitmap_GetWidth);
289 CHK(FPDFBitmap_GetHeight);
290 CHK(FPDFBitmap_GetStride);
291 CHK(FPDFBitmap_Destroy);
292 CHK(FPDF_VIEWERREF_GetPrintScaling);
293 CHK(FPDF_VIEWERREF_GetNumCopies);
294 CHK(FPDF_VIEWERREF_GetPrintPageRange);
295 CHK(FPDF_VIEWERREF_GetDuplex);
thestig04bebfe2016-11-04 16:07:25 -0700296 CHK(FPDF_VIEWERREF_GetName);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700297 CHK(FPDF_CountNamedDests);
298 CHK(FPDF_GetNamedDestByName);
299 CHK(FPDF_GetNamedDest);
Tom Sepez51da0932015-11-25 16:05:49 -0800300#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700301 CHK(FPDF_BStr_Init);
302 CHK(FPDF_BStr_Set);
303 CHK(FPDF_BStr_Clear);
Tom Sepez51da0932015-11-25 16:05:49 -0800304#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700305
306 return 1;
307}
308
309#undef CHK