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

#include <IPreflightRuleVisitor.h>

Inheritance diagram for IPreflightRuleVisitor:
IPMUnknownCPMUnknown< IPreflightRuleVisitor >PreflightBlackOverprintRuleVisitorPreflightFontRuleVisitor

Public Types

enum  { kDefaultIID = IID_IPREFLIGHTRULEVISITOR }
 

Public Member Functions

virtual
PreflightObjectClassIDVector 
GetClassesToVisit () const =0
 
virtual void Visit (IPreflightVisitInfo *iInfo)=0
 
virtual void AggregateResults (const IPreflightProcess *iProcess, const IPreflightProcess::NodeIDVector &resultNodes, IPreflightAggregatedResults *iResults, IPreflightAggregatedResults::NodeID parentID) const =0
 
virtual void UpdateRuleData ()=0
 
virtual ErrorCode ValidateRuleData (const IPreflightRuleData::Key &key, const ScriptData &proposedValue) 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 is the single most important interface to understand if you're writing a rule. The IPreflightRuleVisitor interface is usually a nonpersistent interface that provides the dynamic model behavior for the rule. It sits on a rule boss created by your rule service along with the persistent data.

This is one of two interfaces that are typically implemented on a rule using something other than the standard implementations (more on the standard implementations below).

The methods in this interface are mostly for the inspection of objects and reporting and formatting of results, but a few utilities that require dynamic, rule-specific implementations also reside here. Namely UpdateRuleData().

The other dynamic, rule-specific interface on a rule boss is IPreflightRuleUI, which provides services for the presentation of rule parameters to the user in the profile editing dialog. Since we like to separate model and UI behaviors into separate plugins, IPreflightRuleUI is usually an Add-In implementation onto the rule boss in the UI plugin.

Other interfaces on the rule boss include:

  • IPreflightRuleInfo: Generally static (after construction) information about the rule such as its description, plugin description, etc.
  • IPreflightRuleData: Stores the rule parameters. You don't have to use this for your persistent data but it makes a lot of the UI much easier to implement. The stock implementation (IPreflightRuleDataImpl) is usually all you'll need.
  • IPreflightRuleUtilities: Utilities for rule operations that are typically handled by the stock implementation (kPreflightRuleUtilitiesImpl) but you can override if you need special treatment.

Member Function Documentation

virtual void IPreflightRuleVisitor::AggregateResults (const IPreflightProcessiProcess,
const IPreflightProcess::NodeIDVectorresultNodes,
IPreflightAggregatedResultsiResults,
IPreflightAggregatedResults::NodeID parentID 
) const
pure virtual

Given a list of previously reported nodes in the process database, determine their presentation in the user interface (and reporting, which is why this is in the model interface and not in the rule UI interface).

Parameters
iProcessThe process from which you can get the "raw" results.
resultNodesThe vector of result nodes reported by your rule.
iResultsThe aggregated results database to add nodes to.
parentIDThe node in the results database under which you should add your result nodes.
See Also
IPreflightAggregatedResults
IPreflightResultNodeInfo

Implemented in PreflightFontRuleVisitor, and PreflightBlackOverprintRuleVisitor.

virtual PreflightObjectClassIDVector IPreflightRuleVisitor::GetClassesToVisit () const
pure virtual

Return a vector of class IDs that you're interested in visiting.

Returns
A vector of class IDs.

Implemented in PreflightFontRuleVisitor, and PreflightBlackOverprintRuleVisitor.

virtual void IPreflightRuleVisitor::UpdateRuleData ()
pure virtual

This is called at startup for application-level rules and at document open time for document-level rules. It gives the plugin a chance to review the data in the rule and make any updates based on version changes.

Normally the rule data is stored as a key/value dictionary in IPreflightRuleData on the same boss.

Implemented in PreflightFontRuleVisitor, and PreflightBlackOverprintRuleVisitor.

virtual ErrorCode IPreflightRuleVisitor::ValidateRuleData (const IPreflightRuleData::Keykey,
const ScriptDataproposedValue 
) const
pure virtual

This is called to check a parameter for the rule and should be called before setting the value. It validate the proposed value for the specified key and returns an error code indicating the error, ususally out of range or invalid paragtmers.

Normally the rule data is stored as a key/value dictionary in IPreflightRuleData on the same boss.

Parameters
keyis the data key.
proposedValueis the value for the specified key to be validated.
Returns
an error code or kSuccess.

Implemented in PreflightFontRuleVisitor, and PreflightBlackOverprintRuleVisitor.

virtual void IPreflightRuleVisitor::Visit (IPreflightVisitInfoiInfo)
pure virtual

This method is called when it's time to visit an object whose class you said you were interested in via GetClassesToVisit.

Parameters
iInfoAn information and reporting structure.

Implemented in PreflightFontRuleVisitor, and PreflightBlackOverprintRuleVisitor.