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

#include <IBaseHandler.h>

Inheritance diagram for IBaseHandler:
IPMUnknownBaseHitTestHandlerImpl

Public Member Functions

virtual void InitHandler (GraphicsData *theGD, IShape *theShape)=0
 
virtual void TerminateHandler (void)=0
 
virtual const PMRect GetHandlerIntersectionRect (void) const =0
 
virtual const GraphicsDataGetHandlerGraphicsDataPtr (void) const =0
 
virtual bool16 HandleSpread (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleSpreadLayer (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleInlineItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleSplineItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleMultiColumnFrameItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleFrameItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleGroupItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleGuideItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandlePage (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleImageItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleHTMLItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleEPSTextItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleEPSItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandlePICTItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleWMFItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandlePDFItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleTOPItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleOwnedItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleWaxAnchoredElementItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleParcelItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=0
 
virtual bool16 HandleUnknownItem (IVisitorHelper *pVisitable, IBaseVisitor *theVisitor)=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

An interface class used in conjunction with IBaseVisitor and IVisitorHelper, IBaseHandler 

accomplishes item-specific tasks during a traversal (or visitation) of a structure of connected

nodes -- typically (but not limited to) pageitems on a spread.  As the visitor traverses the

structure, it invokes the appropriate method in the handler to accomplish the task for the

current node.  Using a separate handler is an extension of the visitor design pattern presented

in Gamma, et al.



The separation of handling the "problem" from the particulars of node traversal allows, for 

instance, the same form of traversal to be used for several problem (or "handling") solutions.

For instance, InDesign uses this visitor/handler scheme for hit-testing, but it could (though

presently does not) use the same visitor and a different handler to support pageitem drawing.



NOTE: It is the HandleXXX routine's responsibility to cause visitation of the item's children by

calling theVisitor->VisitChildren(pVisitable), if it is desired that the child nodes be

processed.  If for whatever reason the handler decides the children do not need visitation

(say in the case of the handler's task already being accomplished within the HandleXXX routine), 

it may simply return without visiting the children. 



FURTHER NOTE: Third-party-created pageitems that are not derived from built-in InDesign page item bosses must contain

an IVisitorHelper interface on the page item boss in order for hit-testing to be supported for the item.  

Also, HandleXXX routines aren't defined for these pageitems in IBaseHandler, so

these should be provided by custom implementations that are added-in to the kPtrHitTestHandlerBoss.  

The kPtrHitTestHandlerBoss is the base boss for InDesign hit-testing; several other boss 

classes derive from it.



The handler mechanism can be extended to support a new node, by adding-in a new interface to the handler

boss for the task or problem being handled.  Such an interface, say for a node called MyNode, would

contain a HandleMyNode() routine, along these lines:

<pre>

bool16 MyNodeHandlerImpl::HandleMyNode(IVisitorHelper* pVisitable, IBaseVisitor* theVisitor)

{

    bool16 bDone = kFalse;

Whatever the task to perform, now is the time to perform it on this node, if the task should be performed before performing it on the node's children. Set bDone to kTrue if no further handling should be done. ...

    if ( !bDone )

    {   

Not done, so visit the children bDone = theVisitor->VisitChildren(pVisitable); If, after visiting the children, we have more to do, do it here } } If there is more data to return to caller than bDone, put it on an interface that has been added-in to the handler boss. The code that started this visitor/handler traversal (see sample code in IVisitorHelper.h) can retrieve it there.

    return bDone;

}



</pre>

See Also
IBaseVisitor
IVisitorHelper

Member Function Documentation

virtual const GraphicsData* IBaseHandler::GetHandlerGraphicsDataPtr (void ) const
pure virtual

Get the graphics data pointer for the handler

Returns
GraphicsData* passed into InitHandler

Implemented in BaseHitTestHandlerImpl.

virtual const PMRect IBaseHandler::GetHandlerIntersectionRect (void ) const
pure virtual

Get the target rectangle used by the handler.

Returns
PMRect in pasteboard coordinates

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleEPSItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleEPSTextItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleFrameItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a text frame (a child of multicolumn frame 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleGroupItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleGuideItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a guide 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleHTMLItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleImageItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleInlineItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle an inline pageitem

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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleMultiColumnFrameItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a multicolumn frame 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleOwnedItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle an owned item – that is, owned by 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandlePage (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleParcelItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a parcel – not really a pageitem (such as a line of text or a table cell)

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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandlePDFItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandlePICTItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a PICT 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleSplineItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a spline, or CGraphicFrameShape 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleSpread (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a spread 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleSpreadLayer (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a spread layer 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleTOPItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle 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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleUnknownItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle an item of unknown type (provides generic handling)

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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleWaxAnchoredElementItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle an IWaxAnchoredElement, such as an anchored graphic

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

Implemented in BaseHitTestHandlerImpl.

virtual bool16 IBaseHandler::HandleWMFItem (IVisitorHelperpVisitable,
IBaseVisitortheVisitor 
)
pure virtual

Handle a Windows metafile 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

Implemented in BaseHitTestHandlerImpl.

virtual void IBaseHandler::InitHandler (GraphicsDatatheGD,
IShapetheShape 
)
pure virtual

Initialize the handler with the graphics data and initial IShape – for instance, setting up transform, doing gsave, etc. – prior to handler invocation

Parameters
theGDIN GraphicsData pointer
theShapeIN IShape pointer for the initial item

Implemented in BaseHitTestHandlerImpl.

virtual void IBaseHandler::TerminateHandler (void )
pure virtual

Perform post-handling such as grestore, releasing pointers, etc.

Implemented in BaseHitTestHandlerImpl.