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

#include <IPreflightObjectModel.h>

Inheritance diagram for IPreflightObjectModel:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IPREFLIGHTOBJECTMODEL }
 

Public Member Functions

virtual void Startup ()=0
 
virtual void Shutdown ()=0
 
virtual void OnCloseDocument (IDocument *iDoc)=0
 
virtual void OnInvalidateObject (const PreflightObjectID &objID) 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 PreflightObjectClassID GetClassFromScriptingString (const WideString &scriptString) const =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
 
virtual
PreflightObjectClassIDVector 
GetAllKnownClasses () const =0
 
virtual bool ParentChildRelationshipExists (PreflightObjectClassID parentClass, PreflightObjectClassID childClass) const =0
 
virtual void GetHierarchyAncestorsOfClass (PreflightObjectClassID childClass, PreflightObjectClassIDVector &ancestorClasses) const =0
 
virtual void GetHierarchyAncestorsOfClass (const PreflightObjectClassIDVector &childClasses, PreflightObjectClassIDVector &ancestorClasses) const =0
 
virtual void GetExpansionAncestorsOfClass (PreflightObjectClassID childClass, PreflightObjectClassIDVector &ancestorClasses) const =0
 
virtual void GetExpansionAncestorsOfClass (const PreflightObjectClassIDVector &childClasses, PreflightObjectClassIDVector &ancestorClasses) const =0
 
virtual void Expand (IPreflightExpansionHelper &helper) 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

The preflight object model interface is the application-wide access point for mapping objects in the preflight model. The preflight model follows the InDesign document model in many places but not all – for example objects like marking operations don't exist in the InDesign model but rules can still check them and operate on them. The preflight object model is an attempt to abstract the differences via the interface mechanism.

This interface is really the high-level access point to the model. The model is based on services (see IPreflightObjectModelService) but normally you ask questions at this level, not an individual service level.

A typical use of IPreflightObjectModel is to get an IPreflightObject from a PreflightObjectID, for example:

InterfacePtr<IPreflightObjectModel> iModel(Utils<IPreflightUtils>()->QueryObjectModel());

InterfacePtr<IPreflightObject> iObj(iModel->QueryObject(myObjID));

Other uses are related to user interaction. For example, GetObjectDescription(), CanBeSelected(), SelectObject(), GetPage(), and so on, are all useful for presenting results or other info to the user.

Member Function Documentation

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

Asks whether a given object can be selected.

Parameters
objIDIN The object you're interested in.
Returns
True if selectable; false otherwise.
virtual void IPreflightObjectModel::Expand (IPreflightExpansionHelperhelper) const
pure virtual

Given a parent object, expand the children. This delegates to the object model services.

Note
This is typically called only by the preflight engine, although in theory if you want to write your own IPreflightExpansionHelper implementation you could call it..
Parameters
helperIN The utility interface that provides expansion services.
virtual PreflightObjectClassIDVector IPreflightObjectModel::GetAllKnownClasses () const
pure virtual

Returns a vector of all registered object class IDs.

Returns
A vector of PreflightObjectClassIDs.
virtual PreflightObjectClassID IPreflightObjectModel::GetClassFromScriptingString (const WideStringscriptString) const
pure virtual

Given an object class encoded as a string from the scripting world, get the object class ID. Returns kInvalidClass if there is no mapping for that string.

Parameters
classIDIN The class you want to get the string for.
Returns
A PreflightObjectClassID that maps to the passed-in string, or kInvalidClass if there is no mapping for that string.
virtual WideString IPreflightObjectModel::GetClassScriptingString (PreflightObjectClassID classID) const
pure virtual

Given an object class, get the string representing that class in the scripting world. Returns an empty string if the class does not exist in the object model lookup tables (ie no service offers mapping for it).

Parameters
classIDIN The class you want to get the string for.
Returns
A WideString that can be passed to scripts, or en empty string if there is no mapping.
virtual void IPreflightObjectModel::GetExpansionAncestorsOfClass (PreflightObjectClassID childClass,
PreflightObjectClassIDVectorancestorClasses 
) const
pure virtual

Given a given 'child' class, return all the classes that are hierarchy ancestors of that class. An expansion parent is a class that when expanded may produce the child. An expansion ancestor is an expansion parent recursively.

Typically this is used to determine which classes to expand when building search trees. For example, if you want to get to objects of class X, the only nodes you want to expand are those which are ancestors of X.

