OLD | NEW |
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 #ifndef CORE_SRC_FPDFDOC_PDF_VT_H_ | 7 #ifndef CORE_SRC_FPDFDOC_PDF_VT_H_ |
8 #define CORE_SRC_FPDFDOC_PDF_VT_H_ | 8 #define CORE_SRC_FPDFDOC_PDF_VT_H_ |
9 | 9 |
10 class CPVT_Size; | 10 class CPVT_Size; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 FX_FLOAT Range() const | 185 FX_FLOAT Range() const |
186 { | 186 { |
187 return fMax - fMin; | 187 return fMax - fMin; |
188 } | 188 } |
189 FX_FLOAT fMin, fMax; | 189 FX_FLOAT fMin, fMax; |
190 }; | 190 }; |
191 template<class TYPE> class CPVT_ArrayTemplate : public CFX_ArrayTemplate<TYPE> | 191 template<class TYPE> class CPVT_ArrayTemplate : public CFX_ArrayTemplate<TYPE> |
192 { | 192 { |
193 public: | 193 public: |
194 FX_BOOL IsEmpty() | 194 bool IsEmpty() |
195 { | 195 { |
196 return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; | 196 return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; |
197 } | 197 } |
198 TYPE GetAt(int nIndex) const | 198 TYPE GetAt(int nIndex) const |
199 { | 199 { |
200 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) { | 200 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) { |
201 return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); | 201 return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); |
202 } | 202 } |
203 return NULL; | 203 return NULL; |
204 } | 204 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 }; | 309 }; |
310 class CTypeset | 310 class CTypeset |
311 { | 311 { |
312 public: | 312 public: |
313 CTypeset(CSection * pSection); | 313 CTypeset(CSection * pSection); |
314 virtual ~CTypeset(); | 314 virtual ~CTypeset(); |
315 CPVT_Size GetEditS
ize(FX_FLOAT fFontSize); | 315 CPVT_Size GetEditS
ize(FX_FLOAT fFontSize); |
316 CPVT_FloatRect Typeset(
); | 316 CPVT_FloatRect Typeset(
); |
317 CPVT_FloatRect CharArra
y(); | 317 CPVT_FloatRect CharArra
y(); |
318 private: | 318 private: |
319 void» » » » » » » » »
SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize); | 319 void» » » » » » » » »
SplitLines(bool bTypeset, FX_FLOAT fFontSize); |
320 void
OutputLines(); | 320 void
OutputLines(); |
321 | 321 |
322 CPVT_FloatRect m_rcRet; | 322 CPVT_FloatRect m_rcRet; |
323 CPDF_VariableText * m_pVT; | 323 CPDF_VariableText * m_pVT; |
324 CSection * m_pSec
tion; | 324 CSection * m_pSec
tion; |
325 }; | 325 }; |
326 class CPDF_EditContainer | 326 class CPDF_EditContainer |
327 { | 327 { |
328 public: | 328 public: |
329 CPDF_EditContainer(): m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {}; | 329 CPDF_EditContainer(): m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {}; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 m_nLimitChar = nLimitChar; | 416 m_nLimitChar = nLimitChar; |
417 } | 417 } |
418 void
SetCharSpace(FX_FLOAT fCharSpace = 0.0f) | 418 void
SetCharSpace(FX_FLOAT fCharSpace = 0.0f) |
419 { | 419 { |
420 m_fCharSpace = fCharSpace; | 420 m_fCharSpace = fCharSpace; |
421 } | 421 } |
422 void
SetHorzScale(int32_t nHorzScale = 100) | 422 void
SetHorzScale(int32_t nHorzScale = 100) |
423 { | 423 { |
424 m_nHorzScale = nHorzScale; | 424 m_nHorzScale = nHorzScale; |
425 } | 425 } |
426 void» » » » » » » » »
SetMultiLine(FX_BOOL bMultiLine = TRUE) | 426 void» » » » » » » » »
SetMultiLine(bool bMultiLine = true) |
427 { | 427 { |
428 m_bMultiLine = bMultiLine; | 428 m_bMultiLine = bMultiLine; |
429 } | 429 } |
430 void» » » » » » » » »
SetAutoReturn(FX_BOOL bAuto = TRUE) | 430 void» » » » » » » » »
SetAutoReturn(bool bAuto = true) |
431 { | 431 { |
432 m_bLimitWidth = bAuto; | 432 m_bLimitWidth = bAuto; |
433 } | 433 } |
434 void
SetFontSize(FX_FLOAT fFontSize) | 434 void
SetFontSize(FX_FLOAT fFontSize) |
435 { | 435 { |
436 m_fFontSize = fFontSize; | 436 m_fFontSize = fFontSize; |
437 } | 437 } |
438 void
SetCharArray(int32_t nCharArray = 0) | 438 void
SetCharArray(int32_t nCharArray = 0) |
439 { | 439 { |
440 m_nCharArray = nCharArray; | 440 m_nCharArray = nCharArray; |
441 } | 441 } |
442 void» » » » » » » » »
SetAutoFontSize(FX_BOOL bAuto = TRUE) | 442 void» » » » » » » » »
SetAutoFontSize(bool bAuto = true) |
443 { | 443 { |
444 m_bAutoFontSize = bAuto; | 444 m_bAutoFontSize = bAuto; |
445 } | 445 } |
446 void» » » » » » » » »
SetRichText(FX_BOOL bRichText) | 446 void» » » » » » » » »
SetRichText(bool bRichText) |
447 { | 447 { |
448 m_bRichText = bRichText; | 448 m_bRichText = bRichText; |
449 } | 449 } |
450 void
SetLineLeading(FX_FLOAT fLineLeading) | 450 void
SetLineLeading(FX_FLOAT fLineLeading) |
451 { | 451 { |
452 m_fLineLeading = fLineLeading; | 452 m_fLineLeading = fLineLeading; |
453 } | 453 } |
454 void
Initialize(); | 454 void
Initialize(); |
455 FX_BOOL» » » » » » » » »
IsValid() const | 455 bool» » » » » » » » »
IsValid() const |
456 { | 456 { |
457 return m_bInitial; | 457 return m_bInitial; |
458 } | 458 } |
459 FX_BOOL» » » » » » » » »
IsRichText() const | 459 bool» » » » » » » » »
IsRichText() const |
460 { | 460 { |
461 return m_bRichText; | 461 return m_bRichText; |
462 } | 462 } |
463 void
RearrangeAll(); | 463 void
RearrangeAll(); |
464 void
RearrangePart(const CPVT_WordRange & PlaceRange); | 464 void
RearrangePart(const CPVT_WordRange & PlaceRange); |
465 void
ResetAll(); | 465 void
ResetAll(); |
466 void
SetText(const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecPro
ps = NULL, | 466 void
SetText(const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecPro
ps = NULL, |
467 const CPVT_WordProps * pWordProps = NULL); | 467 const CPVT_WordProps * pWordProps = NULL); |
468 CPVT_WordPlace InsertWo
rd(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1, | 468 CPVT_WordPlace InsertWo
rd(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1, |
469 const CPVT_WordProps * pWordProps = NULL); | 469 const CPVT_WordProps * pWordProps = NULL); |
(...skipping 19 matching lines...) Expand all Loading... |
489 return m_nAlignment; | 489 return m_nAlignment; |
490 } | 490 } |
491 int32_t GetCharA
rray() const | 491 int32_t GetCharA
rray() const |
492 { | 492 { |
493 return m_nCharArray; | 493 return m_nCharArray; |
494 } | 494 } |
495 int32_t GetLimit
Char() const | 495 int32_t GetLimit
Char() const |
496 { | 496 { |
497 return m_nLimitChar; | 497 return m_nLimitChar; |
498 } | 498 } |
499 FX_BOOL» » » » » » » » »
IsMultiLine() const | 499 bool» » » » » » » » »
IsMultiLine() const |
500 { | 500 { |
501 return m_bMultiLine; | 501 return m_bMultiLine; |
502 } | 502 } |
503 int32_t GetHorzS
cale() const | 503 int32_t GetHorzS
cale() const |
504 { | 504 { |
505 return m_nHorzScale; | 505 return m_nHorzScale; |
506 } | 506 } |
507 FX_FLOAT GetCharS
pace() const | 507 FX_FLOAT GetCharS
pace() const |
508 { | 508 { |
509 return m_fCharSpace; | 509 return m_fCharSpace; |
(...skipping 20 matching lines...) Expand all Loading... |
530 FX_WORD
GetSubWord() const | 530 FX_WORD
GetSubWord() const |
531 { | 531 { |
532 return m_wSubWord; | 532 return m_wSubWord; |
533 } | 533 } |
534 private: | 534 private: |
535 int32_t GetCharW
idth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle); | 535 int32_t GetCharW
idth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle); |
536 int32_t GetTypeA
scent(int32_t nFontIndex); | 536 int32_t GetTypeA
scent(int32_t nFontIndex); |
537 int32_t GetTypeD
escent(int32_t nFontIndex); | 537 int32_t GetTypeD
escent(int32_t nFontIndex); |
538 int32_t GetWordF
ontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); | 538 int32_t GetWordF
ontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); |
539 int32_t GetDefau
ltFontIndex(); | 539 int32_t GetDefau
ltFontIndex(); |
540 FX_BOOL» » » » » » » » »
IsLatinWord(FX_WORD word); | 540 bool» » » » » » » » »
IsLatinWord(FX_WORD word); |
541 private: | 541 private: |
542 | 542 |
543 CPVT_WordPlace AddSecti
on(const CPVT_WordPlace & place, const CPVT_SectionInfo & secinfo); | 543 CPVT_WordPlace AddSecti
on(const CPVT_WordPlace & place, const CPVT_SectionInfo & secinfo); |
544 CPVT_WordPlace AddLine(
const CPVT_WordPlace & place, const CPVT_LineInfo & lineinfo); | 544 CPVT_WordPlace AddLine(
const CPVT_WordPlace & place, const CPVT_LineInfo & lineinfo); |
545 CPVT_WordPlace AddWord(
const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); | 545 CPVT_WordPlace AddWord(
const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); |
546 FX_BOOL» » » » » » » » »
GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo); | 546 bool» » » » » » » » »
GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo); |
547 FX_BOOL» » » » » » » » »
SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); | 547 bool» » » » » » » » »
SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); |
548 FX_BOOL» » » » » » » » »
GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo); | 548 bool» » » » » » » » »
GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo); |
549 FX_BOOL» » » » » » » » »
GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo); | 549 bool» » » » » » » » »
GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo); |
550 FX_FLOAT» » » » » » » » GetWordF
ontSize(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); | 550 FX_FLOAT» » » » » » » » GetWordF
ontSize(const CPVT_WordInfo & WordInfo, bool bFactFontSize = false); |
551 FX_FLOAT GetWordW
idth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, | 551 FX_FLOAT GetWordW
idth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, |
552 FX_FLOAT fCharSpace, int32_t nHorzScale, | 552 FX_FLOAT fCharSpace, int32_t nHorzScale, |
553 FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle); | 553 FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle); |
554 FX_FLOAT GetWordW
idth(const CPVT_WordInfo & WordInfo); | 554 FX_FLOAT GetWordW
idth(const CPVT_WordInfo & WordInfo); |
555 FX_FLOAT GetWordA
scent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); | 555 FX_FLOAT GetWordA
scent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); |
556 FX_FLOAT GetWordD
escent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); | 556 FX_FLOAT GetWordD
escent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); |
557 FX_FLOAT» » » » » » » » GetWordA
scent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); | 557 FX_FLOAT» » » » » » » » GetWordA
scent(const CPVT_WordInfo & WordInfo, bool bFactFontSize = false); |
558 FX_FLOAT» » » » » » » » GetWordD
escent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); | 558 FX_FLOAT» » » » » » » » GetWordD
escent(const CPVT_WordInfo & WordInfo, bool bFactFontSize = false); |
559 FX_FLOAT GetLineA
scent(const CPVT_SectionInfo & SecInfo); | 559 FX_FLOAT GetLineA
scent(const CPVT_SectionInfo & SecInfo); |
560 FX_FLOAT GetLineD
escent(const CPVT_SectionInfo & SecInfo); | 560 FX_FLOAT GetLineD
escent(const CPVT_SectionInfo & SecInfo); |
561 FX_FLOAT GetFontA
scent(int32_t nFontIndex, FX_FLOAT fFontSize); | 561 FX_FLOAT GetFontA
scent(int32_t nFontIndex, FX_FLOAT fFontSize); |
562 FX_FLOAT GetFontD
escent(int32_t nFontIndex, FX_FLOAT fFontSize); | 562 FX_FLOAT GetFontD
escent(int32_t nFontIndex, FX_FLOAT fFontSize); |
563 int32_t GetWordF
ontIndex(const CPVT_WordInfo & WordInfo); | 563 int32_t GetWordF
ontIndex(const CPVT_WordInfo & WordInfo); |
564 FX_FLOAT GetCharS
pace(const CPVT_WordInfo & WordInfo); | 564 FX_FLOAT GetCharS
pace(const CPVT_WordInfo & WordInfo); |
565 int32_t GetHorzS
cale(const CPVT_WordInfo & WordInfo); | 565 int32_t GetHorzS
cale(const CPVT_WordInfo & WordInfo); |
566 FX_FLOAT GetLineL
eading(const CPVT_SectionInfo & SecInfo); | 566 FX_FLOAT GetLineL
eading(const CPVT_SectionInfo & SecInfo); |
567 FX_FLOAT GetLineI
ndent(const CPVT_SectionInfo & SecInfo); | 567 FX_FLOAT GetLineI
ndent(const CPVT_SectionInfo & SecInfo); |
568 int32_t GetAlign
ment(const CPVT_SectionInfo& SecInfo); | 568 int32_t GetAlign
ment(const CPVT_SectionInfo& SecInfo); |
569 | 569 |
570 void
ClearSectionRightWords(const CPVT_WordPlace & place); | 570 void
ClearSectionRightWords(const CPVT_WordPlace & place); |
571 CPVT_WordPlace» » » » » » » AjustLin
eHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const; | 571 CPVT_WordPlace» » » » » » » AjustLin
eHeader(const CPVT_WordPlace & place, bool bPrevOrNext) const; |
572 FX_BOOL» » » » » » » » »
ClearEmptySection(const CPVT_WordPlace & place); | 572 bool» » » » » » » » »
ClearEmptySection(const CPVT_WordPlace & place); |
573 void
ClearEmptySections(const CPVT_WordRange & PlaceRange); | 573 void
ClearEmptySections(const CPVT_WordRange & PlaceRange); |
574 void
LinkLatterSection(const CPVT_WordPlace & place); | 574 void
LinkLatterSection(const CPVT_WordPlace & place); |
575 void
ClearWords(const CPVT_WordRange & PlaceRange); | 575 void
ClearWords(const CPVT_WordRange & PlaceRange); |
576 CPVT_WordPlace ClearLef
tWord(const CPVT_WordPlace & place); | 576 CPVT_WordPlace ClearLef
tWord(const CPVT_WordPlace & place); |
577 CPVT_WordPlace ClearRig
htWord(const CPVT_WordPlace & place); | 577 CPVT_WordPlace ClearRig
htWord(const CPVT_WordPlace & place); |
578 private: | 578 private: |
579 CPVT_FloatRect Rearrang
e(const CPVT_WordRange & PlaceRange); | 579 CPVT_FloatRect Rearrang
e(const CPVT_WordRange & PlaceRange); |
580 FX_FLOAT GetAutoF
ontSize(); | 580 FX_FLOAT GetAutoF
ontSize(); |
581 FX_BOOL» » » » » » » » »
IsBigger(FX_FLOAT fFontSize); | 581 bool» » » » » » » » »
IsBigger(FX_FLOAT fFontSize); |
582 CPVT_FloatRect Rearrang
eSections(const CPVT_WordRange & PlaceRange); | 582 CPVT_FloatRect Rearrang
eSections(const CPVT_WordRange & PlaceRange); |
583 private: | 583 private: |
584 void
ResetSectionArray(); | 584 void
ResetSectionArray(); |
585 private: | 585 private: |
586 CPVT_ArrayTemplate<CSection*> m_SectionArray; | 586 CPVT_ArrayTemplate<CSection*> m_SectionArray; |
587 int32_t m_nLimit
Char; | 587 int32_t m_nLimit
Char; |
588 int32_t m_nCharA
rray; | 588 int32_t m_nCharA
rray; |
589 FX_BOOL» » » » » » » » »
m_bMultiLine; | 589 bool» » » » » » » » »
m_bMultiLine; |
590 FX_BOOL» » » » » » » » »
m_bLimitWidth; | 590 bool» » » » » » » » »
m_bLimitWidth; |
591 FX_BOOL» » » » » » » » »
m_bAutoFontSize; | 591 bool» » » » » » » » »
m_bAutoFontSize; |
592 int32_t m_nAlign
ment; | 592 int32_t m_nAlign
ment; |
593 FX_FLOAT m_fLineL
eading; | 593 FX_FLOAT m_fLineL
eading; |
594 FX_FLOAT m_fCharS
pace; | 594 FX_FLOAT m_fCharS
pace; |
595 int32_t m_nHorzS
cale; | 595 int32_t m_nHorzS
cale; |
596 FX_WORD
m_wSubWord; | 596 FX_WORD
m_wSubWord; |
597 FX_FLOAT m_fFontS
ize; | 597 FX_FLOAT m_fFontS
ize; |
598 | 598 |
599 private: | 599 private: |
600 FX_BOOL» » » » » » » » »
m_bInitial; | 600 bool» » » » » » » » »
m_bInitial; |
601 FX_BOOL» » » » » » » » »
m_bRichText; | 601 bool» » » » » » » » »
m_bRichText; |
602 IPDF_VariableText_Provider * m_pVTProvider; | 602 IPDF_VariableText_Provider * m_pVTProvider; |
603 CPDF_VariableText_Iterator * m_pVTIterator; | 603 CPDF_VariableText_Iterator * m_pVTIterator; |
604 }; | 604 }; |
605 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator | 605 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator |
606 { | 606 { |
607 public: | 607 public: |
608 CPDF_VariableText_Iterator(CPDF_VariableText * pVT); | 608 CPDF_VariableText_Iterator(CPDF_VariableText * pVT); |
609 virtual ~CPDF_VariableText_Iterator(); | 609 virtual ~CPDF_VariableText_Iterator(); |
610 FX_BOOL» » » » » » » » »
NextWord(); | 610 bool» » » » » » » » »
NextWord(); |
611 FX_BOOL» » » » » » » » »
PrevWord(); | 611 bool» » » » » » » » »
PrevWord(); |
612 FX_BOOL» » » » » » » » »
NextLine(); | 612 bool» » » » » » » » »
NextLine(); |
613 FX_BOOL» » » » » » » » »
PrevLine(); | 613 bool» » » » » » » » »
PrevLine(); |
614 FX_BOOL» » » » » » » » »
NextSection(); | 614 bool» » » » » » » » »
NextSection(); |
615 FX_BOOL» » » » » » » » »
PrevSection(); | 615 bool» » » » » » » » »
PrevSection(); |
616 FX_BOOL» » » » » » » » »
SetWord(const CPVT_Word & word); | 616 bool» » » » » » » » »
SetWord(const CPVT_Word & word); |
617 FX_BOOL» » » » » » » » »
GetWord(CPVT_Word & word) const; | 617 bool» » » » » » » » »
GetWord(CPVT_Word & word) const; |
618 FX_BOOL» » » » » » » » »
GetLine(CPVT_Line & line) const; | 618 bool» » » » » » » » »
GetLine(CPVT_Line & line) const; |
619 FX_BOOL» » » » » » » » »
GetSection(CPVT_Section & section) const; | 619 bool» » » » » » » » »
GetSection(CPVT_Section & section) const; |
620 FX_BOOL» » » » » » » » »
SetSection(const CPVT_Section & section); | 620 bool» » » » » » » » »
SetSection(const CPVT_Section & section); |
621 void
SetAt(int32_t nWordIndex); | 621 void
SetAt(int32_t nWordIndex); |
622 void
SetAt(const CPVT_WordPlace & place); | 622 void
SetAt(const CPVT_WordPlace & place); |
623 const CPVT_WordPlace & GetAt() const | 623 const CPVT_WordPlace & GetAt() const |
624 { | 624 { |
625 return m_CurPos; | 625 return m_CurPos; |
626 }; | 626 }; |
627 private: | 627 private: |
628 CPVT_WordPlace m_CurPos
; | 628 CPVT_WordPlace m_CurPos
; |
629 CPDF_VariableText * m_pVT; | 629 CPDF_VariableText * m_pVT; |
630 }; | 630 }; |
631 | 631 |
632 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_ | 632 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_ |
OLD | NEW |