pdftron::PDF::OCG::Group Class Reference

The OCG::Group object represents an optional-content group. More...

#include <Group.h>

List of all members.

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.
Groupoperator= (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.


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.


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.


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:
doc The document in which the new OCG will be created.
name The name of the optional-content group.
Returns:
The newly created OCG::Group object.

bool pdftron::PDF::OCG::Group::IsValid (  )  const

Returns:
True if this is a valid (non-null) OCG, false otherwise.

UString pdftron::PDF::OCG::Group::GetName (  )  const

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

void pdftron::PDF::OCG::Group::SetName ( const UString name  ) 

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

Parameters:
name The new name.

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:
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.

Parameters:
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

Returns:
The initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration.
Parameters:
config The 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.

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:
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

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.

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:
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

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:
config The OC configuration.

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:
config IN/OUT The optional-content configuration.
locked true if the OCG should be locked, false otherwise.

bool pdftron::PDF::OCG::Group::HasUsage (  )  const

Returns:
true if this group is associated with a Usage dictionary, false otherwise.

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:
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

Returns:
Pointer to the underlying SDF/Cos object.

Group& pdftron::PDF::OCG::Group::operator= ( const Group g  ) 


© 2002-2010 PDFTron Systems Inc.