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

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

Issue 1800523005: Move core/src/ up to core/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « core/src/fpdfdoc/doc_vtmodule.cpp ('k') | core/src/fpdfdoc/tagged_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef CORE_SRC_FPDFDOC_PDF_VT_H_
8 #define CORE_SRC_FPDFDOC_PDF_VT_H_
9
10 class CPVT_Size;
11 class CPVT_FloatRect;
12 struct CPVT_SectionInfo;
13 struct CPVT_LineInfo;
14 struct CPVT_WordInfo;
15 class CLine;
16 class CLines;
17 class CSection;
18 class CTypeset;
19 class CPDF_EditContainer;
20 class CPDF_VariableText;
21 class CPDF_VariableText_Iterator;
22 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
23 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
24 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
25
26 class CPVT_Size {
27 public:
28 CPVT_Size() : x(0.0f), y(0.0f) {}
29 CPVT_Size(FX_FLOAT other_x, FX_FLOAT other_y) {
30 x = other_x;
31 y = other_y;
32 }
33 FX_FLOAT x, y;
34 };
35 class CPVT_FloatRect : public CFX_FloatRect {
36 public:
37 CPVT_FloatRect() { left = top = right = bottom = 0.0f; }
38 CPVT_FloatRect(FX_FLOAT other_left,
39 FX_FLOAT other_top,
40 FX_FLOAT other_right,
41 FX_FLOAT other_bottom) {
42 left = other_left;
43 top = other_top;
44 right = other_right;
45 bottom = other_bottom;
46 }
47 explicit CPVT_FloatRect(const CFX_FloatRect& rect) {
48 left = rect.left;
49 top = rect.top;
50 right = rect.right;
51 bottom = rect.bottom;
52 }
53 void Default() { left = top = right = bottom = 0.0f; }
54 FX_FLOAT Height() const {
55 if (top > bottom)
56 return top - bottom;
57 return bottom - top;
58 }
59 };
60 struct CPVT_SectionInfo {
61 CPVT_SectionInfo()
62 : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps(NULL) {}
63 virtual ~CPVT_SectionInfo() {
64 delete pSecProps;
65 delete pWordProps;
66 }
67 CPVT_SectionInfo(const CPVT_SectionInfo& other)
68 : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps(NULL) {
69 operator=(other);
70 }
71 void operator=(const CPVT_SectionInfo& other) {
72 if (this == &other) {
73 return;
74 }
75 rcSection = other.rcSection;
76 nTotalLine = other.nTotalLine;
77 if (other.pSecProps) {
78 if (pSecProps) {
79 *pSecProps = *other.pSecProps;
80 } else {
81 pSecProps = new CPVT_SecProps(*other.pSecProps);
82 }
83 }
84 if (other.pWordProps) {
85 if (pWordProps) {
86 *pWordProps = *other.pWordProps;
87 } else {
88 pWordProps = new CPVT_WordProps(*other.pWordProps);
89 }
90 }
91 }
92 CPVT_FloatRect rcSection;
93 int32_t nTotalLine;
94 CPVT_SecProps* pSecProps;
95 CPVT_WordProps* pWordProps;
96 };
97 struct CPVT_LineInfo {
98 CPVT_LineInfo()
99 : nTotalWord(0),
100 nBeginWordIndex(-1),
101 nEndWordIndex(-1),
102 fLineX(0.0f),
103 fLineY(0.0f),
104 fLineWidth(0.0f),
105 fLineAscent(0.0f),
106 fLineDescent(0.0f) {}
107 int32_t nTotalWord;
108 int32_t nBeginWordIndex;
109 int32_t nEndWordIndex;
110 FX_FLOAT fLineX;
111 FX_FLOAT fLineY;
112 FX_FLOAT fLineWidth;
113 FX_FLOAT fLineAscent;
114 FX_FLOAT fLineDescent;
115 };
116 struct CPVT_WordInfo {
117 CPVT_WordInfo()
118 : Word(0),
119 nCharset(0),
120 fWordX(0.0f),
121 fWordY(0.0f),
122 fWordTail(0.0f),
123 nFontIndex(-1),
124 pWordProps(NULL) {}
125 CPVT_WordInfo(FX_WORD word,
126 int32_t charset,
127 int32_t fontIndex,
128 CPVT_WordProps* pProps)
129 : Word(word),
130 nCharset(charset),
131 fWordX(0.0f),
132 fWordY(0.0f),
133 fWordTail(0.0f),
134 nFontIndex(fontIndex),
135 pWordProps(pProps) {}
136 virtual ~CPVT_WordInfo() { delete pWordProps; }
137 CPVT_WordInfo(const CPVT_WordInfo& word)
138 : Word(0),
139 nCharset(0),
140 fWordX(0.0f),
141 fWordY(0.0f),
142 fWordTail(0.0f),
143 nFontIndex(-1),
144 pWordProps(NULL) {
145 operator=(word);
146 }
147 void operator=(const CPVT_WordInfo& word) {
148 if (this == &word) {
149 return;
150 }
151 Word = word.Word;
152 nCharset = word.nCharset;
153 nFontIndex = word.nFontIndex;
154 if (word.pWordProps) {
155 if (pWordProps) {
156 *pWordProps = *word.pWordProps;
157 } else {
158 pWordProps = new CPVT_WordProps(*word.pWordProps);
159 }
160 }
161 }
162 FX_WORD Word;
163 int32_t nCharset;
164 FX_FLOAT fWordX;
165 FX_FLOAT fWordY;
166 FX_FLOAT fWordTail;
167 int32_t nFontIndex;
168 CPVT_WordProps* pWordProps;
169 };
170 struct CPVT_FloatRange {
171 CPVT_FloatRange() : fMin(0.0f), fMax(0.0f) {}
172 CPVT_FloatRange(FX_FLOAT min, FX_FLOAT max) : fMin(min), fMax(max) {}
173 FX_FLOAT Range() const { return fMax - fMin; }
174 FX_FLOAT fMin, fMax;
175 };
176 template <class TYPE>
177 class CPVT_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
178 public:
179 FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
180 TYPE GetAt(int nIndex) const {
181 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) {
182 return CFX_ArrayTemplate<TYPE>::GetAt(nIndex);
183 }
184 return NULL;
185 }
186 void RemoveAt(int nIndex) {
187 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) {
188 CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);
189 }
190 }
191 };
192 class CLine {
193 public:
194 CLine();
195 virtual ~CLine();
196 CPVT_WordPlace GetBeginWordPlace() const;
197 CPVT_WordPlace GetEndWordPlace() const;
198 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
199 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
200 CPVT_WordPlace LinePlace;
201 CPVT_LineInfo m_LineInfo;
202 };
203 class CLines {
204 public:
205 CLines() : m_nTotal(0) {}
206 virtual ~CLines() { RemoveAll(); }
207 int32_t GetSize() const { return m_Lines.GetSize(); }
208 CLine* GetAt(int32_t nIndex) const { return m_Lines.GetAt(nIndex); }
209 void Empty() { m_nTotal = 0; }
210 void RemoveAll() {
211 for (int32_t i = 0, sz = GetSize(); i < sz; i++) {
212 delete GetAt(i);
213 }
214 m_Lines.RemoveAll();
215 m_nTotal = 0;
216 }
217 int32_t Add(const CPVT_LineInfo& lineinfo) {
218 if (m_nTotal >= GetSize()) {
219 CLine* pLine = new CLine;
220 pLine->m_LineInfo = lineinfo;
221 m_Lines.Add(pLine);
222 } else if (CLine* pLine = GetAt(m_nTotal)) {
223 pLine->m_LineInfo = lineinfo;
224 }
225 return m_nTotal++;
226 }
227 void Clear() {
228 for (int32_t i = GetSize() - 1; i >= m_nTotal; i--) {
229 delete GetAt(i);
230 m_Lines.RemoveAt(i);
231 }
232 }
233
234 private:
235 CPVT_ArrayTemplate<CLine*> m_Lines;
236 int32_t m_nTotal;
237 };
238 class CSection {
239 friend class CTypeset;
240
241 public:
242 explicit CSection(CPDF_VariableText* pVT);
243 virtual ~CSection();
244 void ResetAll();
245 void ResetLineArray();
246 void ResetWordArray();
247 void ResetLinePlace();
248 CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
249 const CPVT_WordInfo& wordinfo);
250 CPVT_WordPlace AddLine(const CPVT_LineInfo& lineinfo);
251 void ClearWords(const CPVT_WordRange& PlaceRange);
252 void ClearWord(const CPVT_WordPlace& place);
253 CPVT_FloatRect Rearrange();
254 CPVT_Size GetSectionSize(FX_FLOAT fFontSize);
255 CPVT_WordPlace GetBeginWordPlace() const;
256 CPVT_WordPlace GetEndWordPlace() const;
257 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
258 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
259 void UpdateWordPlace(CPVT_WordPlace& place) const;
260 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const;
261 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx,
262 const CPVT_WordPlace& lineplace) const;
263 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx,
264 const CPVT_WordRange& range) const;
265
266 public:
267 CPVT_WordPlace SecPlace;
268 CPVT_SectionInfo m_SecInfo;
269 CLines m_LineArray;
270 CPVT_ArrayTemplate<CPVT_WordInfo*> m_WordArray;
271
272 private:
273 void ClearLeftWords(int32_t nWordIndex);
274 void ClearRightWords(int32_t nWordIndex);
275 void ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex);
276
277 CPDF_VariableText* m_pVT;
278 };
279 class CTypeset {
280 public:
281 explicit CTypeset(CSection* pSection);
282 virtual ~CTypeset();
283 CPVT_Size GetEditSize(FX_FLOAT fFontSize);
284 CPVT_FloatRect Typeset();
285 CPVT_FloatRect CharArray();
286
287 private:
288 void SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize);
289 void OutputLines();
290
291 CPVT_FloatRect m_rcRet;
292 CPDF_VariableText* m_pVT;
293 CSection* m_pSection;
294 };
295 class CPDF_EditContainer {
296 public:
297 CPDF_EditContainer() : m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {}
298 virtual ~CPDF_EditContainer() {}
299 virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; }
300 virtual const CFX_FloatRect& GetPlateRect() const { return m_rcPlate; }
301 virtual void SetContentRect(const CPVT_FloatRect& rect) {
302 m_rcContent = rect;
303 }
304 virtual CFX_FloatRect GetContentRect() const { return m_rcContent; }
305 FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; }
306 FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; }
307 CPVT_Size GetPlateSize() const {
308 return CPVT_Size(GetPlateWidth(), GetPlateHeight());
309 }
310 CFX_FloatPoint GetBTPoint() const {
311 return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top);
312 }
313 CFX_FloatPoint GetETPoint() const {
314 return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom);
315 }
316 inline CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const {
317 return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y);
318 }
319 inline CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const {
320 return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y);
321 }
322 inline CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const {
323 CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top));
324 CFX_FloatPoint ptRightBottom =
325 InToOut(CFX_FloatPoint(rect.right, rect.bottom));
326 return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x,
327 ptLeftTop.y);
328 }
329 inline CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const {
330 CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top));
331 CFX_FloatPoint ptRightBottom =
332 OutToIn(CFX_FloatPoint(rect.right, rect.bottom));
333 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x,
334 ptRightBottom.y);
335 }
336
337 private:
338 CFX_FloatRect m_rcPlate;
339 CPVT_FloatRect m_rcContent;
340 };
341
342 class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer {
343 friend class CTypeset;
344 friend class CSection;
345 friend class CPDF_VariableText_Iterator;
346
347 public:
348 CPDF_VariableText();
349 ~CPDF_VariableText() override;
350
351 // IPDF_VariableText
352 IPDF_VariableText_Provider* SetProvider(
353 IPDF_VariableText_Provider* pProvider) override;
354 IPDF_VariableText_Iterator* GetIterator() override;
355 void SetPlateRect(const CFX_FloatRect& rect) override {
356 CPDF_EditContainer::SetPlateRect(rect);
357 }
358 void SetAlignment(int32_t nFormat = 0) override { m_nAlignment = nFormat; }
359 void SetPasswordChar(FX_WORD wSubWord = '*') override {
360 m_wSubWord = wSubWord;
361 }
362 void SetLimitChar(int32_t nLimitChar = 0) override {
363 m_nLimitChar = nLimitChar;
364 }
365 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) override {
366 m_fCharSpace = fCharSpace;
367 }
368 void SetHorzScale(int32_t nHorzScale = 100) override {
369 m_nHorzScale = nHorzScale;
370 }
371 void SetMultiLine(FX_BOOL bMultiLine = TRUE) override {
372 m_bMultiLine = bMultiLine;
373 }
374 void SetAutoReturn(FX_BOOL bAuto = TRUE) override { m_bLimitWidth = bAuto; }
375 void SetFontSize(FX_FLOAT fFontSize) override { m_fFontSize = fFontSize; }
376 void SetCharArray(int32_t nCharArray = 0) override {
377 m_nCharArray = nCharArray;
378 }
379 void SetAutoFontSize(FX_BOOL bAuto = TRUE) override {
380 m_bAutoFontSize = bAuto;
381 }
382 void SetRichText(FX_BOOL bRichText) override { m_bRichText = bRichText; }
383 void SetLineLeading(FX_FLOAT fLineLeading) override {
384 m_fLineLeading = fLineLeading;
385 }
386 void Initialize() override;
387 FX_BOOL IsValid() const override { return m_bInitial; }
388 FX_BOOL IsRichText() const override { return m_bRichText; }
389 void RearrangeAll() override;
390 void RearrangePart(const CPVT_WordRange& PlaceRange) override;
391 void ResetAll() override;
392 void SetText(const FX_WCHAR* text,
393 int32_t charset = 1,
394 const CPVT_SecProps* pSecProps = NULL,
395 const CPVT_WordProps* pWordProps = NULL) override;
396 CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
397 FX_WORD word,
398 int32_t charset = 1,
399 const CPVT_WordProps* pWordProps = NULL) override;
400 CPVT_WordPlace InsertSection(
401 const CPVT_WordPlace& place,
402 const CPVT_SecProps* pSecProps = NULL,
403 const CPVT_WordProps* pWordProps = NULL) override;
404 CPVT_WordPlace InsertText(const CPVT_WordPlace& place,
405 const FX_WCHAR* text,
406 int32_t charset = 1,
407 const CPVT_SecProps* pSecProps = NULL,
408 const CPVT_WordProps* pWordProps = NULL) override;
409 CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) override;
410 CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) override;
411 CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) override;
412 const CFX_FloatRect& GetPlateRect() const override {
413 return CPDF_EditContainer::GetPlateRect();
414 }
415 CFX_FloatRect GetContentRect() const override;
416 int32_t GetTotalWords() const override;
417 FX_FLOAT GetFontSize() const override { return m_fFontSize; }
418 int32_t GetAlignment() const override { return m_nAlignment; }
419 FX_WORD GetPasswordChar() const override { return GetSubWord(); }
420 int32_t GetCharArray() const override { return m_nCharArray; }
421 int32_t GetLimitChar() const override { return m_nLimitChar; }
422 FX_BOOL IsMultiLine() const override { return m_bMultiLine; }
423 int32_t GetHorzScale() const override { return m_nHorzScale; }
424 FX_FLOAT GetCharSpace() const override { return m_fCharSpace; }
425 CPVT_WordPlace GetBeginWordPlace() const override;
426 CPVT_WordPlace GetEndWordPlace() const override;
427 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const override;
428 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const override;
429 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const override;
430 CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
431 const CFX_FloatPoint& point) const override;
432 CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place,
433 const CFX_FloatPoint& point) const override;
434 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override;
435 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override;
436 CPVT_WordPlace GetSectionBeginPlace(
437 const CPVT_WordPlace& place) const override;
438 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override;
439 void UpdateWordPlace(CPVT_WordPlace& place) const override;
440 CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place,
441 FX_BOOL bPrevOrNext) const override;
442 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override;
443 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override;
444
445 FX_WORD GetSubWord() const { return m_wSubWord; }
446
447 private:
448 int32_t GetCharWidth(int32_t nFontIndex,
449 FX_WORD Word,
450 FX_WORD SubWord,
451 int32_t nWordStyle);
452 int32_t GetTypeAscent(int32_t nFontIndex);
453 int32_t GetTypeDescent(int32_t nFontIndex);
454 int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex);
455 int32_t GetDefaultFontIndex();
456 FX_BOOL IsLatinWord(FX_WORD word);
457
458 CPVT_WordPlace AddSection(const CPVT_WordPlace& place,
459 const CPVT_SectionInfo& secinfo);
460 CPVT_WordPlace AddLine(const CPVT_WordPlace& place,
461 const CPVT_LineInfo& lineinfo);
462 CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
463 const CPVT_WordInfo& wordinfo);
464 FX_BOOL GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo);
465 FX_BOOL SetWordInfo(const CPVT_WordPlace& place,
466 const CPVT_WordInfo& wordinfo);
467 FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
468 FX_BOOL GetSectionInfo(const CPVT_WordPlace& place,
469 CPVT_SectionInfo& secinfo);
470 FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo,
471 FX_BOOL bFactFontSize = FALSE);
472 FX_FLOAT GetWordWidth(int32_t nFontIndex,
473 FX_WORD Word,
474 FX_WORD SubWord,
475 FX_FLOAT fCharSpace,
476 int32_t nHorzScale,
477 FX_FLOAT fFontSize,
478 FX_FLOAT fWordTail,
479 int32_t nWordStyle);
480 FX_FLOAT GetWordWidth(const CPVT_WordInfo& WordInfo);
481 FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize);
482 FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize);
483 FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo,
484 FX_BOOL bFactFontSize = FALSE);
485 FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo,
486 FX_BOOL bFactFontSize = FALSE);
487 FX_FLOAT GetLineAscent(const CPVT_SectionInfo& SecInfo);
488 FX_FLOAT GetLineDescent(const CPVT_SectionInfo& SecInfo);
489 FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize);
490 FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize);
491 int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo);
492 FX_FLOAT GetCharSpace(const CPVT_WordInfo& WordInfo);
493 int32_t GetHorzScale(const CPVT_WordInfo& WordInfo);
494 FX_FLOAT GetLineLeading(const CPVT_SectionInfo& SecInfo);
495 FX_FLOAT GetLineIndent(const CPVT_SectionInfo& SecInfo);
496 int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
497
498 void ClearSectionRightWords(const CPVT_WordPlace& place);
499
500 FX_BOOL ClearEmptySection(const CPVT_WordPlace& place);
501 void ClearEmptySections(const CPVT_WordRange& PlaceRange);
502 void LinkLatterSection(const CPVT_WordPlace& place);
503 void ClearWords(const CPVT_WordRange& PlaceRange);
504 CPVT_WordPlace ClearLeftWord(const CPVT_WordPlace& place);
505 CPVT_WordPlace ClearRightWord(const CPVT_WordPlace& place);
506
507 private:
508 CPVT_FloatRect Rearrange(const CPVT_WordRange& PlaceRange);
509 FX_FLOAT GetAutoFontSize();
510 FX_BOOL IsBigger(FX_FLOAT fFontSize);
511 CPVT_FloatRect RearrangeSections(const CPVT_WordRange& PlaceRange);
512
513 void ResetSectionArray();
514
515 CPVT_ArrayTemplate<CSection*> m_SectionArray;
516 int32_t m_nLimitChar;
517 int32_t m_nCharArray;
518 FX_BOOL m_bMultiLine;
519 FX_BOOL m_bLimitWidth;
520 FX_BOOL m_bAutoFontSize;
521 int32_t m_nAlignment;
522 FX_FLOAT m_fLineLeading;
523 FX_FLOAT m_fCharSpace;
524 int32_t m_nHorzScale;
525 FX_WORD m_wSubWord;
526 FX_FLOAT m_fFontSize;
527
528 private:
529 FX_BOOL m_bInitial;
530 FX_BOOL m_bRichText;
531 IPDF_VariableText_Provider* m_pVTProvider;
532 CPDF_VariableText_Iterator* m_pVTIterator;
533 };
534
535 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator {
536 public:
537 explicit CPDF_VariableText_Iterator(CPDF_VariableText* pVT);
538 ~CPDF_VariableText_Iterator() override;
539
540 // IPDF_VariableText_Iterator
541 FX_BOOL NextWord() override;
542 FX_BOOL PrevWord() override;
543 FX_BOOL NextLine() override;
544 FX_BOOL PrevLine() override;
545 FX_BOOL NextSection() override;
546 FX_BOOL PrevSection() override;
547 FX_BOOL SetWord(const CPVT_Word& word) override;
548 FX_BOOL GetWord(CPVT_Word& word) const override;
549 FX_BOOL GetLine(CPVT_Line& line) const override;
550 FX_BOOL GetSection(CPVT_Section& section) const override;
551 FX_BOOL SetSection(const CPVT_Section& section) override;
552 void SetAt(int32_t nWordIndex) override;
553 void SetAt(const CPVT_WordPlace& place) override;
554 const CPVT_WordPlace& GetAt() const override { return m_CurPos; }
555
556 private:
557 CPVT_WordPlace m_CurPos;
558 CPDF_VariableText* m_pVT;
559 };
560
561 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_vtmodule.cpp ('k') | core/src/fpdfdoc/tagged_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698