
Adobe Acrobat SDK
Understanding Plug-ins
Developing Plug-ins and Applications
Page view layers 36
Page view layers
Acrobat and Adobe Reader’s drawing and mouse click processing relies on the concept of page view
layers, which are numbers of type
ASFixed
that are associated with the document itself and each
annotation type. For information, see
“Working with Page Views and Contents” on page 122
.
The following table shows the predefined layers used by Acrobat and Adobe Reader.
These layers are used in the following situations:
Drawing
: The layers are drawn from lowest to highest. As indicated in the table, the page contents are
drawn first, followed by links, closed text notes, and finally open text notes. As a result, open text notes
draw over any closed text notes they overlap.
Mouse click processing
: Occurs from highest layer to lowest layer. When a mouse click occurs, it is first
passed to any open text note at the mouse click’s location, then any closed text note, then any link, and
finally to the page view itself. However, mouse clicks are passed to a lower layer only if a higher layer
declines to handle the mouse click by returning
false
from its
DoClick
callback. For information, see
“Tool callbacks” on page 147
.
Annotation handlers provided by plug-ins can reside in any layer. For example, a plug-in could choose for
its annotations to be between the page contents and links, such as in layer 0.5 (because layers are numbers
of type
ASFixed
).
An annotation handler’s
AVAnnotHandlerGetLayerProc
callback is called during screen updates and
mouse clicks to return its layer. Using a callback rather than a constant value allows an annotation’s layer to
change. For example, Acrobat’s built-in text annotation changes its layer, allowing open text annotations
to receive mouse clicks before closed annotations, if both are at the mouse click location (on the other
hand, Acrobat’s built-in link annotation does not change its layer).
Note:
Acrobat and Adobe Reader do not invoke
AVAnnotHandlerGetLayerProc
callbacks for changes
in value, so be sure to invalidate the page rectangle of an annotation when its layer changes.
Minimizing screen redrawing
Minimize screen redrawing by using the
AVPageViewBeginOperation
and
AVPageViewEndOperation
methods to bracket any sequence of view changes you may perform. For
example, the sequence of changing to another page, scrolling, and zooming would normally redraw the
screen three times. But, by invoking the
AVPageViewBeginOperation
method before the sequence
and the
AVPageViewEndOperation
method after it, only one redraw occurs.
Layer
Item
0
Page contents
LINK_LAYER (1)
Links
NOTE_LAYER (3)
Closed notes. Open notes are just above this.