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

#include <IDragDropTextUtils.h>

Inheritance diagram for IDragDropTextUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IDRAGDROPTEXTUTILS }
 

Public Member Functions

virtual bool16 StartTextDrag (IControlView *view, IDragDropSource *dragSource, IEvent *theEvent)=0
 
virtual IParcelQueryTextParcelAtPoint (IControlView *view, const SysPoint mousePt, const IPMUnknown *hitObj, const IParcel *previousParcel, UIDRef &storyUIDRef, RangeData &range, PMReal *hitIndex=nil, PMReal *adjustedHitIndex=nil)=0
 
virtual void DrawCaretAtDropLocation (IControlView *view, UIDRef &storyUIDRef, RangeData &range, bool16 flushDrawing=kTrue)=0
 
virtual ErrorCode ProcessDragDropTextCommand (IControlView *view, IDragDropController *controller, const UIDRef &storyUIDRef, RangeData &range, DragDrop::eCommandType type, bool16 ignoreAttributes=kFalse)=0
 
virtual ErrorCode PrepareForTextFrameDrop (IControlView *view, IDragDropController *controller, PMPoint &dropPoint, UIDRef &parent)=0
 
virtual ErrorCode MakeFrame (const PBPMPoint &location, const UIDRef &parent, const UIDRef &storyUIDRef, UIDRef &createdFrame)=0
 
virtual ErrorCode SendDragDropTextSignal (ServiceID id, IControlView *sourceView, IControlView *destinationView, const UIDRef &sourceStoryRef, RangeData &sourceRange, const UIDRef &destinationStoryRef, RangeData &destinationRange, RangeData &droppedRange, DragDrop::eCommandType type, IDataExchangeHandler *handler)=0
 
virtual ICommandMakeNewTextFrameCmdForDrop (ILayoutControlData *layoutData, IDataExchangeHandler *texthandler, const bool16 ignoreAttributes)=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

Utilities for use for dealing with drag and drop of text.

Member Function Documentation

virtual void IDragDropTextUtils::DrawCaretAtDropLocation (IControlViewview,
UIDRefstoryUIDRef,
RangeDatarange,
bool16 flushDrawing = kTrue 
)
pure virtual

Description: Use the range data (length of 0) to draw a caret at the story position in order to give user feedback about drop location.

See Also
QueryTextParcelAtPoint.
Parameters
viewIN pointer to the control view under the mouse
storyUIDRefIN Reference to the story containing the RangeData
rangeIN text range at drop location (length of 0)
flushDrawingIN whether to force flush the drawing
virtual ErrorCode IDragDropTextUtils::MakeFrame (const PBPMPointlocation,
const UIDRefparent,
const UIDRefstoryUIDRef,
UIDRefcreatedFrame 
)
pure virtual

Description: Process command to create a new text frame or frame grid based on the passed in storyUIDRef parameter.

Parameters
locationWhere the text frame should be created, in pasteboard coordinates.
parentWhere in the hierarchy to put the text frame (typically a spread layer)
storyUIDRefThe source story uid ref (may be kInvalidUIDRef)
createdFrameOUT parameter. The created text frame or frame grid based on the passed in storyUIDRef parameter) and it could be UIDRef(nil, kInvalidUID) if we fail to create.
Returns
ICommand The command to create the text frame (kCreateMultiColumnItemCmdBoss).
virtual ICommand* IDragDropTextUtils::MakeNewTextFrameCmdForDrop (ILayoutControlDatalayoutData,
IDataExchangeHandlertexthandler,
const bool16 ignoreAttributes 
)
pure virtual

Description: Create a new-text-frame command, to hold raw text dragged onto a layout.

Parameters
layoutDataIN Pointer to ILayoutControlData for layout view.
texthandlerIN IDataExchangeHandler for the drop.
ignoreAttributesIN Ignore the attributes of the source.
Returns
ICommand pointer for the command.
virtual ErrorCode IDragDropTextUtils::PrepareForTextFrameDrop (IControlViewview,
IDragDropControllercontroller,
PMPointdropPoint,
UIDRefparent 
)
pure virtual

Description: Check to see if we can create a text frame at this location (checks for locked layers).

Parameters
viewIN What view to drop in.
controllerIN The drag and drop controller
dropPointOUT The dropped point from the controller
parentOUT Where in the hierarchy to put the text frame (typically a spread layer).
Returns
kSuccess if you can create a text frame in this view, an error code otherwise
virtual ErrorCode IDragDropTextUtils::ProcessDragDropTextCommand (IControlViewview,
IDragDropControllercontroller,
const UIDRefstoryUIDRef,
RangeDatarange,
DragDrop::eCommandType type,
bool16 ignoreAttributes = kFalse 
)
pure virtual

