Foxit PDF SDK
foxit::addon::accessibility::ReadingOrder Class Reference
Inheritance diagram for foxit::addon::accessibility::ReadingOrder:
foxit::Base

Public Types

enum  StructureType {
  e_StructureTypeText = 0, e_StructureTypeFigure = 1, e_StructureTypeFormfield = 2, e_StructureTypeFigureOrCaption = 3,
  e_StructureTypeCaption = 4, e_StructureTypeH1 = 5, e_StructureTypeH2 = 6, e_StructureTypeH3 = 7,
  e_StructureTypeH4 = 8, e_StructureTypeH5 = 9, e_StructureTypeH6 = 10, e_StructureTypeTable = 11,
  e_StructureTypeCell = 12, e_StructureTypeFormula = 13, e_StructureTypeReference = 14, e_StructureTypeNote = 15,
  e_StructureTypeBackgroundOrArtifact = 16
}
 Enumeration for structure type of reading order. More...
 
enum  TableSelectResult {
  e_TableSelectResultNone = 0, e_TableSelectResultNotStarted = 1, e_TableSelectResultNotSamePage = 2, e_TableSelectResultNoTableExist = 3,
  e_TableSelectResultNotInTable = 4
}
 Enumeration for table select result. More...
 

Public Member Functions

 ReadingOrder (const foxit::pdf::PDFDoc &pdf_doc)
 Constructor. More...
 
 ReadingOrder (const ReadingOrder &other)
 Constructor, with another reading order object. More...
 
 ~ReadingOrder ()
 Destructor.
 
RectFArray AddOrderDataForRect (int page_index, foxit::RectF rect)
 Add order data for selected rect. More...
 
bool ApplyReadingOrder (int page_index, const RectFArray &selected_rect)
 Apply reading order to the specified page based on the given selected rectangle area(s). More...
 
bool CanMoveDataOrder (int page_index, const TreeItemInfoArray &select_info_array, const TreeItemInfo &dest_move_item)
 Check whether data order can be moved. More...
 
ReadingOrder::TableSelectResult CanSelectTableCellAtPoint (foxit::pdf::PDFPage page, foxit::PointF point)
 Check whether a table cell can be selected on mouse down at the given point. More...
 
void ClearPageStructInfo (foxit::pdf::PDFPage page)
 Clear page structure info. More...
 
int DeleteOrderDataStructInfo (foxit::pdf::PDFPage page, Int32Array src_order_index_array, bool is_loaded)
 Delete order data structure info. More...
 
bool DrawReadingOrderItems (int page_index)
 Draw reading order items for a specified page. More...
 
bool EndEditTable ()
 End edit table. More...
 
bool GenerateTableHeaderIDs ()
 Generate table header IDs. More...
 
StringArray GetAllLeafChildrenByContentItemID (const ContentTreeItemArray &content_tree, const String &content_item_id)
 Get all leaf children by content item ID. More...
 
ContentTreeItemArray GetContentTree ()
 Get content tree. More...
 
WStringArray GetCurrentTableHeaderIDs ()
 Get the array header ID of current table. More...
 
TreeItemArray GetReadingOrderTreeItems ()
 Get reading order tree items. More...
 
TableCellAttributeArray GetSelectedTableCellAttributes ()
 Get selected table cell attributes. More...
 
WString GetTableSummary (foxit::pdf::PDFPage page)
 Get table summary. More...
 
bool HasHeaderID (WString header_id)
 Check whether current table header ID is existing. More...
 
bool HasMissingHeaderIDs ()
 Check whether current table is missing header IDs. More...
 
bool IsEditingTable ()
 Check whether table editing has started. More...
 
bool IsEmpty () const
 Check whether current object is empty or not. More...
 
int MoveOrderData (int page_index, Int32Array src_order_index_array, int dest_order_index)
 Move data order. More...
 
bool operator!= (const ReadingOrder &other) const
 Not equal operator. More...
 
ReadingOrder & operator= (const ReadingOrder &other)
 Assign operator. More...
 
bool operator== (const ReadingOrder &other) const
 Equal operator. More...
 
RectFArray RemoveOrderDataForRect (int page_index, foxit::RectF rect)
 Remove order data for selected rect. More...
 
bool SelectTableAtPoint (int page_index, const PointF &point)
 Select the table at the specified point on a page, if any. More...
 
ReadingOrder::TableSelectResult SelectTableCellAtPoint (foxit::pdf::PDFPage page, foxit::PointF point, foxit::RectFArray &region_selected, bool appended)
 Select table cell by point on mouse up. More...
 
ReadingOrder::TableSelectResult SelectTableCellAtRect (foxit::pdf::PDFPage page, foxit::RectF rect, foxit::RectFArray &region_selected, bool appended)
 Select table cell by rect on mouse up. More...
 
