blob: 2f0cb49fc2c879e75e9b402acf96c4e57ffe5ae5 [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
Lei Zhangb4e7f302015-11-06 15:52:32 -080012#include "public/fpdf_dataavail.h"
13#include "public/fpdf_doc.h"
14#include "public/fpdf_edit.h"
15#include "public/fpdf_ext.h"
16#include "public/fpdf_flatten.h"
17#include "public/fpdf_formfill.h"
18#include "public/fpdf_fwlevent.h"
19#include "public/fpdf_ppo.h"
20#include "public/fpdf_progressive.h"
21#include "public/fpdf_save.h"
22#include "public/fpdf_searchex.h"
23#include "public/fpdf_sysfontinfo.h"
24#include "public/fpdf_text.h"
25#include "public/fpdf_transformpage.h"
26#include "public/fpdfview.h"
Tom Sepezcf22eb82015-05-12 17:28:08 -070027
28// Scheme for avoiding LTO out of existence, warnings, etc.
29typedef void (*fnptr)(void); // Legal generic function type for casts.
30fnptr g_c_api_test_fnptr = NULL; // Extern, so can't know it doesn't change.
31#define CHK(x) if ((fnptr)(x) == g_c_api_test_fnptr) return 0
32
33// Function to call from gtest harness to ensure linker resolution.
34int CheckPDFiumCApi() {
35 // fpdf_dataavail.h
36 CHK(FPDFAvail_Create);
37 CHK(FPDFAvail_Destroy);
38 CHK(FPDFAvail_IsDocAvail);
39 CHK(FPDFAvail_GetDocument);
40 CHK(FPDFAvail_GetFirstPageNum);
41 CHK(FPDFAvail_IsPageAvail);
42 CHK(FPDFAvail_IsFormAvail);
43 CHK(FPDFAvail_IsLinearized);
44
45 // fpdf_doc.h
46 CHK(FPDFBookmark_GetFirstChild);
47 CHK(FPDFBookmark_GetNextSibling);
48 CHK(FPDFBookmark_GetTitle);
49 CHK(FPDFBookmark_Find);
50 CHK(FPDFBookmark_GetDest);
51 CHK(FPDFBookmark_GetAction);
52 CHK(FPDFAction_GetType);
53 CHK(FPDFAction_GetDest);
Lei Zhange0947b32015-09-17 14:51:48 -070054 CHK(FPDFAction_GetFilePath);
Tom Sepezcf22eb82015-05-12 17:28:08 -070055 CHK(FPDFAction_GetURIPath);
56 CHK(FPDFDest_GetPageIndex);
57 CHK(FPDFLink_GetLinkAtPoint);
Lei Zhangbdf72c32015-08-14 19:24:08 -070058 CHK(FPDFLink_GetLinkZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -070059 CHK(FPDFLink_GetDest);
60 CHK(FPDFLink_GetAction);
61 CHK(FPDFLink_Enumerate);
62 CHK(FPDFLink_GetAnnotRect);
63 CHK(FPDFLink_CountQuadPoints);
64 CHK(FPDFLink_GetQuadPoints);
65 CHK(FPDF_GetMetaText);
66
67 // fpdf_edit.h
68 CHK(FPDF_CreateNewDocument);
69 CHK(FPDFPage_New);
70 CHK(FPDFPage_Delete);
71 CHK(FPDFPage_GetRotation);
72 CHK(FPDFPage_SetRotation);
73 CHK(FPDFPage_InsertObject);
74 CHK(FPDFPage_CountObject);
75 CHK(FPDFPage_GetObject);
76 CHK(FPDFPage_HasTransparency);
77 CHK(FPDFPage_GenerateContent);
78 CHK(FPDFPageObj_HasTransparency);
79 CHK(FPDFPageObj_Transform);
80 CHK(FPDFPage_TransformAnnots);
81 CHK(FPDFPageObj_NewImgeObj);
82 CHK(FPDFImageObj_LoadJpegFile);
83 CHK(FPDFImageObj_SetMatrix);
84 CHK(FPDFImageObj_SetBitmap);
85
86 // fpdf_ext.h
87 CHK(FSDK_SetUnSpObjProcessHandler);
88 CHK(FPDFDoc_GetPageMode);
89
90 // fpdf_flatten.h
91 CHK(FPDFPage_Flatten);
92
93 // fpdf_fwlevent.h - no exports.
94
95 // fpdf_formfill.h
96 CHK(FPDFDOC_InitFormFillEnvironment);
97 CHK(FPDFDOC_ExitFormFillEnvironment);
98 CHK(FORM_OnAfterLoadPage);
99 CHK(FORM_OnBeforeClosePage);
100 CHK(FORM_DoDocumentJSAction);
101 CHK(FORM_DoDocumentOpenAction);
102 CHK(FORM_DoDocumentAAction);
103 CHK(FORM_DoPageAAction);
104 CHK(FORM_OnMouseMove);
105 CHK(FORM_OnLButtonDown);
106 CHK(FORM_OnLButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800107#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700108 CHK(FORM_OnRButtonDown);
109 CHK(FORM_OnRButtonUp);
Tom Sepez51da0932015-11-25 16:05:49 -0800110#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700111 CHK(FORM_OnKeyDown);
112 CHK(FORM_OnKeyUp);
113 CHK(FORM_OnChar);
114 CHK(FORM_ForceToKillFocus);
Lei Zhangbdf72c32015-08-14 19:24:08 -0700115 CHK(FPDFPage_HasFormFieldAtPoint);
116 CHK(FPDPage_HasFormFieldAtPoint); // DEPRECATED. Remove in the future.
117 CHK(FPDFPage_FormFieldZOrderAtPoint);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700118 CHK(FPDF_SetFormFieldHighlightColor);
119 CHK(FPDF_SetFormFieldHighlightAlpha);
120 CHK(FPDF_RemoveFormFieldHighlight);
121 CHK(FPDF_FFLDraw);
Tom Sepez51da0932015-11-25 16:05:49 -0800122#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700123 CHK(FPDF_HasXFAField);
124 CHK(FPDF_LoadXFA);
125 CHK(FPDF_Widget_Undo);
126 CHK(FPDF_Widget_Redo);
127 CHK(FPDF_Widget_SelectAll);
128 CHK(FPDF_Widget_Copy);
129 CHK(FPDF_Widget_Cut);
130 CHK(FPDF_Widget_Paste);
131 CHK(FPDF_Widget_ReplaceSpellCheckWord);
132 CHK(FPDF_Widget_GetSpellCheckWords);
133 CHK(FPDF_StringHandleCounts);
134 CHK(FPDF_StringHandleGetStringByIndex);
135 CHK(FPDF_StringHandleRelease);
136 CHK(FPDF_StringHandleAddString);
Tom Sepez51da0932015-11-25 16:05:49 -0800137#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700138
139 // fpdf_ppo.h
140 CHK(FPDF_ImportPages);
141 CHK(FPDF_CopyViewerPreferences);
142
143 // fpdf_progressive.h
144 CHK(FPDF_RenderPageBitmap_Start);
145 CHK(FPDF_RenderPage_Continue);
146 CHK(FPDF_RenderPage_Close);
147
148 // fpdf_save.h
149 CHK(FPDF_SaveAsCopy);
150 CHK(FPDF_SaveWithVersion);
151
152 // fpdf_searchex.h
153 CHK(FPDFText_GetCharIndexFromTextIndex);
154
155 // fpdf_sysfontinfo.h
156 CHK(FPDF_GetDefaultTTFMap);
157 CHK(FPDF_AddInstalledFont);
158 CHK(FPDF_SetSystemFontInfo);
159 CHK(FPDF_GetDefaultSystemFontInfo);
160
161 // fpdf_text.h
162 CHK(FPDFText_LoadPage);
163 CHK(FPDFText_ClosePage);
164 CHK(FPDFText_CountChars);
165 CHK(FPDFText_GetUnicode);
166 CHK(FPDFText_GetFontSize);
167 CHK(FPDFText_GetCharBox);
168 CHK(FPDFText_GetCharIndexAtPos);
169 CHK(FPDFText_GetText);
170 CHK(FPDFText_CountRects);
171 CHK(FPDFText_GetRect);
172 CHK(FPDFText_GetBoundedText);
173 CHK(FPDFText_FindStart);
174 CHK(FPDFText_FindNext);
175 CHK(FPDFText_FindPrev);
176 CHK(FPDFText_GetSchResultIndex);
177 CHK(FPDFText_GetSchCount);
178 CHK(FPDFText_FindClose);
179 CHK(FPDFLink_LoadWebLinks);
180 CHK(FPDFLink_CountWebLinks);
181 CHK(FPDFLink_GetURL);
182 CHK(FPDFLink_CountRects);
183 CHK(FPDFLink_GetRect);
184 CHK(FPDFLink_CloseWebLinks);
185
186 // fpdf_transformpage.h
187 CHK(FPDFPage_SetMediaBox);
188 CHK(FPDFPage_SetCropBox);
189 CHK(FPDFPage_GetMediaBox);
190 CHK(FPDFPage_GetCropBox);
191 CHK(FPDFPage_TransFormWithClip);
192 CHK(FPDFPageObj_TransformClipPath);
193 CHK(FPDF_CreateClipPath);
194 CHK(FPDF_DestroyClipPath);
195 CHK(FPDFPage_InsertClipPath);
196
197 // fpdfview.h
198 CHK(FPDF_InitLibrary);
Lei Zhang6f62d532015-09-23 15:31:44 -0700199 CHK(FPDF_InitLibraryWithConfig);
Tom Sepezcf22eb82015-05-12 17:28:08 -0700200 CHK(FPDF_DestroyLibrary);
201 CHK(FPDF_SetSandBoxPolicy);
202 CHK(FPDF_LoadDocument);
203 CHK(FPDF_LoadMemDocument);
204 CHK(FPDF_LoadCustomDocument);
205 CHK(FPDF_GetFileVersion);
206 CHK(FPDF_GetLastError);
207 CHK(FPDF_GetDocPermissions);
208 CHK(FPDF_GetSecurityHandlerRevision);
209 CHK(FPDF_GetPageCount);
210 CHK(FPDF_LoadPage);
211 CHK(FPDF_GetPageWidth);
212 CHK(FPDF_GetPageHeight);
213 CHK(FPDF_GetPageSizeByIndex);
214 CHK(FPDF_RenderPageBitmap);
215 CHK(FPDF_ClosePage);
216 CHK(FPDF_CloseDocument);
217 CHK(FPDF_DeviceToPage);
218 CHK(FPDF_PageToDevice);
219 CHK(FPDFBitmap_Create);
220 CHK(FPDFBitmap_CreateEx);
221 CHK(FPDFBitmap_FillRect);
222 CHK(FPDFBitmap_GetBuffer);
223 CHK(FPDFBitmap_GetWidth);
224 CHK(FPDFBitmap_GetHeight);
225 CHK(FPDFBitmap_GetStride);
226 CHK(FPDFBitmap_Destroy);
227 CHK(FPDF_VIEWERREF_GetPrintScaling);
228 CHK(FPDF_VIEWERREF_GetNumCopies);
229 CHK(FPDF_VIEWERREF_GetPrintPageRange);
230 CHK(FPDF_VIEWERREF_GetDuplex);
231 CHK(FPDF_CountNamedDests);
232 CHK(FPDF_GetNamedDestByName);
233 CHK(FPDF_GetNamedDest);
Tom Sepez51da0932015-11-25 16:05:49 -0800234#ifdef PDF_ENABLE_XFA
Tom Sepezcf22eb82015-05-12 17:28:08 -0700235 CHK(FPDF_BStr_Init);
236 CHK(FPDF_BStr_Set);
237 CHK(FPDF_BStr_Clear);
Tom Sepez51da0932015-11-25 16:05:49 -0800238#endif
Tom Sepezcf22eb82015-05-12 17:28:08 -0700239
240 return 1;
241}
242
243#undef CHK