Description: Process commands to do text drag and drop.

Parameters
viewIN the control view for the drop (may be nil, used to bring window to front)
controllerIN the drag and drop controller
storyUIDRefIN Reference to the story to drop into (the destination)
rangeIN text range at hit location (length of 0) (the destination)
typeIN an enum of type DragDrop::eCommandType. kDragMove for moving text, otherwise use kDrop to copy.
ignoreAttributesIN Ignore the attributes on drop, default to kFalse
Returns
ErrorCode the result of processing the drag and drop command operation.
virtual IParcel* IDragDropTextUtils::QueryTextParcelAtPoint (IControlViewview,
const SysPoint mousePt,
const IPMUnknownhitObj,
const IParcelpreviousParcel,
UIDRefstoryUIDRef,
RangeDatarange,
PMRealhitIndex = nil,
PMRealadjustedHitIndex = nil 
)
pure virtual

Description: Utility method that encapsulates using the target object (hitObj) and uses its IDragDropTextHelper interface to return a parcel, story ref, and text range at the hit moust point.

See Also
QueryParcelFromHitObject
QueryStoryThreadFromHitObject
HitTestStoryThread
AdjustRangeFromHitTest
Parameters
viewIN pointer to the control view under the mouse
mousePtIN location of current mouse position
hitObjIN an IPMUnknown pointer from a frame from hittesting at the mousePt. May be nil.
previousParcelIN an IParcel interface from a possible previous hit. May be nil, and will be nil initially.
storyUIDRefOUT Reference to the story containing the returned RangeData. kInvalidUIDRef if no hit.
rangeOUT The hit range (length of 0). This is a model range.
hitIndexOUT the model text index that was hit, may be nil.
adjustedHitIndexOUT the adjusted model text index (rounded). May be nil.
Returns
IParcel Return a parcel at the passed in point. May return nil and still be considered a hit (so storyUIDRef and range would still be filled in for return). Defaults to kTrue.
virtual ErrorCode IDragDropTextUtils::SendDragDropTextSignal (ServiceID id,
IControlViewsourceView,
IControlViewdestinationView,
const UIDRefsourceStoryRef,
RangeDatasourceRange,
const UIDRefdestinationStoryRef,
RangeDatadestinationRange,
RangeDatadroppedRange,
DragDrop::eCommandType type,
IDataExchangeHandlerhandler 
)
pure virtual

Description: Signal all drag drop text responders that a drag text event has just occurred.

Parameters
id,aservice id for what signal is being sent. Must be one of: kBeforeDragTextSignalResponderService - Just before we add text drag content to drag controller. Responder may want to adjust source range (e.g. a partially selected hyperlink). Responder may set global error code to display an alert. kBeforeDropTextSignalResponderService - Just before we create a command to do the drag/drop operation. Responder may set global error code (e.g. some kind of illegal drop that will display an error alert). kAfterDropTextSignalResponderService - Just after the drag/drop command has executed. Responder may want to do extra adjustment (e.g. smart cut/paste to insert/delete extra spaces)
sourceViewIN pointer to the control view for the source for drag/drop operation.
destinationViewIN pointer to the control view for the destination for drag/drop operation. May be same as source. May be nil for kBeforeDropTextSignalResponderService signal.
sourceStoryRefIN the source story that is being dragged.
sourceRangeIN/OUT the source text range that is being dragged. May be modified by responder, and may even have zero length after the drop.
destinationStoryRefIN the destination story that is being dropped. Will be kInvalidUIDRef for kBeforeDragTextSignalResponderService signal.
destinationRangeIN/OUT the destination range for the caret drop location (length of zero) that is being dropped. Will be RangeData(0,0,RangeData::kLeanForward)) for kBeforeDragTextSignalResponderService signal. May be modified by responder.
droppedRangeIN/OUT the dropped range for the drag and drop operation. Will be the length of the sourceRange. This range is used to select the text after the drop. May be modified by responder.
handlerIN the data exchange handler used for the text drag drop operation. Gives responders a place to access stored data.
Returns
error code returned by the responders. First error will terminate the rest of the responders, abort the drag/drop operation. Note: An alert will be displayed (if there is a string corresponding to the error code).
virtual bool16 IDragDropTextUtils::StartTextDrag (IControlViewview,
IDragDropSourcedragSource,
IEventtheEvent 
)
pure virtual

Description: Try to start up a text drag operation with the given view, drag drop source, and event.

Parameters
viewIN pointer to the control view under the mouse
dragSourceIN the drag source to ask if it WillDrag
theEventIN the event that initiated this query.
Returns
bool16 kTrue / kFalse. If returns kTrue, need to return true from tracker or event handler. Drag has been started. Returns kFalse if drag has not be started up.