InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SnpInspectLayoutModel Class Reference

Public Member Functions

 SnpInspectLayoutModel ()
 
virtual ~SnpInspectLayoutModel ()
 
void ReportItems (const UIDList &itemList)
 
void ReportDocument (const UIDRef &docUIDRef)
 
void ReportDocumentByHierarchy (const UIDRef &docUIDRef)
 
void ReportDocumentByDocumentLayer (const UIDRef &docUIDRef)
 
void ReportDocumentGeometry (const UIDRef &docUIDRef)
 
void ReportDocumentByHierarchyOfInlines (const UIDRef &docUIDRef)
 
void InspectStoryInlines (const UIDRef &storyUIDRef, void(*Callback)(IHierarchy *))
 
void TraverseIHierarchy (IHierarchy *parent, void(*Callback)(IHierarchy *))
 
void InspectSpreadByDocumentLayer (ISpread *spread)
 
void TraceSpreadGeometry (const UIDRef &objectUIDRef)
 
static void Indent (int32 level)
 
static void TraceNode (IHierarchy *node)
 
static void TraceNodeGeometryAndTransform (IHierarchy *node)
 
static int32 TraceBoss (IPMUnknown *unknown)
 
static int32 TraceBoss (IDataBase *database, const UID &uid)
 
static void TraceLayerName (const char *msg, IHierarchy *spreadLayer)
 
static void TracePMMatrix (const char *msg, const PMMatrix &m)
 
static void TracePMRect (const char *msg, const PMRect &bBox)
 
static void TraceGeometry (IGeometry *geometry)
 
static void TraceTransform (ITransform *transform)
 
static void TracePageNode (IHierarchy *node)
 
static UIDRef GetDocumentUIDRef (IPMUnknown *unknown)
 
static IDocumentQueryDocument (IPMUnknown *unknown)
 

Detailed Description

  • How to examine the layout content in a document,
  • reports spreads, layers, frames, frame content and guides,
  • teaches you the structure of the layout model,
  • lets you peek under the hood IHierarchy, IGeometry and ITransform.

Reports the organisation and geometry of layout content in a document or in a selection of items. To inspect the entire document run the snippet with nothing selected. To inspect specific items select them then run the snippet.

Documents are made up of one or more spreads(ISpreadList). Each spread(ISpread) contains one or more pages. A document has a list(ILayerList) of document layers(IDocumentLayer) that can be shown, hidden, locked, unlocked and arranged in their z-order.

Each spread has a set of spread layers(ISpreadLayer) that map to their corresponding document layer. The spread has a tree structure (accessed via interface IHierarchy) whose children are spread layers. The children of each of the spread layers are the frames (IGraphicFrameData) that contain pictorial or textual content and guides. The children of the frames vary depending on what the frame contains. For example an EPS image would be have a kEPSItem child. A text frame would have a kMultiColumnItemBoss which on turn would have one or more kFrameItemBoss objects (one per column).

The methods in this snippet navigate the IHierarchy tree and report on the objects they discover.

Document layers are the layers the user sees in the layers panel. In addition there is a special layer, the pages layer, which is not displayed in the layer panel. This layer is where the page objects live that draw the outline of each page and its drop shadow. The page object also maintains a reference to its associated master page.

For each document layer there are two spread layers, one that owns the layer's frames and another that owns the layer's guides.

Content and guides are owned by spread layers not by pages (when executing page operations the application considers whether a page item lies within the page area by comparing the bounding box of the item and the bounding box of the page).

Stories can contain inline frames (IInlineData) embedded in the text. The child of an inline frame is a regular graphic frame (IGraphicFrameData), normally a kSplineItemBoss, that contains a picture or other text. Like other layout objects inline frames have an IHierarchy but instead of being rooted on a spread they are rooted on a kInlineBoss that is an owned item in a story.

See Also
IDocument
ISpreadList
ISpread
ISpreadLayer
ILayerList
IDocumentLayer
IGraphicFrameData
IHierarchy
ITransform
IGeometry
IInlineData

Constructor & Destructor Documentation

SnpInspectLayoutModel::SnpInspectLayoutModel ()
inline

Constructor.

virtual SnpInspectLayoutModel::~SnpInspectLayoutModel ()
inlinevirtual

Destructor.

Member Function Documentation

void SnpInspectLayoutModel::Indent (int32 level)
static

Callback functions used to generate reports as the page item hierarchy is traversed. These methods are all declared as static so they can be used as callback functions with TraverseIHierarchy.

void SnpInspectLayoutModel::InspectSpreadByDocumentLayer (ISpreadspread)

Iterates over each document layer and reports the objects found on its associated content and guide spread layers of the given spread.

void SnpInspectLayoutModel::InspectStoryInlines (const UIDRefstoryUIDRef,
void(*)(IHierarchy *) Callback 
)

Iterate the owned items in the given story and report the inline frames (IInlineData) by traversing their hierarchy (IHierarchy).

Parameters
storyUIDRef
Callbackthat will report on each IHierarchy node.
void SnpInspectLayoutModel::ReportDocument (const UIDRefdocUIDRef)

Inspect the layout model of the entire document.

void SnpInspectLayoutModel::ReportDocumentByDocumentLayer (const UIDRefdocUIDRef)

Iterates each spread and master spread in the document and reports the page items associated with each document layer.

Document layers are the layers the user sees in the layers panel. In addition there is a special layer, the pages layer, which is not displayed in the layer panel. This layer is where kPageBoss objects live. The pages layer is always at index 0 in the document's ILayerList.

For each document layer there are two corresponding spread layers. One for content and one for guides.

void SnpInspectLayoutModel::ReportDocumentByHierarchy (const UIDRefdocUIDRef)

Traverses the hierarchy(IHierarchy) for each spread and master spread in the document and reports the page items.

void SnpInspectLayoutModel::ReportDocumentByHierarchyOfInlines (const UIDRefdocUIDRef)

Iterate the stories in the document and report each inline (kInlineBoss) anchored in the text.

void SnpInspectLayoutModel::ReportDocumentGeometry (const UIDRefdocUIDRef)

Iterate over the spreads in the document and traverse each spread's hierarchy of page items reporting their geometry and transformation matrix.

void SnpInspectLayoutModel::ReportItems (const UIDListitemList)

Inspect the layout model by traversing the hierarchy(IHierarchy) of the given items.

Parameters
itemListitems to report on.
void SnpInspectLayoutModel::TraceSpreadGeometry (const UIDRefobjectUIDRef)

Reported spread geometry.

Parameters
objectUIDRef
void SnpInspectLayoutModel::TraverseIHierarchy (IHierarchyparent,
void(*)(IHierarchy *) Callback 
)

Recursive method that visits each node in the given hierarchy and calls the supplied Callback method.

Parameters
parenthierarchy
Callbackthat reports each node.