InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IStoryService.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Wai Cheuk
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 __ISTORYSERVICE__
25 #define __ISTORYSERVICE__
26 
27 #include "IPMUnknown.h"
28 #include "WritingModeUIID2.h"
29 #include "WritingModeID2.h"
30 #include "IFontMgr.h"
31 #include "IDrawingStyle.h"
32 
33 
34 class ITextLines;
35 class IDrawingStyle;
36 class WideString;
37 class LineDescription;
38 class RunDescription;
39 
40 class IStoryService : public IPMUnknown
41 {
42  public:
43 
44  enum { kDefaultIID = IID_ISTORYSERVICE };
45 
46  // Used for galley drawing gets a single chunk of glyphs
47  // that can be drawn in one burst for galley view. Fills out
48  // drawglyphs, widths and invisible characters. Buffers
49  // for these glyphs must be passed to this routine.
50  // It also returns information on what type of glyphs
51  // are being returned with regards to what font style
52  // the glyphs should be drawn in.
53 
54 
73  virtual int32 GetRangeOfDrawGlyphs(UID storyThreadDict,
74  int32 storyThreadKey,
75  ITextLines *textLines,
76  TextIndex rangeStart,
77  int32 textLength,
78  int32 *glyphArray, // space allocated by caller filled out by this method
79  float *widths, // space allocated by caller filled out by this method
80  WideString &text, // returned text
81  PMReal *rangeWidth,
82  IFontMgr::FontStyleBits &fontStyle,
84  bool16 showInvisibles,
85  int32 maxSizeSAllowed,
86  bool16 returnFullText) = 0;
87 
88  // After calling GetRangeOfDrawGlyphs you may call this routine to get the
89  // font to draw in or to measure text with. Galley normally will display in
90  // a single display font family but allows for the possibility that the user
91  // may have used a font having glyphs that are not displayable correctly in
92  // a single display font (such as Symbol font). Galley allows a list of font
93  // overrides to be specified. This routine is aware of those and will always
94  // return the correct font to display text in.
95 
96  virtual IFontInstance *QueryDisplayFontInstanceForCurrentChunk() = 0;
97  virtual IPMFont *QueryDisplayFontForCurrentChunk() = 0;
98 
99  // Return the glyphs for invisible characters. Must have called GetRangeOfDrawGlyphs
100  // for the range of invisibles you are interested in prior to calling these methods.
101  virtual int32 *GetCurrentInvisibles() = 0;
102  virtual float *GetCurrentInvisiblesWidths() = 0;
103  virtual float *GetCurrentInvisiblesYAjustments() = 0;
104  virtual int32 GetCurrentInvisiblesLength() = 0;
105 
106  // Given a widths array from GetRangeOfDrawGlyphs this routine can be used
107  // to find the xPosition from the left of a position.
108  virtual PMReal SumCharWidths(float *widths, int32 numOfCharactersIn) = 0;
109 
110 
111  // Get the text out of a story useful if you don't care
112  // about any style information or glyphs just the straight
113  // text.
114 
115  virtual void GetStoryContent(UID storyThreadDict,
116  int32 storyThreadKey,
117  TextIndex lineStart,
118  int32 textLength,
119  WideString &lineText) = 0; // output
120 
121  virtual TextIndex GetStoryThreadIndex(UID storyThreadDict,
122  int32 storyThreadKey,
123  TextIndex inTextIndex) = 0;
124 
125  // Given the inTextIndex, return the corresponding text
126  // index in the story thread.
127 
128  virtual TextIndex GetStoryThreadEnd(UID storyThreadDict,
129  int32 storyThreadKey,
130  TextIndex inTextIndex) = 0;
131  // Given the inTextIndex, return the corresponding text
132  // last index in the story thread.
133 
134  virtual TextIndex GetTextLineIndex(UID storyThreadDict,
135  int32 storyThreadKey,
136  TextIndex inTextIndex) = 0;
137  // Given the inTextIndex in the story thread, return the
138  // corresponding text index in the main story thread.
139 
140  virtual IFontMgr::FontStyleBits GetFontStyle(IDrawingStyle *drawStyle) = 0;
141 
151  virtual Text::GlyphID ConvertToGlyphUsingPlatformEncoding(IFontInstance *fontInstance, IPMFont *font, UTF32TextChar character, PMReal *glyphWidth) = 0;
152 
156  virtual void ClearGlyphCache() = 0;
157 
175  virtual int32 GetRangeOfDrawGlyphs(UID storyThreadDict,
176  int32 storyThreadKey,
177  ITextLines *textLines,
178  TextIndex rangeStart,
179  int32 textLength,
180  int32 *glyphArray, // space allocated by caller filled out by this method
181  float *widths, // space allocated by caller filled out by this method
182  PMReal *rangeWidth,
183  IFontMgr::FontStyleBits &fontStyle,
185  bool16 showInvisibles,
186  int32 maxSizeSAllowed,
187  bool16 returnFullText) = 0;
188 
189 
190  // Set the current lineDescription
191  virtual void SetCurrentLineDescription(LineDescription* lineDescription) = 0;
192 
193  // Get the current lineDescription
194  virtual LineDescription* GetCurrentLineDescription() = 0;
195 
196  // Set the current runDescription
197  virtual void SetCurrentRunDescription(const RunDescription* runDescription) = 0;
198 
199  // Get the current runDescription
200  virtual const RunDescription* GetCurrentRunDescription() = 0;
201 
202  // Set the offset of the invisibles glyphs (for a run)
203  virtual void SetInvisiblesOffset(float offset) = 0;
204 
205  // Get the offset of the invisibles glyphs (for a run)
206  virtual float GetInvisiblesOffset() = 0;
207 
208 };
209 
210 #endif // __ISTORYSERVICE__
211