InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IPreflightArtworkContext Class Referenceabstract

#include <IPreflightArtworkContext.h>

Inheritance diagram for IPreflightArtworkContext:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IPREFLIGHTARTWORKCONTEXT }
 

Public Member Functions

virtual int32 GetContextDepth (bool stopAtOne=kFalse) const =0
 
virtual int32 GetShapeContextDepth (ClassID subpartID=kInvalidClass, bool stopAtOne=kFalse) const =0
 
virtual int32 GetTextContextDepth (bool stopAtOne=kFalse) const =0
 
virtual int32 GetTableContextDepth (bool stopAtOne=kFalse) const =0
 
virtual int32 GetOPIContextDepth (bool stopAtOne=kFalse) const =0
 
virtual IPreflightArtworkContextQueryParentContext (int32 depth=0) const =0
 
virtual
IPreflightArtworkShapeContext
QueryParentShapeContext (int32 depth=0) const =0
 
virtual
IPreflightArtworkShapeContext
QueryParentShapeContext (ClassID subpartID, int32 depth=0) const =0
 
virtual
IPreflightArtworkTextContext
QueryParentTextContext (int32 depth=0) const =0
 
virtual
IPreflightArtworkTableContext
QueryParentTableContext (int32 depth=0) const =0
 
virtual
IPreflightArtworkOPIContext
QueryParentOPIContext (int32 depth=0) const =0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

This interface is used by rules that examine marking operations.



This interface sits on the three artwork bosses: marks, groups, and context. It provides

utilities for accessing the context in which any of those nodes exists.



BACKGROUND



An artwork node can be either a marking operation, a group (eg transparency group), or 

a context node. The context node is the link to an InDesign object that the marking or

group is part of. For example we have a context for shape, and all marking operations

that comprise the shape are under that context node. An example hierarchy might be:



    Context (Shape): Spread

        Context (Shape): Group Page Item

            Context (Shape): Graphic Frame

                Context (Shape): Graphic Frame / Subpart = Native Fill

                    Mark: Fill

                Context (Shape): Image Page Item

                    Mark: Image

                Context (Shape): Graphic Frame / Subpart = Native Stroke

                    Mark: Stroke



TYPICAL APPLICATION



Normally this is used when looking at marking operations and you want to know what the

marking operation is part of. For example you might want to know what shape it's part

of, or what wax run it's part of (or just *whether* it's part of either of those). 



For example, in  if you want to know whether a given image marking operation is part of an

image or a PDF you could use code like this:



    virtual void MyRuleVisitor::Visit(IPreflightVisitInfo* iVisit)

    {

        InterfacePtr<IPreflightObject> iObj(iVisit->QueryObject());



        if (iVisit->GetObjectID().GetClass() == kPreflightOM_ArtworkMark)

        {

            InterfacePtr<IPreflightArtworkContext> iContext(iObj, UseDefaultIID());

            InterfacePtr<IPreflightArtworkShapeContext> iShapeContext(iContext->QueryParentShapeContext());



            if (iShapeContext)

            {

                InterfacePtr<IShape> iShape(iShapeContext->GetShapeRef());

Use iShape operations, interface queries, IPageItemTypeUtils, etc., to examine the object ... } } }

Another common example is when you want to know if a marking operation is part of drawing a proxy, as opposed to "real" artwork:

virtual void MyRuleVisitor::Visit(IPreflightVisitInfo* iVisit)

