Download Adobe InDesign 2 Programming Guide

Transcript
Adobe InDesign Programming Guide
10.4. Drawing the Layout
335
The use of foreground and background draws means that a page item could be
called twice during a redraw. The first call to IShape::Draw() in the order of the
document hierarchy for the background draw, and the second call to
IHandleShape::Draw() in the order of the selection list for the foreground draw.
If the window is not the front view, then a more abbreviated draw takes place.
Both the document items and the selection are drawn to a foreground offscreen
context, and it is copied to the screen.
10.4.3.2. Introduction to the Draw Manager
Until now, document drawing has implied the kLayoutWidgetBoss is directly
calling each spread to draw. In fact, kLayoutWidgetBoss calls through InDesign’s
Draw Manager facility. The Draw Manager is a session level interface through
which all drawing for the screen, PDF, and print passes. As described above,
drawing in InDesign occurs on a spread-by-spread basis, and is hierarchical.
Without a service like the draw manager, it would be difficult to change the
behavior of drawing a sub hierarchy.
Funneling all drawing activity through the Draw Manager provides three
important features for changing the behavior of draws:
• Clipping of areas to be drawn
• Filtering of items to be drawn
• Interrupting a draw sequence
Clipping and filtering provide a means to select items for the draw based on
regions. The draw manager maintains the current values for the clip and filter
regions. Interruption of the drawing sequence relies on a broader mechanism
called draw events. As items draw they broadcast standard messages that
announce the beginning and end of discrete drawing operations. Draw events
are received by special handlers that register interest in particular types of
messages, and each draw event handler has the opportunity to abort the draw
at that point. Clients of the Draw Manager (such as the LayoutWidget) install a
default draw event handler.
The Draw Manager provides services for hit testing and iterating the draw
order as well as drawing. More information about all of its functions is available
in the Draw Events chapter.