blob: 05242c6fe1603bad2ba091388e0dcad7232d5ba1 [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 Liu4fd9a472017-06-01 18:56:09 -040043 CHK(FPDFAnnot_GetSubtype);
Jane Liu262cf462017-06-09 11:36:37 -040044 CHK(FPDFAnnot_SetColor);
Jane Liu4fd9a472017-06-01 18:56:09 -040045 CHK(FPDFAnnot_GetColor);
Jane Liu262cf462017-06-09 11:36:37 -040046 CHK(FPDFAnnot_HasAttachmentPoints);
47 CHK(FPDFAnnot_SetAttachmentPoints);
Jane Liu4fd9a472017-06-01 18:56:09 -040048 CHK(FPDFAnnot_GetAttachmentPoints);
Jane Liu262cf462017-06-09 11:36:37 -040049 CHK(FPDFAnnot_SetRect);
Jane Liu4fd9a472017-06-01 18:56:09 -040050 CHK(FPDFAnnot_GetRect);
Jane Liu262cf462017-06-09 11:36:37 -040051 CHK(FPDFAnnot_SetText);
Jane Liu4fd9a472017-06-01 18:56:09 -040052 CHK(FPDFAnnot_GetText);
53
Tom Sepezcf22eb82015-05-12 17:28:08 -070054 // fpdf_dataavail.h
55 CHK(FPDFAvail_Create);
56 CHK(FPDFAvail_Destroy);
57 CHK(FPDFAvail_IsDocAvail);
58 CHK(FPDFAvail_GetDocument);
59 CHK(FPDFAvail_GetFirstPageNum);
60 CHK(FPDFAvail_IsPageAvail);
61 CHK(FPDFAvail_IsFormAvail);
62 CHK(FPDFAvail_IsLinearized);
63
64 // fpdf_doc.h
65 CHK(FPDFBookmark_GetFirstChild);
66 CHK(FPDFBookmark_GetNextSibling);
67 CHK(FPDFBookmark_GetTitle);
68 CHK(FPDFBookmark_Find);
69 CHK(FPDFBookmark_GetDest);
70 CHK(FPDFBookmark_GetAction);
71 CHK(FPDFAction_GetType);
72 CHK(FPDFAction_GetDest);
Lei Zhange0947b32015-09-17 14:51:48 -070073 CHK(FPDFAction_GetFilePath);
Tom Sepezcf22eb82015-05-12 17:28:08 -070074 CHK(FPDFAction_GetURIPath);
75 CHK(FPDFDest_GetPageIndex);
dsinclairc59fa882016-11-08 06:55:40 -080076 CHK(FPDFDest_GetLocationInPage);
Tom Sepezcf22eb82015-05-12 17:28:08 -070077 CHK(FPDFLink_GetLinkAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -070078 CHK(FPDFLink_GetLinkZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -070079 CHK(FPDFLink_GetDest);
80 CHK(FPDFLink_GetAction);
81 CHK(FPDFLink_Enumerate);
82 CHK(FPDFLink_GetAnnotRect);
83 CHK(FPDFLink_CountQuadPoints);
84 CHK(FPDFLink_GetQuadPoints);
85 CHK(FPDF_GetMetaText);
dsinclair6bdb56c2016-12-06 09:53:27 -080086 CHK(FPDF_GetPageLabel);
Tom Sepezcf22eb82015-05-12 17:28:08 -070087
88 // fpdf_edit.h
89 CHK(FPDF_CreateNewDocument);
90 CHK(FPDFPage_New);
91 CHK(FPDFPage_Delete);
92 CHK(FPDFPage_GetRotation);
93 CHK(FPDFPage_SetRotation);
94 CHK(FPDFPage_InsertObject);
95 CHK(FPDFPage_CountObject);
96 CHK(FPDFPage_GetObject);
97 CHK(FPDFPage_HasTransparency);
98 CHK(FPDFPage_GenerateContent);
99 CHK(FPDFPageObj_HasTransparency);
wileyryad9dc9622017-05-31 14:12:49 -0500100 CHK(FPDFPageObj_GetBounds);
Miklos Vajna14233192017-04-03 16:02:39 +0200101 CHK(FPDFPageObj_GetType);
wileyryad9dc9622017-05-31 14:12:49 -0500102 CHK(FPDFPageObj_SetBlendMode);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700103 CHK(FPDFPageObj_Transform);
104 CHK(FPDFPage_TransformAnnots);
Lei Zhangcbd89572017-03-15 17:35:47 -0700105 CHK(FPDFPageObj_NewImageObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700106 CHK(FPDFImageObj_LoadJpegFile);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500107 CHK(FPDFImageObj_LoadJpegFileInline);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700108 CHK(FPDFImageObj_SetMatrix);
109 CHK(FPDFImageObj_SetBitmap);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500110 CHK(FPDFPageObj_CreateNewPath);
111 CHK(FPDFPageObj_CreateNewRect);
112 CHK(FPDFPath_SetStrokeColor);
Jane Liu3b057432017-06-19 10:44:01 -0400113 CHK(FPDFPath_GetStrokeColor);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500114 CHK(FPDFPath_SetStrokeWidth);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500115 CHK(FPDFPath_SetFillColor);
Miklos Vajnaed4705b2017-04-05 09:24:50 +0200116 CHK(FPDFPath_GetFillColor);
Nicolas Pena55e026b2017-02-07 14:59:23 -0500117 CHK(FPDFPath_MoveTo);
118 CHK(FPDFPath_LineTo);
119 CHK(FPDFPath_BezierTo);
120 CHK(FPDFPath_Close);
121 CHK(FPDFPath_SetDrawMode);
wileyryad9dc9622017-05-31 14:12:49 -0500122 CHK(FPDFPath_SetLineCap);
123 CHK(FPDFPath_SetLineJoin);
Nicolas Penabe90aae2017-02-27 10:41:41 -0500124 CHK(FPDFPageObj_NewTextObj);
125 CHK(FPDFText_SetText);
wileyryad9dc9622017-05-31 14:12:49 -0500126 CHK(FPDFText_SetFillColor);
Nicolas Penad03ca422017-03-06 13:54:33 -0500127 CHK(FPDFText_LoadFont);
Nicolas Penab3161852017-05-02 14:12:50 -0400128 CHK(FPDFFont_Close);
129 CHK(FPDFPageObj_CreateTextObj);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700130
131 // fpdf_ext.h
132 CHK(FSDK_SetUnSpObjProcessHandler);
133 CHK(FPDFDoc_GetPageMode);
134
135 // fpdf_flatten.h
136 CHK(FPDFPage_Flatten);
137
138 // fpdf_fwlevent.h - no exports.
139
140 // fpdf_formfill.h
141 CHK(FPDFDOC_InitFormFillEnvironment);
142 CHK(FPDFDOC_ExitFormFillEnvironment);
143 CHK(FORM_OnAfterLoadPage);
144 CHK(FORM_OnBeforeClosePage);
145 CHK(FORM_DoDocumentJSAction);
146 CHK(FORM_DoDocumentOpenAction);
147 CHK(FORM_DoDocumentAAction);
148 CHK(FORM_DoPageAAction);
149 CHK(FORM_OnMouseMove);
150 CHK(FORM_OnLButtonDown);
151 CHK(FORM_OnLButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800152#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700153 CHK(FORM_OnRButtonDown);
154 CHK(FORM_OnRButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800155#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700156 CHK(FORM_OnKeyDown);
157 CHK(FORM_OnKeyUp);
158 CHK(FORM_OnChar);
Diana Gagedce2d722017-06-20 11:17:11 -0700159 CHK(FORM_GetSelectedText);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700160 CHK(FORM_ForceToKillFocus);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700161 CHK(FPDFPage_HasFormFieldAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700162 CHK(FPDFPage_FormFieldZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700163 CHK(FPDF_SetFormFieldHighlightColor);
164 CHK(FPDF_SetFormFieldHighlightAlpha);
165 CHK(FPDF_RemoveFormFieldHighlight);
166 CHK(FPDF_FFLDraw);
Tom Sepez51da0932015-11-25 16:05:49 -0800167#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700168 CHK(FPDF_HasXFAField);
169 CHK(FPDF_LoadXFA);
170 CHK(FPDF_Widget_Undo);
171 CHK(FPDF_Widget_Redo);
172 CHK(FPDF_Widget_SelectAll);
173 CHK(FPDF_Widget_Copy);
174 CHK(FPDF_Widget_Cut);
175 CHK(FPDF_Widget_Paste);
176 CHK(FPDF_Widget_ReplaceSpellCheckWord);
177 CHK(FPDF_Widget_GetSpellCheckWords);
178 CHK(FPDF_StringHandleCounts);
179 CHK(FPDF_StringHandleGetStringByIndex);
180 CHK(FPDF_StringHandleRelease);
181 CHK(FPDF_StringHandleAddString);
Tom Sepez51da0932015-11-25 16:05:49 -0800182#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700183
184 // fpdf_ppo.h
185 CHK(FPDF_ImportPages);
186 CHK(FPDF_CopyViewerPreferences);
187
188 // fpdf_progressive.h
189 CHK(FPDF_RenderPageBitmap_Start);
190 CHK(FPDF_RenderPage_Continue);
191 CHK(FPDF_RenderPage_Close);
192
193 // fpdf_save.h
194 CHK(FPDF_SaveAsCopy);
195 CHK(FPDF_SaveWithVersion);
196
197 // fpdf_searchex.h
198 CHK(FPDFText_GetCharIndexFromTextIndex);
Nicolas Pena5c1961d2017-03-10 11:59:17 -0500199 CHK(FPDFText_GetTextIndexFromCharIndex);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700200
thestig9067fd62016-11-23 14:10:06 -0800201 // fpdf_structtree.h
202 CHK(FPDF_StructTree_GetForPage);
203 CHK(FPDF_StructTree_Close);
204 CHK(FPDF_StructTree_CountChildren);
205 CHK(FPDF_StructTree_GetChildAtIndex);
206 CHK(FPDF_StructElement_GetAltText);
Dan Sinclair29479f62017-04-04 10:48:19 -0400207 CHK(FPDF_StructElement_GetType);
thestig9067fd62016-11-23 14:10:06 -0800208 CHK(FPDF_StructElement_CountChildren);
209 CHK(FPDF_StructElement_GetChildAtIndex);
210
Tom Sepezcf22eb82015-05-12 17:28:08 -0700211 // fpdf_sysfontinfo.h
212 CHK(FPDF_GetDefaultTTFMap);
213 CHK(FPDF_AddInstalledFont);
214 CHK(FPDF_SetSystemFontInfo);
215 CHK(FPDF_GetDefaultSystemFontInfo);
npm788217d2016-11-08 16:48:36 -0800216 CHK(FPDF_FreeDefaultSystemFontInfo);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700217
218 // fpdf_text.h
219 CHK(FPDFText_LoadPage);
220 CHK(FPDFText_ClosePage);
221 CHK(FPDFText_CountChars);
222 CHK(FPDFText_GetUnicode);
223 CHK(FPDFText_GetFontSize);
224 CHK(FPDFText_GetCharBox);
225 CHK(FPDFText_GetCharIndexAtPos);
226 CHK(FPDFText_GetText);
227 CHK(FPDFText_CountRects);
228 CHK(FPDFText_GetRect);
229 CHK(FPDFText_GetBoundedText);
230 CHK(FPDFText_FindStart);
231 CHK(FPDFText_FindNext);
232 CHK(FPDFText_FindPrev);
233 CHK(FPDFText_GetSchResultIndex);
234 CHK(FPDFText_GetSchCount);
235 CHK(FPDFText_FindClose);
236 CHK(FPDFLink_LoadWebLinks);
237 CHK(FPDFLink_CountWebLinks);
238 CHK(FPDFLink_GetURL);
239 CHK(FPDFLink_CountRects);
240 CHK(FPDFLink_GetRect);
241 CHK(FPDFLink_CloseWebLinks);
242
243 // fpdf_transformpage.h
244 CHK(FPDFPage_SetMediaBox);
245 CHK(FPDFPage_SetCropBox);
246 CHK(FPDFPage_GetMediaBox);
247 CHK(FPDFPage_GetCropBox);
248 CHK(FPDFPage_TransFormWithClip);
249 CHK(FPDFPageObj_TransformClipPath);
250 CHK(FPDF_CreateClipPath);
251 CHK(FPDF_DestroyClipPath);
252 CHK(FPDFPage_InsertClipPath);
253
254 // fpdfview.h
255 CHK(FPDF_InitLibrary);
Lei Zhang6f62d532015-09-23 15:31:44 -0700256 CHK(FPDF_InitLibraryWithConfig);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700257 CHK(FPDF_DestroyLibrary);
258 CHK(FPDF_SetSandBoxPolicy);
259 CHK(FPDF_LoadDocument);
260 CHK(FPDF_LoadMemDocument);
261 CHK(FPDF_LoadCustomDocument);
262 CHK(FPDF_GetFileVersion);
263 CHK(FPDF_GetLastError);
264 CHK(FPDF_GetDocPermissions);
265 CHK(FPDF_GetSecurityHandlerRevision);
266 CHK(FPDF_GetPageCount);
267 CHK(FPDF_LoadPage);
268 CHK(FPDF_GetPageWidth);
269 CHK(FPDF_GetPageHeight);
270 CHK(FPDF_GetPageSizeByIndex);
271 CHK(FPDF_RenderPageBitmap);
thestiga78ba602016-11-23 15:25:48 -0800272 CHK(FPDF_RenderPageBitmapWithMatrix);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700273 CHK(FPDF_ClosePage);
274 CHK(FPDF_CloseDocument);
275 CHK(FPDF_DeviceToPage);
276 CHK(FPDF_PageToDevice);
277 CHK(FPDFBitmap_Create);
278 CHK(FPDFBitmap_CreateEx);
279 CHK(FPDFBitmap_FillRect);
280 CHK(FPDFBitmap_GetBuffer);
281 CHK(FPDFBitmap_GetWidth);
282 CHK(FPDFBitmap_GetHeight);
283 CHK(FPDFBitmap_GetStride);
284 CHK(FPDFBitmap_Destroy);
285 CHK(FPDF_VIEWERREF_GetPrintScaling);
286 CHK(FPDF_VIEWERREF_GetNumCopies);
287 CHK(FPDF_VIEWERREF_GetPrintPageRange);
288 CHK(FPDF_VIEWERREF_GetDuplex);
thestig04bebfe2016-11-04 16:07:25 -0700289 CHK(FPDF_VIEWERREF_GetName);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700290 CHK(FPDF_CountNamedDests);
291 CHK(FPDF_GetNamedDestByName);
292 CHK(FPDF_GetNamedDest);
Tom Sepez51da0932015-11-25 16:05:49 -0800293#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700294 CHK(FPDF_BStr_Init);
295 CHK(FPDF_BStr_Set);
296 CHK(FPDF_BStr_Clear);
Tom Sepez51da0932015-11-25 16:05:49 -0800297#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700298
299 return 1;
300}
301
302#undef CHK