| 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_FORMFILLER_CFFL_TEXTFIELD_H_ | 7 #ifndef FPDFSDK_FORMFILLER_CFFL_TEXTFIELD_H_ |
| 8 #define FPDFSDK_FORMFILLER_CFFL_TEXTFIELD_H_ | 8 #define FPDFSDK_FORMFILLER_CFFL_TEXTFIELD_H_ |
| 9 | 9 |
| 10 #include "fpdfsdk/formfiller/cffl_formfiller.h" | 10 #include "fpdfsdk/formfiller/cffl_formfiller.h" |
| 11 | 11 |
| 12 #define BF_ALIGN_LEFT 0 | 12 #define BF_ALIGN_LEFT 0 |
| 13 #define BF_ALIGN_MIDDLE 1 | 13 #define BF_ALIGN_MIDDLE 1 |
| 14 #define BF_ALIGN_RIGHT 2 | 14 #define BF_ALIGN_RIGHT 2 |
| 15 | 15 |
| 16 class CBA_FontMap; | 16 class CBA_FontMap; |
| 17 | 17 |
| 18 struct FFL_TextFieldState { | 18 struct FFL_TextFieldState { |
| 19 int nStart; | 19 int nStart; |
| 20 int nEnd; | 20 int nEnd; |
| 21 CFX_WideString sValue; | 21 CFX_WideString sValue; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 class CFFL_TextField : public CFFL_FormFiller, | 24 class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler { |
| 25 public IPWL_FocusHandler, | |
| 26 public IPWL_Edit_Notify { | |
| 27 public: | 25 public: |
| 28 CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot); | 26 CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot); |
| 29 ~CFFL_TextField() override; | 27 ~CFFL_TextField() override; |
| 30 | 28 |
| 31 // CFFL_FormFiller: | 29 // CFFL_FormFiller: |
| 32 PWL_CREATEPARAM GetCreateParam() override; | 30 PWL_CREATEPARAM GetCreateParam() override; |
| 33 CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, | 31 CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, |
| 34 CPDFSDK_PageView* pPageView) override; | 32 CPDFSDK_PageView* pPageView) override; |
| 35 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags) override; | 33 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags) override; |
| 36 FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; | 34 FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; |
| 37 void SaveData(CPDFSDK_PageView* pPageView) override; | 35 void SaveData(CPDFSDK_PageView* pPageView) override; |
| 38 void GetActionData(CPDFSDK_PageView* pPageView, | 36 void GetActionData(CPDFSDK_PageView* pPageView, |
| 39 CPDF_AAction::AActionType type, | 37 CPDF_AAction::AActionType type, |
| 40 PDFSDK_FieldAction& fa) override; | 38 PDFSDK_FieldAction& fa) override; |
| 41 void SetActionData(CPDFSDK_PageView* pPageView, | 39 void SetActionData(CPDFSDK_PageView* pPageView, |
| 42 CPDF_AAction::AActionType type, | 40 CPDF_AAction::AActionType type, |
| 43 const PDFSDK_FieldAction& fa) override; | 41 const PDFSDK_FieldAction& fa) override; |
| 44 FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, | 42 FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, |
| 45 const PDFSDK_FieldAction& faOld, | 43 const PDFSDK_FieldAction& faOld, |
| 46 const PDFSDK_FieldAction& faNew) override; | 44 const PDFSDK_FieldAction& faNew) override; |
| 47 void SaveState(CPDFSDK_PageView* pPageView) override; | 45 void SaveState(CPDFSDK_PageView* pPageView) override; |
| 48 void RestoreState(CPDFSDK_PageView* pPageView) override; | 46 void RestoreState(CPDFSDK_PageView* pPageView) override; |
| 49 CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, | 47 CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, |
| 50 FX_BOOL bRestoreValue) override; | 48 FX_BOOL bRestoreValue) override; |
| 51 | 49 |
| 52 // IPWL_FocusHandler: | 50 // IPWL_FocusHandler: |
| 53 void OnSetFocus(CPWL_Wnd* pWnd) override; | 51 void OnSetFocus(CPWL_Wnd* pWnd) override; |
| 54 void OnKillFocus(CPWL_Wnd* pWnd) override; | |
| 55 | |
| 56 // IPWL_Edit_Notify: | |
| 57 void OnAddUndo(CPWL_Edit* pEdit) override; | |
| 58 | 52 |
| 59 #ifdef PDF_ENABLE_XFA | 53 #ifdef PDF_ENABLE_XFA |
| 60 // CFFL_FormFiller: | 54 // CFFL_FormFiller: |
| 61 FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override; | 55 FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override; |
| 62 #endif // PDF_ENABLE_XFA | 56 #endif // PDF_ENABLE_XFA |
| 63 | 57 |
| 64 private: | 58 private: |
| 65 CBA_FontMap* m_pFontMap; | 59 CBA_FontMap* m_pFontMap; |
| 66 FFL_TextFieldState m_State; | 60 FFL_TextFieldState m_State; |
| 67 }; | 61 }; |
| 68 | 62 |
| 69 #endif // FPDFSDK_FORMFILLER_CFFL_TEXTFIELD_H_ | 63 #endif // FPDFSDK_FORMFILLER_CFFL_TEXTFIELD_H_ |
| OLD | NEW |