Public Member Functions | |
LayerNode (const LayerNode &other) | |
Constructor, with another LayerNode object. More... | |
~LayerNode () | |
Destructor. | |
LayerNode | AddChild (int index, const wchar_t *name, bool has_Layer) |
Add a new layer node as a child for current layer node. More... | |
bool | AddGraphicsObject (const PDFPage &page, graphics::GraphicsObject *graphicsobject) |
Add a graphics object to current layer node. More... | |
LayerNode | GetChild (int index) |
Get a child node. More... | |
int | GetChildrenCount () |
Get the count of children nodes. More... | |
LayerTree::UsageState | GetExportUsage () |
Get the state for exporting usage. More... | |
graphics::GraphicsObjectArray | GetGraphicsObjects (const PDFPage &page) |
Get all graphics objects related to the layer which is associated with current layer node. More... | |
WString | GetName () |
Get the name of current layer node. More... | |
LayerPrintData | GetPrintUsage () |
Get the data for printing usage. More... | |
LayerTree::UsageState | GetViewUsage () |
Get the state for viewing usage. More... | |
LayerZoomData | GetZoomUsage () |
Get the data for zooming usage. More... | |
bool | HasIntent (const char *intent) |
Check if current layer node has a specified intent. More... | |
bool | HasLayer () |
Check if current layer node is associated with a layer. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | IsInPage (const PDFPage &page) |
Check if current layer node is in a specified PDF page. More... | |
bool | MoveTo (LayerNode parent_layer_node, int index) |
Move current layer node to be one of the children of another layer node. More... | |
bool | operator!= (const LayerNode &other) const |
Not equal operator. More... | |
LayerNode & | operator= (const LayerNode &other) |
Assign operator. More... | |
bool | operator== (const LayerNode &other) const |
Equal operator. More... | |
bool | RemoveChild (int index) |
Remove a child node by index. More... | |
bool | RemoveGraphicsObject (graphics::GraphicsObject *graphics_object) |
Remove a graphics object from current layer node. More... | |
bool | RemoveUsage (LayerContext::UsageType usage_type) |
Remove a kind of usage property. More... | |
bool | SetDefaultVisible (bool is_visible) |
Set default visibility. More... | |
bool | SetExportUsage (LayerTree::UsageState state) |
Set state for exporting usage. More... | |
bool | SetName (const wchar_t *name) |
Set the name of current layer node. More... | |
bool | SetPrintUsage (const LayerPrintData &data) |
Set data for layer printing usage. More... | |
bool | SetViewUsage (LayerTree::UsageState state) |
Set state for viewing usage. More... | |
bool | SetZoomUsage (const LayerZoomData &data) |
Set data for layer zooming usage. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
A PDF layer (known as "Optional content group" in <PDF reference 1.7>) is a collection of graphics (known as GraphicsObject in Foxit PDF SDK) that can be made visible or invisible. These graphics belonging to the same layer can reside anywhere in the document: they need not be consecutive in drawing order, nor even belong to the same content stream.
In Foxit PDF SDK, a PDF layer is associated with a layer node and Foxit PDF SDK offers class and methods to get/set layer data via layer node. If user wants to retrieve a layer node, user must construct a PDFLayerTree object first and then call function LayerTree::GetRootNode to get the root layer node of the whole layer tree. Here, "root layer node" is an abstract object. "root layer node" can only have some child layer nodes but no parent, or any data (such as name, intent and so on). And "root layer node" cannot be shown on the application UI since it has no data. So, for a root layer node, only functions LayerNode::GetChildrenCount and LayerNode::GetChild are useful.
This class offers functions to get/set layer data and the graphics belonging to it. For example:
foxit::pdf::LayerNode::LayerNode | ( | const LayerNode & | other | ) |
LayerNode foxit::pdf::LayerNode::AddChild | ( | int | index, |
const wchar_t * | name, | ||
bool | has_Layer | ||
) |
Add a new layer node as a child for current layer node.
[in] | index | Child index for the new child layer node. Valid range: from 0 to count. count means to be the last child of current layer node and is returned by function LayerNode::GetChildrenCount for current layer node. |
[in] | name | Name for the new layer node. It should not be an empty string. |
[in] | has_Layer | true means the new child layer node would be associated with a layer, and false means the new child layer node is not associated with a layer. |
bool foxit::pdf::LayerNode::AddGraphicsObject | ( | const PDFPage & | page, |
graphics::GraphicsObject * | graphicsobject | ||
) |
Add a graphics object to current layer node.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | page | A valid PDF page, to which the input graphics object belongs. |
[in] | graphicsobject | A graphics object to be added to current layer node. |
LayerNode foxit::pdf::LayerNode::GetChild | ( | int | index | ) |
Get a child node.
[in] | index | Index of the child to be retrieved. Valid range: from 0 to (count-1). count is returned by function LayerNode::GetChildrenCount. |
int foxit::pdf::LayerNode::GetChildrenCount | ( | ) |
Get the count of children nodes.
LayerTree::UsageState foxit::pdf::LayerNode::GetExportUsage | ( | ) |
Get the state for exporting usage.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
graphics::GraphicsObjectArray foxit::pdf::LayerNode::GetGraphicsObjects | ( | const PDFPage & | page | ) |
Get all graphics objects related to the layer which is associated with current layer node.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | page | A valid PDF page, to which the input graphics object belongs. |
WString foxit::pdf::LayerNode::GetName | ( | ) |
Get the name of current layer node.
LayerPrintData foxit::pdf::LayerNode::GetPrintUsage | ( | ) |
Get the data for printing usage.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
LayerTree::UsageState foxit::pdf::LayerNode::GetViewUsage | ( | ) |
Get the state for viewing usage.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
LayerZoomData foxit::pdf::LayerNode::GetZoomUsage | ( | ) |
Get the data for zooming usage.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
bool foxit::pdf::LayerNode::HasIntent | ( | const char * | intent | ) |
Check if current layer node has a specified intent.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
Specially, when this function with input parameter "View" returns false, that means the layer related to current layer node will always be visible, and will not be affected by the changing in visibility.
[in] | intent | Intent name to be checked. It should not be an empty string. Pre-defined intent names are "View" and "Design". |
bool foxit::pdf::LayerNode::HasLayer | ( | ) |
Check if current layer node is associated with a layer.
bool foxit::pdf::LayerNode::IsEmpty | ( | ) | const |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
bool foxit::pdf::LayerNode::IsInPage | ( | const PDFPage & | page | ) |
Check if current layer node is in a specified PDF page.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | page | A valid PDF page. |
bool foxit::pdf::LayerNode::MoveTo | ( | LayerNode | parent_layer_node, |
int | index | ||
) |
Move current layer node to be one of the children of another layer node.
[in] | parent_layer_node | The destination layer node. It should not be current layer node itself or any descendant of current layer node. Current layer node will be moved to be one of the children of the destination layer node. |
[in] | index | Child index which specifies where current layer node will be moved as a child of destination layer node. Valid range: from 0 to count. count means to be the last child of destination layer node and is returned by function LayerNode::GetChildrenCount for parameter parent_layer_node. |
bool foxit::pdf::LayerNode::operator!= | ( | const LayerNode & | other | ) | const |
Not equal operator.
[in] | other | Another LayerNode object. This function will check if current object is not equal to this one. |
Assign operator.
[in] | other | Another LayerNode object, whose value would be assigned to current object. |
bool foxit::pdf::LayerNode::operator== | ( | const LayerNode & | other | ) | const |
Equal operator.
[in] | other | Another LayerNode object. This function will check if current object is equal to this one. |
bool foxit::pdf::LayerNode::RemoveChild | ( | int | index | ) |
Remove a child node by index.
[in] | index | Index of the child node to be removed. Valid range: from 0 to (count-1). count is returned by function LayerNode::GetChildrenCount. |
bool foxit::pdf::LayerNode::RemoveGraphicsObject | ( | graphics::GraphicsObject * | graphics_object | ) |
Remove a graphics object from current layer node.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
If the input graphics object does not belong to current layer node, this function will return true directly.
[in] | graphics_object | A graphics object to be removed from current layer node. |
bool foxit::pdf::LayerNode::RemoveUsage | ( | LayerContext::UsageType | usage_type | ) |
Remove a kind of usage property.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
If current layer node does not have the specified usage or does not have any usage, this function will return true.
[in] | usage_type | Layer usage type to be removed. Please refer to values starting from LayerContext::e_UsageView and this should be one of these values. |
bool foxit::pdf::LayerNode::SetDefaultVisible | ( | bool | is_visible | ) |
Set default visibility.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | is_visible | true means visible, and false means invisible. |
bool foxit::pdf::LayerNode::SetExportUsage | ( | LayerTree::UsageState | state | ) |
Set state for exporting usage.
If user wants the new state to have effect on rendering result, please construct a new LayerContext object after this function succeeds, and then use the new LayerContext to Renderer to do rendering.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | state | Layer usage state. It should be one of following values:
|
bool foxit::pdf::LayerNode::SetName | ( | const wchar_t * | name | ) |
Set the name of current layer node.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | name | New layer node name. It should not be an empty string. |
bool foxit::pdf::LayerNode::SetPrintUsage | ( | const LayerPrintData & | data | ) |
Set data for layer printing usage.
If user wants the new state to have effect on rendering result, please construct a new LayerContext object after this function succeeds, and then use the new LayerContext to Renderer to do rendering.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | data | New data for layer printing usage. The value of LayerPrintData::print_state should be one of following values:
|
bool foxit::pdf::LayerNode::SetViewUsage | ( | LayerTree::UsageState | state | ) |
Set state for viewing usage.
If user wants the new state to have effect on rendering result, please construct a new LayerContext object after this function succeeds, and then use the new LayerContext to Renderer to do rendering.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | state | Layer usage state. It should be one of following values:
|
bool foxit::pdf::LayerNode::SetZoomUsage | ( | const LayerZoomData & | data | ) |
Set data for layer zooming usage.
This function can only be used when function LayerNode::HasLayer returns true. If current layer node does not have layer, this function will throw exception foxit::e_ErrUnsupported.
[in] | data | New data for layer zooming usage. |