blob: e6a58734d2d2b9d808e5b99b40bf8024eba7ccd5 [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 Liu2e1a32b2017-07-06 12:01:25 -040056 CHK(FPDFAnnot_HasKey);
57 CHK(FPDFAnnot_SetStringValue);
58 CHK(FPDFAnnot_GetStringValue);
Jane Liub137e752017-07-05 15:04:33 -040059 CHK(FPDFAnnot_GetFlags);
60 CHK(FPDFAnnot_SetFlags);
Jane Liu4fd9a472017-06-01 18:56:09 -040061
Tom Sepezcf22eb82015-05-12 17:28:08 -070062 // fpdf_dataavail.h
63 CHK(FPDFAvail_Create);
64 CHK(FPDFAvail_Destroy);
65 CHK(FPDFAvail_IsDocAvail);
66 CHK(FPDFAvail_GetDocument);
67 CHK(FPDFAvail_GetFirstPageNum);
68 CHK(FPDFAvail_IsPageAvail);
69 CHK(FPDFAvail_IsFormAvail);
70 CHK(FPDFAvail_IsLinearized);
71
72 // fpdf_doc.h
73 CHK(FPDFBookmark_GetFirstChild);
74 CHK(FPDFBookmark_GetNextSibling);
75 CHK(FPDFBookmark_GetTitle);
76 CHK(FPDFBookmark_Find);
77 CHK(FPDFBookmark_GetDest);
78 CHK(FPDFBookmark_GetAction);
79 CHK(FPDFAction_GetType);
80 CHK(FPDFAction_GetDest);
Lei Zhange0947b32015-09-17 14:51:48 -070081 CHK(FPDFAction_GetFilePath);
Tom Sepezcf22eb82015-05-12 17:28:08 -070082 CHK(FPDFAction_GetURIPath);
83 CHK(FPDFDest_GetPageIndex);
dsinclairc59fa882016-11-08 06:55:40 -080084 CHK(FPDFDest_GetLocationInPage);
Tom Sepezcf22eb82015-05-12 17:28:08 -070085 CHK(FPDFLink_GetLinkAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -070086 CHK(FPDFLink_GetLinkZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -070087 CHK(FPDFLink_GetDest);
88 CHK(FPDFLink_GetAction);
89 CHK(FPDFLink_Enumerate);
90 CHK(FPDFLink_GetAnnotRect);
91 CHK(FPDFLink_CountQuadPoints);
92 CHK(FPDFLink_GetQuadPoints);
93 CHK(FPDF_GetMetaText);
dsinclair6bdb56c2016-12-06 09:53:27 -080094 CHK(FPDF_GetPageLabel);
Tom Sepezcf22eb82015-05-12 17:28:08 -070095
96 // fpdf_edit.h
97 CHK(FPDF_CreateNewDocument);
98 CHK(FPDFPage_New);
99 CHK(FPDFPage_Delete);
100 CHK(FPDFPage_GetRotation);
101 CHK(FPDFPage_SetRotation);
102 CHK(FPDFPage_InsertObject);
103 CHK(FPDFPage_CountObject);
104 CHK(FPDFPage_GetObject);
105 CHK(FPDFPage_HasTransparency);
106 CHK(FPDFPage_GenerateContent);
107 CHK(FPDFPageObj_HasTransparency);
wileyryad9dc9622017-05-31 14:12:49 -0500108 CHK(FPDFPageObj_GetBounds);
Miklos Vajna14233192017-04-03 16:02:39 +0200109 CHK(FPDFPageObj_GetType);
wileyryad9dc9622017-05-31 14:12:49 -0500110 CHK(FPDFPageObj_SetBlendMode);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700111 CHK(FPDFPageObj_Transform);
112 CHK(FPDFPage_TransformAnnots);
Lei Zhangcbd89572017-03-15 17:35:47 -0700113 CHK(FPDFPageObj_NewImageObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700114 CHK(FPDFImageObj_LoadJpegFile);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500115 CHK(FPDFImageObj_LoadJpegFileInline);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700116 CHK(FPDFImageObj_SetMatrix);
117 CHK(FPDFImageObj_SetBitmap);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500118 CHK(FPDFPageObj_CreateNewPath);
119 CHK(FPDFPageObj_CreateNewRect);
120 CHK(FPDFPath_SetStrokeColor);
Jane Liu3b057432017-06-19 10:44:01 -0400121 CHK(FPDFPath_GetStrokeColor);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500122 CHK(FPDFPath_SetStrokeWidth);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500123 CHK(FPDFPath_SetFillColor);
Miklos Vajnaed4705b2017-04-05 09:24:50 +0200124 CHK(FPDFPath_GetFillColor);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500125 CHK(FPDFPath_MoveTo);
126 CHK(FPDFPath_LineTo);
127 CHK(FPDFPath_BezierTo);
128 CHK(FPDFPath_Close);
129 CHK(FPDFPath_SetDrawMode);
wileyryad9dc9622017-05-31 14:12:49 -0500130 CHK(FPDFPath_SetLineCap);
131 CHK(FPDFPath_SetLineJoin);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500132 CHK(FPDFPageObj_NewTextObj);
133 CHK(FPDFText_SetText);
wileyryad9dc9622017-05-31 14:12:49 -0500134 CHK(FPDFText_SetFillColor);
Nicolas Penad03ca422017-03-06 13:54:33 -0500135 CHK(FPDFText_LoadFont);
Nicolas Penab3161852017-05-02 14:12:50 -0400136 CHK(FPDFFont_Close);
137 CHK(FPDFPageObj_CreateTextObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700138
139 // fpdf_ext.h
140 CHK(FSDK_SetUnSpObjProcessHandler);
141 CHK(FPDFDoc_GetPageMode);
142
143 // fpdf_flatten.h
144 CHK(FPDFPage_Flatten);
145
146 // fpdf_fwlevent.h - no exports.
147
148 // fpdf_formfill.h
149 CHK(FPDFDOC_InitFormFillEnvironment);
150 CHK(FPDFDOC_ExitFormFillEnvironment);
151 CHK(FORM_OnAfterLoadPage);
152 CHK(FORM_OnBeforeClosePage);
153 CHK(FORM_DoDocumentJSAction);
154 CHK(FORM_DoDocumentOpenAction);
155 CHK(FORM_DoDocumentAAction);
156 CHK(FORM_DoPageAAction);
157 CHK(FORM_OnMouseMove);
158 CHK(FORM_OnLButtonDown);
159 CHK(FORM_OnLButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800160#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700161 CHK(FORM_OnRButtonDown);
162 CHK(FORM_OnRButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800163#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700164 CHK(FORM_OnKeyDown);
165 CHK(FORM_OnKeyUp);
166 CHK(FORM_OnChar);
Diana Gagedce2d722017-06-20 11:17:11 -0700167 CHK(FORM_GetSelectedText);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700168 CHK(FORM_ForceToKillFocus);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700169 CHK(FPDFPage_HasFormFieldAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700170 CHK(FPDFPage_FormFieldZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700171 CHK(FPDF_SetFormFieldHighlightColor);
172 CHK(FPDF_SetFormFieldHighlightAlpha);
173 CHK(FPDF_RemoveFormFieldHighlight);
174 CHK(FPDF_FFLDraw);
Tom Sepez51da0932015-11-25 16:05:49 -0800175#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700176 CHK(FPDF_HasXFAField);
177 CHK(FPDF_LoadXFA);
178 CHK(FPDF_Widget_Undo);
179 CHK(FPDF_Widget_Redo);
180 CHK(FPDF_Widget_SelectAll);
181 CHK(FPDF_Widget_Copy);
182 CHK(FPDF_Widget_Cut);
183 CHK(FPDF_Widget_Paste);
184 CHK(FPDF_Widget_ReplaceSpellCheckWord);
185 CHK(FPDF_Widget_GetSpellCheckWords);
186 CHK(FPDF_StringHandleCounts);
187 CHK(FPDF_StringHandleGetStringByIndex);
188 CHK(FPDF_StringHandleRelease);
189 CHK(FPDF_StringHandleAddString);
Tom Sepez51da0932015-11-25 16:05:49 -0800190#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700191
192 // fpdf_ppo.h
193 CHK(FPDF_ImportPages);
194 CHK(FPDF_CopyViewerPreferences);
195
196 // fpdf_progressive.h
197 CHK(FPDF_RenderPageBitmap_Start);
198 CHK(FPDF_RenderPage_Continue);
199 CHK(FPDF_RenderPage_Close);
200
201 // fpdf_save.h
202 CHK(FPDF_SaveAsCopy);
203 CHK(FPDF_SaveWithVersion);
204
205 // fpdf_searchex.h
206 CHK(FPDFText_GetCharIndexFromTextIndex);
Nicolas Pena5c1961d2017-03-10 11:59:17 -0500207 CHK(FPDFText_GetTextIndexFromCharIndex);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700208
thestig9067fd62016-11-23 14:10:06 -0800209 // fpdf_structtree.h
210 CHK(FPDF_StructTree_GetForPage);
211 CHK(FPDF_StructTree_Close);
212 CHK(FPDF_StructTree_CountChildren);
213 CHK(FPDF_StructTree_GetChildAtIndex);
214 CHK(FPDF_StructElement_GetAltText);
Dan Sinclair29479f62017-04-04 10:48:19 -0400215 CHK(FPDF_StructElement_GetType);
thestig9067fd62016-11-23 14:10:06 -0800216 CHK(FPDF_StructElement_CountChildren);
217 CHK(FPDF_StructElement_GetChildAtIndex);
218
Tom Sepezcf22eb82015-05-12 17:28:08 -0700219 // fpdf_sysfontinfo.h
220 CHK(FPDF_GetDefaultTTFMap);
221 CHK(FPDF_AddInstalledFont);
222 CHK(FPDF_SetSystemFontInfo);
223 CHK(FPDF_GetDefaultSystemFontInfo);
npm788217d2016-11-08 16:48:36 -0800224 CHK(FPDF_FreeDefaultSystemFontInfo);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700225
226 // fpdf_text.h
227 CHK(FPDFText_LoadPage);
228 CHK(FPDFText_ClosePage);
229 CHK(FPDFText_CountChars);
230 CHK(FPDFText_GetUnicode);
231 CHK(FPDFText_GetFontSize);
232 CHK(FPDFText_GetCharBox);
233 CHK(FPDFText_GetCharIndexAtPos);
234 CHK(FPDFText_GetText);
235 CHK(FPDFText_CountRects);
236 CHK(FPDFText_GetRect);
237 CHK(FPDFText_GetBoundedText);
238 CHK(FPDFText_FindStart);
239 CHK(FPDFText_FindNext);
240 CHK(FPDFText_FindPrev);
241 CHK(FPDFText_GetSchResultIndex);
242 CHK(FPDFText_GetSchCount);
243 CHK(FPDFText_FindClose);
244 CHK(FPDFLink_LoadWebLinks);
245 CHK(FPDFLink_CountWebLinks);
246 CHK(FPDFLink_GetURL);
247 CHK(FPDFLink_CountRects);
248 CHK(FPDFLink_GetRect);
249 CHK(FPDFLink_CloseWebLinks);
250
251 // fpdf_transformpage.h
252 CHK(FPDFPage_SetMediaBox);
253 CHK(FPDFPage_SetCropBox);
254 CHK(FPDFPage_GetMediaBox);
255 CHK(FPDFPage_GetCropBox);
256 CHK(FPDFPage_TransFormWithClip);
257 CHK(FPDFPageObj_TransformClipPath);
258 CHK(FPDF_CreateClipPath);
259 CHK(FPDF_DestroyClipPath);
260 CHK(FPDFPage_InsertClipPath);
261
262 // fpdfview.h
263 CHK(FPDF_InitLibrary);
Lei Zhang6f62d532015-09-23 15:31:44 -0700264 CHK(FPDF_InitLibraryWithConfig);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700265 CHK(FPDF_DestroyLibrary);
266 CHK(FPDF_SetSandBoxPolicy);
267 CHK(FPDF_LoadDocument);
268 CHK(FPDF_LoadMemDocument);
269 CHK(FPDF_LoadCustomDocument);
270 CHK(FPDF_GetFileVersion);
271 CHK(FPDF_GetLastError);
272 CHK(FPDF_GetDocPermissions);
273 CHK(FPDF_GetSecurityHandlerRevision);
274 CHK(FPDF_GetPageCount);
275 CHK(FPDF_LoadPage);
276 CHK(FPDF_GetPageWidth);
277 CHK(FPDF_GetPageHeight);
278 CHK(FPDF_GetPageSizeByIndex);
279 CHK(FPDF_RenderPageBitmap);
thestiga78ba602016-11-23 15:25:48 -0800280 CHK(FPDF_RenderPageBitmapWithMatrix);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700281 CHK(FPDF_ClosePage);
282 CHK(FPDF_CloseDocument);
283 CHK(FPDF_DeviceToPage);
284 CHK(FPDF_PageToDevice);
285 CHK(FPDFBitmap_Create);
286 CHK(FPDFBitmap_CreateEx);
287 CHK(FPDFBitmap_FillRect);
288 CHK(FPDFBitmap_GetBuffer);
289 CHK(FPDFBitmap_GetWidth);
290 CHK(FPDFBitmap_GetHeight);
291 CHK(FPDFBitmap_GetStride);
292 CHK(FPDFBitmap_Destroy);
293 CHK(FPDF_VIEWERREF_GetPrintScaling);
294 CHK(FPDF_VIEWERREF_GetNumCopies);
295 CHK(FPDF_VIEWERREF_GetPrintPageRange);
296 CHK(FPDF_VIEWERREF_GetDuplex);
thestig04bebfe2016-11-04 16:07:25 -0700297 CHK(FPDF_VIEWERREF_GetName);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700298 CHK(FPDF_CountNamedDests);
299 CHK(FPDF_GetNamedDestByName);
300 CHK(FPDF_GetNamedDest);
Tom Sepez51da0932015-11-25 16:05:49 -0800301#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700302 CHK(FPDF_BStr_Init);
303 CHK(FPDF_BStr_Set);
304 CHK(FPDF_BStr_Clear);
Tom Sepez51da0932015-11-25 16:05:49 -0800305#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700306
307 return 1;
308}
309
310#undef CHK