Home | History | Annotate | Download | only in public
      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.
     24 DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page);
     25 
     26 // Function: FPDF_StructTree_Close
     27 //          Release the resource allocate by FPDF_StructTree_GetForPage.
     28 // Parameters:
     29 //          struct_tree -   Handle to the struct tree. Returned by
     30 //          FPDF_StructTree_LoadPage function.
     31 // Return value:
     32 //          NULL
     33 DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree);
     34 
     35 // Function: FPDF_StructTree_CountChildren
     36 //          Count the number of children for the structure tree.
     37 // Parameters:
     38 //          struct_tree -   Handle to the struct tree. Returned by
     39 //          FPDF_StructTree_LoadPage function.
     40 // Return value:
     41 //          The number of children, or -1 on error.
     42 DLLEXPORT int STDCALL
     43 FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree);
     44 
     45 // Function: FPDF_StructTree_GetChildAtIndex
     46 //          Get a child in the structure tree.
     47 // Parameters:
     48 //          struct_tree -   Handle to the struct tree. Returned by
     49 //          FPDF_StructTree_LoadPage function.
     50 //          index       -   The index for the child, 0-based.
     51 // Return value:
     52 //          The child at the n-th index or NULL on error.
     53 DLLEXPORT FPDF_STRUCTELEMENT STDCALL
     54 FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index);
     55 
     56 // Function: FPDF_StructElement_GetAltText
     57 //          Get the alt text for a given element.
     58 // Parameters:
     59 //          struct_element -   Handle to the struct element.
     60 //          buffer         -   A buffer for output the alt text. May be NULL.
     61 //          buflen         -   The length of the buffer, in bytes. May be 0.
     62 // Return value:
     63 //          The number of bytes in the title, including the terminating NUL
     64 //          character. The number of bytes is returned regardless of the
     65 //          |buffer| and |buflen| parameters.
     66 // Comments:
     67 //          Regardless of the platform, the |buffer| is always in UTF-16LE
     68 //          encoding. The string is terminated by a UTF16 NUL character. If
     69 //          |buflen| is less than the required length, or |buffer| is NULL,
     70 //          |buffer| will not be modified.
     71 DLLEXPORT unsigned long STDCALL
     72 FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
     73                               void* buffer,
     74                               unsigned long buflen);
     75 
     76 // Function: FPDF_StructElement_CountChildren
     77 //          Count the number of children for the structure element.
     78 // Parameters:
     79 //          struct_element -   Handle to the struct element.
     80 // Return value:
     81 //          The number of children, or -1 on error.
     82 DLLEXPORT int STDCALL
     83 FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element);
     84 
     85 // Function: FPDF_StructElement_GetChildAtIndex
     86 //          Get a child in the structure element.
     87 // Parameters:
     88 //          struct_tree -   Handle to the struct element.
     89 //          index       -   The index for the child, 0-based.
     90 // Return value:
     91 //          The child at the n-th index or NULL on error.
     92 // Comments:
     93 //          If the child exists but is not an element, then this function will
     94 //          return NULL. This will also return NULL for out of bounds indices.
     95 DLLEXPORT FPDF_STRUCTELEMENT STDCALL
     96 FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
     97                                    int index);
     98 
     99 #ifdef __cplusplus
    100 }
    101 #endif
    102 
    103 #endif  // PUBLIC_FPDF_STRUCTTREE_H_
    104