InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IWaxStrand.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: zwilliam
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 __IWaxStrand__
25 #define __IWaxStrand__
26 
27 #include "IPMUnknown.h"
28 #include "TextID.h"
29 #include "CTextEnum.h"
30 #include "K2Vector.h"
31 #include "ParcelKey.h"
32 
33 class IWaxLine;
34 class IParcelList;
35 class PMReal;
36 class IWaxIterator;
37 class PMPoint;
38 class PMRect;
39 class PMLineSeg;
40 class PMMatrix;
41 class IGraphicsContext;
42 class ITextModel;
43 class IComposeScanner;
44 class ITiler;
45 class IParcel;
46 class ITextParcelList;
47 class IComposeScanner;
48 class IParagraphComposer;
49 class IFrameList;
50 class IControlView;
51 #ifdef DEBUG
52 class CompositionTic;
53 #endif
54 #include "IStrand.h"
55 
56 typedef std::pair<IWaxLine*, int32> WaxLineApplyEntry;
57 DECLARE_BASE_TYPE(WaxLineApplyEntry);
59 
60 class IdleTimer;
61 
66 class IWaxStrand : public IPMUnknown
67 {
68 public:
69  enum { kDefaultIID = IID_IWAXSTRAND };
70 
71 #ifdef DEBUG
72  virtual void TraceStrandContents() = 0;
73 #endif
74 
75  virtual void MarkInsertDamage(TextIndex at, int32 amt) = 0;
76  virtual void MarkDeleteDamage(TextIndex start, int32 length,
77  bool16 paraStrandAfter = kTrue) = 0;
78 
79  // mark change damage should be filtered through the text model : ForceRecompositionDamage()
80  virtual void MarkChangeDamage(TextIndex start, int32 length, bool16 addOneToLength = kFalse) = 0;
81 
82  enum CheckForKeeps { kDontCheckForKeeps = 0, kCheckForKeeps = 1 };
83  enum TreatAsOverset { kDontTreatAsOverset = 0, kTreatAsOverset = 1 };
84  virtual void MarkGeometryDamage(TextIndex start, int32 length,
85  CheckForKeeps checkForKeeps = kCheckForKeeps,
86  TreatAsOverset treatAsOverset = kDontTreatAsOverset,
87  int32 limitLeanLeftParcelIndex = kInvalidParcelIndex) = 0;
88 
89  virtual void MarkRegenDamage(TextIndex start, int32 length) = 0;
90  virtual void MarkContentDamage(TextIndex start, int32 length,
91  CheckForKeeps checkForKeeps = kCheckForKeeps) = 0;
92 
98  virtual IWaxIterator* NewWaxIterator(bool16 changeAware = kFalse) const = 0;
105  virtual const IWaxIterator * NewReadOnlyWaxIterator() const = 0;
106 
107  virtual IWaxLine* QueryNewWaxLine() const = 0;
108  virtual void ApplyLineIntoWax(IParcelList* pl,
109  IWaxLine* waxLine,
110  TextIndex waxLineTextIndex,
111  int32 waxLineSpan,
112  bool16 disableApplyInval) = 0;
113  virtual void NewDeferredInval() = 0;
114  virtual void AddDeferredInval(TextIndex at, bool16 disableInval,
115  bool16 forceInkCache) = 0;
116  virtual void EndDeferredInval() = 0;
117 
118  enum {kLeanRight = 0, kLeanLeft = 1};
119  virtual bool16 GetTextIndexToWaxLineData(TextIndex index,
120  bool16 leanLeft,
121  int32 *pOffsetWithinLine = nil,
122  int32 *pTextSpan = nil,
123  ParcelKey *pParcelKey = nil,
124  UID *pFrameUID = nil,
125  PMReal *pLineHeight = nil,
126  PMLineSeg *pSelection = nil,
127  PMPoint *pWaxPt = nil, // YPosition
128  PMMatrix *pWaxToFrameMatrix = nil,
129  PMMatrix *pWaxToGlyphMatrix = nil) = 0;
130 
131  virtual bool16 GetTextCaretLine( IFrameList* frameList,
132  const IControlView* layoutView,
133  TextIndex index,
134  bool16 leanLeft,
135  PMLineSeg* pCaretLine,
136  UIDRef& textFrameUIDRef,
137  ParcelKey& parcelKey) = 0;
138 
139  // This interface exists for legacy purposes, it internally calls
140  // GetTextIndexToWaxLineData(). You should use that one too. pLocationHit
141  // is returned in pasteboard coordinates BUT without having done any
142  // waxToGlyphTransformation.
143  virtual ITextFrameColumn * QueryFrameContaining(TextIndex indexHit,
144  bool16 leanLeft /* = kFalse*/,
145  PMPoint * pLocationHit = nil, // pasteboard coord.
146  PMReal * hitLineSelectionTop = nil,
147  PMReal * hitLineSelectionBottom = nil) = 0;
148 
150  {
151  PMReal prevSelectionBottom; // valid if !prevInvalid
152  PMReal prevSelectionTop;
153 
154  PMReal thisSelectionTop;
155  PMReal thisSelectionBottom;
156 
157  PMReal nextSelectionTop; // valid if !nextInvalid
158 
159  IWaxLine *waxLine;
160  int32 localOffset;
161  bool16 prevInvalid; // kTrue if no interfering neighbor
162  bool16 nextInvalid; // kTrue if no interfering neighbor
163 
165  prevSelectionBottom(0.), prevSelectionTop(0.),
166  thisSelectionTop(0.), thisSelectionBottom(0.),
167  nextSelectionTop(0.), waxLine(nil),
168  localOffset(0), prevInvalid(kFalse), nextInvalid(kFalse)
169  { }
170  };
171 
172  virtual void CallbackWaxIterator(TextIndex start,
173  bool16 (*callback)(void *priv,
174  const CallbackWaxIteratorData *),
175  void *callback_priv) = 0;
176 
177  //
178  // Return the ParagraphComposer for the given WaxLine.
179  //
180  virtual IParagraphComposer * QueryComposer(ITextModel* textModel,
181  const IWaxLine* waxLine,
182  TextIndex waxLineTextIndex) = 0;
183 
185  virtual IParagraphComposer* QueryComposer(ClassID composerID) = 0;
186 
187  //
188  // Notification of the creation/deletion of a StoryThread.
189  //
190  virtual void StoryThreadCreated(TextIndex prevThreadStart,
191  int32 prevThreadSpan,
192  TextIndex newThreadStart,
193  int32 newThreadSpan) = 0;
194 
195  virtual void StoryThreadDeleted(TextIndex prevThreadStart,
196  int32 prevThreadSpan,
197  TextIndex oldThreadStart,
198  int32 oldThreadSpan) = 0;
199 
200  //
201  // FreezeDamage
202  // For internal use. This method allows for a performance optimization by flipping
203  // a flag that bypasses damage recording in wax. If damage is frozen all calls
204  // to MarkChangeDamage and MargRegenDamage are ignored.
205  // If used incorrectly this could leave the wax in a bad state and out of sync with
206  // the the model. The idea is to freeze damaging of wax in cases where we know that
207  // everything is damaged to start with.
208  // The freeze flag is non persistent. So make sure you hold on to the IWaxStrand interface
209  // for the scope of the freeze/unfreeze.
210  // Returns the previous freeze damage state
211  virtual bool16 FreezeDamage(bool16 freeze) = 0;
212  virtual int32 MarkPasteDamage(TextIndex pos, int32 len) = 0;
213  virtual ITextModel * QueryTextModel() = 0;
214 
215  // Adobe internal use only
216  virtual void ConvertAnnaTableFrameWaxLines(TextIndex at, int32 lineCount) = 0;
217  virtual void MarkReplaceDamage(const boost::shared_ptr<ITextModel::ReplacementList >& replList) = 0;
218 #ifdef DEBUG
219  virtual void CheckFishyWaxWorld() const = 0;
220 #endif
221 };
222 
223 #endif