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

#include <BaseHitTestHandler.h>

Inheritance diagram for BaseHitTestHandlerImpl:
IBaseHandlerIPMUnknown

Classes

class  ConcatTransformInScope
 

Public Types

enum  LockedItemTreatment { kDontSeeLockedItems = 0, kSeeLockedItems }
 
enum  LockedLayerTreatment { kDontSeeLockedLayers = 0, kSeeLockedLayers }
 
enum  MasterPageHandlerTreatment { kDontSeeMPItems = 0, kSeeAndOverrideMPItems, kOnlySeeMPItems, kSeeAndOverrideMPItemsAndThreads }
 

Public Member Functions

 BaseHitTestHandlerImpl (IPMUnknown *boss)
 
virtual void InitHandler (GraphicsData *gd, IShape *theShape)
 
virtual void TerminateHandler (void)
 
virtual const PMRect GetHandlerIntersectionRect (void) const
 
virtual const GraphicsDataGetHandlerGraphicsDataPtr (void) const
 
virtual bool16 HandleSpread (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleSpreadLayer (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleInlineItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleSplineItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleMultiColumnFrameItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleFrameItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleGroupItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleGuideItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandlePage (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleImageItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleHTMLItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleEPSTextItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleEPSItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandlePICTItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleWMFItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandlePDFItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleTOPItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleOwnedItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleWaxAnchoredElementItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleParcelItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HandleUnknownItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 

Protected Member Functions

virtual bool16 HandleAdornments (IAdornmentShape::AdornmentDrawOrder drawOrder, IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
void InitAssociatedData (void)
 
virtual bool16 StandardPageItemHandler (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 StandardLeafNodeHandler (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 HitTestTextOnPath (IShape *iShape, IAdornmentShape::AdornmentDrawOrder drawOrder, GraphicsData *gd, const PMRect &r) const
 
virtual bool16 HandleSpreadOMP (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)
 
virtual bool16 DoHandleSpreadLayer (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor, MasterPageHandlerTreatment mph, LockedLayerTreatment llt=kDontSeeLockedLayers)
 
virtual bool16 DoHandleSplineItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor, LockedItemTreatment lit=kDontSeeLockedItems)
 
virtual bool16 IsItemLocked (IPMUnknown *item)
 

Protected Attributes

GraphicsDatafHitTestHandlerGrarphicsData
 
PMRect fTheHitTestRectangle
 
UIDListfThingsHit
 
IShapefShape
 

Friends

class ConcatTransformInScope
 

Detailed Description

Base implementation for IBaseHandler to accomplish hit-testing in InDesign. This implements the most widely-used handler routines for basic hit-testing. Several specialized subclasses exist, and in fact none of the hit-test handler bosses in InDesign derive solely from this implementation.

When a hit is found by a handler routine, it appends the item UID to the UIDList pointed to by fThingsHit, for access by the top-level caller to the item hit. This mechanism could support the storage of more than one hit item, though in practice this handler typically stops hit-testing after one hit is found.

Situations requiring hit-testing behavior other than this implementation should subclass and override the HandleXXX routines as necessary. See related files for information on adding hit-testing support for new types of pageitems.

See Also
IBaseHandler
IBaseVisitor
IVisitorHelper

Member Enumeration Documentation

Flags for DoHandleSplineItem for extra control over how hit-testing works.
Enumerator
kDontSeeLockedItems 

Don't visit items on locked layers.

kSeeLockedItems 

Visit items even if on locked layers.

Flags for DoHandleSpreadLayer for extra control over how hit-testing works.
Enumerator
kDontSeeLockedLayers 

Don't visit items on locked layers.

kSeeLockedLayers 

Visit items even if on locked layers.

Flags for how to treat master page items while hit-testing.
Enumerator
kDontSeeMPItems 

Don't visit any master page items.

kSeeAndOverrideMPItems 

See and override a master page item that is hit.

kOnlySeeMPItems 

See master page items, but don't override if we hit one.

kSeeAndOverrideMPItemsAndThreads 

See master page items and override if hit, including text frames threaded to the hit item.

Member Function Documentation

virtual bool16 BaseHitTestHandlerImpl::DoHandleSplineItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor,
LockedItemTreatment lit = kDontSeeLockedItems 
)
protectedvirtual

Hit-test a SplineItem, with control over how to handle locked items

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
mphIN specifies how to treat masterpage items
lltIN specifies how to treat locked layers
Returns
kTrue to be done with all handling, kFalse to continue
virtual bool16 BaseHitTestHandlerImpl::DoHandleSpreadLayer (IVisitorHelperpVisitable,
IBaseVisitortheVisitor,
MasterPageHandlerTreatment mph,
LockedLayerTreatment llt = kDontSeeLockedLayers 
)
protectedvirtual

Hit-test a spread layer, with control over how to handle masterpage items and locked layers

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
mphIN specifies how to treat masterpage items
lltIN specifies how to treat locked layers
Returns
kTrue to be done with all handling, kFalse to continue
virtual const GraphicsData* BaseHitTestHandlerImpl::GetHandlerGraphicsDataPtr (void ) const
inlinevirtual

Get the GraphicsData pointer provided to InitHandler()

Returns
the GraphicsData pointer

Implements IBaseHandler.

virtual const PMRect BaseHitTestHandlerImpl::GetHandlerIntersectionRect (void ) const
virtual

Get the hit-testing rectangle stored in IBaseSelectionHandlerData.

Returns
the hit-test rectangle for this handler boss

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleAdornments (IAdornmentShape::AdornmentDrawOrder drawOrder,
IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
protectedvirtual

Subclasses can handle adornments here.

virtual bool16 BaseHitTestHandlerImpl::HandleEPSItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardLeafNodeHandler for an EPS item.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleEPSTextItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardLeafNodeHandler for an EPS text item.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleFrameItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardPageItemHandler for a text frame.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleGroupItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardPageItemHandler for a group item.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleGuideItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Check for a hit in the area occupied by a ruler guide.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleHTMLItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardLeafNodeHandler for an embedded HTML item.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleImageItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardLeafNodeHandler for an image.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleInlineItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Hit-test an inline item

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleMultiColumnFrameItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardPageItemHandler for a multi-column frame.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleOwnedItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Hit-test an owned item, such as a graphic anchored in a text frame or a table

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandlePage (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardLeafNodeHandler for a page.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleParcelItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Hit-test a text parcel

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandlePDFItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardLeafNodeHandler for a PDF item.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandlePICTItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardLeafNodeHandler for a PICT.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleSplineItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Hit-test a spline item

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleSpread (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Hit-test a spread

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleSpreadLayer (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Hit-test a spread layer

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleSpreadOMP (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
protectedvirtual

Hit-tests a spread, while passing a flag to master pages code to override any hit item

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue
virtual bool16 BaseHitTestHandlerImpl::HandleTOPItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardPageItemHandler for a text on a path item.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleUnknownItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardPageItemHandler for an unknown item.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleWaxAnchoredElementItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Hit-test a wax anchored element, such as a footnote

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HandleWMFItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
virtual

Invoke StandardLeafNodeHandler for a Windows metafile.

Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::HitTestTextOnPath (IShapeiShape,
IAdornmentShape::AdornmentDrawOrder drawOrder,
GraphicsDatagd,
const PMRectr 
) const
protectedvirtual

Test for a hit using IMainItemTOPData::PointIsInTOPTextArea

Parameters
iShapeIN pointer to the shape having the text on a path
drawOrderUNUSED pass a dummy value
gdIN GraphicsData pointer
rIN the hit-test rectangle
Returns
kTrue for a hit; kFalse for no hit
void BaseHitTestHandlerImpl::InitAssociatedData (void )
protected

Cache some information from other interfaces on this boss.

virtual void BaseHitTestHandlerImpl::InitHandler (GraphicsDatagd,
IShapetheShape 
)
virtual

Do some caching, do a gsave, and concatenate theShape's ParentToPasteboardMatrix into the gport.

Parameters
gdIN GraphicsData pointer for drawing environment
theShapeIN IShape pointer for initial shape to hit-test from, typically a spread

Implements IBaseHandler.

virtual bool16 BaseHitTestHandlerImpl::StandardLeafNodeHandler (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
protectedvirtual

Apply simple hit-testing logic to an item that has graphic data by checking adornments, any clipping path, and the item's shape itself.

Steps:

  1. If trivial reject fails based on entire shape's bbox being outside hit rect, return kFalse.
  2. Handle any kAfterShape adornments for the pageitem.
  3. Check for a hit in the clipping path, if one exists.
  4. Check for a hit in the fill area of the shape itself.
  5. Handle all adornments for the item. Any hit item has its UID appended to the UIDList at fThingsHit.
Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue
virtual bool16 BaseHitTestHandlerImpl::StandardPageItemHandler (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
protectedvirtual

Apply bare-bones hit-testing logic to a pageitem by only checking adornments and children, but not the item itself.

Steps:

  1. If trivial reject fails based on entire shape's bbox being outside hit rect, return kFalse.
  2. Handle any kAfterShape adornments for the pageitem.
  3. Visit the children.
  4. Handle all adornments for the item. Note that this handler does not test the item itself for a hit. Also, any hit item has its UID appended to the UIDList at fThingsHit.
Parameters
pVisitableIN the IVisitorHelper interface on the item
theVisitorIN the IBaseVisitor interface used for traversal
Returns
kTrue to be done with all handling, kFalse to continue
virtual void BaseHitTestHandlerImpl::TerminateHandler (void )
virtual

Do a grestore to match the gsave performed in InitHandler().

Implements IBaseHandler.