bool SetOrderTypeForSelectedContent (StructureType structure_type)
 Set order type for selected content. More...
 
bool SetOrderTypeForSelectedTreeItems (StructureType structure_type, const TreeItemInfoArray &select_info_array)
 Set order type for selected tree items. More...
 
void SetReadingOrderOptions (const ReadingOrderOptions &options)
 Set reading order options. More...
 
bool SetSelectedTableCellAttributes (TableCellAttribute cell_attribute, bool change_id_enabled, bool need_change_ids)
 Set selected table cell attributes. More...
 
bool SetTableSummary (foxit::pdf::PDFPage page, const wchar_t *table_summary)
 Set table summary. More...
 
bool StartEditTable (foxit::pdf::PDFPage page)
 Start edit table. More...
 
bool StartEditTableAtPoint (foxit::pdf::PDFPage page, foxit::PointF point)
 Start editing the table located at the specified point on a page, if any. More...
 
void SynchronizeTable ()
 Synchronize table. More...
 
- Public Member Functions inherited from foxit::Base
FS_HANDLE Handle () const
 Get the handle of current object. More...
 

Detailed Description

This class represents a reading order for PDF document accessibility reading order operations. Before using any class or methods in this module, please ensure Foxit PDF SDK has been initialized successfully by function common::Library::Initialize with a key including "Accessibility" module.

See also
common::Library

Member Enumeration Documentation

◆ StructureType

Enumeration for structure type of reading order.

Values of this enumeration should be used alone.

Enumerator
e_StructureTypeText 

Structure type: text.

e_StructureTypeFigure 

Structure type: figure.

e_StructureTypeFormfield 

Structure type: form field.

e_StructureTypeFigureOrCaption 

Structure type: figure or caption.

e_StructureTypeCaption 

Structure type: caption.

e_StructureTypeH1 

Structure type: H1.

e_StructureTypeH2 

Structure type: H2.

e_StructureTypeH3 

Structure type: H3.

e_StructureTypeH4 

Structure type: H4.

e_StructureTypeH5 

Structure type: H5.

e_StructureTypeH6 

Structure type: H6.

e_StructureTypeTable 

Structure type: table.

e_StructureTypeCell 

Structure type: cell.

e_StructureTypeFormula 

Structure type: formula.

e_StructureTypeReference 

Structure type: reference.

e_StructureTypeNote 

Structure type: note.

e_StructureTypeBackgroundOrArtifact 

Structure type: background or artifact.

◆ TableSelectResult

Enumeration for table select result.

Values of this enumeration should be used alone.

Enumerator
e_TableSelectResultNone 

Table select result : none.

e_TableSelectResultNotStarted 

Table select result : not started.

e_TableSelectResultNotSamePage 

Table select result : not same page.

e_TableSelectResultNoTableExist 

Table select result : no table exist.

e_TableSelectResultNotInTable 

Table select result : not in table.

Constructor & Destructor Documentation

◆ ReadingOrder() [1/2]

foxit::addon::accessibility::ReadingOrder::ReadingOrder ( const foxit::pdf::PDFDoc &  pdf_doc)

Constructor.

Parameters
[in]pdf_docA valid PDF document object.

◆ ReadingOrder() [2/2]

foxit::addon::accessibility::ReadingOrder::ReadingOrder ( const ReadingOrder &  other)

Constructor, with another reading order object.

Parameters
[in]otherAnother reading order object.

Member Function Documentation

◆ AddOrderDataForRect()

RectFArray foxit::addon::accessibility::ReadingOrder::AddOrderDataForRect ( int  page_index,
foxit::RectF  rect 
)

Add order data for selected rect.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::GetPageCount.
[in]rectThe selected rect.
Returns
The updated order rect array.

◆ ApplyReadingOrder()

bool foxit::addon::accessibility::ReadingOrder::ApplyReadingOrder ( int  page_index,
const RectFArray &  selected_rect 
)

Apply reading order to the specified page based on the given selected rectangle area(s).

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::GetPageCount.
[in]selected_rectThe array of selected rects which define the area(s) to be used for applying reading order.
Returns
true means success, while false means not.

◆ CanMoveDataOrder()

bool foxit::addon::accessibility::ReadingOrder::CanMoveDataOrder ( int  page_index,
const TreeItemInfoArray &  select_info_array,
const TreeItemInfo &  dest_move_item 
)

Check whether data order can be moved.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::GetPageCount.
[in]select_info_arrayThe selected info array.
[in]dest_move_itemThe destination move item.
Returns
true means data order can be moved, while false means not.

◆ CanSelectTableCellAtPoint()

ReadingOrder::TableSelectResult foxit::addon::accessibility::ReadingOrder::CanSelectTableCellAtPoint ( foxit::pdf::PDFPage  page,
foxit::PointF  point 
)

Check whether a table cell can be selected on mouse down at the given point.

