InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IParagraphComposer.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: ?
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 __IParagraphComposer__
25 #define __IParagraphComposer__
26 
27 #include "IPMUnknown.h"
28 #include "ParcelKey.h"
29 #include "OwnedItemDataList.h"
30 #include "CTextEnum.h"
31 #include "PMRect.h" // for PMRectCollection
32 #include "PMMatrix.h"
33 #include "TextID.h"
34 #include "AttributeBossList.h"
35 
36 class IDataBase;
37 class IParcelList;
38 class ITextParcelList;
39 class ITextModel;
40 class IParcel;
41 class IComposeScanner;
42 class IWaxLine;
43 class IWaxIterator;
44 class IdleTimer;
45 class ITextOptions;
46 class IStoryOptions;
47 class IPairKernDict;
48 class IEdgeAlignDict;
51 class ILanguage;
52 
57 {
58 public:
59  enum { kDefaultIID = IID_IPARAGRAPHCOMPOSER };
60  enum { kDefaultServiceID = kTextEngineService };
61 
64  class Tiler
65  {
66  protected:
68  Tiler();
69 
70  private:
72  Tiler(const Tiler& copy);
74  Tiler& operator=(const Tiler& copy);
75 
76  public:
78  virtual ~Tiler() { }
79 
81  virtual IParcelList* GetParcelList() const = 0;
82 
89  virtual ParcelKey GetFirstParcelKey() const = 0;
90 
97  virtual ParcelKey GetNextParcelKey(ParcelKey key) const = 0;
98 
100  virtual bool16 GetHasAnyValidStartBreakLocation() const = 0;
101 
103  virtual bool16 GetParcelIsValidStartBreakLocation(ParcelKey key,
104  Text::StartBreakLocation mode) const = 0;
105 
117  Text::StartBreakLocation mode) const = 0;
118 
125  virtual ParcelKey GetPreviousParcelKey(ParcelKey key) const = 0;
126 
127  //
128  // This method will adjust the specified ParcelKeys and YPosition to
129  // the top of the desired break location. If the specified key and
130  // position is already at the top of the desired break location then
131  // they are unchanged. Returns kTrue if the position changed.
132  //
133  virtual bool16 MoveToTopNextParcelByBreak(Text::StartBreakLocation mode,
134  ParcelKey* pKey,
135  PMReal* pYPosition) const = 0;
136 
138  virtual PMRect GetParcelContentBounds(ParcelKey key) const = 0;
139 
141  virtual bool16 GetParcelContentIsAnArea(ParcelKey key) const = 0;
142 
147  virtual bool16 GetHasAnyIntrusionsAt(ParcelKey key) const = 0;
148 
149  //
150  // The Parcel itself can have a grid or the grid can bleed through
151  // from the PageGrid. Either way we return the effective vertical
152  // spacing of 0.0 if no grid is active.
153  //
154  virtual PMReal GetParcelEffectiveVerticalSpacing(ParcelKey key) const = 0;
155 
157  virtual UID GetParcelFrameUID(ParcelKey key) const = 0;
158 
160  virtual PMMatrix GetParcelContentToFrameMatrix(ParcelKey key) const = 0;
161 
163  virtual bool16 GetParcelAppearsMultiplePlaces(ParcelKey key) const = 0;
164 
173  // Returns
174  // kFalse Tile is at top of the Parcel but the specified top of Parcel
175  // alignment doesn't match the Parcel's.
176  //
177  // pParcelKey set the Parcel Key
178  // pYOffset set to the top of the Parcel
179  // pTOPAlignment set to the Parcel TOP alignment value
180  // pAtTOP set to kTrue
181  //
182  // The caller should simply re-call the method with the same
183  // values returned for ParcelIndex and yPosition but specify
184  // a TOP alignment compatible with the Parcel.
185  //
186  // kTrue A tile was found that fits the desired criteria.
187  //
188  // pParcelKey set to the Parcel Key (invalid if overset)
189  // pYOffset set to bottom of the returned tile
190  // pTOPAlignment set to the Parcel TOP alignment value
191  // pAtTOP set to kTrue if tile is at the top of
192  // the Parcel, kFalse otherwise.
193  // pParcelPositionDependent set to kTrue if the position of
194  // the tile was dependent on the
195  // position of the Parcel.
196  // Typically indicates that the
197  // tile was aligned to a non-
198  // Parcel relative grid.
199  // pLeftMargin set to the left margin of the Parcel
200  // pRightMargin set to the right margin of the Parcel
201  // tiles has the returned tile(s)
202  //
203  virtual bool16 GetTiles(PMReal minWidth,
204  PMReal height,
205  PMReal TOPHeight,
206  Text::GridAlignmentMetric gridAlignment,
207  PMReal gridAlignmentAdj,
208  Text::LeadingModel leadingModel,
209  PMReal leading,
210  PMReal leadingModelOffset,
211  PMReal minHeightLeadingDiff,
212  TextIndex nCurrentPosition,
213  bool16 affectedByVerticalJustification,
214  ParcelKey *pParcelKey,
215  PMReal *pYOffset,
216  Text::FirstLineOffsetMetric *pTOPHeightMetric,
217  PMRectCollection& tiles,
218  bool16 *pAtTOP,
219  bool16 *pParcelPositionDependent,
220  PMReal *pLeftMargin,
221  PMReal *pRightMargin) const = 0;
222 
224  virtual PMReal GetParcelGrowableContentBottom(ParcelKey key) const = 0;
225 
226  //
227  // In the context of the composing paragraph
228  //
229  // This method will return the Parcel Content Top plus any skipped area
230  // due to active TileableTopAdj. Note that Content Top will allready
231  // include any EffectiveTopAdj.
232  //
233  virtual PMReal GetParcelTileableContentTop(ParcelKey key) const = 0;
234 
235  //
236  // In the context of the composing paragraph
237  //
238  // This method will return the GrowableContentBottom minus any skipped
239  // ranges.
240  //
241  // Note: This method may only be called during composition and only by
242  // composers that have committed to compose their WaxLine in the
243  // specified or later Parcel. The internal composition support
244  // code will consider this call notification that the composing
245  // WaxLine wishes to do so and will resolve pending composing,
246  // such as footnotes at the time of this call.
247  //
248  virtual PMReal GetParcelTileableContentBottom(ParcelKey key) const = 0;
249 
261  virtual bool16 GetParcelShouldInvalNewWax(ParcelKey key) const = 0;
262 
263  };
264 
265 
266  class RecomposeHelper : public Tiler
267  {
268  protected:
270  RecomposeHelper();
271 
272  private:
274  RecomposeHelper(const RecomposeHelper& copy);
276  RecomposeHelper& operator=(const RecomposeHelper& copy);
277 
278  public:
280  virtual ~RecomposeHelper() { }
281 
282  virtual IDataBase* GetDataBase() const = 0;
283 
285  virtual IComposeScanner* GetComposeScanner() const = 0;
286 
288  virtual TextIndex GetThreadStart() const = 0;
289 
291  virtual int32 GetThreadSpan() const = 0;
292 
294  virtual TextIndex GetThreadEnd() const = 0;
295 
297  virtual TextIndex GetParagraphStart() const = 0;
298 
300  virtual int32 GetParagraphSpan() const = 0;
301 
303  virtual TextIndex GetParagraphEnd() const = 0;
304 
306  virtual const ITextParcelList* GetTextParcelList() const = 0;
307 
308  virtual bool16 ShouldFakeTabAlignToChar() const = 0;
309 
311  virtual const ITextOptions* GetTextOptions() const = 0;
312 
314  virtual const IStoryOptions* GetStoryOptions() const = 0;
315 
317  virtual bool16 GetIsVertical() const = 0;
318 
320  virtual IPairKernDict* GetPairKernDict(ClassID whichAlgorithm) const = 0;
321 
323  virtual IEdgeAlignDict* GetEdgeAlignDict(ClassID whichAlgorithm) const = 0;
324 
326  virtual IHyphenationService* GetSimpleHyphenator() const = 0;
327 
329  virtual IHyphenationService* GetHyphenator(const ILanguage* pLanguage) const = 0;
330 
332  virtual IHyphenationExceptions* GetHyphenationExceptions(bool16 *pCheckUserDictionary) const = 0;
333 
339  virtual IdleTimer* GetIdleTimer() const = 0;
340 
347  virtual const OwnedItemDataList::const_iterator GetOwnedItemBeginIter() const = 0;
348 
355  virtual const OwnedItemDataList::const_iterator GetOwnedItemEndIter() const = 0;
356 
363  virtual bool16 GetOwnedItemsHaveStandOffsIn(TextIndex start, TextIndex end) const = 0;
364 
371  virtual TextIndex GetStartingTextIndex() const = 0;
372 
374  virtual ParcelKey GetStartingParcelKey() const = 0;
375 
377  virtual PMReal GetStartingYPosition() const = 0;
378 
384  virtual bool16 GetKeptWithPrevByNextNLines() const = 0;
385 
391  virtual bool16 GetKeptWithPrevByFirstNLines() const = 0;
392 
398  virtual bool16 GetKeptWithPrevByAllLines() const = 0;
399 
404  virtual bool16 GetIsContentDamaged() const = 0;
405 
410  virtual bool16 GetIsKeepsDamaged() const = 0;
411 
418  virtual bool16 GetParagraphCalculatedStateInvalid() const = 0;
419 
423  virtual TextIndex GetWaxLineTextIndex() const = 0;
424 
430  virtual ParcelKey GetWaxLineParcelKey() const = 0;
431 
437  virtual PMReal GetWaxLineCompositionYPosition() const = 0;
438 
444  virtual PMReal GetWaxLineLineHeightLeadingDiff() const = 0;
445 
451  virtual bool16 GetWaxLineKeepsViolation() const = 0;
452 
457  virtual int32 GetWaxLineTextSpan() const = 0;
458 
464  virtual const IWaxLine* GetPreviousWaxLine() const = 0;
465 
471  virtual TextIndex GetPreviousWaxLineTextIndex() const = 0;
472 
481  virtual uchar GetPreviousHyphenLadderPattern() const = 0;
482 
487  virtual IWaxIterator * NewWaxIterator(bool16 changeAware = kFalse) const = 0;
488 
507  virtual bool16 BackupTowardsParagraphStart() = 0;
508 
520  virtual bool16 BackupOneLineTowardsParagraphStart() = 0;
521 
526  virtual bool16 DestroyAllWaxLinesInParagraph() = 0;
527 
533  virtual void OwnedItemsChanged() = 0;
534 
536  virtual IWaxLine* QueryNewWaxLine() const = 0;
537 
551  virtual void ApplyComposedLine(IWaxLine* newWaxLine,
552  int32 newTextSpan,
553  bool16 disableApplyDamage = kFalse,
554  bool16 disableApplyInval = kFalse,
555  bool16 forceInkCache = kFalse) = 0;
556 
561  virtual void SetNoShuffle() = 0;
562 
569  virtual void MarkContentDamage(int32 nChars) = 0;
570 
587  virtual void ResetDamageToContent() = 0;
588 
596  virtual void MarkContentDamagePreviousAt(TextIndex at) = 0;
597 
600  virtual void SetDeferredCompositionDueToKeeps() = 0;
601 
605  virtual TextIndex GetNoDamageBackTextIndex() = 0;
606 
610  virtual int32 GetShapingEngine() const = 0;
611 
615  virtual void SetShapingEngine(int32 shapingEngine) = 0;
616  };
617 
623  virtual bool16 Recompose(RecomposeHelper* helper) = 0;
624 
625 
627  {
628  protected:
630  RebuildHelper();
631 
632  private:
634  RebuildHelper(const RebuildHelper& copy);
636  RebuildHelper& operator=(const RebuildHelper& copy);
637 
638  public:
640  virtual ~RebuildHelper() { }
641 
642  virtual IDataBase* GetDataBase() const = 0;
643 
645  virtual IComposeScanner* GetComposeScanner() const = 0;
646 
648  virtual TextIndex GetThreadStart() const = 0;
649 
651  virtual int32 GetThreadSpan() const = 0;
652 
654  virtual TextIndex GetThreadEnd() const = 0;
655 
657  virtual TextIndex GetParagraphStart() const = 0;
658 
660  virtual int32 GetParagraphSpan() const = 0;
661 
663  virtual TextIndex GetParagraphEnd() const = 0;
664 
666  virtual const IParcelList* GetParcelList() const = 0;
667 
669  virtual const ITextParcelList* GetTextParcelList() const = 0;
670 
671  virtual bool16 ShouldFakeTabAlignToChar() const = 0;
672 
674  virtual const ITextOptions* GetTextOptions() const = 0;
675 
677  virtual const IStoryOptions* GetStoryOptions() const = 0;
678 
680  virtual bool16 GetIsVertical() const = 0;
681 
683  virtual IPairKernDict* GetPairKernDict(ClassID whichAlgorithm) const = 0;
684 
686  virtual IEdgeAlignDict* GetEdgeAlignDict(ClassID whichAlgorithm) const = 0;
687 
689  virtual IHyphenationService* GetSimpleHyphenator() const = 0;
690 
692  virtual IHyphenationService* GetHyphenator(const ILanguage* pLanguage) const = 0;
693 
695  virtual IHyphenationExceptions* GetHyphenationExceptions(bool16 *pCheckUserDictionary) const = 0;
696 
698  virtual TextIndex GetTextIndex() const = 0;
699 
701  virtual const IWaxLine* GetWaxLine() const = 0;
702 
708  virtual const IWaxLine* GetPreviousWaxLine() const = 0;
709 
710  virtual UID GetParcelFrameUID() const = 0;
711 
712  virtual PMRect GetParcelContentBounds() const = 0;
713  virtual bool16 IsParcelContentAnArea() const = 0;
714  virtual PMReal GetParcelEffectiveVerticalSpacing() const = 0;
715 
721  virtual const OwnedItemDataList::const_iterator GetOwnedItemBeginIter() const = 0;
722 
728  virtual const OwnedItemDataList::const_iterator GetOwnedItemEndIter() const = 0;
729 
733  virtual int32 GetShapingEngine() const = 0;
734 
738  virtual void SetShapingEngine(int32 shapingEngine) = 0;
739 
740  };
741 
747  virtual bool16 RebuildLineToFit(RebuildHelper* helper) = 0;
748 
755  virtual bool16 RebuildLineWithOverrides(IParagraphComposer::RebuildHelper* helper, const AttributeBossList *overrides, bool16 clearOverrides=kFalse) = 0;
756 
757 };
758 
759 #endif