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

#include <ITextAdornment.h>

Inheritance diagram for ITextAdornment:
IPMUnknownCPMUnknown< ITextAdornment >BscTAAdornmentHidTxtAnchorTextAdornment

Public Types

enum  { kDefaultIID = IID_ITEXTADORNMENT }
 

Public Member Functions

virtual Text::DrawPriority GetDrawPriority ()=0
 
virtual void GetInkBounds (PMRect *inkBounds, const PMRect &runInkBounds, IWaxRun *waxRun, IWaxRenderData *renderData, IWaxGlyphs *waxGlyphs, const ITextAdornmentData *data)=0
 
virtual void Draw (GraphicsData *gd, int32 iShapeFlags, IWaxRun *waxRun, IWaxRenderData *renderData, IWaxGlyphs *waxGlyphs, const ITextAdornmentData *data)=0
 
virtual ITextAdornmentDataSplitAt (int32 offsetInRun, IWaxRun *waxRun, IWaxRun *newWaxRun, ITextAdornmentData *data)=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

Text Adornments are bosses that are "attached" by ClassID to individual wax runs and, when the run is drawn, they are given control via this interface.

Adornments affect when they are called by the priority value they return via their GetPriority() method. Higher priorities (smaller numbers) are called before lower priorities (larger numbers).

In addition, drawing priorities are further broken down into two pieces - Pass (whole part) and Run (fractional part). For each unique Pass value across all the active adornments in a frame, a full iteration of the wax runs will be made calling all the adornments which share that pass value. Then, within each wax run, the adornments will be called based on their Run priority.

For performance reasons it is important to minimize the number of passes that are made over the wax. Try to piggyback your drawing on an existing pass, such as when text is drawn. The critical indicator is to decide if drawing your adornment on a particular run will be negatively effected by some other adornment drawn on another run within the same pass. This is usually the case with fill type operations. These types of adornments probably require their own pass.

To assist in selecting appropriate priorities, we have defined some values below for adornments that are part of the base implementation.

And now a word about Page Item Adornments... These aren't strictly related to text but it may be important for them to know when the text will be drawn related to their priorities. So in that vein:

Page Item Adornment Relative To Text "Priority" Adornment Draw Priority


kBeforeTextBackground BEFORE kMaxPriority kBeforeText kPassPriText (before any text adornment with same priority) kBeforeTextForeground kPassPriForeground (before any text adornment with same priority) kAfterTextForeground AFTER kMinPriority

Member Function Documentation

virtual void ITextAdornment::Draw (GraphicsDatagd,
int32 iShapeFlags,
IWaxRunwaxRun,
IWaxRenderDatarenderData,
IWaxGlyphswaxGlyphs,
const ITextAdornmentDatadata 
)
pure virtual

Draw the text adornment.

Two important IShape flags must be observed:

IShape::kPrinting If set, indicates that we are printing.

IShape::kPreviewMode If set, indicates that we are previewing printing to the screen, text adornments that do not draw when printing should not draw for this either

Parameters
gdIN Pointer to the GraphicsData.
iShapeFlagsIN The value of the flags parameter passed into IShape::Draw.
waxRunIN An interface on this wax run boss.
renderDataAn interface on this wax run boss. It can be nil, meaning the WaxRunis NOT a typical text run.
waxGlyphsIN An interface on this wax run boss. It can be nil, meaning the WaxRunis NOT a typical text run.
dataIN pointer to optional ITextAdornmentData. It may be nil if no data is specified when the adornment was attached.

Implemented in HidTxtAnchorTextAdornment, and BscTAAdornment.

virtual Text::DrawPriority ITextAdornment::GetDrawPriority ()
pure virtual

Returns the Draw priority of the adornment.

Returns
the Text::DrawPriority of the adornment.

Implemented in HidTxtAnchorTextAdornment, and BscTAAdornment.

virtual void ITextAdornment::GetInkBounds (PMRectinkBounds,
const PMRectrunInkBounds,
IWaxRunwaxRun,
IWaxRenderDatarenderData,
IWaxGlyphswaxGlyphs,
const ITextAdornmentDatadata 
)
pure virtual

Returns information about the adornment including whether it would draw on this run and what the ink bounds are.

The ink bounds are in waxLine coordinate space (i.e. "within the line" space). (The same space as the baseTextWaxRun itself - no xForm need be done at the waxLine level).

Parameters
inkBoundsOUT The inkBounds are passed in empty. If your adornment is guaranteed to draw within the Text bounds of the run and the vertical selection bounds of the line then you DO NOT have to return anything for the inkBounds, just leave them unchanged (empty).
runInkBoundsIN Value returned by CWaxRunShape::GetTextInkBounds() for this wax run boss.
waxRunIN An interface on this wax run boss.
renderDataAn interface on this wax run boss. It can be nil, meaning the WaxRunis NOT a typical text run.
waxGlyphsIN An interface on this wax run boss. It can be nil, meaning the WaxRunis NOT a typical text run.
dataIN pointer to optional ITextAdornmentData. It may be nil if no data is specified when the adornment was attached.

Implemented in HidTxtAnchorTextAdornment, and BscTAAdornment.

virtual ITextAdornmentData* ITextAdornment::SplitAt (int32 offsetInRun,
IWaxRunwaxRun,
IWaxRunnewWaxRun,
ITextAdornmentDatadata 
)
pure virtual

The adorned run is splitting: split the given data at the given offset and return the new data

Parameters
offsetInRunIN Offset in original run.
waxRunIN An interface on the original wax run boss.
newWaxRunIN An interface on the new wax run boss the .
dataIN pointer to optional ITextAdornmentData. It may be nil if no data is specified when the adornment was attached.
Returns
Pointer to new instance of ITextAdornmentData which will be attached to the new wax run.

Implemented in HidTxtAnchorTextAdornment, and BscTAAdornment.