blob: 1c066dd295e3071a23b3472d998c1d693e338257 [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 Liu7a9a38b2017-07-11 13:47:37 -040045 CHK(FPDFAnnot_IsObjectSupportedSubtype);
Jane Liu36567742017-07-06 11:13:35 -040046 CHK(FPDFAnnot_UpdateObject);
47 CHK(FPDFAnnot_AppendObject);
48 CHK(FPDFAnnot_GetObjectCount);
49 CHK(FPDFAnnot_GetObject);
Jane Liu7a9a38b2017-07-11 13:47:37 -040050 CHK(FPDFAnnot_RemoveObject);
Jane Liu262cf462017-06-09 11:36:37 -040051 CHK(FPDFAnnot_SetColor);
Jane Liu4fd9a472017-06-01 18:56:09 -040052 CHK(FPDFAnnot_GetColor);
Jane Liu262cf462017-06-09 11:36:37 -040053 CHK(FPDFAnnot_HasAttachmentPoints);
54 CHK(FPDFAnnot_SetAttachmentPoints);
Jane Liu4fd9a472017-06-01 18:56:09 -040055 CHK(FPDFAnnot_GetAttachmentPoints);
Jane Liu262cf462017-06-09 11:36:37 -040056 CHK(FPDFAnnot_SetRect);
Jane Liu4fd9a472017-06-01 18:56:09 -040057 CHK(FPDFAnnot_GetRect);
Jane Liu2e1a32b2017-07-06 12:01:25 -040058 CHK(FPDFAnnot_HasKey);
59 CHK(FPDFAnnot_SetStringValue);
60 CHK(FPDFAnnot_GetStringValue);
Jane Liub137e752017-07-05 15:04:33 -040061 CHK(FPDFAnnot_GetFlags);
62 CHK(FPDFAnnot_SetFlags);
Jane Liu4fd9a472017-06-01 18:56:09 -040063
Tom Sepezcf22eb82015-05-12 17:28:08 -070064 // fpdf_dataavail.h
65 CHK(FPDFAvail_Create);
66 CHK(FPDFAvail_Destroy);
67 CHK(FPDFAvail_IsDocAvail);
68 CHK(FPDFAvail_GetDocument);
69 CHK(FPDFAvail_GetFirstPageNum);
70 CHK(FPDFAvail_IsPageAvail);
71 CHK(FPDFAvail_IsFormAvail);
72 CHK(FPDFAvail_IsLinearized);
73
74 // fpdf_doc.h
75 CHK(FPDFBookmark_GetFirstChild);
76 CHK(FPDFBookmark_GetNextSibling);
77 CHK(FPDFBookmark_GetTitle);
78 CHK(FPDFBookmark_Find);
79 CHK(FPDFBookmark_GetDest);
80 CHK(FPDFBookmark_GetAction);
81 CHK(FPDFAction_GetType);
82 CHK(FPDFAction_GetDest);
Lei Zhange0947b32015-09-17 14:51:48 -070083 CHK(FPDFAction_GetFilePath);
Tom Sepezcf22eb82015-05-12 17:28:08 -070084 CHK(FPDFAction_GetURIPath);
85 CHK(FPDFDest_GetPageIndex);
dsinclairc59fa882016-11-08 06:55:40 -080086 CHK(FPDFDest_GetLocationInPage);
Tom Sepezcf22eb82015-05-12 17:28:08 -070087 CHK(FPDFLink_GetLinkAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -070088 CHK(FPDFLink_GetLinkZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -070089 CHK(FPDFLink_GetDest);
90 CHK(FPDFLink_GetAction);
91 CHK(FPDFLink_Enumerate);
92 CHK(FPDFLink_GetAnnotRect);
93 CHK(FPDFLink_CountQuadPoints);
94 CHK(FPDFLink_GetQuadPoints);
95 CHK(FPDF_GetMetaText);
dsinclair6bdb56c2016-12-06 09:53:27 -080096 CHK(FPDF_GetPageLabel);
Tom Sepezcf22eb82015-05-12 17:28:08 -070097
98 // fpdf_edit.h
99 CHK(FPDF_CreateNewDocument);
100 CHK(FPDFPage_New);
101 CHK(FPDFPage_Delete);
102 CHK(FPDFPage_GetRotation);
103 CHK(FPDFPage_SetRotation);
104 CHK(FPDFPage_InsertObject);
105 CHK(FPDFPage_CountObject);
106 CHK(FPDFPage_GetObject);
107 CHK(FPDFPage_HasTransparency);
108 CHK(FPDFPage_GenerateContent);
109 CHK(FPDFPageObj_HasTransparency);
wileyryad9dc9622017-05-31 14:12:49 -0500110 CHK(FPDFPageObj_GetBounds);
Miklos Vajna14233192017-04-03 16:02:39 +0200111 CHK(FPDFPageObj_GetType);
wileyryad9dc9622017-05-31 14:12:49 -0500112 CHK(FPDFPageObj_SetBlendMode);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700113 CHK(FPDFPageObj_Transform);
114 CHK(FPDFPage_TransformAnnots);
Lei Zhangcbd89572017-03-15 17:35:47 -0700115 CHK(FPDFPageObj_NewImageObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700116 CHK(FPDFImageObj_LoadJpegFile);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500117 CHK(FPDFImageObj_LoadJpegFileInline);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700118 CHK(FPDFImageObj_SetMatrix);
119 CHK(FPDFImageObj_SetBitmap);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500120 CHK(FPDFPageObj_CreateNewPath);
121 CHK(FPDFPageObj_CreateNewRect);
122 CHK(FPDFPath_SetStrokeColor);
Jane Liu3b057432017-06-19 10:44:01 -0400123 CHK(FPDFPath_GetStrokeColor);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500124 CHK(FPDFPath_SetStrokeWidth);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500125 CHK(FPDFPath_SetFillColor);
Miklos Vajnaed4705b2017-04-05 09:24:50 +0200126 CHK(FPDFPath_GetFillColor);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500127 CHK(FPDFPath_MoveTo);
128 CHK(FPDFPath_LineTo);
129 CHK(FPDFPath_BezierTo);
130 CHK(FPDFPath_Close);
131 CHK(FPDFPath_SetDrawMode);
wileyryad9dc9622017-05-31 14:12:49 -0500132 CHK(FPDFPath_SetLineCap);
133 CHK(FPDFPath_SetLineJoin);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500134 CHK(FPDFPageObj_NewTextObj);
135 CHK(FPDFText_SetText);
wileyryad9dc9622017-05-31 14:12:49 -0500136 CHK(FPDFText_SetFillColor);
Nicolas Penad03ca422017-03-06 13:54:33 -0500137 CHK(FPDFText_LoadFont);
Nicolas Penab3161852017-05-02 14:12:50 -0400138 CHK(FPDFFont_Close);
139 CHK(FPDFPageObj_CreateTextObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700140
141 // fpdf_ext.h
142 CHK(FSDK_SetUnSpObjProcessHandler);
143 CHK(FPDFDoc_GetPageMode);
144
145 // fpdf_flatten.h
146 CHK(FPDFPage_Flatten);
147
148 // fpdf_fwlevent.h - no exports.
149
150 // fpdf_formfill.h
151 CHK(FPDFDOC_InitFormFillEnvironment);
152 CHK(FPDFDOC_ExitFormFillEnvironment);
153 CHK(FORM_OnAfterLoadPage);
154 CHK(FORM_OnBeforeClosePage);
155 CHK(FORM_DoDocumentJSAction);
156 CHK(FORM_DoDocumentOpenAction);
157 CHK(FORM_DoDocumentAAction);
158 CHK(FORM_DoPageAAction);
159 CHK(FORM_OnMouseMove);
160 CHK(FORM_OnLButtonDown);
161 CHK(FORM_OnLButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800162#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700163 CHK(FORM_OnRButtonDown);
164 CHK(FORM_OnRButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800165#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700166 CHK(FORM_OnKeyDown);
167 CHK(FORM_OnKeyUp);
168 CHK(FORM_OnChar);
Diana Gagedce2d722017-06-20 11:17:11 -0700169 CHK(FORM_GetSelectedText);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700170 CHK(FORM_ForceToKillFocus);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700171 CHK(FPDFPage_HasFormFieldAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700172 CHK(FPDFPage_FormFieldZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700173 CHK(FPDF_SetFormFieldHighlightColor);
174 CHK(FPDF_SetFormFieldHighlightAlpha);
175 CHK(FPDF_RemoveFormFieldHighlight);
176 CHK(FPDF_FFLDraw);
Tom Sepez51da0932015-11-25 16:05:49 -0800177#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700178 CHK(FPDF_HasXFAField);
179 CHK(FPDF_LoadXFA);
180 CHK(FPDF_Widget_Undo);
181 CHK(FPDF_Widget_Redo);
182 CHK(FPDF_Widget_SelectAll);
183 CHK(FPDF_Widget_Copy);
184 CHK(FPDF_Widget_Cut);
185 CHK(FPDF_Widget_Paste);
186 CHK(FPDF_Widget_ReplaceSpellCheckWord);
187 CHK(FPDF_Widget_GetSpellCheckWords);
188 CHK(FPDF_StringHandleCounts);
189 CHK(FPDF_StringHandleGetStringByIndex);
190 CHK(FPDF_StringHandleRelease);
191 CHK(FPDF_StringHandleAddString);
Tom Sepez51da0932015-11-25 16:05:49 -0800192#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700193
194 // fpdf_ppo.h
195 CHK(FPDF_ImportPages);
196 CHK(FPDF_CopyViewerPreferences);
197
198 // fpdf_progressive.h
199 CHK(FPDF_RenderPageBitmap_Start);
200 CHK(FPDF_RenderPage_Continue);
201 CHK(FPDF_RenderPage_Close);
202
203 // fpdf_save.h
204 CHK(FPDF_SaveAsCopy);
205 CHK(FPDF_SaveWithVersion);
206
207 // fpdf_searchex.h
208 CHK(FPDFText_GetCharIndexFromTextIndex);
Nicolas Pena5c1961d2017-03-10 11:59:17 -0500209 CHK(FPDFText_GetTextIndexFromCharIndex);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700210
thestig9067fd62016-11-23 14:10:06 -0800211 // fpdf_structtree.h
212 CHK(FPDF_StructTree_GetForPage);
213 CHK(FPDF_StructTree_Close);
214 CHK(FPDF_StructTree_CountChildren);
215 CHK(FPDF_StructTree_GetChildAtIndex);
216 CHK(FPDF_StructElement_GetAltText);
Dan Sinclair29479f62017-04-04 10:48:19 -0400217 CHK(FPDF_StructElement_GetType);
thestig9067fd62016-11-23 14:10:06 -0800218 CHK(FPDF_StructElement_CountChildren);
219 CHK(FPDF_StructElement_GetChildAtIndex);
220
Tom Sepezcf22eb82015-05-12 17:28:08 -0700221 // fpdf_sysfontinfo.h
222 CHK(FPDF_GetDefaultTTFMap);
223 CHK(FPDF_AddInstalledFont);
224 CHK(FPDF_SetSystemFontInfo);
225 CHK(FPDF_GetDefaultSystemFontInfo);
npm788217d2016-11-08 16:48:36 -0800226 CHK(FPDF_FreeDefaultSystemFontInfo);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700227
228 // fpdf_text.h
229 CHK(FPDFText_LoadPage);
230 CHK(FPDFText_ClosePage);
231 CHK(FPDFText_CountChars);
232 CHK(FPDFText_GetUnicode);
233 CHK(FPDFText_GetFontSize);
234 CHK(FPDFText_GetCharBox);
235 CHK(FPDFText_GetCharIndexAtPos);
236 CHK(FPDFText_GetText);
237 CHK(FPDFText_CountRects);
238 CHK(FPDFText_GetRect);
239 CHK(FPDFText_GetBoundedText);
240 CHK(FPDFText_FindStart);
241 CHK(FPDFText_FindNext);
242 CHK(FPDFText_FindPrev);
243 CHK(FPDFText_GetSchResultIndex);
244 CHK(FPDFText_GetSchCount);
245 CHK(FPDFText_FindClose);
246 CHK(FPDFLink_LoadWebLinks);
247 CHK(FPDFLink_CountWebLinks);
248 CHK(FPDFLink_GetURL);
249 CHK(FPDFLink_CountRects);
250 CHK(FPDFLink_GetRect);
251 CHK(FPDFLink_CloseWebLinks);
252
253 // fpdf_transformpage.h
254 CHK(FPDFPage_SetMediaBox);
255 CHK(FPDFPage_SetCropBox);
256 CHK(FPDFPage_GetMediaBox);
257 CHK(FPDFPage_GetCropBox);
258 CHK(FPDFPage_TransFormWithClip);
259 CHK(FPDFPageObj_TransformClipPath);
260 CHK(FPDF_CreateClipPath);
261 CHK(FPDF_DestroyClipPath);
262 CHK(FPDFPage_InsertClipPath);
263
264 // fpdfview.h
265 CHK(FPDF_InitLibrary);
Lei Zhang6f62d532015-09-23 15:31:44 -0700266 CHK(FPDF_InitLibraryWithConfig);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700267 CHK(FPDF_DestroyLibrary);
268 CHK(FPDF_SetSandBoxPolicy);
269 CHK(FPDF_LoadDocument);
270 CHK(FPDF_LoadMemDocument);
271 CHK(FPDF_LoadCustomDocument);
272 CHK(FPDF_GetFileVersion);
273 CHK(FPDF_GetLastError);
274 CHK(FPDF_GetDocPermissions);
275 CHK(FPDF_GetSecurityHandlerRevision);
276 CHK(FPDF_GetPageCount);
277 CHK(FPDF_LoadPage);
278 CHK(FPDF_GetPageWidth);
279 CHK(FPDF_GetPageHeight);
280 CHK(FPDF_GetPageSizeByIndex);
281 CHK(FPDF_RenderPageBitmap);
thestiga78ba602016-11-23 15:25:48 -0800282 CHK(FPDF_RenderPageBitmapWithMatrix);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700283 CHK(FPDF_ClosePage);
284 CHK(FPDF_CloseDocument);
285 CHK(FPDF_DeviceToPage);
286 CHK(FPDF_PageToDevice);
287 CHK(FPDFBitmap_Create);
288 CHK(FPDFBitmap_CreateEx);
289 CHK(FPDFBitmap_FillRect);
290 CHK(FPDFBitmap_GetBuffer);
291 CHK(FPDFBitmap_GetWidth);
292 CHK(FPDFBitmap_GetHeight);
293 CHK(FPDFBitmap_GetStride);
294 CHK(FPDFBitmap_Destroy);
295 CHK(FPDF_VIEWERREF_GetPrintScaling);
296 CHK(FPDF_VIEWERREF_GetNumCopies);
297 CHK(FPDF_VIEWERREF_GetPrintPageRange);
298 CHK(FPDF_VIEWERREF_GetDuplex);
thestig04bebfe2016-11-04 16:07:25 -0700299 CHK(FPDF_VIEWERREF_GetName);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700300 CHK(FPDF_CountNamedDests);
301 CHK(FPDF_GetNamedDestByName);
302 CHK(FPDF_GetNamedDest);
Tom Sepez51da0932015-11-25 16:05:49 -0800303#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700304 CHK(FPDF_BStr_Init);
305 CHK(FPDF_BStr_Set);
306 CHK(FPDF_BStr_Clear);
Tom Sepez51da0932015-11-25 16:05:49 -0800307#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700308
309 return 1;
310}
311
312#undef CHK