thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 1 | // Copyright 2016 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 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
| 7 | #ifndef PUBLIC_FPDF_STRUCTTREE_H_ |
| 8 | #define PUBLIC_FPDF_STRUCTTREE_H_ |
| 9 | |
| 10 | // NOLINTNEXTLINE(build/include) |
| 11 | #include "fpdfview.h" |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | |
| 17 | // Function: FPDF_StructTree_GetForPage |
| 18 | // Get the structure tree for a page. |
| 19 | // Parameters: |
| 20 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 21 | // function. |
| 22 | // Return value: |
| 23 | // A handle to the structure tree or NULL on error. |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 24 | FPDF_EXPORT FPDF_STRUCTTREE FPDF_CALLCONV |
| 25 | FPDF_StructTree_GetForPage(FPDF_PAGE page); |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 26 | |
| 27 | // Function: FPDF_StructTree_Close |
| 28 | // Release the resource allocate by FPDF_StructTree_GetForPage. |
| 29 | // Parameters: |
| 30 | // struct_tree - Handle to the struct tree. Returned by |
| 31 | // FPDF_StructTree_LoadPage function. |
| 32 | // Return value: |
| 33 | // NULL |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 34 | FPDF_EXPORT void FPDF_CALLCONV |
| 35 | FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree); |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 36 | |
| 37 | // Function: FPDF_StructTree_CountChildren |
| 38 | // Count the number of children for the structure tree. |
| 39 | // Parameters: |
| 40 | // struct_tree - Handle to the struct tree. Returned by |
| 41 | // FPDF_StructTree_LoadPage function. |
| 42 | // Return value: |
| 43 | // The number of children, or -1 on error. |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 44 | FPDF_EXPORT int FPDF_CALLCONV |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 45 | FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree); |
| 46 | |
| 47 | // Function: FPDF_StructTree_GetChildAtIndex |
| 48 | // Get a child in the structure tree. |
| 49 | // Parameters: |
| 50 | // struct_tree - Handle to the struct tree. Returned by |
| 51 | // FPDF_StructTree_LoadPage function. |
| 52 | // index - The index for the child, 0-based. |
| 53 | // Return value: |
| 54 | // The child at the n-th index or NULL on error. |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 55 | FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 56 | FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index); |
| 57 | |
| 58 | // Function: FPDF_StructElement_GetAltText |
| 59 | // Get the alt text for a given element. |
| 60 | // Parameters: |
| 61 | // struct_element - Handle to the struct element. |
| 62 | // buffer - A buffer for output the alt text. May be NULL. |
| 63 | // buflen - The length of the buffer, in bytes. May be 0. |
| 64 | // Return value: |
| 65 | // The number of bytes in the title, including the terminating NUL |
| 66 | // character. The number of bytes is returned regardless of the |
| 67 | // |buffer| and |buflen| parameters. |
| 68 | // Comments: |
| 69 | // Regardless of the platform, the |buffer| is always in UTF-16LE |
| 70 | // encoding. The string is terminated by a UTF16 NUL character. If |
| 71 | // |buflen| is less than the required length, or |buffer| is NULL, |
| 72 | // |buffer| will not be modified. |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 73 | FPDF_EXPORT unsigned long FPDF_CALLCONV |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 74 | FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element, |
| 75 | void* buffer, |
| 76 | unsigned long buflen); |
| 77 | |
Dan Sinclair | 29479f6 | 2017-04-04 10:48:19 -0400 | [diff] [blame] | 78 | // Function: FPDF_StructElement_GetType |
| 79 | // Get the type (/S) for a given element. |
| 80 | // Parameters: |
| 81 | // struct_element - Handle to the struct element. |
| 82 | // buffer - A buffer for output. May be NULL. |
| 83 | // buflen - The length of the buffer, in bytes. May be 0. |
| 84 | // Return value: |
| 85 | // The number of bytes in the type, including the terminating NUL |
| 86 | // character. The number of bytes is returned regardless of the |
| 87 | // |buffer| and |buflen| parameters. |
| 88 | // Comments: |
| 89 | // Regardless of the platform, the |buffer| is always in UTF-16LE |
| 90 | // encoding. The string is terminated by a UTF16 NUL character. If |
| 91 | // |buflen| is less than the required length, or |buffer| is NULL, |
| 92 | // |buffer| will not be modified. |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 93 | FPDF_EXPORT unsigned long FPDF_CALLCONV |
Dan Sinclair | 29479f6 | 2017-04-04 10:48:19 -0400 | [diff] [blame] | 94 | FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element, |
| 95 | void* buffer, |
| 96 | unsigned long buflen); |
| 97 | |
dan sinclair | d9dad3a | 2017-04-06 14:44:02 -0400 | [diff] [blame] | 98 | // Function: FPDF_StructElement_GetTitle |
| 99 | // Get the title (/T) for a given element. |
| 100 | // Parameters: |
| 101 | // struct_element - Handle to the struct element. |
| 102 | // buffer - A buffer for output. May be NULL. |
| 103 | // buflen - The length of the buffer, in bytes. May be 0. |
| 104 | // Return value: |
| 105 | // The number of bytes in the title, including the terminating NUL |
| 106 | // character. The number of bytes is returned regardless of the |
| 107 | // |buffer| and |buflen| parameters. |
| 108 | // Comments: |
| 109 | // Regardless of the platform, the |buffer| is always in UTF-16LE |
| 110 | // encoding. The string is terminated by a UTF16 NUL character. If |
| 111 | // |buflen| is less than the required length, or |buffer| is NULL, |
| 112 | // |buffer| will not be modified. |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 113 | FPDF_EXPORT unsigned long FPDF_CALLCONV |
dan sinclair | d9dad3a | 2017-04-06 14:44:02 -0400 | [diff] [blame] | 114 | FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element, |
| 115 | void* buffer, |
| 116 | unsigned long buflen); |
| 117 | |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 118 | // Function: FPDF_StructElement_CountChildren |
| 119 | // Count the number of children for the structure element. |
| 120 | // Parameters: |
| 121 | // struct_element - Handle to the struct element. |
| 122 | // Return value: |
| 123 | // The number of children, or -1 on error. |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 124 | FPDF_EXPORT int FPDF_CALLCONV |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 125 | FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element); |
| 126 | |
| 127 | // Function: FPDF_StructElement_GetChildAtIndex |
| 128 | // Get a child in the structure element. |
| 129 | // Parameters: |
| 130 | // struct_tree - Handle to the struct element. |
| 131 | // index - The index for the child, 0-based. |
| 132 | // Return value: |
| 133 | // The child at the n-th index or NULL on error. |
| 134 | // Comments: |
| 135 | // If the child exists but is not an element, then this function will |
| 136 | // return NULL. This will also return NULL for out of bounds indices. |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame^] | 137 | FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 138 | FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element, |
| 139 | int index); |
| 140 | |
| 141 | #ifdef __cplusplus |
Dan Sinclair | ddcb6e7 | 2017-04-05 10:30:33 -0400 | [diff] [blame] | 142 | } // extern "C" |
thestig | 9067fd6 | 2016-11-23 14:10:06 -0800 | [diff] [blame] | 143 | #endif |
| 144 | |
| 145 | #endif // PUBLIC_FPDF_STRUCTTREE_H_ |