Parameters
[in]pageA PDF page object.
[in]pointThe point, in the PDF coordinate system (PDFPage).
Returns
The table select result. Please refer to values starting from ReadingOrder::e_TableSelectResultNone.

◆ ClearPageStructInfo()

void foxit::addon::accessibility::ReadingOrder::ClearPageStructInfo ( foxit::pdf::PDFPage  page)

Clear page structure info.

Parameters
[in]pageThe PDF page object.
Returns
None.

◆ DeleteOrderDataStructInfo()

int foxit::addon::accessibility::ReadingOrder::DeleteOrderDataStructInfo ( foxit::pdf::PDFPage  page,
Int32Array  src_order_index_array,
bool  is_loaded 
)

Delete order data structure info.

Parameters
[in]pageThe PDF page object.
[in]src_order_index_arrayThe source order index array.
[in]is_loadedWhether the page is loaded.
Returns
The deleted count.

◆ DrawReadingOrderItems()

bool foxit::addon::accessibility::ReadingOrder::DrawReadingOrderItems ( int  page_index)

Draw reading order items for a specified page.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::GetPageCount.
Returns
true means success, while false means not.

◆ EndEditTable()

bool foxit::addon::accessibility::ReadingOrder::EndEditTable ( )

End edit table.

Returns
true means success, while false means not.

◆ GenerateTableHeaderIDs()

bool foxit::addon::accessibility::ReadingOrder::GenerateTableHeaderIDs ( )

Generate table header IDs.

Returns
true means success, while false means not.

◆ GetAllLeafChildrenByContentItemID()

StringArray foxit::addon::accessibility::ReadingOrder::GetAllLeafChildrenByContentItemID ( const ContentTreeItemArray &  content_tree,
const String &  content_item_id 
)

Get all leaf children by content item ID.

Parameters
[in]content_treeThe content tree.
[in]content_item_idThe content item ID.
Returns
The array of leaf children IDs.

◆ GetContentTree()

ContentTreeItemArray foxit::addon::accessibility::ReadingOrder::GetContentTree ( )

Get content tree.

Returns
The array of content tree items.

◆ GetCurrentTableHeaderIDs()

WStringArray foxit::addon::accessibility::ReadingOrder::GetCurrentTableHeaderIDs ( )

Get the array header ID of current table.

Returns
The array of header ID.

◆ GetReadingOrderTreeItems()

TreeItemArray foxit::addon::accessibility::ReadingOrder::GetReadingOrderTreeItems ( )

Get reading order tree items.

Returns
The array of reading order tree items.

◆ GetSelectedTableCellAttributes()

TableCellAttributeArray foxit::addon::accessibility::ReadingOrder::GetSelectedTableCellAttributes ( )

Get selected table cell attributes.

Returns
The array of cell attribute objects.

◆ GetTableSummary()

WString foxit::addon::accessibility::ReadingOrder::GetTableSummary ( foxit::pdf::PDFPage  page)

Get table summary.

Parameters
[in]pageThe PDF page object.
Returns
The table summary text.

◆ HasHeaderID()

bool foxit::addon::accessibility::ReadingOrder::HasHeaderID ( WString  header_id)

Check whether current table header ID is existing.

Parameters
[in]header_idThe header ID to check.
Returns
true means the header ID is existing, while false means not.

◆ HasMissingHeaderIDs()

bool foxit::addon::accessibility::ReadingOrder::HasMissingHeaderIDs ( )

Check whether current table is missing header IDs.

Returns
true means current table is missing header IDs, while false means not.

◆ IsEditingTable()

bool foxit::addon::accessibility::ReadingOrder::IsEditingTable ( )

Check whether table editing has started.

Returns
true means table editing has started, while false means not.

◆ IsEmpty()

bool foxit::addon::accessibility::ReadingOrder::IsEmpty ( ) const

Check whether current object is empty or not.

Returns
true means current object is empty, while false means not.

◆ MoveOrderData()

int foxit::addon::accessibility::ReadingOrder::MoveOrderData ( int  page_index,
Int32Array  src_order_index_array,
int  dest_order_index 
)

Move data order.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::GetPageCount.
[in]src_order_index_arrayThe source order index array.
[in]dest_order_indexThe destination order index.
Returns
The moved count.

◆ operator!=()

bool foxit::addon::accessibility::ReadingOrder::operator!= ( const ReadingOrder &  other) const

Not equal operator.

Parameters
[in]otherAnother reading order object. This function will check if current object is not equal to this one.
Returns
true means not equal, while false means equal.

◆ operator=()

ReadingOrder& foxit::addon::accessibility::ReadingOrder::operator= ( const ReadingOrder &  other)

Assign operator.

Parameters
[in]otherAnother reading order object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ operator==()

bool foxit::addon::accessibility::ReadingOrder::operator== ( const ReadingOrder &  other) const

