blob: 688471f28d6ba2bc1c9a946033e1ac83906eb629 [file] [log] [blame]
thestig9067fd62016-11-23 14:10:06 -08001// 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
14extern "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 Sinclair00d2ad12017-08-10 14:13:02 -040024FPDF_EXPORT FPDF_STRUCTTREE FPDF_CALLCONV
25FPDF_StructTree_GetForPage(FPDF_PAGE page);
thestig9067fd62016-11-23 14:10:06 -080026
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 Sinclair00d2ad12017-08-10 14:13:02 -040034FPDF_EXPORT void FPDF_CALLCONV
35FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree);
thestig9067fd62016-11-23 14:10:06 -080036
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 Sinclair00d2ad12017-08-10 14:13:02 -040044FPDF_EXPORT int FPDF_CALLCONV
thestig9067fd62016-11-23 14:10:06 -080045FPDF_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 Sinclair00d2ad12017-08-10 14:13:02 -040055FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV
thestig9067fd62016-11-23 14:10:06 -080056FPDF_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 Sinclair00d2ad12017-08-10 14:13:02 -040073FPDF_EXPORT unsigned long FPDF_CALLCONV
thestig9067fd62016-11-23 14:10:06 -080074FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
75 void* buffer,
76 unsigned long buflen);
77
Dan Sinclair29479f62017-04-04 10:48:19 -040078// 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 Sinclair00d2ad12017-08-10 14:13:02 -040093FPDF_EXPORT unsigned long FPDF_CALLCONV
Dan Sinclair29479f62017-04-04 10:48:19 -040094FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element,
95 void* buffer,
96 unsigned long buflen);
97
dan sinclaird9dad3a2017-04-06 14:44:02 -040098// 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 Sinclair00d2ad12017-08-10 14:13:02 -0400113FPDF_EXPORT unsigned long FPDF_CALLCONV
dan sinclaird9dad3a2017-04-06 14:44:02 -0400114FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element,
115 void* buffer,
116 unsigned long buflen);
117
thestig9067fd62016-11-23 14:10:06 -0800118// 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 Sinclair00d2ad12017-08-10 14:13:02 -0400124FPDF_EXPORT int FPDF_CALLCONV
thestig9067fd62016-11-23 14:10:06 -0800125FPDF_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 Sinclair00d2ad12017-08-10 14:13:02 -0400137FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV
thestig9067fd62016-11-23 14:10:06 -0800138FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
139 int index);
140
141#ifdef __cplusplus
Dan Sinclairddcb6e72017-04-05 10:30:33 -0400142} // extern "C"
thestig9067fd62016-11-23 14:10:06 -0800143#endif
144
145#endif // PUBLIC_FPDF_STRUCTTREE_H_