{

    InterfacePtr<IPreflightObject> iObj(iVisit->QueryObject());



    if (iVisit->GetObjectID().GetClass() == kPreflightOM_ArtworkMark)

    {

        InterfacePtr<IPreflightArtworkContext> iContext(iObj, UseDefaultIID());

        if (iContext->GetShapeContextDepth(kPreflightOSP_GraphicProxy, kTrue))

        {

Yep, part of a proxy, so don't look at it. return; } Not a proxy, so evaluate the marking operation. ... } }

Member Function Documentation

virtual int32 IPreflightArtworkContext::GetContextDepth (bool stopAtOne = kFalse) const
pure virtual

Get the total number of ancestor context nodes (not including this node). This method is used if you want to look at all contexts regardless of type, eg if you want to know whether there's a text context within a particular shape context.

Parameters
stopAtOneIN If true, stops as soon as it hits one match. More efficient if you're only interested in the presence of a node rather than the total number.
Returns
The total number of parent/ancestor context nodes.
virtual int32 IPreflightArtworkContext::GetOPIContextDepth (bool stopAtOne = kFalse) const
pure virtual

Get the total number of ancestor OPI context nodes (not including this node).

Parameters
stopAtOneIN If true, stops as soon as it hits one match. More efficient if you're only interested in the presence of a node rather than the total number.
Returns
The total number of parent/ancestor context nodes.
virtual int32 IPreflightArtworkContext::GetShapeContextDepth (ClassID subpartID = kInvalidClass,
bool stopAtOne = kFalse 
) const
pure virtual

Get the total number of ancestor shape context nodes (not including this node). This does not consider other kinds of contexts. However, note that each shape context is both a shape and a subpart so in some/most cases you'll find repeats. See class comments for an example of this.

Parameters
stopAtOneIN If true, stops as soon as it hits one match. More efficient if you're only interested in the presence of a node rather than the total number.
subpartIDIN The subpart you want to look for. kInvalidClass will match any.
Returns
The total number of parent/ancestor context nodes.
virtual int32 IPreflightArtworkContext::GetTableContextDepth (bool stopAtOne = kFalse) const
pure virtual

Get the total number of ancestor table context nodes (not including this node).

Parameters
stopAtOneIN If true, stops as soon as it hits one match. More efficient if you're only interested in the presence of a node rather than the total number.
Returns
The total number of parent/ancestor context nodes.
virtual int32 IPreflightArtworkContext::GetTextContextDepth (bool stopAtOne = kFalse) const
pure virtual

Get the total number of ancestor text context nodes (not including this node).

Parameters
stopAtOneIN If true, stops as soon as it hits one match. More efficient if you're only interested in the presence of a node rather than the total number.
Returns
The total number of parent/ancestor context nodes.
virtual IPreflightArtworkContext* IPreflightArtworkContext::QueryParentContext (int32 depth = 0) const
pure virtual

Query a context node that is a parent or ancestor of this one. This method matches any kind of context, so it's useful (along with GetContextDepth) at examining the entire context stack associated with a node.

Parameters
depthIN The depth to query; 0 means the immediate parent. Should be between 0 and GetContextDepth() - 1.
Returns
A refcounted context interface or nil if there is none at the requested depth. Typically you'd query from this interface for one of the specific context interfaces.
virtual IPreflightArtworkOPIContext* IPreflightArtworkContext::QueryParentOPIContext (int32 depth = 0) const
pure virtual

Query an OPI context node that is a parent or ancestor of this one.

Parameters
depthIN The depth to query; 0 means the immediate parent. Should be between 0 and GetOPIContextDepth() - 1.
Returns
A refcounted OPI context interface or nil if there is none at the requested depth.
virtual IPreflightArtworkShapeContext* IPreflightArtworkContext::QueryParentShapeContext (int32 depth = 0) const
pure virtual

Query a shape context node that is a parent or ancestor of this one.

Parameters
depthIN The depth to query; 0 means the immediate parent. Should be between 0 and GetShapeContextDepth() - 1.
Returns
A refcounted shape context interface or nil if there is none at the requested depth.
virtual IPreflightArtworkShapeContext* IPreflightArtworkContext::QueryParentShapeContext (ClassID subpartID,
int32 depth = 0 
) const
pure virtual

Query a shape context node that is a parent or ancestor of this one and matches the specified subpart.

Parameters
subpartIDIN The subpart in which you're interested. 0 matches any.
depthIN The depth to query; 0 means the immediate parent. Should be between 0 and GetShapeContextDepth(subpartID) - 1.
Returns
A refcounted shape context interface or nil if there is none at the requested depth.
virtual IPreflightArtworkTableContext* IPreflightArtworkContext::QueryParentTableContext (int32 depth = 0) const
pure virtual

Query a table context node that is a parent or ancestor of this one.

Parameters
depthIN The depth to query; 0 means the immediate parent. Should be between 0 and GetTableContextDepth() - 1.
Returns
A refcounted table context interface or nil if there is none at the requested depth.
virtual IPreflightArtworkTextContext* IPreflightArtworkContext::QueryParentTextContext (int32 depth = 0) const
pure virtual

Query a text context node that is a parent or ancestor of this one.

Parameters
depthIN The depth to query; 0 means the immediate parent. Should be between 0 and GetTextContextDepth() - 1.
Returns
A refcounted text context interface or nil if there is none at the requested depth.