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

#include <IWaxHitTest.h>

Inheritance diagram for IWaxHitTest:
IPMUnknownCPMUnknown< IWaxHitTest >CWaxCollectionHitTest

Public Types

enum  { kDefaultIID = IID_IWAXHITTEST }
 
enum  HitTestPosition { kHitBefore = -1, kHitToTheRight = 0x7FFFFFFE, kHitBelow = 0x7FFFFFFF }
 

Public Member Functions

virtual PMReal HitTestWax (PMPoint pt, PMLineSeg selection, int32 *charCount=nil) const =0
 
virtual bool16 GetLocationOf (int32 offset, PMPoint *pt, int32 innerPos, PMMatrix *pWaxToGlyphMatrix=nil) 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

Class providing translation from a text index relative to the waxLine to a point within the waxLine coordinate space or vice versa.

Member Enumeration Documentation

This enum provides exceptional return values for the translation of points to text indices.

Member Function Documentation

virtual bool16 IWaxHitTest::GetLocationOf (int32 offset,
PMPointpt,
int32 innerPos,
PMMatrixpWaxToGlyphMatrix = nil 
) const
pure virtual

Translate a text index relative to this object to a point in this object.

Returns
kTrue for a valid translation, kFalse otherwise.
Parameters
offsetIN A valid offset in to the wax, or alternatively a value equal to the wax length.
ptOUT If a valid offset, then pt is always adjusted to reflect the Wax X and Y Position, not necessarily where and how the glyph is actually drawn in the case of complex transformations (shears, TOP, etc).

If offset is within the wax then pt is adjusted to reflect the left edge of the appropriate char. If offset is equal to the wax length AND this object was hit, then pt is adjusted to reflect the right edge of the last char.

Note
that this works on characters, not glyphs. For characters that result in multiple glyphs, the group of glyphs is treated as a single glyph.
Parameters
innerPosIN Affects the "lean" of the index. For instance, if offset is equal to the wax length, then if this is non-zero this wax will not be considered to be hit (the next one will). If innerPos is 0, then this object will be hit and the last char will be used to determine the results.
pWaxToGlyphMatrixOUT An optional return parameter which can be used to transform things (such as lines) to the actual glyph location.
Note
that anything returned via the wax (e.g. pt) is already transformed and thus applying this matrix would be wrong for those items. It should only be applied to items in the same coordinate space that waxLines are in (i.e. parcel coordinates).

Implemented in CWaxCollectionHitTest.

virtual PMReal IWaxHitTest::HitTestWax (PMPoint pt,
PMLineSeg selection,
int32 * charCount = nil 
) const
pure virtual

Translate a point in this object waxLine to a text index relative to this object.

Parameters
ptIN A point in Wax coordinate system.
selectionOUT A line designating the height of the selection.
charCountOUT An optional return parameter returning the number of chars in this object.
Returns
a real number which designates the index of the char hit and includes the fractional distance to the next character. designates how far into that char it hit, or one of the following values, as described below: kHitBefore, kHitToTheRight, kHitBelow
Note
that this works on characters, not glyphs. For characters that result in multiple glyphs, the group of glyphs is treated as a single glyph.

Additional information on return values: WaxRuns: If pt is above or to the left then the call returns kHitBefore. If pt is to the right then the call returns kHitToTheRight. If pt is below then the call returns kHitBelow. Otherwise the run is hit and the call returns the offset of the first glyph that is at or to the right of pt and pt is adjusted as follows: (the left of the glyph, selection bottom).

WaxLines: If pt is above or to the left then the call returns zero (0) and pt is adjusted to point to the first glyph on the line. If pt is below then the call returns kHitBelow as an indication to try the next line. If pt is within the bounds of the line, this call returns the offset of the closest glyph within the line and adjusts pt to point to the start of that glyph at the YPosition of the waxLine. If pt is within the bounds o the line, but to the right of the last glyph then this call returns the equivalent offset for the first glyph on the NEXT waxLine (if this would not be past the story thread boundry), adjusts pt to point to the end of the last glyph on the waxLine, and sets the endOfLine flag to kTrue.

Implemented in CWaxCollectionHitTest.