Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 1 | // 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 Sinclair | f766ad2 | 2016-03-14 13:51:24 -0400 | [diff] [blame] | 10 | #include "fpdfsdk/fpdfview_c_api_test.h" |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 11 | |
Lei Zhang | b4e7f30 | 2015-11-06 15:52:32 -0800 | [diff] [blame] | 12 | #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 Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 27 | |
| 28 | // Scheme for avoiding LTO out of existence, warnings, etc. |
| 29 | typedef void (*fnptr)(void); // Legal generic function type for casts. |
| 30 | fnptr 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. |
| 34 | int 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 Zhang | e0947b3 | 2015-09-17 14:51:48 -0700 | [diff] [blame] | 54 | CHK(FPDFAction_GetFilePath); |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 55 | CHK(FPDFAction_GetURIPath); |
| 56 | CHK(FPDFDest_GetPageIndex); |
| 57 | CHK(FPDFLink_GetLinkAtPoint); |
Lei Zhang | bdf72c3 | 2015-08-14 19:24:08 -0700 | [diff] [blame] | 58 | CHK(FPDFLink_GetLinkZOrderAtPoint); |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 59 | 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 Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 107 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 108 | CHK(FORM_OnRButtonDown); |
| 109 | CHK(FORM_OnRButtonUp); |
Tom Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 110 | #endif |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 111 | CHK(FORM_OnKeyDown); |
| 112 | CHK(FORM_OnKeyUp); |
| 113 | CHK(FORM_OnChar); |
| 114 | CHK(FORM_ForceToKillFocus); |
Lei Zhang | bdf72c3 | 2015-08-14 19:24:08 -0700 | [diff] [blame] | 115 | CHK(FPDFPage_HasFormFieldAtPoint); |
| 116 | CHK(FPDPage_HasFormFieldAtPoint); // DEPRECATED. Remove in the future. |
| 117 | CHK(FPDFPage_FormFieldZOrderAtPoint); |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 118 | CHK(FPDF_SetFormFieldHighlightColor); |
| 119 | CHK(FPDF_SetFormFieldHighlightAlpha); |
| 120 | CHK(FPDF_RemoveFormFieldHighlight); |
| 121 | CHK(FPDF_FFLDraw); |
Tom Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 122 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 123 | 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 Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 137 | #endif |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 138 | |
| 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 Zhang | 6f62d53 | 2015-09-23 15:31:44 -0700 | [diff] [blame] | 199 | CHK(FPDF_InitLibraryWithConfig); |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 200 | 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 Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 234 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 235 | CHK(FPDF_BStr_Init); |
| 236 | CHK(FPDF_BStr_Set); |
| 237 | CHK(FPDF_BStr_Clear); |
Tom Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 238 | #endif |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 239 | |
| 240 | return 1; |
| 241 | } |
| 242 | |
| 243 | #undef CHK |