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

#include <IPreflightObjectModelService.h>

Inheritance diagram for IPreflightObjectModelService:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IPREFLIGHTOBJECTMODELSERVICE }
 

Public Member Functions

virtual
PreflightObjectClassIDVector 
GetMappedClasses () const =0
 
virtual bool IsValidObject (const PreflightObjectID &objID) const =0
 
virtual IPreflightObjectQueryObject (const PreflightObjectID &objID) const =0
 
virtual WideString GetClassScriptingString (PreflightObjectClassID classID) const =0
 
virtual
PreflightObjectClassIDVector 
GetHierarchyClasses () const =0
 
virtual
PreflightObjectClassIDVector 
GetChildClasses (PreflightObjectClassID parentClass) const =0
 
virtual
PreflightObjectClassIDVector 
GetParentClasses (PreflightObjectClassID childClass) const =0
 
virtual
PreflightObjectClassIDVector 
GetExpansionClasses () const =0
 
virtual
PreflightObjectClassIDVector 
GetExpandsIntoClasses (PreflightObjectClassID parentClass) const =0
 
virtual void Expand (IPreflightExpansionHelper &helper) const =0
 
virtual void OnCloseDocument (IDocument *iDoc)=0
 
virtual void OnInvalidateObject (const PreflightObjectID &objID)=0
 
virtual PMString GetObjectDescription (const PreflightObjectID &objID) const =0
 
virtual PMString GetObjectSortValue (const PreflightObjectID &objID) const =0
 
virtual bool CanBeSelected (const PreflightObjectID &objID) const =0
 
virtual bool SelectObject (const PreflightObjectID &objID) const =0
 
virtual PMString GetPage (const PreflightObjectID &objID) const =0
 
virtual PMString GetSubpartName (ClassID subpartID) 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 service provides the DOM and mapping to real InDesign elements and/or derived data from those elements (eg artwork). You'd normally implement one of these services only if you want to expand the preflight object model from what is supported natively. Having said that, this is still somewhat common because you may want to inspect and/or invalidate objects in the model in a way that isn't useful for a rule you want to implement.

In order to extend the model you need to:

  • Indicate which object classes your service supports (GetMappedClasses)
  • Indicate which objects your object is related to in the hierarchy (GetHierarchyClasses et al) (the preflight hierarchy, which may or may not match the natural document hierarchy)
  • Expand (ie create child nodes for) your object classes when handed a parent you say your nodes are children of.

The preflight object model as a whole (ie IPreflightObjectModel) takes care of pulling together the composite response of all service providers and builds master trees of all of the relationships. All of the native objects are implemented using this same public interface.

See Also
IPreflightObjectModel

Member Function Documentation

virtual bool IPreflightObjectModelService::CanBeSelected (const PreflightObjectIDobjID) const
pure virtual

Return whether the object can be selected.

Parameters
objIDIN The object to provide a description for.
Returns
True if the object can be selected; false otherwise.
virtual void IPreflightObjectModelService::Expand (IPreflightExpansionHelperhelper) const
pure virtual

Given an object whose class you say you provide hierarchy information for, return the actual children of that object.

See Also
PreflightExpansionHelper
Note
Via the expansion helper you can expand in multiple places in the tree; you don't have to expand only the children. This is for the convenience of services which can expand an entire subtree at once.
Parameters
helperIN A helper object which provides interfaces for expansion
virtual PreflightObjectClassIDVector IPreflightObjectModelService::GetChildClasses (PreflightObjectClassID parentClass) const
pure virtual

Given a class you say you provide hierarchy information for, indicate what classes are its children. Since multiple services may provide hierarchy for the same class, this isn't an exhaustive list; it's only the list you intend to expand.

Also, you only need to declare one side of the parent-child relationship. Eg if 'B' is a child of 'A' then A can declare B a child, or B can declare A a parent; but either one is sufficient. No harm is done by declaring them both.

Note
You should only list children that are one generation deep from the class; we want children and not all descendents (the object model compiles that list automatically).
Parameters
parentClassIN The class ID of interest.
Returns
The vector of child class IDs.
virtual WideString IPreflightObjectModelService::GetClassScriptingString (PreflightObjectClassID classID) const
pure virtual

Get the scripting-domain string used to identify the class. At the C++ level everything is ClassID based for efficiency but at scripting level it's not feasible to maintain a giant enum.

Parameters
classIDIN The class you're interested in.
Returns
The scripting string for the class. For example, kPreflightOM_PageItem maps to the scripting string "OTPageItem." The string is arbitrary but must be unique and of course must be a consistent mapping.
virtual PreflightObjectClassIDVector IPreflightObjectModelService::GetExpandsIntoClasses (PreflightObjectClassID parentClass) const
pure virtual

Given a class you say you provide hierarchy information for, indicate what classes can be discovered by calling Expand() on an object of the specified class. In simple cases this is no different than GetChildClasses().

