33 var _sharedDefaultParagraphStyle,
39 CPTextAlignment _alignment;
40 unsigned _firstLineHeadIndent;
43 unsigned _paragraphSpacing;
44 unsigned _minimumLineHeight;
45 unsigned _maximumLineHeight;
46 unsigned _lineSpacing;
51 #pragma mark Class methods 55 if (!_sharedDefaultParagraphStyle)
56 _sharedDefaultParagraphStyle = [
self new];
58 return _sharedDefaultParagraphStyle;
61 + (CPArray)_defaultTabStops
63 if (!_defaultTabStopArray)
66 _defaultTabStopArray = [];
69 for (i = 1; i < 16 ; i++)
75 return _defaultTabStopArray;
80 #pragma mark Init methods 84 [
self _initWithDefaults];
93 _tabStops = [other._tabStops
copy];
94 _alignment = other._alignment;
95 _firstLineHeadIndent = other._firstLineHeadIndent;
96 _headIndent = other._headIndent;
97 _tailIndent = other._tailIndent;
98 _paragraphSpacing = other._paragraphSpacing;
99 _minimumLineHeight = other._minimumLineHeight;
100 _maximumLineHeight = other._maximumLineHeight;
101 _lineSpacing = other._lineSpacing;
106 - (void)_initWithDefaults
109 _tabStops = [[[
self class] _defaultTabStops] copy];
114 _tabStops.push(aStop);
119 var other = [[
self class] alloc];
139 - (id)initWithCoder:(
id)aCoder
145 _tabStops = [aCoder decodeObjectForKey:"CPParagraphStyleTabStopsKey"];
146 _alignment = [aCoder decodeIntForKey:"CPParagraphStyleAlignmentKey"];
147 _firstLineHeadIndent = [aCoder decodeIntForKey:"CPParagraphStyleFirstLineHeadIndentKey"];
148 _headIndent = [aCoder decodeIntForKey:"CPParagraphStyleHeadIndentKey"];
149 _tailIndent = [aCoder decodeIntForKey:"CPParagraphStyleTailIndentKey"];
150 _paragraphSpacing = [aCoder decodeIntForKey:"CPParagraphStyleParagraphSpacingKey"];
151 _minimumLineHeight = [aCoder decodeIntForKey:"CPParagraphStyleMinimumLineHeightKey"];
152 _maximumLineHeight = [aCoder decodeIntForKey:"CPParagraphStyleMaximumLineHeightKey"];
153 _lineSpacing = [aCoder decodeIntForKey:"CPParagraphStyleLineSpacingKey"];
159 - (void)encodeWithCoder:(
id)aCoder
161 [aCoder encodeInt:_alignment forKey:"CPParagraphStyleAlignmentKey"];
162 [aCoder encodeObject:_tabStops forKey:"CPParagraphStyleTabStopsKey"];
163 [aCoder encodeInt:_firstLineHeadIndent forKey:"CPParagraphStyleFirstLineHeadIndentKey"];
164 [aCoder encodeInt:_headIndent forKey:"CPParagraphStyleHeadIndentKey"];
165 [aCoder encodeInt:_tailIndent forKey:"CPParagraphStyleTailIndentKey"];
166 [aCoder encodeInt:_paragraphSpacing forKey:"CPParagraphStyleParagraphSpacingKey"];
167 [aCoder encodeInt:_minimumLineHeight forKey:"CPParagraphStyleMinimumLineHeightKey"];
168 [aCoder encodeInt:_maximumLineHeight forKey:"CPParagraphStyleMaximumLineHeightKey"];
169 [aCoder encodeInt:_lineSpacing forKey:"CPParagraphStyleLineSpacingKey"];
182 - (id)initWithType:(CPTabStopType) aType location:(
double) aLocation
184 if ([
self = [super
init]])
187 _location = aLocation;
201 - (id)initWithCoder:(
id)aCoder
207 _type = [aCoder decodeIntForKey:"CPTextTabTypeKey"];
208 _location = [aCoder decodeDoubleForKey:"CPTextTabLocationKey"];
214 - (void)encodeWithCoder:(
id)aCoder
216 [aCoder encodeInt:_type forKey:"CPTextTabTypeKey"];
217 [aCoder encodeDouble:_location forKey:"CPTextTabLocationKey"];
235 - (void)setTabStops:(CPArray)aValue
243 - (CPTextAlignment)alignment
251 - (void)setAlignment:(CPTextAlignment)aValue
259 - (unsigned)firstLineHeadIndent
261 return _firstLineHeadIndent;
267 - (void)setFirstLineHeadIndent:(
unsigned)aValue
269 _firstLineHeadIndent = aValue;
275 - (unsigned)headIndent
283 - (void)setHeadIndent:(
unsigned)aValue
285 _headIndent = aValue;
291 - (unsigned)tailIndent
299 - (void)setTailIndent:(
unsigned)aValue
301 _tailIndent = aValue;
307 - (unsigned)paragraphSpacing
309 return _paragraphSpacing;
315 - (void)setParagraphSpacing:(
unsigned)aValue
317 _paragraphSpacing = aValue;
323 - (unsigned)minimumLineHeight
325 return _minimumLineHeight;
331 - (void)setMinimumLineHeight:(
unsigned)aValue
333 _minimumLineHeight = aValue;
339 - (unsigned)maximumLineHeight
341 return _maximumLineHeight;
347 - (void)setMaximumLineHeight:(
unsigned)aValue
349 _maximumLineHeight = aValue;
355 - (unsigned)lineSpacing
363 - (void)setLineSpacing:(
unsigned)aValue
365 _lineSpacing = aValue;
383 - (void)setTabStopType:(
int)aValue
399 - (void)setLocation:(
double)aValue
var CPParagraphStyleTabStopsKey
var CPParagraphStyleFirstLineHeadIndentKey
CPParagraphStyleAttributeName
var CPParagraphStyleAlignmentKey
var CPParagraphStyleTailIndentKey
var CPParagraphStyleMinimumLineHeightKey
CPParagraphStyle initWithParagraphStyle:(CPParagraphStyle other)
var CPParagraphStyleMaximumLineHeightKey
CPTextAlignment CPLeftTextAlignment
var CPParagraphStyleLineSpacingKey
var CPParagraphStyleHeadIndentKey
var CPParagraphStyleParagraphSpacingKey