Chromium Code Reviews| 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 FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ | 7 #ifndef FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ |
| 8 #define FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ | 8 #define FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ |
| 9 | 9 |
| 10 #include "core/include/fpdfdoc/fpdf_vt.h" | 10 #include "core/fpdfdoc/include/cpvt_secprops.h" |
| 11 #include "core/fpdfdoc/include/cpvt_wordprops.h" | |
| 11 #include "fpdfsdk/include/fxedit/fx_edit.h" | 12 #include "fpdfsdk/include/fxedit/fx_edit.h" |
| 12 | 13 |
| 13 class CFX_Edit; | 14 class CFX_Edit; |
| 14 class CFX_Edit_Iterator; | 15 class CFX_Edit_Iterator; |
| 15 class CFX_Edit_Provider; | 16 class CFX_Edit_Provider; |
| 16 | 17 |
| 17 #define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001) | 18 #define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001) |
| 18 #define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb) | 19 #define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb) |
| 19 #define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb)) | 20 #define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb)) |
| 20 #define FX_EDIT_IsFloatSmaller(fa, fb) \ | 21 #define FX_EDIT_IsFloatSmaller(fa, fb) \ |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 friend class CFXEU_InsertReturn; | 504 friend class CFXEU_InsertReturn; |
| 504 friend class CFXEU_Backspace; | 505 friend class CFXEU_Backspace; |
| 505 friend class CFXEU_Delete; | 506 friend class CFXEU_Delete; |
| 506 friend class CFXEU_Clear; | 507 friend class CFXEU_Clear; |
| 507 friend class CFXEU_ClearRich; | 508 friend class CFXEU_ClearRich; |
| 508 friend class CFXEU_SetSecProps; | 509 friend class CFXEU_SetSecProps; |
| 509 friend class CFXEU_SetWordProps; | 510 friend class CFXEU_SetWordProps; |
| 510 friend class CFXEU_InsertText; | 511 friend class CFXEU_InsertText; |
| 511 | 512 |
| 512 public: | 513 public: |
| 513 explicit CFX_Edit(IPDF_VariableText* pVT); | 514 explicit CFX_Edit(CPDF_VariableText* pVT); |
| 514 ~CFX_Edit() override; | 515 ~CFX_Edit() override; |
| 515 | 516 |
| 516 // IFX_Edit | 517 // IFX_Edit |
| 517 void SetFontMap(IFX_Edit_FontMap* pFontMap) override; | 518 void SetFontMap(IPVT_FontMap* pFontMap) override; |
| 518 void SetVTProvider(IPDF_VariableText::Provider* pProvider) override; | 519 void SetVTProvider(CPDF_VariableText::Provider* pProvider) override; |
| 519 void SetNotify(IFX_Edit_Notify* pNotify) override; | 520 void SetNotify(IFX_Edit_Notify* pNotify) override; |
| 520 void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override; | 521 void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override; |
| 521 IFX_Edit_Iterator* GetIterator() override; | 522 IFX_Edit_Iterator* GetIterator() override; |
| 522 IPDF_VariableText* GetVariableText() override; | 523 CPDF_VariableText* GetVariableText() override; |
| 523 IFX_Edit_FontMap* GetFontMap() override; | 524 IPVT_FontMap* GetFontMap() override; |
| 524 void Initialize() override; | 525 void Initialize() override; |
| 525 void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE) override; | 526 void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE) override; |
| 526 void SetScrollPos(const CFX_FloatPoint& point) override; | 527 void SetScrollPos(const CFX_FloatPoint& point) override; |
| 527 void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; | 528 void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; |
| 528 void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; | 529 void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; |
| 529 void SetPasswordChar(uint16_t wSubWord = '*', FX_BOOL bPaint = TRUE) override; | 530 void SetPasswordChar(uint16_t wSubWord = '*', FX_BOOL bPaint = TRUE) override; |
| 530 void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) override; | 531 void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) override; |
| 531 void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) override; | 532 void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) override; |
| 532 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) override; | 533 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) override; |
| 533 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) override; | 534 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) override; |
| 534 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) override; | 535 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) override; |
| 535 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) override; | 536 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) override; |
| 536 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 537 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; |
| 537 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 538 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; |
| 538 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 539 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; |
| 539 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) override; | 540 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) override; |
| 540 void SetTextOverflow(FX_BOOL bAllowed = FALSE, | 541 void SetTextOverflow(FX_BOOL bAllowed = FALSE, |
| 541 FX_BOOL bPaint = TRUE) override; | 542 FX_BOOL bPaint = TRUE) override; |
| 542 FX_BOOL IsRichText() const override; | 543 FX_BOOL IsRichText() const override; |
| 543 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) override; | 544 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) override; |
| 544 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) override; | 545 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) override; |
| 545 FX_BOOL SetRichFontIndex(int32_t nFontIndex) override; | 546 FX_BOOL SetRichFontIndex(int32_t nFontIndex) override; |
| 546 FX_BOOL SetRichTextColor(FX_COLORREF dwColor) override; | 547 FX_BOOL SetRichTextColor(FX_COLORREF dwColor) override; |
| 547 FX_BOOL SetRichTextScript(int32_t nScriptType) override; | 548 FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) override; |
|
Tom Sepez
2016/04/05 16:58:23
nit: eScriptType
dsinclair
2016/04/05 17:29:20
Acknowledged.
| |
| 548 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) override; | 549 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) override; |
| 549 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) override; | 550 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) override; |
| 550 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) override; | 551 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) override; |
| 551 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) override; | 552 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) override; |
| 552 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) override; | 553 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) override; |
| 553 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) override; | 554 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) override; |
| 554 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) override; | 555 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) override; |
| 555 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) override; | 556 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) override; |
| 556 FX_BOOL SetRichTextAlignment(int32_t nAlignment) override; | 557 FX_BOOL SetRichTextAlignment(int32_t nAlignment) override; |
| 557 void OnMouseDown(const CFX_FloatPoint& point, | 558 void OnMouseDown(const CFX_FloatPoint& point, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 void EndGroupUndo(); | 719 void EndGroupUndo(); |
| 719 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); | 720 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); |
| 720 | 721 |
| 721 void SetPageInfo(const CPVT_WordPlace& place); | 722 void SetPageInfo(const CPVT_WordPlace& place); |
| 722 CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, | 723 CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, |
| 723 const CFX_FloatPoint& point) const; | 724 const CFX_FloatPoint& point) const; |
| 724 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; | 725 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; |
| 725 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; | 726 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; |
| 726 | 727 |
| 727 private: | 728 private: |
| 728 IPDF_VariableText* m_pVT; | 729 CPDF_VariableText* m_pVT; |
| 729 IFX_Edit_Notify* m_pNotify; | 730 IFX_Edit_Notify* m_pNotify; |
| 730 IFX_Edit_OprNotify* m_pOprNotify; | 731 IFX_Edit_OprNotify* m_pOprNotify; |
| 731 CFX_Edit_Provider* m_pVTProvide; | 732 CFX_Edit_Provider* m_pVTProvide; |
| 732 | 733 |
| 733 CPVT_WordPlace m_wpCaret; | 734 CPVT_WordPlace m_wpCaret; |
| 734 CPVT_WordPlace m_wpOldCaret; | 735 CPVT_WordPlace m_wpOldCaret; |
| 735 CFX_Edit_Select m_SelState; | 736 CFX_Edit_Select m_SelState; |
| 736 | 737 |
| 737 CFX_FloatPoint m_ptScrollPos; | 738 CFX_FloatPoint m_ptScrollPos; |
| 738 CFX_FloatPoint m_ptRefreshScrollPos; | 739 CFX_FloatPoint m_ptRefreshScrollPos; |
| 739 FX_BOOL m_bEnableScroll; | 740 FX_BOOL m_bEnableScroll; |
| 740 IFX_Edit_Iterator* m_pIterator; | 741 IFX_Edit_Iterator* m_pIterator; |
| 741 CFX_Edit_Refresh m_Refresh; | 742 CFX_Edit_Refresh m_Refresh; |
| 742 CFX_FloatPoint m_ptCaret; | 743 CFX_FloatPoint m_ptCaret; |
| 743 CFX_Edit_Undo m_Undo; | 744 CFX_Edit_Undo m_Undo; |
| 744 int32_t m_nAlignment; | 745 int32_t m_nAlignment; |
| 745 FX_BOOL m_bNotifyFlag; | 746 FX_BOOL m_bNotifyFlag; |
| 746 FX_BOOL m_bEnableOverflow; | 747 FX_BOOL m_bEnableOverflow; |
| 747 FX_BOOL m_bEnableRefresh; | 748 FX_BOOL m_bEnableRefresh; |
| 748 CFX_FloatRect m_rcOldContent; | 749 CFX_FloatRect m_rcOldContent; |
| 749 FX_BOOL m_bEnableUndo; | 750 FX_BOOL m_bEnableUndo; |
| 750 FX_BOOL m_bNotify; | 751 FX_BOOL m_bNotify; |
| 751 FX_BOOL m_bOprNotify; | 752 FX_BOOL m_bOprNotify; |
| 752 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; | 753 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; |
| 753 }; | 754 }; |
| 754 | 755 |
| 755 class CFX_Edit_Iterator : public IFX_Edit_Iterator { | 756 class CFX_Edit_Iterator : public IFX_Edit_Iterator { |
| 756 public: | 757 public: |
| 757 CFX_Edit_Iterator(CFX_Edit* pEdit, IPDF_VariableText::Iterator* pVTIterator); | 758 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); |
| 758 ~CFX_Edit_Iterator() override; | 759 ~CFX_Edit_Iterator() override; |
| 759 | 760 |
| 760 // IFX_Edit_Iterator | 761 // IFX_Edit_Iterator |
| 761 FX_BOOL NextWord() override; | 762 FX_BOOL NextWord() override; |
| 762 FX_BOOL NextLine() override; | 763 FX_BOOL NextLine() override; |
| 763 FX_BOOL NextSection() override; | 764 FX_BOOL NextSection() override; |
| 764 FX_BOOL PrevWord() override; | 765 FX_BOOL PrevWord() override; |
| 765 FX_BOOL PrevLine() override; | 766 FX_BOOL PrevLine() override; |
| 766 FX_BOOL PrevSection() override; | 767 FX_BOOL PrevSection() override; |
| 767 FX_BOOL GetWord(CPVT_Word& word) const override; | 768 FX_BOOL GetWord(CPVT_Word& word) const override; |
| 768 FX_BOOL GetLine(CPVT_Line& line) const override; | 769 FX_BOOL GetLine(CPVT_Line& line) const override; |
| 769 FX_BOOL GetSection(CPVT_Section& section) const override; | 770 FX_BOOL GetSection(CPVT_Section& section) const override; |
| 770 void SetAt(int32_t nWordIndex) override; | 771 void SetAt(int32_t nWordIndex) override; |
| 771 void SetAt(const CPVT_WordPlace& place) override; | 772 void SetAt(const CPVT_WordPlace& place) override; |
| 772 const CPVT_WordPlace& GetAt() const override; | 773 const CPVT_WordPlace& GetAt() const override; |
| 773 IFX_Edit* GetEdit() const override; | 774 IFX_Edit* GetEdit() const override; |
| 774 | 775 |
| 775 private: | 776 private: |
| 776 CFX_Edit* m_pEdit; | 777 CFX_Edit* m_pEdit; |
| 777 IPDF_VariableText::Iterator* m_pVTIterator; | 778 CPDF_VariableText::Iterator* m_pVTIterator; |
| 778 }; | 779 }; |
| 779 | 780 |
| 780 class CFX_Edit_Provider : public IPDF_VariableText::Provider { | 781 class CFX_Edit_Provider : public CPDF_VariableText::Provider { |
|
dsinclair
2016/04/05 16:21:24
This is the one other subclass of IPDF_VariableTex
| |
| 781 public: | 782 public: |
| 782 explicit CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap); | 783 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); |
|
dsinclair
2016/04/05 16:21:24
This constructor is what necessitated the merge if
| |
| 783 ~CFX_Edit_Provider() override; | 784 ~CFX_Edit_Provider() override; |
| 784 | 785 |
| 785 IFX_Edit_FontMap* GetFontMap(); | 786 IPVT_FontMap* GetFontMap(); |
| 786 | 787 |
| 787 // IPDF_VariableText::Provider: | 788 // CPDF_VariableText::Provider: |
| 788 int32_t GetCharWidth(int32_t nFontIndex, | 789 int32_t GetCharWidth(int32_t nFontIndex, |
| 789 uint16_t word, | 790 uint16_t word, |
| 790 int32_t nWordStyle) override; | 791 int32_t nWordStyle) override; |
| 791 int32_t GetTypeAscent(int32_t nFontIndex) override; | 792 int32_t GetTypeAscent(int32_t nFontIndex) override; |
| 792 int32_t GetTypeDescent(int32_t nFontIndex) override; | 793 int32_t GetTypeDescent(int32_t nFontIndex) override; |
| 793 int32_t GetWordFontIndex(uint16_t word, | 794 int32_t GetWordFontIndex(uint16_t word, |
| 794 int32_t charset, | 795 int32_t charset, |
| 795 int32_t nFontIndex) override; | 796 int32_t nFontIndex) override; |
| 796 int32_t GetDefaultFontIndex() override; | 797 int32_t GetDefaultFontIndex() override; |
| 797 FX_BOOL IsLatinWord(uint16_t word) override; | 798 FX_BOOL IsLatinWord(uint16_t word) override; |
| 798 | 799 |
| 799 private: | 800 private: |
| 800 IFX_Edit_FontMap* m_pFontMap; | 801 IPVT_FontMap* m_pFontMap; |
| 801 }; | 802 }; |
| 802 | 803 |
| 803 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ | 804 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ |
| OLD | NEW |