All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftron::PDF::OCG::Group Class Reference

#include <Group.h>

Public Member Functions

 Group (SDF::Obj ocg)
 
bool IsValid () const
 
UString GetName () const
 
void SetName (const UString &name)
 
bool GetCurrentState (const class Context &context) const
 
void SetCurrentState (class Context &context, bool state)
 
bool GetInitialState (const class Config &config) const
 
void SetInitialState (class Config &config, bool state)
 
SDF::Obj GetIntent () const
 
void SetIntent (SDF::Obj intent)
 
bool IsLocked (const Config &config) const
 
void SetLocked (const Config &config, bool locked)
 
bool HasUsage () const
 
SDF::Obj GetUsage (const char *key) const
 
SDF::Obj GetSDFObj () const
 
 Group (const Group &g)
 
Groupoperator= (const Group &g)
 
 Group (TRN_OCG g)
 

Static Public Member Functions

static Group Create (PDFDoc &doc, const UString &name)
 

Public Attributes

TRN_OCG mp_obj
 

Detailed Description

The OCG::Group object represents an optional-content group. 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.

Definition at line 50 of file Group.h.

Constructor & Destructor Documentation

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

pdftron::PDF::OCG::Group::Group ( TRN_OCG  g)
inline

Definition at line 179 of file Group.h.

Member Function Documentation

static Group pdftron::PDF::OCG::Group::Create ( PDFDoc doc,
const UString name 
)
static

Creates a new optional-content group (OCG) object in the document.

Parameters
docThe document in which the new OCG will be created.
nameThe name of the optional-content group.
Returns
The newly created OCG::Group object.
bool pdftron::PDF::OCG::Group::GetCurrentState ( const class Context context) const
Returns
true if this OCG object is in the ON state in a given context, false otherwise.
Parameters
contextThe context for which to get the group's state.
bool pdftron::PDF::OCG::Group::GetInitialState ( const class Config config) const
Returns
The initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration.
Parameters
configThe configuration for which to get the group's initial state.
Note
If the configuration has a BaseState of Unchanged, and the OCG is not listed explicitly in its ON list or OFF list, then the initial state is taken from the OCG's current state in the document's default context.
SDF::Obj pdftron::PDF::OCG::Group::GetIntent ( ) const
Returns
OCG intent. An intent is a name object (or an array of name objects) broadly describing the intended use, which can be either "View" or "Design". 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.
UString pdftron::PDF::OCG::Group::GetName ( ) const
Returns
the name of this optional-content group (OCG).
SDF::Obj pdftron::PDF::OCG::Group::GetSDFObj ( ) const
Returns
Pointer to the underlying SDF/Cos object.
SDF::Obj pdftron::PDF::OCG::Group::GetUsage ( const char *  key) const
Returns
The usage information associated with the given key in the Usage dictionary for the group, or a NULL if the entry is not present. A Usage dictionary entry provides more specific intended usage information than an intent entry.
Parameters
keyThe usage key in the usage dictionary entry. The possible key values are: CreatorInfo, Language, Export, Zoom, Print, View, User, PageElement.
bool pdftron::PDF::OCG::Group::HasUsage ( ) const
Returns
true if this group is associated with a Usage dictionary, false otherwise.
bool pdftron::PDF::OCG::Group::IsLocked ( const Config config) const
Returns
true if this OCG is locked in a given configuration, false otherwise. The on/off state of a locked OCG cannot be toggled by the user through the user interface.
Parameters
configThe OC configuration.
bool pdftron::PDF::OCG::Group::IsValid ( ) const
Returns
True if this is a valid (non-null) OCG, false otherwise.
Group& pdftron::PDF::OCG::Group::operator= ( const Group g)
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.

Parameters
contextThe context for which to set the group's state.
stateThe new 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.

Parameters
configThe configuration for which to set the group's initial state.
stateThe new initial state, true if the state is ON, false if it is OFF.
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().

Parameters
intentThe new Intent entry value (a name object or an array of name objects).
void pdftron::PDF::OCG::Group::SetLocked ( const Config config,
bool  locked 
)

Sets the locked state of an OCG in a given configuration. The on/off state of a locked OCG cannot be toggled by the user through the user interface.

Parameters
configIN/OUT The optional-content configuration.
lockedtrue if the OCG should be locked, false otherwise.
void pdftron::PDF::OCG::Group::SetName ( const UString name)

Sets the name of this optional-content group (OCG).

Parameters
nameThe new name.

Member Data Documentation

TRN_OCG pdftron::PDF::OCG::Group::mp_obj

Definition at line 180 of file Group.h.


The documentation for this class was generated from the following file: