InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITextAttributeSuite.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 // ADOBE CONFIDENTIAL
24 //
25 // Notes:
26 //
27 //========================================================================================
28 
29 #ifndef __ITextAttributeSuite__
30 #define __ITextAttributeSuite__
31 
32 #include "IPMUnknown.h"
33 #include "TextID.h"
34 #include "AttributeBossList.h"
35 #include "ICommand.h"
36 #include "IDrawingStyle.h"
37 #include "ICompositionStyle.h"
38 #include "IHyphenationStyle.h"
39 #include "ITextAttrFigureStyle.h"
40 #include "IMojikumiStyle.h"
41 
43 
50 {
51  public:
52  enum { kDefaultIID = IID_ITEXTATTRIBUTE_ISUITE };
53 
54  public:
55 
56  //________________________________________________________________________________________
57  // DESCR: Return the number of unique attributes bosses for the specified class.
58  //
59  // RETURNS: Count of attributes or 0
60  //________________________________________________________________________________________
61  virtual int32 CountAttributes(ClassID attr) = 0;
62 
63  //________________________________________________________________________________________
64  // DESCR: Query the N-th ("which" - a zero based index) attribute of the specified
65  // class for the specified interface.
66  //________________________________________________________________________________________
67  virtual const IPMUnknown* QueryAttributeN(int32 which, ClassID attr, PMIID interfaceID) = 0;
68 
69  //________________________________________________________________________________________
70  // DESCR: Apply the new attributes in the "appliedAttrBossList" and remove the
71  // attributes in "removedAttrBossList".
72  //
73  // RETURNS: Error Code.
74  //________________________________________________________________________________________
75  virtual ErrorCode ApplyAttributes(const AttributeBossList* applied, ClassID strandID) = 0;
76  // !!! To do: It's really unfortunate to perpetuate this exposure of the strandID
77 
78  //________________________________________________________________________________________
79  // DESCR: Copy attribute classes with a single attribute boss into "attrList".
80  // Copy attribute classes with 2 or more unique attributes into "mixedList".
81  //________________________________________________________________________________________
82  virtual void CopyToAttributeLists(AttributeBossList* attrList, AttributeBossList* mixedList = nil ) = 0;
83 
84  //________________________________________________________________________________________
85  // DESCR: Returns the number of paragraph styles in the selection
86  //________________________________________________________________________________________
87  virtual int32 CountParagraphStyles() = 0;
88 
89  //________________________________________________________________________________________
90  // DESCR: Returns the N-th (0-based) paragraph style in the selection
91  //________________________________________________________________________________________
92  virtual UID GetNthParagraphStyle(int32 n) = 0;
93 
94  //________________________________________________________________________________________
95  // DESCR: Returns the number of character styles in the selection
96  //________________________________________________________________________________________
97  virtual int32 CountCharacterStyles() = 0;
98 
99  //________________________________________________________________________________________
100  // DESCR: Returns the N-th (0-based) paragraph style in the selection
101  //________________________________________________________________________________________
102  virtual UID GetNthCharacterStyle(int32 n) = 0;
103 
104  //________________________________________________________________________________________
105  // DESCR: Returns the number of paragraph styles in the selection
106  //________________________________________________________________________________________
107  virtual int32 CountRunInCharacterStyles() = 0;
108 
109  //________________________________________________________________________________________
110  // DESCR: Returns the N-th (0-based) paragraph style in the selection
111  //________________________________________________________________________________________
112  virtual UID GetNthRunInCharacterStyle(int32 n) = 0;
113 
114  //________________________________________________________________________________________
115  // DESCR: Returns kTrue if the specified style is overridden in the selection
116  //________________________________________________________________________________________
117  virtual bool16 IsStyleOverridden(UID style) = 0;
118 
119  //________________________________________________________________________________________
120  // DESCR: How many different runs of attributes are selected?
121  //________________________________________________________________________________________
122  virtual int32 CountSelectedRuns() = 0;
123 
124  //________________________________________________________________________________________
125  // DESCR: Returns the number of fonts in the selection
126  //________________________________________________________________________________________
127  virtual int32 CountFonts(ClassID fontUIDBoss = kTextAttrFontUIDBoss) = 0;
128 
129  //________________________________________________________________________________________
130  // DESCR: Returns the N-th (0-based) font in the selection
131  //________________________________________________________________________________________
132  virtual PMString GetNthFont(int32 n, bool16* incorrectFace = nil, ClassID fontUIDBoss = kTextAttrFontUIDBoss, ClassID fontStyleBoss = kTextAttrFontStyleBoss) = 0;
133  virtual UID GetNthFamilyUIDAndFace(int32 n, PMString * faceName, ClassID fontUIDBoss = kTextAttrFontUIDBoss, ClassID fontStyleBoss = kTextAttrFontStyleBoss) = 0;
134 
135  //________________________________________________________________________________________
136  // DESCR: ???
137  //________________________________________________________________________________________
138  virtual const Fixed* GetNthMMAxes(int32 n, int32 *numaxes) = 0;
139 
140  virtual bool16 CanApplyAttributes() const = 0;
141 
142  // Currently, CanQueryAttributes() is only used when we determine if a para/char style can be created or not.
143  // We allow to create a para/char style if the selection contains logic text ranges.
144  // For text/table selection, CanQueryAttributes() will always return kTrue.
145  // For layout selection, CanQueryAttributes() will return kFalse if the selection
146  // does not have text frame included, otherwise, it will always return kTrue.
147  // See bug #619781 for more info. --- Yeming Liu(07/30/2003).
148  virtual bool16 CanQueryAttributes() const = 0;
149 
150  typedef enum { kOff, kOn, kMixed, kUnavailable, kUninitialized } FeatureState;
151 
152  // General Setters/Accessors
153  virtual ErrorCode ApplyAttribute(const IPMUnknown * attribute) = 0;
154 
155  virtual ErrorCode ToggleBooleanAttribute(ClassID attributeClass) = 0;
156  virtual ErrorCode SetBooleanAttribute(ClassID attributeClass, bool16 theValue) = 0;
157  virtual FeatureState GetBooleanAttributeState(ClassID attributeClass) = 0;
158 
159  virtual ErrorCode ToggleInt16Attribute(ClassID attributeClass, int16 onValue, int16 offValue) = 0;
160  virtual ErrorCode SetInt16Attribute(ClassID attributeClass, int16 theValue) = 0;
161  virtual FeatureState GetInt16AttributeState(ClassID attributeClass, int16 theValue) = 0;
162 
163  virtual ErrorCode SetRealNumberAttribute(ClassID attributeClass, PMReal theValue) = 0;
164  virtual bool16 GetRealNumberAttributeValue(ClassID attributeClass, PMReal * pValue) = 0;
165  // Returns kTrue if the selection contained only one value for this attribute
166  // and returns the attribute value in pValue;
167  // Returns kFalse if the attribute contained multiple values for the current
168  // selection or there were no attribute for the ClassID (and the value returned
169  // in pValue is undefined).
170 
171 
172  // Specific Setters/Accessors
173  virtual ErrorCode ClearTypeStyleAttributes() = 0;
174  virtual ErrorCode ToggleBold() = 0;
175  virtual ErrorCode ToggleItalic() = 0;
176 
177  virtual ErrorCode ToggleBaselineGrid() = 0;
178  virtual FeatureState GetBaselineGridState() = 0;
179 
180  virtual ErrorCode ToggleUnderline() = 0;
181  virtual FeatureState GetUnderlineState() = 0;
182 
183  virtual ErrorCode ToggleCapsMode(IDrawingStyle::CapitalizeMode theMode) = 0;
184  virtual FeatureState GetCapsModeState(IDrawingStyle::CapitalizeMode theMode) = 0;
185 
186  virtual ErrorCode TogglePositionMode(IDrawingStyle::PositionMode positionMode) = 0;
187  virtual FeatureState GetPositionModeState(IDrawingStyle::PositionMode positionMode) = 0;
188 
189  virtual ErrorCode ToggleHyphenationMethod(IHyphenationStyle::HyphenationMethod hyphenationMethod) = 0;
190  virtual ITextAttributeSuite::FeatureState GetHyphenationMethodState(IHyphenationStyle::HyphenationMethod hyphenationMethod) = 0;
191 
192  virtual ErrorCode SetFigureStyle(ITextAttrFigureStyle::FigureStyle figureStyle) = 0;
193  virtual FeatureState GetFigureStyleState(ITextAttrFigureStyle::FigureStyle figureStyle) = 0;
194 
195  virtual ErrorCode ToggleStylisticSet(int32 whichSet) = 0;
196  virtual FeatureState GetOTStylisticSetState(int32 whichSet) = 0;
197 
198  virtual ErrorCode SetAlignment(ICompositionStyle::TextAlignment align) = 0;
199 
200  virtual ErrorCode IncrementRealNumberAttribute(ClassID attributeClass, PMReal incrementAmt,
201  const PMString& undoIncreaseString, const PMString& undoDecreaseString) = 0;
202 
203  virtual ErrorCode IncrementPointSize(PMReal amount) = 0;
204  virtual ErrorCode IncrementLeading(PMReal amount) = 0;
205  virtual ErrorCode IncrementTracking(PMReal amount) = 0;
206  virtual ErrorCode IncrementBaselineShift(PMReal amount) = 0;
207  virtual ErrorCode IncrementWordSpace(PMReal amount) = 0;
208 
209  typedef enum { kIgnoreCharacterStyles, kRemoveCharacterStyles } CharStyleParam;
210  typedef enum { kApplySingleStyle, kAutoApplyNextStyle } NextStyleParam;
211  typedef enum { kRemoveOldStyle, kMaintainOldStyleAttrs } StyleToAttrParam;
212 
217  virtual ErrorCode ApplyStyle(UID styleUID, bool16 clearOverrides = kFalse, CharStyleParam removeCharacterStyles = kIgnoreCharacterStyles,
218  NextStyleParam autoNextStyle = kApplySingleStyle, StyleToAttrParam oldStyleAttrs = kMaintainOldStyleAttrs) = 0;
219 
220  virtual ErrorCode ClearCharacterOverrides() = 0;
221  virtual ErrorCode ClearParagraphOverrides() = 0;
222  virtual ErrorCode ClearIndentOverrides() = 0;
223  virtual bool16 CanClearIndentOverrides() = 0;
224  virtual ErrorCode ClearAllOverrides() = 0;
225 
226  virtual ErrorCode SetCharAlignment(IDrawingStyle::CharacterHang theMode) = 0;
227  virtual FeatureState GetCharAlignmentState(IDrawingStyle::CharacterHang theMode) = 0;
228 
229  virtual ErrorCode SetKinsokuType(IMojikumiStyle::KinsokuType theMode) = 0;
230  virtual FeatureState GetKinsokuTypeState(IMojikumiStyle::KinsokuType theMode) = 0;
231 
232  virtual ErrorCode ToggleKinsokuHangType(IMojikumiStyle::KinsokuHangType theMode) = 0;
233  virtual FeatureState GetKinsokuHangTypeState(IMojikumiStyle::KinsokuHangType theMode) = 0;
234 
235  virtual ErrorCode ToggleGridAlignmentMetric(Text::GridAlignmentMetric theMode) = 0;
236  virtual FeatureState GetGridAlignmentMetricState(Text::GridAlignmentMetric theMode) = 0;
237 
238  virtual ErrorCode SetLeadingModel(Text::LeadingModel theMode) = 0;
239  virtual FeatureState GetLeadingModelState(Text::LeadingModel theMode) = 0;
240 
241  virtual bool16 CanRemoveFormatting() const = 0;
242  virtual ErrorCode RemoveFormatting() = 0;
243 
244  virtual bool16 AdjacentParagraphsSelected() const = 0;
245  virtual bool16 ContainsParagraphStyleOverrides() const = 0;
246  // Are there paragraph style overrides within the selected range of characters?
247 
248  virtual bool16 SelectedParagraphsIncludeOverrides() const = 0;
249  // Are there paraagraph style overrides within the paragraphs intersected by the selection?
250 
251  virtual bool16 SelectedParagraphsIncludeCharStyles() const = 0;
252  // Are there character styles used (other than "[None]") within the paragraphs intersected by the selection?
253 
254  virtual bool16 CheckSelectionForRuby() = 0;
255  virtual ErrorCode SetRubyNone() = 0;
256 
257  virtual ErrorCode AdjustSelectionForBoolAttribute(ITextSelectionSuite * textSelectionSuite, ClassID attrClass) = 0;
258 
259  // This takes all ruby runs in the selection and makes sure that the ruby attr and ruby string attr matches
260  virtual ErrorCode SynchRubyAttrToRubyStrand() = 0;
261 
262  //________________________________________________________________________________________
263  // DESCR: Fills the vector of strings passed in with the names of the current overrides
264  // (to be used to display the overrides in the tool tip)
265  // @param K2Vector<PMString>& overrideStrings
266  // @param useParaStyle kTrue -- paragraph style, kFalse -- characterStyle
267  // @return bool16 true if the overrides are mixed
268  //________________________________________________________________________________________
269  virtual bool16 FillStringListWithOverrides(K2Vector<PMString>& overrideStrings, bool16 useParaStyle) const = 0;
270 
271  virtual ErrorCode SetPositionalForm(IDrawingStyle::OTPositioningForm form) = 0;
272  virtual FeatureState CheckPositionalForm(IDrawingStyle::OTPositioningForm check) const = 0;
273  virtual ErrorCode ChangeParagraphDirection(ICompositionStyle::ParagraphDirection paraDir) = 0;
274 
275  //________________________________________________________________________________________
276  // DESCR: Apply the new attributes in the "appliedAttrBossList" with the specified undo ability type
277  //
278  // RETURNS: Error Code.
279  //________________________________________________________________________________________
280  virtual ErrorCode ApplyAttributes(const AttributeBossList* applied, ClassID strandID, ICommand::Undoability undoabilityFlag) = 0;
281 
282 };
283 
284 #endif
285