| 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_FPDFDOC_PDF_VT_H_ | 7 #ifndef CORE_FPDFDOC_PDF_VT_H_ |
| 8 #define CORE_FPDFDOC_PDF_VT_H_ | 8 #define CORE_FPDFDOC_PDF_VT_H_ |
| 9 | 9 |
| 10 #include "core/include/fpdfdoc/fpdf_vt.h" | 10 #include "core/include/fpdfdoc/fpdf_vt.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 }; | 108 }; |
| 109 struct CPVT_WordInfo { | 109 struct CPVT_WordInfo { |
| 110 CPVT_WordInfo() | 110 CPVT_WordInfo() |
| 111 : Word(0), | 111 : Word(0), |
| 112 nCharset(0), | 112 nCharset(0), |
| 113 fWordX(0.0f), | 113 fWordX(0.0f), |
| 114 fWordY(0.0f), | 114 fWordY(0.0f), |
| 115 fWordTail(0.0f), | 115 fWordTail(0.0f), |
| 116 nFontIndex(-1), | 116 nFontIndex(-1), |
| 117 pWordProps(NULL) {} | 117 pWordProps(NULL) {} |
| 118 CPVT_WordInfo(FX_WORD word, | 118 CPVT_WordInfo(uint16_t word, |
| 119 int32_t charset, | 119 int32_t charset, |
| 120 int32_t fontIndex, | 120 int32_t fontIndex, |
| 121 CPVT_WordProps* pProps) | 121 CPVT_WordProps* pProps) |
| 122 : Word(word), | 122 : Word(word), |
| 123 nCharset(charset), | 123 nCharset(charset), |
| 124 fWordX(0.0f), | 124 fWordX(0.0f), |
| 125 fWordY(0.0f), | 125 fWordY(0.0f), |
| 126 fWordTail(0.0f), | 126 fWordTail(0.0f), |
| 127 nFontIndex(fontIndex), | 127 nFontIndex(fontIndex), |
| 128 pWordProps(pProps) {} | 128 pWordProps(pProps) {} |
| (...skipping 16 matching lines...) Expand all Loading... |
| 145 nCharset = word.nCharset; | 145 nCharset = word.nCharset; |
| 146 nFontIndex = word.nFontIndex; | 146 nFontIndex = word.nFontIndex; |
| 147 if (word.pWordProps) { | 147 if (word.pWordProps) { |
| 148 if (pWordProps) { | 148 if (pWordProps) { |
| 149 *pWordProps = *word.pWordProps; | 149 *pWordProps = *word.pWordProps; |
| 150 } else { | 150 } else { |
| 151 pWordProps = new CPVT_WordProps(*word.pWordProps); | 151 pWordProps = new CPVT_WordProps(*word.pWordProps); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 FX_WORD Word; | 155 uint16_t Word; |
| 156 int32_t nCharset; | 156 int32_t nCharset; |
| 157 FX_FLOAT fWordX; | 157 FX_FLOAT fWordX; |
| 158 FX_FLOAT fWordY; | 158 FX_FLOAT fWordY; |
| 159 FX_FLOAT fWordTail; | 159 FX_FLOAT fWordTail; |
| 160 int32_t nFontIndex; | 160 int32_t nFontIndex; |
| 161 CPVT_WordProps* pWordProps; | 161 CPVT_WordProps* pWordProps; |
| 162 }; | 162 }; |
| 163 struct CPVT_FloatRange { | 163 struct CPVT_FloatRange { |
| 164 CPVT_FloatRange() : fMin(0.0f), fMax(0.0f) {} | 164 CPVT_FloatRange() : fMin(0.0f), fMax(0.0f) {} |
| 165 CPVT_FloatRange(FX_FLOAT min, FX_FLOAT max) : fMin(min), fMax(max) {} | 165 CPVT_FloatRange(FX_FLOAT min, FX_FLOAT max) : fMin(min), fMax(max) {} |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 ~CPDF_VariableText() override; | 342 ~CPDF_VariableText() override; |
| 343 | 343 |
| 344 // IPDF_VariableText | 344 // IPDF_VariableText |
| 345 IPDF_VariableText_Provider* SetProvider( | 345 IPDF_VariableText_Provider* SetProvider( |
| 346 IPDF_VariableText_Provider* pProvider) override; | 346 IPDF_VariableText_Provider* pProvider) override; |
| 347 IPDF_VariableText_Iterator* GetIterator() override; | 347 IPDF_VariableText_Iterator* GetIterator() override; |
| 348 void SetPlateRect(const CFX_FloatRect& rect) override { | 348 void SetPlateRect(const CFX_FloatRect& rect) override { |
| 349 CPDF_EditContainer::SetPlateRect(rect); | 349 CPDF_EditContainer::SetPlateRect(rect); |
| 350 } | 350 } |
| 351 void SetAlignment(int32_t nFormat = 0) override { m_nAlignment = nFormat; } | 351 void SetAlignment(int32_t nFormat = 0) override { m_nAlignment = nFormat; } |
| 352 void SetPasswordChar(FX_WORD wSubWord = '*') override { | 352 void SetPasswordChar(uint16_t wSubWord = '*') override { |
| 353 m_wSubWord = wSubWord; | 353 m_wSubWord = wSubWord; |
| 354 } | 354 } |
| 355 void SetLimitChar(int32_t nLimitChar = 0) override { | 355 void SetLimitChar(int32_t nLimitChar = 0) override { |
| 356 m_nLimitChar = nLimitChar; | 356 m_nLimitChar = nLimitChar; |
| 357 } | 357 } |
| 358 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) override { | 358 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) override { |
| 359 m_fCharSpace = fCharSpace; | 359 m_fCharSpace = fCharSpace; |
| 360 } | 360 } |
| 361 void SetHorzScale(int32_t nHorzScale = 100) override { | 361 void SetHorzScale(int32_t nHorzScale = 100) override { |
| 362 m_nHorzScale = nHorzScale; | 362 m_nHorzScale = nHorzScale; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 380 FX_BOOL IsValid() const override { return m_bInitial; } | 380 FX_BOOL IsValid() const override { return m_bInitial; } |
| 381 FX_BOOL IsRichText() const override { return m_bRichText; } | 381 FX_BOOL IsRichText() const override { return m_bRichText; } |
| 382 void RearrangeAll() override; | 382 void RearrangeAll() override; |
| 383 void RearrangePart(const CPVT_WordRange& PlaceRange) override; | 383 void RearrangePart(const CPVT_WordRange& PlaceRange) override; |
| 384 void ResetAll() override; | 384 void ResetAll() override; |
| 385 void SetText(const FX_WCHAR* text, | 385 void SetText(const FX_WCHAR* text, |
| 386 int32_t charset = 1, | 386 int32_t charset = 1, |
| 387 const CPVT_SecProps* pSecProps = NULL, | 387 const CPVT_SecProps* pSecProps = NULL, |
| 388 const CPVT_WordProps* pWordProps = NULL) override; | 388 const CPVT_WordProps* pWordProps = NULL) override; |
| 389 CPVT_WordPlace InsertWord(const CPVT_WordPlace& place, | 389 CPVT_WordPlace InsertWord(const CPVT_WordPlace& place, |
| 390 FX_WORD word, | 390 uint16_t word, |
| 391 int32_t charset = 1, | 391 int32_t charset = 1, |
| 392 const CPVT_WordProps* pWordProps = NULL) override; | 392 const CPVT_WordProps* pWordProps = NULL) override; |
| 393 CPVT_WordPlace InsertSection( | 393 CPVT_WordPlace InsertSection( |
| 394 const CPVT_WordPlace& place, | 394 const CPVT_WordPlace& place, |
| 395 const CPVT_SecProps* pSecProps = NULL, | 395 const CPVT_SecProps* pSecProps = NULL, |
| 396 const CPVT_WordProps* pWordProps = NULL) override; | 396 const CPVT_WordProps* pWordProps = NULL) override; |
| 397 CPVT_WordPlace InsertText(const CPVT_WordPlace& place, | 397 CPVT_WordPlace InsertText(const CPVT_WordPlace& place, |
| 398 const FX_WCHAR* text, | 398 const FX_WCHAR* text, |
| 399 int32_t charset = 1, | 399 int32_t charset = 1, |
| 400 const CPVT_SecProps* pSecProps = NULL, | 400 const CPVT_SecProps* pSecProps = NULL, |
| 401 const CPVT_WordProps* pWordProps = NULL) override; | 401 const CPVT_WordProps* pWordProps = NULL) override; |
| 402 CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) override; | 402 CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) override; |
| 403 CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) override; | 403 CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) override; |
| 404 CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) override; | 404 CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) override; |
| 405 const CFX_FloatRect& GetPlateRect() const override { | 405 const CFX_FloatRect& GetPlateRect() const override { |
| 406 return CPDF_EditContainer::GetPlateRect(); | 406 return CPDF_EditContainer::GetPlateRect(); |
| 407 } | 407 } |
| 408 CFX_FloatRect GetContentRect() const override; | 408 CFX_FloatRect GetContentRect() const override; |
| 409 int32_t GetTotalWords() const override; | 409 int32_t GetTotalWords() const override; |
| 410 FX_FLOAT GetFontSize() const override { return m_fFontSize; } | 410 FX_FLOAT GetFontSize() const override { return m_fFontSize; } |
| 411 int32_t GetAlignment() const override { return m_nAlignment; } | 411 int32_t GetAlignment() const override { return m_nAlignment; } |
| 412 FX_WORD GetPasswordChar() const override { return GetSubWord(); } | 412 uint16_t GetPasswordChar() const override { return GetSubWord(); } |
| 413 int32_t GetCharArray() const override { return m_nCharArray; } | 413 int32_t GetCharArray() const override { return m_nCharArray; } |
| 414 int32_t GetLimitChar() const override { return m_nLimitChar; } | 414 int32_t GetLimitChar() const override { return m_nLimitChar; } |
| 415 FX_BOOL IsMultiLine() const override { return m_bMultiLine; } | 415 FX_BOOL IsMultiLine() const override { return m_bMultiLine; } |
| 416 int32_t GetHorzScale() const override { return m_nHorzScale; } | 416 int32_t GetHorzScale() const override { return m_nHorzScale; } |
| 417 FX_FLOAT GetCharSpace() const override { return m_fCharSpace; } | 417 FX_FLOAT GetCharSpace() const override { return m_fCharSpace; } |
| 418 CPVT_WordPlace GetBeginWordPlace() const override; | 418 CPVT_WordPlace GetBeginWordPlace() const override; |
| 419 CPVT_WordPlace GetEndWordPlace() const override; | 419 CPVT_WordPlace GetEndWordPlace() const override; |
| 420 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const override; | 420 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const override; |
| 421 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const override; | 421 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const override; |
| 422 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const override; | 422 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const override; |
| 423 CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place, | 423 CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place, |
| 424 const CFX_FloatPoint& point) const override; | 424 const CFX_FloatPoint& point) const override; |
| 425 CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place, | 425 CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place, |
| 426 const CFX_FloatPoint& point) const override; | 426 const CFX_FloatPoint& point) const override; |
| 427 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override; | 427 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override; |
| 428 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override; | 428 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override; |
| 429 CPVT_WordPlace GetSectionBeginPlace( | 429 CPVT_WordPlace GetSectionBeginPlace( |
| 430 const CPVT_WordPlace& place) const override; | 430 const CPVT_WordPlace& place) const override; |
| 431 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override; | 431 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override; |
| 432 void UpdateWordPlace(CPVT_WordPlace& place) const override; | 432 void UpdateWordPlace(CPVT_WordPlace& place) const override; |
| 433 CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place, | 433 CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place, |
| 434 FX_BOOL bPrevOrNext) const override; | 434 FX_BOOL bPrevOrNext) const override; |
| 435 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; | 435 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; |
| 436 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override; | 436 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override; |
| 437 | 437 |
| 438 FX_WORD GetSubWord() const { return m_wSubWord; } | 438 uint16_t GetSubWord() const { return m_wSubWord; } |
| 439 | 439 |
| 440 private: | 440 private: |
| 441 int32_t GetCharWidth(int32_t nFontIndex, | 441 int32_t GetCharWidth(int32_t nFontIndex, |
| 442 FX_WORD Word, | 442 uint16_t Word, |
| 443 FX_WORD SubWord, | 443 uint16_t SubWord, |
| 444 int32_t nWordStyle); | 444 int32_t nWordStyle); |
| 445 int32_t GetTypeAscent(int32_t nFontIndex); | 445 int32_t GetTypeAscent(int32_t nFontIndex); |
| 446 int32_t GetTypeDescent(int32_t nFontIndex); | 446 int32_t GetTypeDescent(int32_t nFontIndex); |
| 447 int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); | 447 int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex); |
| 448 int32_t GetDefaultFontIndex(); | 448 int32_t GetDefaultFontIndex(); |
| 449 FX_BOOL IsLatinWord(FX_WORD word); | 449 FX_BOOL IsLatinWord(uint16_t word); |
| 450 | 450 |
| 451 CPVT_WordPlace AddSection(const CPVT_WordPlace& place, | 451 CPVT_WordPlace AddSection(const CPVT_WordPlace& place, |
| 452 const CPVT_SectionInfo& secinfo); | 452 const CPVT_SectionInfo& secinfo); |
| 453 CPVT_WordPlace AddLine(const CPVT_WordPlace& place, | 453 CPVT_WordPlace AddLine(const CPVT_WordPlace& place, |
| 454 const CPVT_LineInfo& lineinfo); | 454 const CPVT_LineInfo& lineinfo); |
| 455 CPVT_WordPlace AddWord(const CPVT_WordPlace& place, | 455 CPVT_WordPlace AddWord(const CPVT_WordPlace& place, |
| 456 const CPVT_WordInfo& wordinfo); | 456 const CPVT_WordInfo& wordinfo); |
| 457 FX_BOOL GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo); | 457 FX_BOOL GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo); |
| 458 FX_BOOL SetWordInfo(const CPVT_WordPlace& place, | 458 FX_BOOL SetWordInfo(const CPVT_WordPlace& place, |
| 459 const CPVT_WordInfo& wordinfo); | 459 const CPVT_WordInfo& wordinfo); |
| 460 FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo); | 460 FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo); |
| 461 FX_BOOL GetSectionInfo(const CPVT_WordPlace& place, | 461 FX_BOOL GetSectionInfo(const CPVT_WordPlace& place, |
| 462 CPVT_SectionInfo& secinfo); | 462 CPVT_SectionInfo& secinfo); |
| 463 FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo, | 463 FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo, |
| 464 FX_BOOL bFactFontSize = FALSE); | 464 FX_BOOL bFactFontSize = FALSE); |
| 465 FX_FLOAT GetWordWidth(int32_t nFontIndex, | 465 FX_FLOAT GetWordWidth(int32_t nFontIndex, |
| 466 FX_WORD Word, | 466 uint16_t Word, |
| 467 FX_WORD SubWord, | 467 uint16_t SubWord, |
| 468 FX_FLOAT fCharSpace, | 468 FX_FLOAT fCharSpace, |
| 469 int32_t nHorzScale, | 469 int32_t nHorzScale, |
| 470 FX_FLOAT fFontSize, | 470 FX_FLOAT fFontSize, |
| 471 FX_FLOAT fWordTail, | 471 FX_FLOAT fWordTail, |
| 472 int32_t nWordStyle); | 472 int32_t nWordStyle); |
| 473 FX_FLOAT GetWordWidth(const CPVT_WordInfo& WordInfo); | 473 FX_FLOAT GetWordWidth(const CPVT_WordInfo& WordInfo); |
| 474 FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize); | 474 FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize); |
| 475 FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize); | 475 FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize); |
| 476 FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, | 476 FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, |
| 477 FX_BOOL bFactFontSize = FALSE); | 477 FX_BOOL bFactFontSize = FALSE); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 508 CPVT_ArrayTemplate<CSection*> m_SectionArray; | 508 CPVT_ArrayTemplate<CSection*> m_SectionArray; |
| 509 int32_t m_nLimitChar; | 509 int32_t m_nLimitChar; |
| 510 int32_t m_nCharArray; | 510 int32_t m_nCharArray; |
| 511 FX_BOOL m_bMultiLine; | 511 FX_BOOL m_bMultiLine; |
| 512 FX_BOOL m_bLimitWidth; | 512 FX_BOOL m_bLimitWidth; |
| 513 FX_BOOL m_bAutoFontSize; | 513 FX_BOOL m_bAutoFontSize; |
| 514 int32_t m_nAlignment; | 514 int32_t m_nAlignment; |
| 515 FX_FLOAT m_fLineLeading; | 515 FX_FLOAT m_fLineLeading; |
| 516 FX_FLOAT m_fCharSpace; | 516 FX_FLOAT m_fCharSpace; |
| 517 int32_t m_nHorzScale; | 517 int32_t m_nHorzScale; |
| 518 FX_WORD m_wSubWord; | 518 uint16_t m_wSubWord; |
| 519 FX_FLOAT m_fFontSize; | 519 FX_FLOAT m_fFontSize; |
| 520 | 520 |
| 521 private: | 521 private: |
| 522 FX_BOOL m_bInitial; | 522 FX_BOOL m_bInitial; |
| 523 FX_BOOL m_bRichText; | 523 FX_BOOL m_bRichText; |
| 524 IPDF_VariableText_Provider* m_pVTProvider; | 524 IPDF_VariableText_Provider* m_pVTProvider; |
| 525 CPDF_VariableText_Iterator* m_pVTIterator; | 525 CPDF_VariableText_Iterator* m_pVTIterator; |
| 526 }; | 526 }; |
| 527 | 527 |
| 528 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator { | 528 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 545 void SetAt(int32_t nWordIndex) override; | 545 void SetAt(int32_t nWordIndex) override; |
| 546 void SetAt(const CPVT_WordPlace& place) override; | 546 void SetAt(const CPVT_WordPlace& place) override; |
| 547 const CPVT_WordPlace& GetAt() const override { return m_CurPos; } | 547 const CPVT_WordPlace& GetAt() const override { return m_CurPos; } |
| 548 | 548 |
| 549 private: | 549 private: |
| 550 CPVT_WordPlace m_CurPos; | 550 CPVT_WordPlace m_CurPos; |
| 551 CPDF_VariableText* m_pVT; | 551 CPDF_VariableText* m_pVT; |
| 552 }; | 552 }; |
| 553 | 553 |
| 554 #endif // CORE_FPDFDOC_PDF_VT_H_ | 554 #endif // CORE_FPDFDOC_PDF_VT_H_ |
| OLD | NEW |