Note
The results are unioned with the incoming list, ie ancestorClasses is not cleared first.
Parameters
childClassIN The class you want to get ancestors for (not including the child).
ancestorClassesOUT The vector of ancestors. The ancestors are unioned with the incoming list state.
virtual void IPreflightObjectModel::GetExpansionAncestorsOfClass (const PreflightObjectClassIDVectorchildClasses,
PreflightObjectClassIDVectorancestorClasses 
) const
pure virtual

Given a vector of child classes, produce a vector of expansion ancestor classes. Note: the results are added to, not cleared first.

Parameters
childClassesIN The classes you want to get ancestors for.
ancestorClassesOUT The vector of ancestors. The ancestors are unioned with the incoming list state.
virtual void IPreflightObjectModel::GetHierarchyAncestorsOfClass (PreflightObjectClassID childClass,
PreflightObjectClassIDVectorancestorClasses 
) const
pure virtual

Given a given 'child' class, return all the classes that are hierarchy ancestors of that class. A hierarchy parent is a class that when expanded may produce the child. A hierarchy ancestor is a hierarchy parent recursively.

Typically this is used to determine which classes to expand when building search trees. For example, if you want to get to objects of class X, the only nodes you want to expand are those which are ancestors of X.

Note
The results are unioned with the incoming list, ie ancestorClasses is not cleared first.
Parameters
childClassIN The class you want to get ancestors for (not including the child).
ancestorClassesOUT The vector of ancestors. The ancestors are unioned with the incoming list state.
virtual void IPreflightObjectModel::GetHierarchyAncestorsOfClass (const PreflightObjectClassIDVectorchildClasses,
PreflightObjectClassIDVectorancestorClasses 
) const
pure virtual

Given a vector of child classes, produce a vector of hierarchy ancestor classes. Note: the results are added to, not cleared first.

Parameters
childClassesIN The classes you want to get ancestors for.
ancestorClassesOUT The vector of ancestors. The ancestors are unioned with the incoming list state.
virtual PMString IPreflightObjectModel::GetObjectDescription (const PreflightObjectIDobjID) const
pure virtual

Provides a description of the object.

Parameters
objIDIN The object you want a description of.
Returns
A description string, often prelocalized because it's parameterized.
virtual PMString IPreflightObjectModel::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 IPreflightObjectModel::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 PMString IPreflightObjectModel::GetSubpartName (ClassID subpartID) const
pure virtual
Given a subpart ID, obtain a UI-friendly name for the subpart. For example, the subpart name

for kPreflightOSP_NativeFill is "fill".

Parameters
subpartIDIN The ID of the subpart.
Returns
A (typically untranslated but not always) string, or empty if no service understood the subpart.
virtual bool IPreflightObjectModel::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.

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 IPreflightObjectModel::OnCloseDocument (IDocumentiDoc)
pure virtual

Called by the preflight manager; you shouldn't call this.

virtual void IPreflightObjectModel::OnInvalidateObject (const PreflightObjectIDobjID) const
pure virtual

Notification that the given object is being invalidated. Note that this is not a comprehensive indicator that a given object is no longer valid; it's only called to let services know that an invalidation took place, in case they want to monitor patterns.

Parameters
Theobject ID being invalidated.
virtual bool IPreflightObjectModel::ParentChildRelationshipExists (PreflightObjectClassID parentClass,
PreflightObjectClassID childClass 
) const
pure virtual

Returns whether there is a parent child relationship between the specified classes.

Parameters
parentClassIN The class ID of the parent.
parentClassIN The class ID of the child.
Returns
True if a service has declared that the parent class has children of the child class.
Note
This is not checking ancestors/descendents; it's purely a single level parent-child.
virtual IPreflightObject* IPreflightObjectModel::QueryObject (const PreflightObjectIDobjID) const
pure virtual

Given a preflight object (simple reference), obtain a pointer to an interface you can get concrete implementations from via QueryInterface, or pass on to functions that need it. Note that the returned interface is very short lived; any invalidation of the document can cause it to be out of date. DO NOT store this interface away as a member variable unless it will exist only over an atomic operation that does not modify the document.

Parameters
objIDIN The object you want to map to an interface.
Returns
A refcounted preflight object interface.
virtual bool IPreflightObjectModel::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.
virtual void IPreflightObjectModel::Shutdown ()
pure virtual

Called by the preflight manager; you shouldn't call this.

virtual void IPreflightObjectModel::Startup ()
pure virtual

Called by the preflight manager; you shouldn't call this.