InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITextRuns.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Kevin Van Wiel
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 __ITextRuns__
25 #define __ITextRuns__
26 
27 #include "IPMUnknown.h"
28 
29 #include "WritingModeUIID2.h"
30 #include "PMRect.h"
31 #include "UIDList.h"
32 #include "IInterfaceColors.h"
33 #include "LineDescription.h"
34 #include "K2Vector.h"
35 #include "IStoryService.h"
36 
37 class ITextRun;
38 class IGraphicsPort;
39 class IPMFont;
40 class ITextModel;
41 class WideString;
42 class RangeData;
43 
48 {
49  public:
55 
62  RunLocation(int32 lineIndex, int32 runIndex) : fLineIndex(lineIndex), fRunIndex(runIndex) {}
63 
65  int32 fLineIndex;
66 
68  int32 fRunIndex;
69 };
70 
78 class ITextRuns : public IPMUnknown
79 {
80  public:
81  enum { kDefaultIID = IID_ITEXTRUNS };
82 
88  virtual ITextRun *QueryRunInterface(const RunDescription &description) = 0;
89 
96  virtual const RunDescription& GetRun(int32 at, int32 run) = 0;
97 
105  virtual const RunDescription& GetRun(int32 storyIndex, int32 at, int32 run) = 0;
106 
114  virtual bool16 TextRunsContainedInLine(int32 storyIndex, int32 lineIndex) = 0;
115 
128  virtual void DrawRuns(int32 at, IGraphicsPort *gPort, const PMRect &clipRect, const PMPoint &scrollCompensationValue,
129  IPMFont *displayFont, PMReal displaySize, const LineDescription &description, bool16 topLineInDraw) = 0;
130 
144  virtual void DrawRuns(int32 storyIndex, int32 at, IGraphicsPort *gPort, const PMRect &clipRect, const PMPoint &scrollCompensationValue,
145  IPMFont *displayFont, PMReal displaySize, const LineDescription &description, bool16 topLineInDraw) = 0;
146 
147 
155  virtual void CopyRuns(K2Vector<RunDescription> *source, K2Vector<RunDescription> *destination) = 0;
156 
161  virtual void AppendRun(LineDescription& line, RunDescription::RunType runType, TextIndex runStartOffset, TextIndex runEndOffset, UIDRef storyThreadRef, RealAGMColor runColor = RealAGMColor(1.0, 1.0, 1.0)) = 0;
162 
168  virtual int32 GetNumRuns(int32 at) = 0;
169 
176  virtual int32 GetNumRuns(int32 storyIndex, int32 at) = 0;
177 
184  virtual PMRect CalculateRunRect(int32 lineIndex, int32 runIndex) = 0;
185 
192  virtual int32 FindIndexOfRunAtPoint(const PMPoint &point, int32 *lineIndex) = 0;
193 
200  virtual int32 FindIndexOfRunAtPoint(const PMPoint &point, int32 lineIndex) = 0;
201 
207  virtual int32 GetLastRunIndex(int32 lineIndex) = 0;
208 
215  virtual int32 GetLastRunIndex(int32 storyIndex, int32 lineIndex) = 0;
216 
220  virtual PMReal ComputeRunWidth(int32 lineIndex, const RunDescription& runDescription, int32 *runLength) = 0;
221 
226  virtual bool8 GetUseTextRuns() = 0;
227 
235  virtual TextIndex GetLineStartOffsetAtRun(int32 lineIndex, int32 runIndex) = 0;
236 
244  virtual TextIndex GetLineEndOffsetAtRun(int32 lineIndex, int32 runIndex) = 0;
245 
256  virtual bool16 FindCharacterAtXPosition(int32 atLineIndex, int32 atRunIndex, PMReal &xPosition, int32 &offsetIntoLine) = 0;
257 
258 
267  virtual int32 FindIndexOfRunAtTextModelOffset(LineDescription &description, int32 atTextModelOffset) = 0;
268 
276  virtual int32 FindIndexOfRunAtDisplayOffset(TextIndex offset, int32 &offsetIntoRun, bool16 bUsingEndOfLine = kFalse) = 0;
277 
288  virtual UIDRef GetNoteContent(ITextModel* model, TextIndex textStart, int32 &textLength, WideString &textContent, int32 startIndex = -1) = 0;
289 
299  virtual TextIndex FindInitialRunStart(int32 at, int32 runIndex, RunDescription::RunType type) = 0;
300 
311  virtual TextIndex FindInitialRunStart(int32 storyIndex, int32 at, int32 runIndex, RunDescription::RunType type) = 0;
312 
320  virtual RunDescription *FindRunAtDisplayOffset(TextIndex galleyDisplayOffset, int32 lineIndex, int32 *runIndex = nil) = 0;
321 
330  virtual RunDescription *FindRunAtDisplayOffset(int32 storyIndex, TextIndex galleyDisplayOffset, int32 lineIndex, int32 *runIndex = nil) = 0;
331 
348  virtual int32 GetRunChunk(ITextModel *model, const RunDescription &description, TextIndex textStart, int32 textLength, WideString &textContent,
349  float *widths, bool16 showInvisibles, int32 bufferSize, IFontMgr::FontStyleBits &fontStyle, IDrawingStyle::CapitalizeMode &capMode,
350  int32 lineIndex, int32 runIndex) = 0;
351 
369  virtual int32 GetRunChunk(int32 storyIndex, ITextModel *model, const RunDescription &description, TextIndex textStart, int32 textLength, WideString &textContent,
370  float *widths, bool16 showInvisibles, int32 bufferSize, IFontMgr::FontStyleBits &fontStyle, IDrawingStyle::CapitalizeMode &capMode,
371  int32 lineIndex, int32 runIndex) = 0;
372 
373 
393  virtual int32 GetRunChunk(int32 storyIndex, ITextModel *model, const RunDescription &description, TextIndex textStart, int32 textLength,
394  float *widths, bool16 showInvisibles, int32 bufferSize, IFontMgr::FontStyleBits &fontStyle, IDrawingStyle::CapitalizeMode &capMode,
395  int32 lineIndex, int32 runIndex) = 0;
396 
410  virtual PMReal DrawRegularTextRun(int32 at, IGraphicsPort *gPort, IPMFont *displayFont, PMReal displaySize,
411  int32 runIndex, const RealAGMColor &textColor, const PMPoint &drawPt, bool16 showInvisibles) = 0;
412 
420  virtual int32 FindIndexOfRunAtPoint(int32 storyIndex, const PMPoint &point, int32 *lineIndex) = 0;
421 
429  virtual int32 FindIndexOfRunAtPoint(int32 storyIndex, const PMPoint &point, int32 lineIndex) = 0;
430 
431 
442  virtual void DrawLineOverlaps(int32 at, IGraphicsPort *gPort, const PMPoint &scrollCompensationValue,
443  const LineDescription &description, bool16 topLineInDraw, int32 storyIndex) = 0;
444 
458  virtual bool16 GetExtendedRunSpanInformation(int32 storyIndex, const RunLocation &runIndex, RunDescription::RunType type,
459  RangeData *displayIndexRange,
460  RunLocation *extendedRunStart, RunLocation *extendedRunEnd) = 0;
461 };
462 
463 #endif // __ITextRuns__