blob: f9a3c387c2c15f89ea7902e4820013c62ae56525 [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 Liu262cf462017-06-09 11:36:37 -040045 CHK(FPDFAnnot_SetColor);
Jane Liu4fd9a472017-06-01 18:56:09 -040046 CHK(FPDFAnnot_GetColor);
Jane Liu262cf462017-06-09 11:36:37 -040047 CHK(FPDFAnnot_HasAttachmentPoints);
48 CHK(FPDFAnnot_SetAttachmentPoints);
Jane Liu4fd9a472017-06-01 18:56:09 -040049 CHK(FPDFAnnot_GetAttachmentPoints);
Jane Liu262cf462017-06-09 11:36:37 -040050 CHK(FPDFAnnot_SetRect);
Jane Liu4fd9a472017-06-01 18:56:09 -040051 CHK(FPDFAnnot_GetRect);
Jane Liu262cf462017-06-09 11:36:37 -040052 CHK(FPDFAnnot_SetText);
Jane Liu4fd9a472017-06-01 18:56:09 -040053 CHK(FPDFAnnot_GetText);
54
Tom Sepezcf22eb82015-05-12 17:28:08 -070055 // fpdf_dataavail.h
56 CHK(FPDFAvail_Create);
57 CHK(FPDFAvail_Destroy);
58 CHK(FPDFAvail_IsDocAvail);
59 CHK(FPDFAvail_GetDocument);
60 CHK(FPDFAvail_GetFirstPageNum);
61 CHK(FPDFAvail_IsPageAvail);
62 CHK(FPDFAvail_IsFormAvail);
63 CHK(FPDFAvail_IsLinearized);
64
65 // fpdf_doc.h
66 CHK(FPDFBookmark_GetFirstChild);
67 CHK(FPDFBookmark_GetNextSibling);
68 CHK(FPDFBookmark_GetTitle);
69 CHK(FPDFBookmark_Find);
70 CHK(FPDFBookmark_GetDest);
71 CHK(FPDFBookmark_GetAction);
72 CHK(FPDFAction_GetType);
73 CHK(FPDFAction_GetDest);
Lei Zhange0947b32015-09-17 14:51:48 -070074 CHK(FPDFAction_GetFilePath);
Tom Sepezcf22eb82015-05-12 17:28:08 -070075 CHK(FPDFAction_GetURIPath);
76 CHK(FPDFDest_GetPageIndex);
dsinclairc59fa882016-11-08 06:55:40 -080077 CHK(FPDFDest_GetLocationInPage);
Tom Sepezcf22eb82015-05-12 17:28:08 -070078 CHK(FPDFLink_GetLinkAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -070079 CHK(FPDFLink_GetLinkZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -070080 CHK(FPDFLink_GetDest);
81 CHK(FPDFLink_GetAction);
82 CHK(FPDFLink_Enumerate);
83 CHK(FPDFLink_GetAnnotRect);
84 CHK(FPDFLink_CountQuadPoints);
85 CHK(FPDFLink_GetQuadPoints);
86 CHK(FPDF_GetMetaText);
dsinclair6bdb56c2016-12-06 09:53:27 -080087 CHK(FPDF_GetPageLabel);
Tom Sepezcf22eb82015-05-12 17:28:08 -070088
89 // fpdf_edit.h
90 CHK(FPDF_CreateNewDocument);
91 CHK(FPDFPage_New);
92 CHK(FPDFPage_Delete);
93 CHK(FPDFPage_GetRotation);
94 CHK(FPDFPage_SetRotation);
95 CHK(FPDFPage_InsertObject);
96 CHK(FPDFPage_CountObject);
97 CHK(FPDFPage_GetObject);
98 CHK(FPDFPage_HasTransparency);
99 CHK(FPDFPage_GenerateContent);
100 CHK(FPDFPageObj_HasTransparency);
wileyryad9dc9622017-05-31 14:12:49 -0500101 CHK(FPDFPageObj_GetBounds);
Miklos Vajna14233192017-04-03 16:02:39 +0200102 CHK(FPDFPageObj_GetType);
wileyryad9dc9622017-05-31 14:12:49 -0500103 CHK(FPDFPageObj_SetBlendMode);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700104 CHK(FPDFPageObj_Transform);
105 CHK(FPDFPage_TransformAnnots);
Lei Zhangcbd89572017-03-15 17:35:47 -0700106 CHK(FPDFPageObj_NewImageObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700107 CHK(FPDFImageObj_LoadJpegFile);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500108 CHK(FPDFImageObj_LoadJpegFileInline);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700109 CHK(FPDFImageObj_SetMatrix);
110 CHK(FPDFImageObj_SetBitmap);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500111 CHK(FPDFPageObj_CreateNewPath);
112 CHK(FPDFPageObj_CreateNewRect);
113 CHK(FPDFPath_SetStrokeColor);
Jane Liu3b057432017-06-19 10:44:01 -0400114 CHK(FPDFPath_GetStrokeColor);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500115 CHK(FPDFPath_SetStrokeWidth);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500116 CHK(FPDFPath_SetFillColor);
Miklos Vajnaed4705b2017-04-05 09:24:50 +0200117 CHK(FPDFPath_GetFillColor);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500118 CHK(FPDFPath_MoveTo);
119 CHK(FPDFPath_LineTo);
120 CHK(FPDFPath_BezierTo);
121 CHK(FPDFPath_Close);
122 CHK(FPDFPath_SetDrawMode);
wileyryad9dc9622017-05-31 14:12:49 -0500123 CHK(FPDFPath_SetLineCap);
124 CHK(FPDFPath_SetLineJoin);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500125 CHK(FPDFPageObj_NewTextObj);
126 CHK(FPDFText_SetText);
wileyryad9dc9622017-05-31 14:12:49 -0500127 CHK(FPDFText_SetFillColor);
Nicolas Penad03ca422017-03-06 13:54:33 -0500128 CHK(FPDFText_LoadFont);
Nicolas Penab3161852017-05-02 14:12:50 -0400129 CHK(FPDFFont_Close);
130 CHK(FPDFPageObj_CreateTextObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700131
132 // fpdf_ext.h
133 CHK(FSDK_SetUnSpObjProcessHandler);
134 CHK(FPDFDoc_GetPageMode);
135
136 // fpdf_flatten.h
137 CHK(FPDFPage_Flatten);
138
139 // fpdf_fwlevent.h - no exports.
140
141 // fpdf_formfill.h
142 CHK(FPDFDOC_InitFormFillEnvironment);
143 CHK(FPDFDOC_ExitFormFillEnvironment);
144 CHK(FORM_OnAfterLoadPage);
145 CHK(FORM_OnBeforeClosePage);
146 CHK(FORM_DoDocumentJSAction);
147 CHK(FORM_DoDocumentOpenAction);
148 CHK(FORM_DoDocumentAAction);
149 CHK(FORM_DoPageAAction);
150 CHK(FORM_OnMouseMove);
151 CHK(FORM_OnLButtonDown);
152 CHK(FORM_OnLButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800153#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700154 CHK(FORM_OnRButtonDown);
155 CHK(FORM_OnRButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800156#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700157 CHK(FORM_OnKeyDown);
158 CHK(FORM_OnKeyUp);
159 CHK(FORM_OnChar);
Diana Gagedce2d722017-06-20 11:17:11 -0700160 CHK(FORM_GetSelectedText);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700161 CHK(FORM_ForceToKillFocus);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700162 CHK(FPDFPage_HasFormFieldAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700163 CHK(FPDFPage_FormFieldZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700164 CHK(FPDF_SetFormFieldHighlightColor);
165 CHK(FPDF_SetFormFieldHighlightAlpha);
166 CHK(FPDF_RemoveFormFieldHighlight);
167 CHK(FPDF_FFLDraw);
Tom Sepez51da0932015-11-25 16:05:49 -0800168#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700169 CHK(FPDF_HasXFAField);
170 CHK(FPDF_LoadXFA);
171 CHK(FPDF_Widget_Undo);
172 CHK(FPDF_Widget_Redo);
173 CHK(FPDF_Widget_SelectAll);
174 CHK(FPDF_Widget_Copy);
175 CHK(FPDF_Widget_Cut);
176 CHK(FPDF_Widget_Paste);
177 CHK(FPDF_Widget_ReplaceSpellCheckWord);
178 CHK(FPDF_Widget_GetSpellCheckWords);
179 CHK(FPDF_StringHandleCounts);
180 CHK(FPDF_StringHandleGetStringByIndex);
181 CHK(FPDF_StringHandleRelease);
182 CHK(FPDF_StringHandleAddString);
Tom Sepez51da0932015-11-25 16:05:49 -0800183#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700184
185 // fpdf_ppo.h
186 CHK(FPDF_ImportPages);
187 CHK(FPDF_CopyViewerPreferences);
188
189 // fpdf_progressive.h
190 CHK(FPDF_RenderPageBitmap_Start);
191 CHK(FPDF_RenderPage_Continue);
192 CHK(FPDF_RenderPage_Close);
193
194 // fpdf_save.h
195 CHK(FPDF_SaveAsCopy);
196 CHK(FPDF_SaveWithVersion);
197
198 // fpdf_searchex.h
199 CHK(FPDFText_GetCharIndexFromTextIndex);
Nicolas Pena5c1961d2017-03-10 11:59:17 -0500200 CHK(FPDFText_GetTextIndexFromCharIndex);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700201
thestig9067fd62016-11-23 14:10:06 -0800202 // fpdf_structtree.h
203 CHK(FPDF_StructTree_GetForPage);
204 CHK(FPDF_StructTree_Close);
205 CHK(FPDF_StructTree_CountChildren);
206 CHK(FPDF_StructTree_GetChildAtIndex);
207 CHK(FPDF_StructElement_GetAltText);
Dan Sinclair29479f62017-04-04 10:48:19 -0400208 CHK(FPDF_StructElement_GetType);
thestig9067fd62016-11-23 14:10:06 -0800209 CHK(FPDF_StructElement_CountChildren);
210 CHK(FPDF_StructElement_GetChildAtIndex);
211
Tom Sepezcf22eb82015-05-12 17:28:08 -0700212 // fpdf_sysfontinfo.h
213 CHK(FPDF_GetDefaultTTFMap);
214 CHK(FPDF_AddInstalledFont);
215 CHK(FPDF_SetSystemFontInfo);
216 CHK(FPDF_GetDefaultSystemFontInfo);
npm788217d2016-11-08 16:48:36 -0800217 CHK(FPDF_FreeDefaultSystemFontInfo);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700218
219 // fpdf_text.h
220 CHK(FPDFText_LoadPage);
221 CHK(FPDFText_ClosePage);
222 CHK(FPDFText_CountChars);
223 CHK(FPDFText_GetUnicode);
224 CHK(FPDFText_GetFontSize);
225 CHK(FPDFText_GetCharBox);
226 CHK(FPDFText_GetCharIndexAtPos);
227 CHK(FPDFText_GetText);
228 CHK(FPDFText_CountRects);
229 CHK(FPDFText_GetRect);
230 CHK(FPDFText_GetBoundedText);
231 CHK(FPDFText_FindStart);
232 CHK(FPDFText_FindNext);
233 CHK(FPDFText_FindPrev);
234 CHK(FPDFText_GetSchResultIndex);
235 CHK(FPDFText_GetSchCount);
236 CHK(FPDFText_FindClose);
237 CHK(FPDFLink_LoadWebLinks);
238 CHK(FPDFLink_CountWebLinks);
239 CHK(FPDFLink_GetURL);
240 CHK(FPDFLink_CountRects);
241 CHK(FPDFLink_GetRect);
242 CHK(FPDFLink_CloseWebLinks);
243
244 // fpdf_transformpage.h
245 CHK(FPDFPage_SetMediaBox);
246 CHK(FPDFPage_SetCropBox);
247 CHK(FPDFPage_GetMediaBox);
248 CHK(FPDFPage_GetCropBox);
249 CHK(FPDFPage_TransFormWithClip);
250 CHK(FPDFPageObj_TransformClipPath);
251 CHK(FPDF_CreateClipPath);
252 CHK(FPDF_DestroyClipPath);
253 CHK(FPDFPage_InsertClipPath);
254
255 // fpdfview.h
256 CHK(FPDF_InitLibrary);
Lei Zhang6f62d532015-09-23 15:31:44 -0700257 CHK(FPDF_InitLibraryWithConfig);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700258 CHK(FPDF_DestroyLibrary);
259 CHK(FPDF_SetSandBoxPolicy);
260 CHK(FPDF_LoadDocument);
261 CHK(FPDF_LoadMemDocument);
262 CHK(FPDF_LoadCustomDocument);
263 CHK(FPDF_GetFileVersion);
264 CHK(FPDF_GetLastError);
265 CHK(FPDF_GetDocPermissions);
266 CHK(FPDF_GetSecurityHandlerRevision);
267 CHK(FPDF_GetPageCount);
268 CHK(FPDF_LoadPage);
269 CHK(FPDF_GetPageWidth);
270 CHK(FPDF_GetPageHeight);
271 CHK(FPDF_GetPageSizeByIndex);
272 CHK(FPDF_RenderPageBitmap);
thestiga78ba602016-11-23 15:25:48 -0800273 CHK(FPDF_RenderPageBitmapWithMatrix);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700274 CHK(FPDF_ClosePage);
275 CHK(FPDF_CloseDocument);
276 CHK(FPDF_DeviceToPage);
277 CHK(FPDF_PageToDevice);
278 CHK(FPDFBitmap_Create);
279 CHK(FPDFBitmap_CreateEx);
280 CHK(FPDFBitmap_FillRect);
281 CHK(FPDFBitmap_GetBuffer);
282 CHK(FPDFBitmap_GetWidth);
283 CHK(FPDFBitmap_GetHeight);
284 CHK(FPDFBitmap_GetStride);
285 CHK(FPDFBitmap_Destroy);
286 CHK(FPDF_VIEWERREF_GetPrintScaling);
287 CHK(FPDF_VIEWERREF_GetNumCopies);
288 CHK(FPDF_VIEWERREF_GetPrintPageRange);
289 CHK(FPDF_VIEWERREF_GetDuplex);
thestig04bebfe2016-11-04 16:07:25 -0700290 CHK(FPDF_VIEWERREF_GetName);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700291 CHK(FPDF_CountNamedDests);
292 CHK(FPDF_GetNamedDestByName);
293 CHK(FPDF_GetNamedDest);
Tom Sepez51da0932015-11-25 16:05:49 -0800294#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700295 CHK(FPDF_BStr_Init);
296 CHK(FPDF_BStr_Set);
297 CHK(FPDF_BStr_Clear);
Tom Sepez51da0932015-11-25 16:05:49 -0800298#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700299
300 return 1;
301}
302
303#undef CHK