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

#include <Context.h>

Public Types

enum  OCDrawMode { e_VisibleOC, e_AllOC, e_NoOC }
 

Public Member Functions

 Context (const Context &context)
 
Contextoperator= (const Context &g)
 
 Context (const class Config &config)
 
 ~Context ()
 
bool IsValid () const
 
bool GetState (const class Group &group) const
 
void SetState (const class Group &group, bool state)
 
void ResetStates (bool all_on)
 
void SetNonOCDrawing (bool draw_non_OC)
 
bool GetNonOCDrawing () const
 
void SetOCDrawMode (OCDrawMode oc_draw_mode)
 
OCDrawMode GetOCMode () const
 
void Destroy ()
 
ptrdiff_t GetHandleInternal ()
 
 Context (TRN_OCGContext ctx)
 

Static Public Member Functions

static ContextCreateInternal (ptrdiff_t impl)
 

Public Attributes

TRN_OCGContext mp_obj
 

Detailed Description

The OCG::Context object represents an optional-content context in a document, within which document objects such as words or annotations are visible or hidden. The context keeps track of the ON-OFF states of all of the optional-content groups (OCGs) in a document. Content is or is not visible with respect to the OCG states stored in a specific context. Unlike other objects in OCG namespace, the OCG::Context does not correspond to any explicit PDF structure.

Each PDFView has a default context (PDF::GetOCGContext()) that it uses for on-screen drawing and that determines the default state for any drawing. The context has flags that control whether to draw content that is marked as optional, and whether to draw content that is not marked as optional.

When enumerating page content, OCG::Context can be passed as a parameter in ElementReader.Begin() method. When using PDFDraw, PDFRasterizer, or PDFView class to render PDF pages use ( PDFDraw::SetOCGContext() method to select an OC context.

There can be more than one Context object, representing different combinations of OCG states. You can change the states of OCGs within any context. You can build contexts with your own combination of OCG states, and issue drawing or enumeration commands using that context. For example, you can pass an optional-content context to ElementReader.Begin(). You can save the resulting state information as part of the configuration (e.g. using Config::SetInit methods), but the context itself has no corresponding PDF representation, and is not saved.

Definition at line 40 of file Context.h.

Member Enumeration Documentation

OCDrawMode controls drawing or enumerating the page with respect to optional content. Together with the value of SetNonOCDrawing this mode controls drawing or enumerating content on a page with optional content:

  • Content that is marked as optional content is drawn or not drawn according to the OCDrawMode and the visibility state as determined by the Optional Content Groups (OCGs) and OCMDs.
  • Content that is not marked as optional content is drawn when GetNonOCDrawing() is true, and not drawn when GetNonOCDrawing() is false.
Enumerator
e_VisibleOC 

Draw or enumerate optional content that is visible, according to the current state of Optional Content Groups (OCGs) and Optional Content Membership Dictionaries (OCMDs). This is the default mode.

e_AllOC 

Draw or enumerate all optional content, regardless of its visibility state. If the context's 'SetNonOCDrawing' is enabled, all contents of document are shown.

e_NoOC 

Draw or enumerate no optional content, regardless of its visibility state. If the context's 'SetNonOCDrawing' is not enabled, nothing is drawn, resulting in a blank page.

Definition at line 123 of file Context.h.

Constructor & Destructor Documentation

pdftron::PDF::OCG::Context::Context ( const Context context)

Copy constructor.

Parameters
contextAnother context from which to take initial OCG states.
pdftron::PDF::OCG::Context::Context ( const class Config config)

Create a context object that represents an optional-content state of the document from a given configuration.

Parameters
configA configuration from which to take initial OCG states.
pdftron::PDF::OCG::Context::~Context ( )

Destructor

pdftron::PDF::OCG::Context::Context ( TRN_OCGContext  ctx)

Member Function Documentation

static Context* pdftron::PDF::OCG::Context::CreateInternal ( ptrdiff_t  impl)
static
void pdftron::PDF::OCG::Context::Destroy ( )

Frees the native memory of the object.

ptrdiff_t pdftron::PDF::OCG::Context::GetHandleInternal ( )
bool pdftron::PDF::OCG::Context::GetNonOCDrawing ( ) const
Returns
the non-OC status for this context. The flag indicates whether the content that is not marked as optional should be treated as visible. For more information, please see SetNonOCDrawing().
OCDrawMode pdftron::PDF::OCG::Context::GetOCMode ( ) const
Returns
the drawing and enumeration type for this context. For more information, please see SetOCMode() and OCG::Context::OCDrawMode.
bool pdftron::PDF::OCG::Context::GetState ( const class Group group) const
Returns
the ON-OFF states (true or false) for the given optional-content group (OCG) in this OC context.
Parameters
groupThe optional-content group (OCG) that is queried.
bool pdftron::PDF::OCG::Context::IsValid ( ) const
inline
Returns
true is this is a valid (non-null) context, false otherwise.

Definition at line 67 of file Context.h.

Context& pdftron::PDF::OCG::Context::operator= ( const Context g)
void pdftron::PDF::OCG::Context::ResetStates ( bool  all_on)

Sets the sates of all OCGs in the context to ON or OFF.

Parameters
all_onA flag used to specify whether the OCG states should be set to ON (if true), or OFF (if false).
void pdftron::PDF::OCG::Context::SetNonOCDrawing ( bool  draw_non_OC)

Sets the non-OC status for this context. Content that is not marked as optional content is drawn (or element.IsOCVisible()) when 'draw_non_OC' is true, and not drawn/visible otherwise.

Parameters
draw_non_OCA flag specifying whether the content that is not marked as optional should be treated as visible.
void pdftron::PDF::OCG::Context::SetOCDrawMode ( OCDrawMode  oc_draw_mode)

Sets the drawing and enumeration type for this context. This type, together with the visibility determined by the OCG and OCMD states, controls whether content that is marked as optional content is drawn or enumerated.

Parameters
oc_draw_modeA flag specifying the visibility of optional content.
void pdftron::PDF::OCG::Context::SetState ( const class Group group,
bool  state 
)

Sets the ON-OFF states for the given optional-content group (OCG) in this context.

Parameters
groupThe optional-content group (OCG) that is queried.
statetrue for 'ON' and false for 'OFF'.

Member Data Documentation

TRN_OCGContext pdftron::PDF::OCG::Context::mp_obj

Definition at line 172 of file Context.h.


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