InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITextGrid.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: dwaterfa
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 __ITextGrid__
25 #define __ITextGrid__
26 
27 
28 #include "IPMUnknown.h"
29 #include "PMRect.h"
30 #include "TextID.h"
31 #include "CTextEnum.h"
32 
33 
37 class ITextGrid : public IPMUnknown
38 {
39  public:
40  enum { kDefaultIID = IID_ITEXTGRID };
41 
42  //
43  // Returns the top-to-top distance between grid cells. For single
44  // dimensional (baseline) grids, this is simply the distance between
45  // adjacent lines. For two dimensional cell-based (CJK) grids, this is
46  // the distance between the same position on adjacent cells.
47  //
48  // Text Frames which do not have grids enabled will return 0.0.
49  //
50  virtual PMReal GetVerticalSpacing() const = 0;
51 
52  //
53  // Some grids, such as InDesign J text frame grids will have
54  // a text size that is a component of vertical spacing.
55  // GetGridHasTextSize returns whether or not the grid has
56  // a text size. And GetGridTextSize returns the text size.
57  //
58  virtual bool16 GetGridHasTextSize() const = 0;
59  virtual PMReal GetGridTextSize() const = 0;
60 
61  //
62  // Adjusts the top and bottom points by moving them down (or up)
63  // relative to the Text Frame to achieve the desired vertical
64  // alignment.
65  //
66  // pYTop Address of top and bottom values for the tile to
67  // pYBottom be aligned.
68  //
69  // These values are adjusted only if the the grid was
70  // effective.
71  //
72  // alignmentMetric These two argument work together to determine what
73  // alignmentOffset part of the above tile is aligned to what part of
74  // the grid.
75  //
76  // The alignmentMetric determines WHAT position in the
77  // grid is to be aligned to.
78  //
79  // kGABaseline Roman baseline
80  // kGAEmTop/Center/Bottom Top/Center/Bottom of the
81  // Em Box
82  // kGAICFTop/Center/Bottom Top/Center/Bottom of the
83  // ICF Box
84  //
85  // The alignmentOffset then determines what position
86  // in the tile is the snap point as an offset from
87  // *pYBottom. A value of zero would simply have the
88  // bottom of the tile aligned to the specified point
89  // on the grid.
90  //
91  // A negative value will cause the tile to align above
92  // *pYBottom and a positive value will cause the tile
93  // to align below *pYBottom.
94  //
95  // To align Roman composed text to the Roman baseline
96  // of any grid simply specify (kGABaseline, 0.0).
97  //
98  // To align Japanese composed text to top of the EmBox
99  // of a grid simply specify (kEmBoxTop, -EmBoxHeight).
100  //
101  // pParcelRelative The value pointed to by this argument will be set
102  // to indicate if the location of the effective grid
103  // is relative to the Parcel (kTrue) or not (kFalse).
104  //
105  // Note that this value DOES NOT indicate that tile
106  // was adjusted by the grid. Implementations should
107  // return the appropriate value even if the values
108  // were not adjusted.
109  //
110  // This information is used by the Text System to
111  // determine what should happen to the composed
112  // WaxLine when the Parcel is moved. If the
113  // effective grid is local then the WaxLine can be
114  // left alone, otherwise it will be recomposed.
115  //
116  // Returns kFalse The adjustment forced us outside the Parcel.
117  // kTrue The final position, whether it was moved or
118  // not, is within the Parcel.
119  //
120  virtual bool16 AlignVertically(PMReal *pYTop, PMReal *pYBottom,
121  Text::GridAlignmentMetric alignmentMetric,
122  PMReal alignmentOffset,
123  bool16 *pParcelRelative) const = 0;
124 
125 };
126 #endif
127