InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TextAttributeRunIterator.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: zwilliam
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 // Purpose:
24 //
25 //========================================================================================
26 
27 #ifndef __TextAttributeRunIterator__
28 #define __TextAttributeRunIterator__
29 
30 #include "TextRange.h"
31 #include "K2Vector.h"
32 #include "AttributeBossList.h"
33 #include "K2SmartPtr.h"
34 
76 {
77  public:
92  K2Vector<ClassID>::const_iterator firstAttributeClass,
93  K2Vector<ClassID>::const_iterator endOfAttributeClasses);
94 
98  : fCurrentRange(other.fCurrentRange),
99  fEndOfRanges(other.fEndOfRanges),
100  fRunStart(other.fRunStart),
101  fRunEnd(other.fRunEnd),
102  fFirstClass(other.fFirstClass),
103  fEndOfClasses(other.fEndOfClasses),
104  fAttributes(other.fAttributes)
105  {}
106 
108  {}
109 
117  const AttributeBossList& operator * () const;
118 
122  const AttributeBossList * operator -> () const;
123 
129 
133  bool16 operator < (const TextAttributeRunIterator& other) const
134  {
135  if (fCurrentRange < other.fCurrentRange)
136  return kTrue;
137 
138  if (fCurrentRange > other.fCurrentRange)
139  return kFalse;
140 
141  // Both iterators are in the same range of the same text model.
142  if (fRunStart < other.fRunStart)
143  return kTrue;
144 
145  return kFalse;
146  }
147 
150  operator bool()
151  { return fCurrentRange < fEndOfRanges; }
152 
156  ErrorCode ApplyAttributes(const boost::shared_ptr<AttributeBossList>& attributes, const ClassID& which = kCharAttrStrandBoss);
157 
161  ErrorCode ApplyAttribute(IPMUnknown * attribute, const ClassID& which = kCharAttrStrandBoss);
162 
166  { return RangeData( fRunStart, fRunEnd, RangeData::kLeanForward);}
167 
168  private:
169  void UpdateRunEnd(bool16 calledFromConstructor);
170 
173 
174  TextIndex fRunStart;
175  TextIndex fRunEnd;
176 
178  K2Vector<ClassID>::const_iterator fEndOfClasses;
179 
180  AttributeBossList fAttributes;
181 };
182 
183 #endif
184