Note
You should only list children that are one generation deep from the parent, we want children and not all descendents.
Parameters
parentClassIN The class ID of interest.
Returns
The vector of child class IDs.
virtual PreflightObjectClassIDVector IPreflightObjectModelService::GetExpansionClasses () const
pure virtual

Return the classes for which this service provides expansion services. By 'provides expansion services' we mean that it implements the GetExpandsIntoClasses and Expand methods. Note that more than one service can provide expansion services for the same class.

Returns
A vector of object classes this service provides expansion services for.
virtual PreflightObjectClassIDVector IPreflightObjectModelService::GetHierarchyClasses () const
pure virtual

Return the classes for which this service provides hierarchy. By 'provides hierarchy' we mean that it implements the GetChildClasses and GetParentClasses methods. Note that more than one service can provide hierarchy for the same class.

Returns
A vector of object classes.
virtual PreflightObjectClassIDVector IPreflightObjectModelService::GetMappedClasses () const
pure virtual

Return a vector of object classes this service provides mapping for. By 'mapping' we mean it answers the QueryObject, GetClassScriptingString, and GetObjectDescription methods.

Returns
A vector of object classes. Can be empty if this service only provides hierarchy.
virtual PMString IPreflightObjectModelService::GetObjectDescription (const PreflightObjectIDobjID) const
pure virtual

Provide a description of the object.

Parameters
objIDIN The object to provide a description for.
Returns
A description string.
virtual PMString IPreflightObjectModelService::GetObjectSortValue (const PreflightObjectIDobjID) const
pure virtual

Provide a sorting string for the object. This should be a string that can be used to determine the order of results so they're consistently presented in the UI and reports.

Parameters
objIDIN The object to provide a sort-string for.
Returns
A sorting string.
virtual PMString IPreflightObjectModelService::GetPage (const PreflightObjectIDobjID) const
pure virtual

Get the page (or pages) on which the object appears.

Parameters
objIDIN The object to provide a description for.
Returns
A string describing the page number, or an empty string if there is no page associated with the object (eg if the object is a document, or a swatch). Can also be a page range if the object spans more than one page (eg "2-3").
virtual PreflightObjectClassIDVector IPreflightObjectModelService::GetParentClasses (PreflightObjectClassID childClass) const
pure virtual

Given a class you say you provide hierarchy information for, indicate what classes are its parents. Since multiple services may provide hierarchy for the same class, this isn't an exhaustive list; it's only the list you intend to expand.

Also, you only need to declare one side of the parent-child relationship. Eg if 'B' is a child of 'A' then A can declare B a child, or B can declare A a parent; but either one is sufficient. No harm is done by declaring them both.

Note
You should only list parents that are one generation deep from the class; we want parents and not all ancestors (the object model compiles that list automatically).
Parameters
parentClassIN The class ID of interest.
Returns
The vector of child class IDs.
virtual PMString IPreflightObjectModelService::GetSubpartName (ClassID subpartID) const
pure virtual

Given a subpart ID, obtain a UI-friendly name for the subpart.

Parameters
subpartIDIN The ID of the subpart.
Returns
A (typically untranslated but not always) string, or empty if this service doesn't map that subpart.
virtual bool IPreflightObjectModelService::IsValidObject (const PreflightObjectIDobjID) const
pure virtual

Indicates whether the given object may still be valid. This is primarily used by debug code to verify that the database is still in good shape. A return value of true is not necessarily a true positive; it simply means there's no particular reason to believe it's bad.

Note
The database associated with objID must be in memory when this is called. The PreflightObjectModel ensures this.
Parameters
Theobject ID to validate.
Returns
kTrue if the object seems to be valid; kFalse if it's known to be bad (ie out of date, invalid)
virtual void IPreflightObjectModelService::OnCloseDocument (IDocumentiDoc)
pure virtual

Called when a document is closed. Many services will maintain separate data for the objects they track, and rather than those services all observe the document list, we'll do it for them.

Parameters
iDocIN The document that is about to close.
virtual void IPreflightObjectModelService::OnInvalidateObject (const PreflightObjectIDobjID)
pure virtual

Called when an object is about to be invalidated. Note that this isn't a comprehensive notification; it doesn't tell you about every single invalidation, only when an object is being invalidated via a process that's tracking the object. The children are usually deleted, but you don't get notification for those.

Parameters
iDocIN The document that is about to close.
virtual IPreflightObject* IPreflightObjectModelService::QueryObject (const PreflightObjectIDobjID) const
pure virtual

Map an object ID into a 'live' object that can be inspected.

Note
The database associated with objID must be in memory when this is called. The PreflightObjectModel ensures this.
Parameters
Theobject ID to map.
Returns
A refcounted interface. Note that this does not have to be a 'true' boss based interface, although it must inherit from IPreflightObject, which inherits from IPMUnknown.
virtual bool IPreflightObjectModelService::SelectObject (const PreflightObjectIDobjID) const
pure virtual

Select the object.

Parameters
objIDIN The object to provide a description for.
Returns
True if the object was selected; false otherwise.