Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef PUBLIC_FPDF_DATAAVAIL_H_ | 7 #ifndef PUBLIC_FPDF_DATAAVAIL_H_ |
| 8 #define PUBLIC_FPDF_DATAAVAIL_H_ | 8 #define PUBLIC_FPDF_DATAAVAIL_H_ |
| 9 | 9 |
| 10 #include <stddef.h> // For size_t. | 10 #include <stddef.h> // For size_t. |
| 11 | 11 |
| 12 #include "fpdfview.h" | 12 #include "fpdfview.h" |
| 13 | 13 |
| 14 /** The result of the process which check linearized PDF. */ | 14 #define PDF_LINEARIZATION_UNKNOWN -1 |
| 15 #define FSDK_IS_LINEARIZED 1 | 15 #define PDF_NOT_LINEARIZED 0 |
| 16 #define FSDK_NOT_LINEARIZED 0 | 16 #define PDF_LINEARIZED 1 |
| 17 #define FSDK_UNKNOW_LINEARIZED -1 | 17 #define PDF_DATA_ERROR -1 |
| 18 #define PDF_DATA_NOTAVAIL 0 | |
| 19 #define PDF_DATA_AVAIL 1 | |
| 20 #define PDF_FORM_NOTAVAIL 0 | |
|
jun_fang
2015/10/29 15:31:45
should add "#define PDF_FORM_ERROR -1"
| |
| 21 #define PDF_FORM_AVAIL 1 | |
| 22 #define PDF_FORM_NOTEXIST 2 | |
| 18 | 23 |
| 19 #ifdef __cplusplus | 24 #ifdef __cplusplus |
| 20 extern "C" { | 25 extern "C" { |
| 21 #endif | 26 #endif |
| 22 | 27 |
| 23 /** | 28 /** |
| 24 * Interface: FX_FILEAVAIL | 29 * Interface: FX_FILEAVAIL |
| 25 * Interface for checking whether the section of the file is available. | 30 * Interface for checking whether the section of the file is available. |
| 26 */ | 31 */ |
| 27 typedef struct _FX_FILEAVAIL { | 32 typedef struct _FX_FILEAVAIL { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 * Function: FPDFAvail_IsDocAvail | 128 * Function: FPDFAvail_IsDocAvail |
| 124 * Check whether the document is ready for loading, if not, get | 129 * Check whether the document is ready for loading, if not, get |
| 125 * download hints. | 130 * download hints. |
| 126 * | 131 * |
| 127 * Parameters: | 132 * Parameters: |
| 128 * avail - Handle to document availability provider returned by | 133 * avail - Handle to document availability provider returned by |
| 129 * FPDFAvail_Create | 134 * FPDFAvail_Create |
| 130 * hints - Pointer to a download hints interface, receiving | 135 * hints - Pointer to a download hints interface, receiving |
| 131 * generated hints | 136 * generated hints |
| 132 * Return value: | 137 * Return value: |
| 133 * Non-zero for page is fully available, 0 for page not yet available. | 138 * PDF_DATA_ERROR: A common error is returned. It can't tell |
| 139 * whehter data are availabe or not. | |
| 140 * PDF_DATA_NOTAVAIL: Data are not yet available. | |
| 141 * PDF_DATA_AVAIL: Data are available. | |
| 134 * Comments: | 142 * Comments: |
| 135 * The application should call this function whenever new data arrived, | 143 * The application should call this function whenever new data arrived, |
| 136 * and process all the | 144 * and process all the |
| 137 * generated download hints if any, until the function returns non-zero | 145 * generated download hints if any, until the function returns true. |
|
jun_fang
2015/10/29 15:31:45
true should be changed to PDF_DATA_ERROR or PDF_DA
jun_fang
2015/10/29 15:36:00
"true" should be changed to "PDF_DATA_ERROR or PDF
| |
| 138 * value. Then the | 146 * Then the application can call FPDFAvail_GetDocument() to get a document |
| 139 * application can call FPDFAvail_GetDocument() to get a document | |
| 140 * handle. | 147 * handle. |
| 141 */ | 148 */ |
| 142 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, | 149 DLLEXPORT int STDCALL |
| 143 FX_DOWNLOADHINTS* hints); | 150 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints); |
| 144 | 151 |
| 145 /** | 152 /** |
| 146 * Function: FPDFAvail_GetDocument | 153 * Function: FPDFAvail_GetDocument |
| 147 * Get document from the availability provider. | 154 * Get document from the availability provider. |
| 148 * | 155 * |
| 149 * Parameters: | 156 * Parameters: |
| 150 * avail - Handle to document availability provider returned by | 157 * avail - Handle to document availability provider returned by |
| 151 * FPDFAvail_Create | 158 * FPDFAvail_Create |
| 152 * password - Optional password for decrypting the PDF file. | 159 * password - Optional password for decrypting the PDF file. |
| 153 * Return value: | 160 * Return value: |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 182 * Check whether a page is ready for loading, if not, get download | 189 * Check whether a page is ready for loading, if not, get download |
| 183 * hints. | 190 * hints. |
| 184 * | 191 * |
| 185 * Parameters: | 192 * Parameters: |
| 186 * avail - Handle to document availability provider returned by | 193 * avail - Handle to document availability provider returned by |
| 187 * FPDFAvail_Create | 194 * FPDFAvail_Create |
| 188 * page_index - Index number of the page. 0 for the first page. | 195 * page_index - Index number of the page. 0 for the first page. |
| 189 * hints - Pointer to a download hints interface, receiving | 196 * hints - Pointer to a download hints interface, receiving |
| 190 * generated hints | 197 * generated hints |
| 191 * Return value: | 198 * Return value: |
| 192 * Non-zero for page is fully available, 0 for page not yet available. | 199 * PDF_DATA_ERROR: A common error is returned. It can't tell |
| 200 * whehter data are availabe or not. | |
| 201 * PDF_DATA_NOTAVAIL: Data are not yet available. | |
| 202 * PDF_DATA_AVAIL: Data are available. | |
| 193 * Comments: | 203 * Comments: |
| 194 * This function call be called only after FPDFAvail_GetDocument if | 204 * This function call be called only after FPDFAvail_GetDocument if |
| 195 * called. | 205 * called. |
| 196 * The application should call this function whenever new data arrived, | 206 * The application should call this function whenever new data arrived, |
| 197 * and process all the | 207 * and process all the |
| 198 * generated download hints if any, until the function returns non-zero | 208 * generated download hints if any, until the function returns true. |
|
jun_fang
2015/10/29 15:31:45
true should be changed to PDF_DATA_ERROR or PDF_DA
jun_fang
2015/10/29 15:36:00
"true" should be changed to "PDF_DATA_ERROR or PDF
| |
| 199 * value. Then the | 209 * Then the application can perform page loading. |
| 200 * application can perform page loading. | |
| 201 */ | 210 */ |
| 202 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, | 211 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, |
| 203 int page_index, | 212 int page_index, |
| 204 FX_DOWNLOADHINTS* hints); | 213 FX_DOWNLOADHINTS* hints); |
| 205 | 214 |
| 206 /** | 215 /** |
| 207 * Function: FPDFAvail_ISFormAvail | 216 * Function: FPDFAvail_ISFormAvail |
| 208 * Check whether Form data is ready for init, if not, get download | 217 * Check whether Form data is ready for init, if not, get download |
| 209 * hints. | 218 * hints. |
| 210 * | 219 * |
| 211 * Parameters: | 220 * Parameters: |
| 212 * avail - Handle to document availability provider returned by | 221 * avail - Handle to document availability provider returned by |
| 213 * FPDFAvail_Create | 222 * FPDFAvail_Create |
| 214 * hints - Pointer to a download hints interface, receiving | 223 * hints - Pointer to a download hints interface, receiving |
| 215 * generated hints | 224 * generated hints |
| 216 * Return value: | 225 * Return value: |
| 217 * Non-zero for Form data is fully available, 0 for Form data not yet | 226 * Non-zero for Form data is fully available, 0 for Form data not yet |
| 218 * available. | 227 * available. |
| 219 * Details: -1 - error, the input parameter not correct, such as hints | 228 * Details: -1 - error, the input parameter not correct, such as hints |
|
jun_fang
2015/10/29 15:31:45
Use the following marcros to replace integers.
PD
| |
| 220 * is null. | 229 * is null. |
| 221 * 0 - data not available | 230 * 0 - data not available |
| 222 * 1 - data available | 231 * 1 - data available |
| 223 * 2 - no form data. | 232 * 2 - no form data. |
| 224 * Comments: | 233 * Comments: |
| 225 * This function call be called only after FPDFAvail_GetDocument if | 234 * This function call be called only after FPDFAvail_GetDocument if |
| 226 * called. | 235 * called. |
| 227 * The application should call this function whenever new data arrived, | 236 * The application should call this function whenever new data arrived, |
| 228 * and process all the | 237 * and process all the |
| 229 * generated download hints if any, until the function returns non-zero | 238 * generated download hints if any, until the function returns non-zero |
| 230 * value. Then the | 239 * value. Then the |
| 231 * application can perform page loading. Recommend to call | 240 * application can perform page loading. Recommend to call |
| 232 * FPDFDOC_InitFormFillEnvironment | 241 * FPDFDOC_InitFormFillEnvironment |
| 233 * after the function returns non-zero value. | 242 * after the function returns non-zero value. |
| 234 */ | 243 */ |
| 235 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, | 244 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, |
| 236 FX_DOWNLOADHINTS* hints); | 245 FX_DOWNLOADHINTS* hints); |
| 237 | 246 |
| 238 /** | 247 /** |
| 239 * Function: FPDFAvail_IsLinearized | 248 * Function: FPDFAvail_IsLinearized |
| 240 * To check whether a document is Linearized PDF file. | 249 * To check whether a document is Linearized PDF file. |
| 241 * | 250 * |
| 242 * Parameters: | 251 * Parameters: |
| 243 * avail - Handle to document availability provider returned by | 252 * avail - Handle to document availability provider returned by |
| 244 * FPDFAvail_Create | 253 * FPDFAvail_Create |
| 245 * Return value: | 254 * Return value: |
| 246 * return TRUE means the document is linearized PDF else not. | 255 * PDF_LINEARIZED is a linearize file. |
| 247 * FSDK_IS_LINEARIZED is a linearize file. | 256 * PDF_NOT_LINEARIZED is not a linearize file. |
| 248 * FSDK_NOT_LINEARIZED is not a linearize file. | 257 * PDF_LINEARIZATION_UNKNOWN doesn't know whether the file is a |
| 249 * FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize | 258 *linearize file. |
| 250 * file. | 259 * |
| 251 * Comments: | 260 * Comments: |
| 252 * It return TRUE/FALSE as soon as we have first 1K data. If the | 261 * It return PDF_LINEARIZED or PDF_NOT_LINEARIZED as soon as |
| 253 * file's size less than | 262 * we have first 1K data. If the file's size less than 1K, it returns |
| 254 * 1K,we don't known whether the PDF is a linearized file. | 263 * PDF_LINEARIZATION_UNKNOWN because there is not enough information to |
| 264 * tell whether a PDF file is a linearized file or not. | |
| 255 * | 265 * |
| 256 */ | 266 */ |
| 257 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); | 267 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); |
| 258 | 268 |
| 259 #ifdef __cplusplus | 269 #ifdef __cplusplus |
| 260 } | 270 } |
| 261 #endif | 271 #endif |
| 262 | 272 |
| 263 #endif // PUBLIC_FPDF_DATAAVAIL_H_ | 273 #endif // PUBLIC_FPDF_DATAAVAIL_H_ |
| OLD | NEW |