Equal operator.

Parameters
[in]otherAnother reading order object. This function will check if current object is equal to this one.
Returns
true means equal, while false means not equal.

◆ RemoveOrderDataForRect()

RectFArray foxit::addon::accessibility::ReadingOrder::RemoveOrderDataForRect ( int  page_index,
foxit::RectF  rect 
)

Remove order data for selected rect.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::GetPageCount.
[in]rectThe selected rect.
Returns
The updated order rect array.

◆ SelectTableAtPoint()

bool foxit::addon::accessibility::ReadingOrder::SelectTableAtPoint ( int  page_index,
const PointF &  point 
)

Select the table at the specified point on a page, if any.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function pdf::PDFDoc::GetPageCount.
[in]pointThe point used to locate the table, in PDF page coordinate system.
Returns
true means a table is found and selected at the specified point, while false means not.

◆ SelectTableCellAtPoint()

ReadingOrder::TableSelectResult foxit::addon::accessibility::ReadingOrder::SelectTableCellAtPoint ( foxit::pdf::PDFPage  page,
foxit::PointF  point,
foxit::RectFArray &  region_selected,
bool  appended 
)

Select table cell by point on mouse up.

Parameters
[in]pageA PDF page object.
[in]pointThe point.
[out]region_selectedThe selected region array.
[in]appendedWhether to append the selection.
Returns
The table select result. Please refer to values starting from ReadingOrder::e_TableSelectResultNone.

◆ SelectTableCellAtRect()

ReadingOrder::TableSelectResult foxit::addon::accessibility::ReadingOrder::SelectTableCellAtRect ( foxit::pdf::PDFPage  page,
foxit::RectF  rect,
foxit::RectFArray &  region_selected,
bool  appended 
)

Select table cell by rect on mouse up.

Parameters
[in]pageA PDF page object.
[in]rectThe rectangular area .
[out]region_selectedThe selected region array.
[in]appendedWhether to append the selection.
Returns
The table select result. Please refer to values starting from ReadingOrder::e_TableSelectResultNone.

◆ SetOrderTypeForSelectedContent()

bool foxit::addon::accessibility::ReadingOrder::SetOrderTypeForSelectedContent ( StructureType  structure_type)

Set order type for selected content.

Parameters
[in]structure_typeThe structure type. Please refer to values starting from e_StructureTypeText and this should be one of these values.
Returns
true means success, while false means not.

◆ SetOrderTypeForSelectedTreeItems()

bool foxit::addon::accessibility::ReadingOrder::SetOrderTypeForSelectedTreeItems ( StructureType  structure_type,
const TreeItemInfoArray &  select_info_array 
)

Set order type for selected tree items.

Parameters
[in]structure_typeThe structure type. Please refer value StructureType.
[in]select_info_arrayThe selected info array.
Returns
true means success, while false means not.

◆ SetReadingOrderOptions()

void foxit::addon::accessibility::ReadingOrder::SetReadingOrderOptions ( const ReadingOrderOptions &  options)

Set reading order options.

Parameters
[in]optionsThe reading order options. Please refer to ReadingOrderOptions.
Returns
None.

◆ SetSelectedTableCellAttributes()

bool foxit::addon::accessibility::ReadingOrder::SetSelectedTableCellAttributes ( TableCellAttribute  cell_attribute,
bool  change_id_enabled,
bool  need_change_ids 
)

Set selected table cell attributes.

Parameters
[in]cell_attributeThe cell attribute to set.
[in]change_id_enabledWhether to enable changing Id.
[in]need_change_idsWhether to change IDs.
Returns
true means success, while false means not.

◆ SetTableSummary()

bool foxit::addon::accessibility::ReadingOrder::SetTableSummary ( foxit::pdf::PDFPage  page,
const wchar_t *  table_summary 
)

Set table summary.

Parameters
[in]pageThe PDF page object.
[in]table_summaryThe table summary text.
Returns
true means success, while false means not.

◆ StartEditTable()

bool foxit::addon::accessibility::ReadingOrder::StartEditTable ( foxit::pdf::PDFPage  page)

Start edit table.

Parameters
[in]pageThe PDF page object.
Returns
true means success, while false means not.

◆ StartEditTableAtPoint()

bool foxit::addon::accessibility::ReadingOrder::StartEditTableAtPoint ( foxit::pdf::PDFPage  page,
foxit::PointF  point 
)

Start editing the table located at the specified point on a page, if any.

Parameters
[in]pageThe PDF page object.
[in]pointThe point used to locate the table to be edited, in the PDF coordinate system (PDFPage).
Returns
true means a table is found at the specified point and editing has started successfully, while false means not.

◆ SynchronizeTable()

void foxit::addon::accessibility::ReadingOrder::SynchronizeTable ( )

Synchronize table.

Returns
None.