InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ISplineUIUtils.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Lonnie Millett
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __ISplineUIUtils__
25 #define __ISplineUIUtils__
26 
27 #include "SplineUIID.h"
28 #include "IPMUnknown.h"
29 #include "Utils.h"
30 
31 #include "IShape.h"
32 #include "PMPathPoint.h"
33 #include "PMRect.h"
34 #include "HitTestDragConstants.h"
35 #include "CursorSpec.h"
36 #include "ISplineState.h"
37 
38 class ICommand;
39 class IControlView;
40 class IPathGeometry;
41 class UIDList;
42 
43 #define kInvalidParameter -1.0 //valid values for spline curve parameter are 0 <= u <= 1.0
44 
46 const bool16 kUpdateMotion = kTrue;
47 const bool16 kDontUpdateMotion = kFalse;
48 const bool16 kDeleteMotion = kTrue;
49 const bool16 kDontDeleteMotion = kFalse;
50 
55 class ISplineUIUtils : public IPMUnknown
56 {
57 public:
58  enum { kDefaultIID = IID_ISPLINEUIUTILS };
59 
60  //Hit testing for cursor providers and trackers
61  typedef enum {
62  kDontCheckSelection = 0, //Check all path objects in the spread hierarchy, some of which may be selected (excludes standoffs)
63  kDoCheckSelection, //Check the selection first (in order to include their standoffs), as well as the hierarchy
64  kOnlyCheckSelection, //Check only selected path objects (includes standoffs)
65  kExcludeSelection //Check only path objects that aren't selected (excludes standoffs)
66  } CheckOption;
67 
72  virtual ISplineState::SplineState GetSplineState( IControlView* view = nil ) = 0;
73 
87  virtual ErrorCode SetSplineState( const UIDRef& document,
88  IControlView* view = nil,
89  const UIDRef& pathItem = UIDRef::gNull,
90  const UIDRef& motionItem = UIDRef::gNull,
91  const UIDRef& motionOwnerItem = UIDRef::gNull,
92  int32 pathIndex = -1,
93  int32 pointIndex = -1,
94  bool16 bUpdateMotionItem = kUpdateMotion,
95  bool16 bDeleteMotionItem = kDeleteMotion,
96  bool16 bScheduleCmd = kFalse) = 0;
97 
98  virtual ISplineState* QueryDocSplineState( IControlView* view = nil ) = 0;
99 
100  virtual bool16 HitTestCurrentPathBeginPoint( const SysPoint& globalLocation ) = 0;
101 
102  virtual bool16 HitTestCurrentPathEndPoint( const SysPoint& globalLocation ) = 0;
103 
104  virtual bool16 HitTestOtherPathEndPoints( const SysPoint& globalLocation,
105  UIDRef* pathItem = nil,
106  int32* pathIndex = nil,
107  int32* pointIndex = nil ) = 0;
108 
109  virtual bool16 HitTestAnyPathEndPoints( const SysPoint& globalLocation, //Includes a closed, single-point path
110  UIDRef* pathItem= nil,
111  int32* pathIndex = nil,
112  int32* pointIndex = nil,
113  int32 hitTestFlags = IShape::kDirectSelect,
114  bool16 allVisibleSpreads = kTrue, //if kFalse, check only current spread
115  int32 tolerance = kHitTestTolerance) = 0;
116 
117  virtual bool16 HitTestAnyPathMidPoints( const SysPoint& globalLocation, //Includes all points on a closed, multi-point path
118  CheckOption checkOpt,
119  UIDRef* pathItem = nil,
120  int32* pathIndex = nil,
121  int32* pointIndex = nil,
122  int32 hitTestFlags = IShape::kDirectSelect,
123  bool16 allVisibleSpreads = kTrue ) = 0; //if kFalse, check only current spread
124 
125  virtual bool16 HitTestAnyPathPoints( const SysPoint& globalLocation,
126  CheckOption checkOpt,
127  UIDRef* pathItem = nil,
128  int32* pathIndex = nil,
129  int32* pointIndex = nil,
130  int32 hitTestFlags = IShape::kDirectSelect,
131  bool16 allVisibleSpreads = kTrue, //if kFalse, check only current spread
132  int32 tolerance = kHitTestTolerance) = 0;
133 
134  virtual bool16 HitTestAnyPathHandles( const SysPoint& globalLocation,
135  CheckOption checkOpt,
136  UIDRef* pathItem,
137  PointSelector* selector,
138  int32 hitTestFlags = IShape::kDirectSelect,
139  bool16 allVisibleSpreads = kTrue, //if kFalse, check only current spread
140  bool16 testTextFrameHandles = kFalse ) = 0; //TODO: Would be better if text frame handles were adornments to avoid special case
141 
142  virtual bool16 HitTestAnyPathSegments( const SysPoint& globalLocation,
143  CheckOption checkOpt,
144  UIDRef* pathItem = nil,
145  int32* pathIndex = nil,
146  int32* segmentIndex = nil,
147  PMReal* curveParameter = nil,
148  int32 hitTestFlags = IShape::kDirectSelect,
149  bool16 allVisibleSpreads = kTrue, //if kFalse, check only current spread
150  int32 tolerance = kHitTestTolerance) = 0;
151 
152  //check for hit on parts of a particular item
153  virtual bool16 HitTestPathEndPoints( const SysPoint& globalLocation, IPMUnknown* pageItem, int32* pathIndex, int32* pointIndex, int32 tolerance = kHitTestTolerance ) = 0;
154  virtual bool16 HitTestPathMidPoints( const SysPoint& globalLocation, IPMUnknown* pageItem, int32* pathIndex, int32* pointIndex ) = 0;
155  virtual bool16 HitTestPathPoints( const SysPoint& globalLocation, IPMUnknown* pageItem, int32* pathIndex, int32* pointIndex, int32 tolerance = kHitTestTolerance ) = 0;
156  virtual bool16 HitTestPathPoint( const SysPoint& globalLocation, const PBPMPathPoint& pathPoint, int32 tolerance = kHitTestTolerance ) = 0;
157  virtual bool16 HitTestPathHandles( const SysPoint& globalLocation, IPMUnknown* pageItem, PointSelector* selector ) = 0;
158  virtual bool16 HitTestPathHandle( const SysPoint& globalLocation, PBPMPathPoint pathPoint, PathPointIndex& handleHit, int32 tolerance = kHitTestTolerance ) = 0;
159  virtual bool16 HitTestPathSegments( const SysPoint& globalLocation, IPMUnknown* pageItem, int32* pathIndex, int32* segmentIndex, PMReal* curveParameter, int32 tolerance = kHitTestTolerance ) = 0;
160 
161  virtual bool16 HitTestPathFills( const PBPMPoint& location, IPMUnknown* pageItem, int32* pathIndex ) = 0;
162 
163  //check for hit on a particular segment
164  virtual bool16 HitTestPathSegment( const PBPMPoint& location, IPMUnknown* pageItem, int32 pathIndex, int32 segmentIndex, PMReal* curveParameter ) = 0;
165  virtual bool16 HitTestPathSegment( const PBPMRect& r, IPMUnknown* pageItem, int32 pathIndex, int32 segmentIndex ) = 0;
166 
167  /* Return kTrue if item has a "fake" center point handle, kFalse if not.
168  @param pageItem [IN] The geometry for the page item to possibly draw center handle for.
169  */
170  virtual bool16 HasCenterPoint(IGeometry* pageItem) = 0;
171 
172  /* Check for hit on center point of a particular item. Center point is only draw for spline shapes with no 'X' drawn and no center point.
173  @param pageItem [IN] The geometry for the page item to hit test.
174  @param centerPoint [IN] Pasteboard coordinates of point to test.
175  @param tolerance [IN] The hit test slop to use, typically kHitTestTolerance.
176  */
177  virtual bool16 HitTestCenterPoint(IControlView* view, IGeometry* pageItem, const PBPMPoint& where, int16 tolerance) = 0;
178 
185  virtual void GetRotationCursor(const PBPMPoint& where, const PBPMPoint& centerPoint, CursorSpec& spec) = 0;
186 
187  //Used by add point trackers to get the revised path points
188  virtual void GetNewPathPoints( IPathGeometry* pathGeom,
189  int32 pathIndex,
190  int32 pointIndex,
191  const PMReal& curveParameter,
192  PBPMPathPoint& newPathPtBefore,
193  PBPMPathPoint& newPathPtAt,
194  PBPMPathPoint& newPathPtAfter ) = 0;
195 
196  //Tests whether another anchor point in theItem's path geometry intersects pbBounds (typically
197  // used to ensure an object will remain on the pasteboard even if currentPt is moved off it)
198  virtual bool16 AnotherAnchorPointIntersects( const UIDRef& theItem, const PointSelector& currentPt, const PBPMRect& pbBounds ) = 0;
199 
200  // Tests whether an item can be broken into two separate page items. Scissors tool uses this when operating on open paths.
201  virtual bool16 IsSplitAllowed( const UIDRef& item ) = 0;
202 };
203 
204 
205 #endif // __ISplineUIUtils__