![]() |
#include <Group.h>
Public Member Functions | |
Group (SDF::Obj ocg) | |
Creates a new optional-content group (OCG) object from an existing SDF/Cos object. | |
bool | IsValid () const |
UString | GetName () const |
void | SetName (const UString &name) |
Sets the name of this optional-content group (OCG). | |
bool | GetCurrentState (const class Context &context) const |
void | SetCurrentState (class Context &context, bool state) |
Sets the current ON-OFF state of the optional-content group (OCG) object in a given context. | |
bool | GetInitialState (const class Config &config) const |
void | SetInitialState (class Config &config, bool state) |
Sets the initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration. | |
SDF::Obj | GetIntent () const |
void | SetIntent (SDF::Obj intent) |
Sets the Intent entry in an optional-content group's SDF/Cos dictionary. | |
bool | IsLocked (const Config &config) const |
void | SetLocked (const Config &config, bool locked) |
Sets the locked state of an OCG in a given configuration. | |
bool | HasUsage () const |
SDF::Obj | GetUsage (const char *key) const |
SDF::Obj | GetSDFObj () const |
Group (const Group &g) | |
Copy constructor. | |
Group & | operator= (const Group &g) |
Static Public Member Functions | |
static Group | Create (PDFDoc &doc, const UString &name) |
Creates a new optional-content group (OCG) object in the document. |
This corresponds to a PDF OCG dictionary representing a collection of graphic objects that can be made visible or invisible (Section 4.10.1 'Optional Content Groups' in PDF Reference). Any graphic content of the PDF can be made optional, including page contents, XObjects, and annotations. The specific content objects in the group have an OC entry in the PDF as part of the surrounding marked content or in the XObject dictionary. The group itself is a named object that can be typically manipulated through a Layers panel in a PDF viewer.
In the simplest case, the group's ON-OFF state makes the associated content visible or hidden. The ON-OFF state of a group can be toggled for a particular context (OCG::Context), and a set of states is kept in a configuration (OCG::Config). The visibility can depend on more than one group in an optional-content membership dictionary (OCG::OCMD), and can also be affected by the context's draw mode (OCGContext::OCDrawMode).
A group has an Intent entry, broadly describing the intended use. A group's content is considered to be optional (that is, the group's state is considered in its visibility) if any intent in its list matches an intent of the context. The intent list of the context is usually set from the intent list of the document configuration.
A Usage dictionary entry provides more specific intended usage information than an intent entry. Possible key values are: CreatorInfo, Language, Export, Zoom, Print, View, User, PageElement. The usage value can act as a kind of metadata, describing the sort of things that belong to the group, such as text in French, fine detail on a map, or a watermark. The usage values can also be used by the AutoState mechanism to make decisions about what groups should be on and what groups should be off. The AutoState mechanism considers the usage information in the OCGs, the AS array of the configuration, and external factors; for example, the language the application is running in, the current zoom level on the page, or whether the page is being printed.
pdftron::PDF::OCG::Group::Group | ( | SDF::Obj | ocg | ) |
Creates a new optional-content group (OCG) object from an existing SDF/Cos object.
pdftron::PDF::OCG::Group::Group | ( | const Group & | g | ) |
Copy constructor.
Creates a new optional-content group (OCG) object in the document.
doc | The document in which the new OCG will be created. | |
name | The name of the optional-content group. |
bool pdftron::PDF::OCG::Group::IsValid | ( | ) | const |
UString pdftron::PDF::OCG::Group::GetName | ( | ) | const |
void pdftron::PDF::OCG::Group::SetName | ( | const UString & | name | ) |
bool pdftron::PDF::OCG::Group::GetCurrentState | ( | const class Context & | context | ) | const |
context | The context for which to get the group's state. |
void pdftron::PDF::OCG::Group::SetCurrentState | ( | class Context & | context, | |
bool | state | |||
) |
Sets the current ON-OFF state of the optional-content group (OCG) object in a given context.
context | The context for which to set the group's state. | |
state | The new state. |
bool pdftron::PDF::OCG::Group::GetInitialState | ( | const class Config & | config | ) | const |
config | The configuration for which to get the group's initial state. |
void pdftron::PDF::OCG::Group::SetInitialState | ( | class Config & | config, | |
bool | state | |||
) |
Sets the initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration.
config | The configuration for which to set the group's initial state. | |
state | The new initial state, true if the state is ON, false if it is OFF. |
SDF::Obj pdftron::PDF::OCG::Group::GetIntent | ( | ) | const |
void pdftron::PDF::OCG::Group::SetIntent | ( | SDF::Obj | intent | ) |
Sets the Intent entry in an optional-content group's SDF/Cos dictionary.
For more information, see GetIntent().
intent | The new Intent entry value (a name object or an array of name objects). |
bool pdftron::PDF::OCG::Group::IsLocked | ( | const Config & | config | ) | const |
void pdftron::PDF::OCG::Group::SetLocked | ( | const Config & | config, | |
bool | locked | |||
) |
bool pdftron::PDF::OCG::Group::HasUsage | ( | ) | const |
SDF::Obj pdftron::PDF::OCG::Group::GetUsage | ( | const char * | key | ) | const |
key | The usage key in the usage dictionary entry. The possible key values are: CreatorInfo, Language, Export, Zoom, Print, View, User, PageElement. |
SDF::Obj pdftron::PDF::OCG::Group::GetSDFObj | ( | ) | const |