Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: core/src/fpdfdoc/pdf_vt.h

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #define _PDF_VT_H_ 7 #define _PDF_VT_H_
8 class CPVT_Size; 8 class CPVT_Size;
9 class CPVT_FloatRect; 9 class CPVT_FloatRect;
10 struct CPVT_SectionInfo; 10 struct CPVT_SectionInfo;
11 struct CPVT_LineInfo; 11 struct CPVT_LineInfo;
12 struct CPVT_WordInfo; 12 struct CPVT_WordInfo;
13 class CLine; 13 class CLine;
14 class CLines; 14 class CLines;
15 class CSection; 15 class CSection;
16 class CTypeset; 16 class CTypeset;
17 class CPDF_EditContainer; 17 class CPDF_EditContainer;
18 class CPDF_VariableText; 18 class CPDF_VariableText;
19 class CPDF_VariableText_Iterator; 19 class CPDF_VariableText_Iterator;
20 #define IsFloatZero(f)» » » » » » ((f) < 0.0001 && (f) > -0.0001) 20 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
21 #define IsFloatBigger(fa,fb)» » » » ((fa) > (fb) && !IsFloat Zero((fa) - (fb))) 21 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
22 #define IsFloatSmaller(fa,fb)» » » » ((fa) < (fb) && !IsFloat Zero((fa) - (fb))) 22 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
23 template<class T> T FPDF_MIN (const T & i, const T & j) 23 template <class T>
24 { 24 T FPDF_MIN(const T& i, const T& j) {
25 return ((i < j) ? i : j); 25 return ((i < j) ? i : j);
26 } 26 }
27 template<class T> T FPDF_MAX (const T & i, const T & j) 27 template <class T>
28 { 28 T FPDF_MAX(const T& i, const T& j) {
29 return ((i > j) ? i : j); 29 return ((i > j) ? i : j);
30 } 30 }
31 class CPVT_Size 31 class CPVT_Size {
32 { 32 public:
33 public: 33 CPVT_Size() : x(0.0f), y(0.0f) {}
34 CPVT_Size() : x(0.0f), y(0.0f) 34 CPVT_Size(FX_FLOAT x, FX_FLOAT y) {
35 { 35 this->x = x;
36 } 36 this->y = y;
37 CPVT_Size(FX_FLOAT x, FX_FLOAT y) 37 }
38 { 38 FX_FLOAT x, y;
39 this->x = x; 39 };
40 this->y = y; 40 class CPVT_FloatRect : public CFX_FloatRect {
41 } 41 public:
42 FX_FLOAT x, y; 42 CPVT_FloatRect() { left = top = right = bottom = 0.0f; }
43 }; 43 CPVT_FloatRect(FX_FLOAT left, FX_FLOAT top, FX_FLOAT right, FX_FLOAT bottom) {
44 class CPVT_FloatRect : public CFX_FloatRect 44 this->left = left;
45 { 45 this->top = top;
46 public: 46 this->right = right;
47 CPVT_FloatRect() 47 this->bottom = bottom;
48 { 48 }
49 left = top = right = bottom = 0.0f; 49 CPVT_FloatRect(const CPDF_Rect& rect) {
50 } 50 this->left = rect.left;
51 CPVT_FloatRect(FX_FLOAT left, FX_FLOAT top, 51 this->top = rect.top;
52 FX_FLOAT right, FX_FLOAT bottom) 52 this->right = rect.right;
53 { 53 this->bottom = rect.bottom;
54 this->left = left; 54 }
55 this->top = top; 55 void Default() { left = top = right = bottom = 0.0f; }
56 this->right = right; 56 FX_FLOAT Height() const {
57 this->bottom = bottom; 57 if (this->top > this->bottom) {
58 } 58 return this->top - this->bottom;
59 CPVT_FloatRect(const CPDF_Rect & rect) 59 } else {
60 { 60 return this->bottom - this->top;
61 this->left = rect.left; 61 }
62 this->top = rect.top; 62 }
63 this->right = rect.right;
64 this->bottom = rect.bottom;
65 }
66 void Default()
67 {
68 left = top = right = bottom = 0.0f;
69 }
70 FX_FLOAT Height() const
71 {
72 if(this->top > this->bottom) {
73 return this->top - this->bottom;
74 } else {
75 return this->bottom - this->top;
76 }
77 }
78 }; 63 };
79 struct CPVT_SectionInfo { 64 struct CPVT_SectionInfo {
80 CPVT_SectionInfo() : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps (NULL) 65 CPVT_SectionInfo()
81 { 66 : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps(NULL) {}
82 } 67 virtual ~CPVT_SectionInfo() {
83 virtual ~CPVT_SectionInfo() 68 if (pSecProps) {
84 { 69 delete pSecProps;
85 if (pSecProps) { 70 }
86 delete pSecProps; 71 if (pWordProps) {
87 } 72 delete pWordProps;
88 if (pWordProps) { 73 }
89 delete pWordProps; 74 }
90 } 75 CPVT_SectionInfo(const CPVT_SectionInfo& other)
91 } 76 : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps(NULL) {
92 CPVT_SectionInfo(const CPVT_SectionInfo & other): rcSection(), nTotalLine(0) , pSecProps(NULL), pWordProps(NULL) 77 operator=(other);
93 { 78 }
94 operator = (other); 79 void operator=(const CPVT_SectionInfo& other) {
95 } 80 if (this == &other) {
96 void operator = (const CPVT_SectionInfo & other) 81 return;
97 { 82 }
98 if (this == &other) { 83 this->rcSection = other.rcSection;
99 return; 84 this->nTotalLine = other.nTotalLine;
100 } 85 if (other.pSecProps) {
101 this->rcSection = other.rcSection; 86 if (pSecProps) {
102 this->nTotalLine = other.nTotalLine; 87 *pSecProps = *other.pSecProps;
103 if (other.pSecProps) { 88 } else {
104 if (pSecProps) { 89 pSecProps = FX_NEW CPVT_SecProps(*other.pSecProps);
105 *pSecProps = *other.pSecProps; 90 }
106 } else { 91 }
107 pSecProps = FX_NEW CPVT_SecProps(*other.pSecProps); 92 if (other.pWordProps) {
108 } 93 if (pWordProps) {
109 } 94 *pWordProps = *other.pWordProps;
110 if (other.pWordProps) { 95 } else {
111 if (pWordProps) { 96 pWordProps = FX_NEW CPVT_WordProps(*other.pWordProps);
112 *pWordProps = *other.pWordProps; 97 }
113 } else { 98 }
114 pWordProps = FX_NEW CPVT_WordProps(*other.pWordProps); 99 }
115 } 100 CPVT_FloatRect rcSection;
116 } 101 FX_INT32 nTotalLine;
117 } 102 CPVT_SecProps* pSecProps;
118 CPVT_FloatRect» » » » rcSection; 103 CPVT_WordProps* pWordProps;
119 FX_INT32» » » » » nTotalLine;
120 CPVT_SecProps*» » » » pSecProps;
121 CPVT_WordProps*» » » » pWordProps;
122 }; 104 };
123 struct CPVT_LineInfo { 105 struct CPVT_LineInfo {
124 CPVT_LineInfo() : nTotalWord(0), nBeginWordIndex(-1), nEndWordIndex(-1), 106 CPVT_LineInfo()
125 fLineX(0.0f), fLineY(0.0f), fLineWidth(0.0f), fLineAscent(0.0f), fLineDe scent(0.0f) 107 : nTotalWord(0),
126 { 108 nBeginWordIndex(-1),
127 } 109 nEndWordIndex(-1),
128 FX_INT32» » » » » nTotalWord; 110 fLineX(0.0f),
129 FX_INT32» » » » » nBeginWordIndex; 111 fLineY(0.0f),
130 FX_INT32» » » » » nEndWordIndex; 112 fLineWidth(0.0f),
131 FX_FLOAT» » » » » fLineX; 113 fLineAscent(0.0f),
132 FX_FLOAT» » » » » fLineY; 114 fLineDescent(0.0f) {}
133 FX_FLOAT» » » » » fLineWidth; 115 FX_INT32 nTotalWord;
134 FX_FLOAT» » » » » fLineAscent; 116 FX_INT32 nBeginWordIndex;
135 FX_FLOAT» » » » » fLineDescent; 117 FX_INT32 nEndWordIndex;
118 FX_FLOAT fLineX;
119 FX_FLOAT fLineY;
120 FX_FLOAT fLineWidth;
121 FX_FLOAT fLineAscent;
122 FX_FLOAT fLineDescent;
136 }; 123 };
137 struct CPVT_WordInfo : public CFX_Object { 124 struct CPVT_WordInfo : public CFX_Object {
138 CPVT_WordInfo() : Word(0), nCharset(0), 125 CPVT_WordInfo()
139 fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps( NULL) 126 : Word(0),
140 { 127 nCharset(0),
141 } 128 fWordX(0.0f),
142 CPVT_WordInfo(FX_WORD word, FX_INT32 charset, FX_INT32 fontIndex, CPVT_WordP rops * pProps): 129 fWordY(0.0f),
143 Word(word), nCharset(charset), fWordX(0.0f), fWordY(0.0f), fWordTail(0.0 f), 130 fWordTail(0.0f),
144 nFontIndex(fontIndex), pWordProps(pProps) 131 nFontIndex(-1),
145 { 132 pWordProps(NULL) {}
146 } 133 CPVT_WordInfo(FX_WORD word,
147 virtual ~CPVT_WordInfo() 134 FX_INT32 charset,
148 { 135 FX_INT32 fontIndex,
149 if (pWordProps) { 136 CPVT_WordProps* pProps)
150 delete pWordProps; 137 : Word(word),
151 } 138 nCharset(charset),
152 } 139 fWordX(0.0f),
153 CPVT_WordInfo(const CPVT_WordInfo & word): Word(0), nCharset(0), 140 fWordY(0.0f),
154 fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps( NULL) 141 fWordTail(0.0f),
155 { 142 nFontIndex(fontIndex),
156 operator = (word); 143 pWordProps(pProps) {}
157 } 144 virtual ~CPVT_WordInfo() {
158 void operator = (const CPVT_WordInfo & word) 145 if (pWordProps) {
159 { 146 delete pWordProps;
160 if (this == &word) { 147 }
161 return; 148 }
162 } 149 CPVT_WordInfo(const CPVT_WordInfo& word)
163 this->Word = word.Word; 150 : Word(0),
164 this->nCharset = word.nCharset; 151 nCharset(0),
165 this->nFontIndex = word.nFontIndex; 152 fWordX(0.0f),
166 if (word.pWordProps) { 153 fWordY(0.0f),
167 if (pWordProps) { 154 fWordTail(0.0f),
168 *pWordProps = *word.pWordProps; 155 nFontIndex(-1),
169 } else { 156 pWordProps(NULL) {
170 pWordProps = FX_NEW CPVT_WordProps(*word.pWordProps); 157 operator=(word);
171 } 158 }
172 } 159 void operator=(const CPVT_WordInfo& word) {
173 } 160 if (this == &word) {
174 FX_WORD» » » » » » Word; 161 return;
175 FX_INT32» » » » » nCharset; 162 }
176 FX_FLOAT» » » » » fWordX; 163 this->Word = word.Word;
177 FX_FLOAT» » » » » fWordY; 164 this->nCharset = word.nCharset;
178 FX_FLOAT» » » » » fWordTail; 165 this->nFontIndex = word.nFontIndex;
179 FX_INT32» » » » » nFontIndex; 166 if (word.pWordProps) {
180 CPVT_WordProps*» » » » pWordProps; 167 if (pWordProps) {
168 *pWordProps = *word.pWordProps;
169 } else {
170 pWordProps = FX_NEW CPVT_WordProps(*word.pWordProps);
171 }
172 }
173 }
174 FX_WORD Word;
175 FX_INT32 nCharset;
176 FX_FLOAT fWordX;
177 FX_FLOAT fWordY;
178 FX_FLOAT fWordTail;
179 FX_INT32 nFontIndex;
180 CPVT_WordProps* pWordProps;
181 }; 181 };
182 struct CPVT_FloatRange { 182 struct CPVT_FloatRange {
183 CPVT_FloatRange() : fMin(0.0f), fMax(0.0f) 183 CPVT_FloatRange() : fMin(0.0f), fMax(0.0f) {}
184 { 184 CPVT_FloatRange(FX_FLOAT min, FX_FLOAT max) : fMin(min), fMax(max) {}
185 } 185 FX_FLOAT Range() const { return fMax - fMin; }
186 CPVT_FloatRange(FX_FLOAT min, FX_FLOAT max) : fMin(min), fMax(max) 186 FX_FLOAT fMin, fMax;
187 { 187 };
188 } 188 template <class TYPE>
189 FX_FLOAT Range() const 189 class CPVT_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
190 { 190 public:
191 return fMax - fMin; 191 FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
192 } 192 TYPE GetAt(int nIndex) const {
193 FX_FLOAT fMin, fMax; 193 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) {
194 }; 194 return CFX_ArrayTemplate<TYPE>::GetAt(nIndex);
195 template<class TYPE> class CPVT_ArrayTemplate : public CFX_ArrayTemplate<TYPE> 195 }
196 { 196 return NULL;
197 public: 197 }
198 FX_BOOL IsEmpty() 198 void RemoveAt(int nIndex) {
199 { 199 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) {
200 return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; 200 CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);
201 } 201 }
202 TYPE GetAt(int nIndex) const 202 }
203 { 203 };
204 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) { 204 class CLine : public CFX_Object {
205 return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); 205 public:
206 } 206 CLine();
207 return NULL; 207 virtual ~CLine();
208 } 208 CPVT_WordPlace GetBeginWordPlace() const;
209 void RemoveAt(int nIndex) 209 CPVT_WordPlace GetEndWordPlace() const;
210 { 210 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
211 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) { 211 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
212 CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex); 212 CPVT_WordPlace LinePlace;
213 } 213 CPVT_LineInfo m_LineInfo;
214 } 214 };
215 }; 215 class CLines {
216 class CLine : public CFX_Object 216 public:
217 { 217 CLines() : m_nTotal(0) {}
218 public: 218 virtual ~CLines() { RemoveAll(); }
219 CLine(); 219 FX_INT32 GetSize() const { return m_Lines.GetSize(); }
220 virtual ~CLine(); 220 CLine* GetAt(FX_INT32 nIndex) const { return m_Lines.GetAt(nIndex); }
221 CPVT_WordPlace GetBegin WordPlace() const; 221 void Empty() { m_nTotal = 0; }
222 CPVT_WordPlace GetEndWo rdPlace() const; 222 void RemoveAll() {
223 CPVT_WordPlace GetPrevW ordPlace(const CPVT_WordPlace & place) const; 223 for (FX_INT32 i = 0, sz = GetSize(); i < sz; i++) {
224 CPVT_WordPlace GetNextW ordPlace(const CPVT_WordPlace & place) const; 224 delete GetAt(i);
225 CPVT_WordPlace LinePlac e; 225 }
226 CPVT_LineInfo m_LineIn fo; 226 m_Lines.RemoveAll();
227 }; 227 m_nTotal = 0;
228 class CLines 228 }
229 { 229 FX_INT32 Add(const CPVT_LineInfo& lineinfo) {
230 public: 230 if (m_nTotal >= GetSize()) {
231 CLines() : m_nTotal(0) {} 231 if (CLine* pLine = FX_NEW CLine) {
232 virtual ~CLines() 232 pLine->m_LineInfo = lineinfo;
233 { 233 m_Lines.Add(pLine);
234 RemoveAll(); 234 return m_nTotal++;
235 } 235 }
236 FX_INT32 GetSize( ) const 236 return m_nTotal;
237 { 237 } else {
238 return m_Lines.GetSize(); 238 if (CLine* pLine = GetAt(m_nTotal)) {
239 } 239 pLine->m_LineInfo = lineinfo;
240 CLine * GetAt(FX_INT32 nIndex) const 240 }
241 { 241 return m_nTotal++;
242 return m_Lines.GetAt(nIndex); 242 }
243 } 243 }
244 void Empty() 244 void Clear() {
245 { 245 for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) {
246 m_nTotal = 0; 246 delete GetAt(i);
247 } 247 m_Lines.RemoveAt(i);
248 void RemoveAll() 248 }
249 { 249 }
250 for (FX_INT32 i = 0, sz = GetSize(); i < sz; i++) { 250
251 delete GetAt(i); 251 private:
252 } 252 CPVT_ArrayTemplate<CLine*> m_Lines;
253 m_Lines.RemoveAll(); 253 FX_INT32 m_nTotal;
254 m_nTotal = 0; 254 };
255 } 255 class CSection : public CFX_Object {
256 FX_INT32 Add(cons t CPVT_LineInfo & lineinfo) 256 friend class CTypeset;
257 { 257
258 if (m_nTotal >= GetSize()) { 258 public:
259 if (CLine * pLine = FX_NEW CLine) { 259 CSection(CPDF_VariableText* pVT);
260 pLine->m_LineInfo = lineinfo; 260 virtual ~CSection();
261 m_Lines.Add(pLine); 261 void ResetAll();
262 return m_nTotal++; 262 void ResetLineArray();
263 } 263 void ResetWordArray();
264 return m_nTotal; 264 void ResetLinePlace();
265 } else { 265 CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
266 if (CLine * pLine = GetAt(m_nTotal)) { 266 const CPVT_WordInfo& wordinfo);
267 pLine->m_LineInfo = lineinfo; 267 CPVT_WordPlace AddLine(const CPVT_LineInfo& lineinfo);
268 } 268 void ClearWords(const CPVT_WordRange& PlaceRange);
269 return m_nTotal++; 269 void ClearWord(const CPVT_WordPlace& place);
270 } 270 CPVT_FloatRect Rearrange();
271 } 271 CPVT_Size GetSectionSize(FX_FLOAT fFontSize);
272 void Clear() 272 CPVT_WordPlace GetBeginWordPlace() const;
273 { 273 CPVT_WordPlace GetEndWordPlace() const;
274 for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) { 274 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
275 delete GetAt(i); 275 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
276 m_Lines.RemoveAt(i); 276 void UpdateWordPlace(CPVT_WordPlace& place) const;
277 } 277 CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
278 } 278 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx,
279 private: 279 const CPVT_WordPlace& lineplace) const;
280 CPVT_ArrayTemplate<CLine*> m_Lines; 280 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx,
281 FX_INT32 m_nTotal ; 281 const CPVT_WordRange& range) const;
282 }; 282
283 class CSection : public CFX_Object 283 public:
284 { 284 CPVT_WordPlace SecPlace;
285 friend class CTypeset; 285 CPVT_SectionInfo m_SecInfo;
286 public: 286 CLines m_LineArray;
287 CSection(CPDF_VariableText * pVT); 287 CPVT_ArrayTemplate<CPVT_WordInfo*> m_WordArray;
288 virtual ~CSection(); 288
289 void ResetAll(); 289 private:
290 void ResetLineArray(); 290 void ClearLeftWords(FX_INT32 nWordIndex);
291 void ResetWordArray(); 291 void ClearRightWords(FX_INT32 nWordIndex);
292 void ResetLinePlace(); 292 void ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);
293 CPVT_WordPlace AddWord( const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); 293
294 CPVT_WordPlace AddLine( const CPVT_LineInfo & lineinfo); 294 CPDF_VariableText* m_pVT;
295 void ClearWords(const CPVT_WordRange & PlaceRange); 295 };
296 void ClearWord(const CPVT_WordPlace & place); 296 class CTypeset {
297 CPVT_FloatRect Rearrang e(); 297 public:
298 CPVT_Size GetSecti onSize(FX_FLOAT fFontSize); 298 CTypeset(CSection* pSection);
299 CPVT_WordPlace GetBegin WordPlace() const; 299 virtual ~CTypeset();
300 CPVT_WordPlace GetEndWo rdPlace() const; 300 CPVT_Size GetEditSize(FX_FLOAT fFontSize);
301 CPVT_WordPlace GetPrevW ordPlace(const CPVT_WordPlace & place) const; 301 CPVT_FloatRect Typeset();
302 CPVT_WordPlace GetNextW ordPlace(const CPVT_WordPlace & place) const; 302 CPVT_FloatRect CharArray();
303 void UpdateWordPlace(CPVT_WordPlace & place) const; 303
304 CPVT_WordPlace SearchWo rdPlace(const CPDF_Point & point) const; 304 private:
305 CPVT_WordPlace SearchWo rdPlace(FX_FLOAT fx, const CPVT_WordPlace & lineplace) const; 305 void SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize);
306 CPVT_WordPlace SearchWo rdPlace(FX_FLOAT fx, const CPVT_WordRange & range) const; 306 void OutputLines();
307 public: 307
308 CPVT_WordPlace SecPlace ; 308 CPVT_FloatRect m_rcRet;
309 CPVT_SectionInfo m_SecInfo; 309 CPDF_VariableText* m_pVT;
310 CLines m_LineArray; 310 CSection* m_pSection;
311 CPVT_ArrayTemplate<CPVT_WordInfo*> m_WordArray; 311 };
312 private: 312 class CPDF_EditContainer {
313 void ClearLeftWords(FX_INT32 nWordIndex); 313 public:
314 void ClearRightWords(FX_INT32 nWordIndex); 314 CPDF_EditContainer() : m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0){};
315 void ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex); 315 virtual ~CPDF_EditContainer(){};
316 316 virtual void SetPlateRect(const CPDF_Rect& rect) { m_rcPlate = rect; };
317 CPDF_VariableText *m_pVT; 317 virtual const CPDF_Rect& GetPlateRect() const { return m_rcPlate; };
318 }; 318 virtual void SetContentRect(const CPVT_FloatRect& rect) {
319 class CTypeset 319 m_rcContent = rect;
320 { 320 };
321 public: 321 virtual CPDF_Rect GetContentRect() const { return m_rcContent; };
322 CTypeset(CSection * pSection); 322 FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; };
323 virtual ~CTypeset(); 323 FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; };
324 CPVT_Size GetEditS ize(FX_FLOAT fFontSize); 324 CPVT_Size GetPlateSize() const {
325 CPVT_FloatRect Typeset( ); 325 return CPVT_Size(GetPlateWidth(), GetPlateHeight());
326 CPVT_FloatRect CharArra y(); 326 };
327 private: 327 CPDF_Point GetBTPoint() const {
328 void SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize); 328 return CPDF_Point(m_rcPlate.left, m_rcPlate.top);
329 void OutputLines(); 329 };
330 330 CPDF_Point GetETPoint() const {
331 CPVT_FloatRect m_rcRet; 331 return CPDF_Point(m_rcPlate.right, m_rcPlate.bottom);
332 CPDF_VariableText * m_pVT; 332 };
333 CSection * m_pSec tion; 333 inline CPDF_Point InToOut(const CPDF_Point& point) const {
334 }; 334 return CPDF_Point(point.x + GetBTPoint().x, GetBTPoint().y - point.y);
335 class CPDF_EditContainer 335 };
336 { 336 inline CPDF_Point OutToIn(const CPDF_Point& point) const {
337 public: 337 return CPDF_Point(point.x - GetBTPoint().x, GetBTPoint().y - point.y);
338 CPDF_EditContainer(): m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {}; 338 };
339 virtual ~CPDF_EditContainer() {}; 339 inline CPDF_Rect InToOut(const CPVT_FloatRect& rect) const {
340 virtual void SetPlate Rect(const CPDF_Rect & rect) 340 CPDF_Point ptLeftTop = InToOut(CPDF_Point(rect.left, rect.top));
341 { 341 CPDF_Point ptRightBottom = InToOut(CPDF_Point(rect.right, rect.bottom));
342 m_rcPlate = rect; 342 return CPDF_Rect(
343 }; 343 ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y);
344 virtual const CPDF_Rect & GetPlateRect() const 344 };
345 { 345 inline CPVT_FloatRect OutToIn(const CPDF_Rect& rect) const {
346 return m_rcPlate; 346 CPDF_Point ptLeftTop = OutToIn(CPDF_Point(rect.left, rect.top));
347 }; 347 CPDF_Point ptRightBottom = OutToIn(CPDF_Point(rect.right, rect.bottom));
348 virtual void SetConte ntRect(const CPVT_FloatRect & rect) 348 return CPVT_FloatRect(
349 { 349 ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRightBottom.y);
350 m_rcContent = rect; 350 };
351 }; 351
352 virtual CPDF_Rect GetContentRect() const 352 private:
353 { 353 CPDF_Rect m_rcPlate;
354 return m_rcContent; 354 CPVT_FloatRect m_rcContent;
355 }; 355 };
356 FX_FLOAT GetPlate Width() const 356 class CPDF_VariableText : public IPDF_VariableText,
357 { 357 public CFX_Object,
358 return m_rcPlate.right - m_rcPlate.left; 358 private CPDF_EditContainer {
359 }; 359 friend class CTypeset;
360 FX_FLOAT GetPlate Height() const 360 friend class CSection;
361 { 361 friend class CPDF_VariableText_Iterator;
362 return m_rcPlate.top - m_rcPlate.bottom; 362
363 }; 363 public:
364 CPVT_Size GetPlate Size() const 364 CPDF_VariableText();
365 { 365 virtual ~CPDF_VariableText();
366 return CPVT_Size(GetPlateWidth(), GetPlateHeight()); 366 IPDF_VariableText_Provider* SetProvider(
367 }; 367 IPDF_VariableText_Provider* pProvider);
368 CPDF_Point GetBTPoi nt() const 368 IPDF_VariableText_Iterator* GetIterator();
369 { 369 void SetPlateRect(const CPDF_Rect& rect) {
370 return CPDF_Point(m_rcPlate.left, m_rcPlate.top); 370 CPDF_EditContainer::SetPlateRect(rect);
371 }; 371 }
372 CPDF_Point GetETPoi nt() const 372 void SetAlignment(FX_INT32 nFormat = 0) { m_nAlignment = nFormat; }
373 { 373 void SetPasswordChar(FX_WORD wSubWord = '*') { m_wSubWord = wSubWord; }
374 return CPDF_Point(m_rcPlate.right, m_rcPlate.bottom); 374 void SetLimitChar(FX_INT32 nLimitChar = 0) { m_nLimitChar = nLimitChar; }
375 }; 375 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) { m_fCharSpace = fCharSpace; }
376 inline CPDF_Point InToOut(const CP DF_Point & point) const 376 void SetHorzScale(FX_INT32 nHorzScale = 100) { m_nHorzScale = nHorzScale; }
377 { 377 void SetMultiLine(FX_BOOL bMultiLine = TRUE) { m_bMultiLine = bMultiLine; }
378 return CPDF_Point(point.x + GetBTPoint().x, GetBTPoint().y - point.y); 378 void SetAutoReturn(FX_BOOL bAuto = TRUE) { m_bLimitWidth = bAuto; }
379 }; 379 void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; }
380 inline CPDF_Point OutToIn(const CP DF_Point & point) const 380 void SetCharArray(FX_INT32 nCharArray = 0) { m_nCharArray = nCharArray; }
381 { 381 void SetAutoFontSize(FX_BOOL bAuto = TRUE) { m_bAutoFontSize = bAuto; }
382 return CPDF_Point(point.x - GetBTPoint().x, GetBTPoint().y - point.y); 382 void SetRichText(FX_BOOL bRichText) { m_bRichText = bRichText; }
383 }; 383 void SetLineLeading(FX_FLOAT fLineLeading) { m_fLineLeading = fLineLeading; }
384 inline CPDF_Rect InToOut(const CP VT_FloatRect & rect) const 384 void Initialize();
385 { 385 FX_BOOL IsValid() const { return m_bInitial; }
386 CPDF_Point ptLeftTop = InToOut(CPDF_Point(rect.left, rect.top)); 386 FX_BOOL IsRichText() const { return m_bRichText; }
387 CPDF_Point ptRightBottom = InToOut(CPDF_Point(rect.right, rect.bottom)); 387 void RearrangeAll();
388 return CPDF_Rect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTo p.y); 388 void RearrangePart(const CPVT_WordRange& PlaceRange);
389 }; 389 void ResetAll();
390 inline CPVT_FloatRect OutToIn(const CP DF_Rect & rect) const 390 void SetText(FX_LPCWSTR text,
391 { 391 FX_INT32 charset = 1,
392 CPDF_Point ptLeftTop = OutToIn(CPDF_Point(rect.left, rect.top)); 392 const CPVT_SecProps* pSecProps = NULL,
393 CPDF_Point ptRightBottom = OutToIn(CPDF_Point(rect.right, rect.bottom)); 393 const CPVT_WordProps* pWordProps = NULL);
394 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRight Bottom.y); 394 CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
395 }; 395 FX_WORD word,
396 396 FX_INT32 charset = 1,
397 private: 397 const CPVT_WordProps* pWordProps = NULL);
398 CPDF_Rect m_rcPlat e; 398 CPVT_WordPlace InsertSection(const CPVT_WordPlace& place,
399 CPVT_FloatRect m_rcCont ent; 399 const CPVT_SecProps* pSecProps = NULL,
400 }; 400 const CPVT_WordProps* pWordProps = NULL);
401 class CPDF_VariableText : public IPDF_VariableText, public CFX_Object, private C PDF_EditContainer 401 CPVT_WordPlace InsertText(const CPVT_WordPlace& place,
402 { 402 FX_LPCWSTR text,
403 friend class CTypeset; 403 FX_INT32 charset = 1,
404 friend class CSection; 404 const CPVT_SecProps* pSecProps = NULL,
405 friend class CPDF_VariableText_Iterator; 405 const CPVT_WordProps* pWordProps = NULL);
406 public: 406 CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange);
407 CPDF_VariableText(); 407 CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place);
408 virtual ~CPDF_VariableText(); 408 CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place);
409 IPDF_VariableText_Provider* SetProvider(IPDF_Variabl eText_Provider * pProvider); 409 const CPDF_Rect& GetPlateRect() const {
410 IPDF_VariableText_Iterator* GetIterator(); 410 return CPDF_EditContainer::GetPlateRect();
411 void SetPlateRect(const CPDF_Rect & rect) 411 }
412 { 412 CPDF_Rect GetContentRect() const;
413 CPDF_EditContainer::SetPlateRect(rect); 413 FX_INT32 GetTotalWords() const;
414 } 414 FX_FLOAT GetFontSize() const { return m_fFontSize; }
415 void SetAlignment(FX_INT32 nFormat = 0) 415 FX_INT32 GetAlignment() const { return m_nAlignment; }
416 { 416 FX_INT32 GetCharArray() const { return m_nCharArray; }
417 m_nAlignment = nFormat; 417 FX_INT32 GetLimitChar() const { return m_nLimitChar; }
418 } 418 FX_BOOL IsMultiLine() const { return m_bMultiLine; }
419 void SetPasswordChar(FX_WORD wSubWord = '*') 419 FX_INT32 GetHorzScale() const { return m_nHorzScale; }
420 { 420 FX_FLOAT GetCharSpace() const { return m_fCharSpace; }
421 m_wSubWord = wSubWord; 421
422 } 422 CPVT_WordPlace GetBeginWordPlace() const;
423 void SetLimitChar(FX_INT32 nLimitChar = 0) 423 CPVT_WordPlace GetEndWordPlace() const;
424 { 424 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
425 m_nLimitChar = nLimitChar; 425 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
426 } 426 CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
427 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) 427 CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
428 { 428 const CPDF_Point& point) const;
429 m_fCharSpace = fCharSpace; 429 CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place,
430 } 430 const CPDF_Point& point) const;
431 void SetHorzScale(FX_INT32 nHorzScale = 100) 431 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const;
432 { 432 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const;
433 m_nHorzScale = nHorzScale; 433 CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const;
434 } 434 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const;
435 void SetMultiLine(FX_BOOL bMultiLine = TRUE) 435 void UpdateWordPlace(CPVT_WordPlace& place) const;
436 { 436 FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace& place) const;
437 m_bMultiLine = bMultiLine; 437 CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const;
438 } 438 FX_WORD GetPasswordChar() const { return GetSubWord(); }
439 void SetAutoReturn(FX_BOOL bAuto = TRUE) 439 FX_WORD GetSubWord() const { return m_wSubWord; }
440 { 440
441 m_bLimitWidth = bAuto; 441 private:
442 } 442 FX_INT32 GetCharWidth(FX_INT32 nFontIndex,
443 void SetFontSize(FX_FLOAT fFontSize) 443 FX_WORD Word,
444 { 444 FX_WORD SubWord,
445 m_fFontSize = fFontSize; 445 FX_INT32 nWordStyle);
446 } 446 FX_INT32 GetTypeAscent(FX_INT32 nFontIndex);
447 void SetCharArray(FX_INT32 nCharArray = 0) 447 FX_INT32 GetTypeDescent(FX_INT32 nFontIndex);
448 { 448 FX_INT32 GetWordFontIndex(FX_WORD word,
449 m_nCharArray = nCharArray; 449 FX_INT32 charset,
450 } 450 FX_INT32 nFontIndex);
451 void SetAutoFontSize(FX_BOOL bAuto = TRUE) 451 FX_INT32 GetDefaultFontIndex();
452 { 452 FX_BOOL IsLatinWord(FX_WORD word);
453 m_bAutoFontSize = bAuto; 453
454 } 454 private:
455 void SetRichText(FX_BOOL bRichText) 455 CPVT_WordPlace AddSection(const CPVT_WordPlace& place,
456 { 456 const CPVT_SectionInfo& secinfo);
457 m_bRichText = bRichText; 457 CPVT_WordPlace AddLine(const CPVT_WordPlace& place,
458 } 458 const CPVT_LineInfo& lineinfo);
459 void SetLineLeading(FX_FLOAT fLineLeading) 459 CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
460 { 460 const CPVT_WordInfo& wordinfo);
461 m_fLineLeading = fLineLeading; 461 FX_BOOL GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo);
462 } 462 FX_BOOL SetWordInfo(const CPVT_WordPlace& place,
463 void Initialize(); 463 const CPVT_WordInfo& wordinfo);
464 FX_BOOL IsValid() const 464 FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
465 { 465 FX_BOOL GetSectionInfo(const CPVT_WordPlace& place,
466 return m_bInitial; 466 CPVT_SectionInfo& secinfo);
467 } 467 FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo,
468 FX_BOOL IsRichText() const 468 FX_BOOL bFactFontSize = FALSE);
469 { 469 FX_FLOAT GetWordWidth(FX_INT32 nFontIndex,
470 return m_bRichText; 470 FX_WORD Word,
471 } 471 FX_WORD SubWord,
472 void RearrangeAll(); 472 FX_FLOAT fCharSpace,
473 void RearrangePart(const CPVT_WordRange & PlaceRange); 473 FX_INT32 nHorzScale,
474 void ResetAll(); 474 FX_FLOAT fFontSize,
475 void SetText(FX_LPCWSTR text, FX_INT32 charset = 1, const CPVT_SecProps * pSecProps = NULL, 475 FX_FLOAT fWordTail,
476 const CPVT_WordProps * pWordProps = NULL); 476 FX_INT32 nWordStyle);
477 CPVT_WordPlace InsertWo rd(const CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset = 1, 477 FX_FLOAT GetWordWidth(const CPVT_WordInfo& WordInfo);
478 const CPVT_WordProps * pWordProps = NULL); 478 FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize);
479 CPVT_WordPlace InsertSe ction(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps = NULL, 479 FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize);
480 const CPVT_WordProps * pWordProps = NULL); 480 FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo,
481 CPVT_WordPlace InsertTe xt(const CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset = 1, 481 FX_BOOL bFactFontSize = FALSE);
482 const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * p WordProps = NULL); 482 FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo,
483 CPVT_WordPlace DeleteWo rds(const CPVT_WordRange & PlaceRange); 483 FX_BOOL bFactFontSize = FALSE);
484 CPVT_WordPlace DeleteWo rd(const CPVT_WordPlace & place); 484 FX_FLOAT GetLineAscent(const CPVT_SectionInfo& SecInfo);
485 CPVT_WordPlace BackSpac eWord(const CPVT_WordPlace & place); 485 FX_FLOAT GetLineDescent(const CPVT_SectionInfo& SecInfo);
486 const CPDF_Rect & GetPlateRect() c onst 486 FX_FLOAT GetFontAscent(FX_INT32 nFontIndex, FX_FLOAT fFontSize);
487 { 487 FX_FLOAT GetFontDescent(FX_INT32 nFontIndex, FX_FLOAT fFontSize);
488 return CPDF_EditContainer::GetPlateRect(); 488 FX_INT32 GetWordFontIndex(const CPVT_WordInfo& WordInfo);
489 } 489 FX_FLOAT GetCharSpace(const CPVT_WordInfo& WordInfo);
490 CPDF_Rect GetConte ntRect() const; 490 FX_INT32 GetHorzScale(const CPVT_WordInfo& WordInfo);
491 FX_INT32 GetTotal Words() const; 491 FX_FLOAT GetLineLeading(const CPVT_SectionInfo& SecInfo);
492 FX_FLOAT GetFontS ize() const 492 FX_FLOAT GetLineIndent(const CPVT_SectionInfo& SecInfo);
493 { 493 FX_INT32 GetAlignment(const CPVT_SectionInfo& SecInfo);
494 return m_fFontSize; 494
495 } 495 void ClearSectionRightWords(const CPVT_WordPlace& place);
496 FX_INT32 GetAlign ment() const 496 CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace& place,
497 { 497 FX_BOOL bPrevOrNext) const;
498 return m_nAlignment; 498 FX_BOOL ClearEmptySection(const CPVT_WordPlace& place);
499 } 499 void ClearEmptySections(const CPVT_WordRange& PlaceRange);
500 FX_INT32 GetCharA rray() const 500 void LinkLatterSection(const CPVT_WordPlace& place);
501 { 501 void ClearWords(const CPVT_WordRange& PlaceRange);
502 return m_nCharArray; 502 CPVT_WordPlace ClearLeftWord(const CPVT_WordPlace& place);
503 } 503 CPVT_WordPlace ClearRightWord(const CPVT_WordPlace& place);
504 FX_INT32 GetLimit Char() const 504
505 { 505 private:
506 return m_nLimitChar; 506 CPVT_FloatRect Rearrange(const CPVT_WordRange& PlaceRange);
507 } 507 FX_FLOAT GetAutoFontSize();
508 FX_BOOL IsMultiLine() const 508 FX_BOOL IsBigger(FX_FLOAT fFontSize);
509 { 509 CPVT_FloatRect RearrangeSections(const CPVT_WordRange& PlaceRange);
510 return m_bMultiLine; 510
511 } 511 private:
512 FX_INT32 GetHorzS cale() const 512 void ResetSectionArray();
513 { 513
514 return m_nHorzScale; 514 private:
515 } 515 CPVT_ArrayTemplate<CSection*> m_SectionArray;
516 FX_FLOAT GetCharS pace() const 516 FX_INT32 m_nLimitChar;
517 { 517 FX_INT32 m_nCharArray;
518 return m_fCharSpace; 518 FX_BOOL m_bMultiLine;
519 } 519 FX_BOOL m_bLimitWidth;
520 520 FX_BOOL m_bAutoFontSize;
521 CPVT_WordPlace GetBegin WordPlace() const; 521 FX_INT32 m_nAlignment;
522 CPVT_WordPlace GetEndWo rdPlace() const; 522 FX_FLOAT m_fLineLeading;
523 CPVT_WordPlace GetPrevW ordPlace(const CPVT_WordPlace & place) const; 523 FX_FLOAT m_fCharSpace;
524 CPVT_WordPlace GetNextW ordPlace(const CPVT_WordPlace & place) const; 524 FX_INT32 m_nHorzScale;
525 CPVT_WordPlace SearchWo rdPlace(const CPDF_Point & point) const; 525 FX_WORD m_wSubWord;
526 CPVT_WordPlace GetUpWor dPlace(const CPVT_WordPlace & place, const CPDF_Point & point) const; 526 FX_FLOAT m_fFontSize;
527 CPVT_WordPlace GetDownW ordPlace(const CPVT_WordPlace & place, const CPDF_Point & point) const; 527
528 CPVT_WordPlace GetLineB eginPlace(const CPVT_WordPlace & place) const; 528 private:
529 CPVT_WordPlace GetLineE ndPlace(const CPVT_WordPlace & place) const; 529 FX_BOOL m_bInitial;
530 CPVT_WordPlace GetSecti onBeginPlace(const CPVT_WordPlace & place) const; 530 FX_BOOL m_bRichText;
531 CPVT_WordPlace GetSecti onEndPlace(const CPVT_WordPlace & place) const; 531 IPDF_VariableText_Provider* m_pVTProvider;
532 void UpdateWordPlace(CPVT_WordPlace & place) const; 532 CPDF_VariableText_Iterator* m_pVTIterator;
533 FX_INT32 WordPlac eToWordIndex(const CPVT_WordPlace & place) const; 533 };
534 CPVT_WordPlace WordInde xToWordPlace(FX_INT32 index) const; 534 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator,
535 FX_WORD GetPasswordChar() const 535 public CFX_Object {
536 { 536 public:
537 return GetSubWord(); 537 CPDF_VariableText_Iterator(CPDF_VariableText* pVT);
538 } 538 virtual ~CPDF_VariableText_Iterator();
539 FX_WORD GetSubWord() const 539 FX_BOOL NextWord();
540 { 540 FX_BOOL PrevWord();
541 return m_wSubWord; 541 FX_BOOL NextLine();
542 } 542 FX_BOOL PrevLine();
543 private: 543 FX_BOOL NextSection();
544 FX_INT32 GetCharW idth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, FX_INT32 nWordStyle); 544 FX_BOOL PrevSection();
545 FX_INT32 GetTypeA scent(FX_INT32 nFontIndex); 545 FX_BOOL SetWord(const CPVT_Word& word);
546 FX_INT32 GetTypeD escent(FX_INT32 nFontIndex); 546 FX_BOOL GetWord(CPVT_Word& word) const;
547 FX_INT32 GetWordF ontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex); 547 FX_BOOL GetLine(CPVT_Line& line) const;
548 FX_INT32 GetDefau ltFontIndex(); 548 FX_BOOL GetSection(CPVT_Section& section) const;
549 FX_BOOL IsLatinWord(FX_WORD word); 549 FX_BOOL SetSection(const CPVT_Section& section);
550 private: 550 void SetAt(FX_INT32 nWordIndex);
551 551 void SetAt(const CPVT_WordPlace& place);
552 CPVT_WordPlace AddSecti on(const CPVT_WordPlace & place, const CPVT_SectionInfo & secinfo); 552 const CPVT_WordPlace& GetAt() const { return m_CurPos; };
553 CPVT_WordPlace AddLine( const CPVT_WordPlace & place, const CPVT_LineInfo & lineinfo); 553
554 CPVT_WordPlace AddWord( const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); 554 private:
555 FX_BOOL GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo); 555 CPVT_WordPlace m_CurPos;
556 FX_BOOL SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); 556 CPDF_VariableText* m_pVT;
557 FX_BOOL GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo); 557 };
558 FX_BOOL GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo);
559 FX_FLOAT GetWordF ontSize(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE);
560 FX_FLOAT GetWordW idth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord,
561 FX_FLOAT fCharSpace, FX_INT32 nHorzScale,
562 FX_FLOAT fFontSize, FX_FLOAT fWordTail, FX_INT32 nWordStyle);
563 FX_FLOAT GetWordW idth(const CPVT_WordInfo & WordInfo);
564 FX_FLOAT GetWordA scent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize);
565 FX_FLOAT GetWordD escent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize);
566 FX_FLOAT GetWordA scent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE);
567 FX_FLOAT GetWordD escent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE);
568 FX_FLOAT GetLineA scent(const CPVT_SectionInfo & SecInfo);
569 FX_FLOAT GetLineD escent(const CPVT_SectionInfo & SecInfo);
570 FX_FLOAT GetFontA scent(FX_INT32 nFontIndex, FX_FLOAT fFontSize);
571 FX_FLOAT GetFontD escent(FX_INT32 nFontIndex, FX_FLOAT fFontSize);
572 FX_INT32 GetWordF ontIndex(const CPVT_WordInfo & WordInfo);
573 FX_FLOAT GetCharS pace(const CPVT_WordInfo & WordInfo);
574 FX_INT32 GetHorzS cale(const CPVT_WordInfo & WordInfo);
575 FX_FLOAT GetLineL eading(const CPVT_SectionInfo & SecInfo);
576 FX_FLOAT GetLineI ndent(const CPVT_SectionInfo & SecInfo);
577 FX_INT32 GetAlign ment(const CPVT_SectionInfo& SecInfo);
578
579 void ClearSectionRightWords(const CPVT_WordPlace & place);
580 CPVT_WordPlace AjustLin eHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const;
581 FX_BOOL ClearEmptySection(const CPVT_WordPlace & place);
582 void ClearEmptySections(const CPVT_WordRange & PlaceRange);
583 void LinkLatterSection(const CPVT_WordPlace & place);
584 void ClearWords(const CPVT_WordRange & PlaceRange);
585 CPVT_WordPlace ClearLef tWord(const CPVT_WordPlace & place);
586 CPVT_WordPlace ClearRig htWord(const CPVT_WordPlace & place);
587 private:
588 CPVT_FloatRect Rearrang e(const CPVT_WordRange & PlaceRange);
589 FX_FLOAT GetAutoF ontSize();
590 FX_BOOL IsBigger(FX_FLOAT fFontSize);
591 CPVT_FloatRect Rearrang eSections(const CPVT_WordRange & PlaceRange);
592 private:
593 void ResetSectionArray();
594 private:
595 CPVT_ArrayTemplate<CSection*> m_SectionArray;
596 FX_INT32 m_nLimit Char;
597 FX_INT32 m_nCharA rray;
598 FX_BOOL m_bMultiLine;
599 FX_BOOL m_bLimitWidth;
600 FX_BOOL m_bAutoFontSize;
601 FX_INT32 m_nAlign ment;
602 FX_FLOAT m_fLineL eading;
603 FX_FLOAT m_fCharS pace;
604 FX_INT32 m_nHorzS cale;
605 FX_WORD m_wSubWord;
606 FX_FLOAT m_fFontS ize;
607
608 private:
609 FX_BOOL m_bInitial;
610 FX_BOOL m_bRichText;
611 IPDF_VariableText_Provider * m_pVTProvider;
612 CPDF_VariableText_Iterator * m_pVTIterator;
613 };
614 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator, public CFX _Object
615 {
616 public:
617 CPDF_VariableText_Iterator(CPDF_VariableText * pVT);
618 virtual ~CPDF_VariableText_Iterator();
619 FX_BOOL NextWord();
620 FX_BOOL PrevWord();
621 FX_BOOL NextLine();
622 FX_BOOL PrevLine();
623 FX_BOOL NextSection();
624 FX_BOOL PrevSection();
625 FX_BOOL SetWord(const CPVT_Word & word);
626 FX_BOOL GetWord(CPVT_Word & word) const;
627 FX_BOOL GetLine(CPVT_Line & line) const;
628 FX_BOOL GetSection(CPVT_Section & section) const;
629 FX_BOOL SetSection(const CPVT_Section & section);
630 void SetAt(FX_INT32 nWordIndex);
631 void SetAt(const CPVT_WordPlace & place);
632 const CPVT_WordPlace & GetAt() const
633 {
634 return m_CurPos;
635 };
636 private:
637 CPVT_WordPlace m_CurPos ;
638 CPDF_VariableText * m_pVT;
639 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698