Initial commit.
[pdfium.git] / fpdfsdk / include / formfiller / FFL_TextField.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4  \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #if !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)\r
8 #define AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_\r
9 \r
10 #include "FFL_FormFiller.h"\r
11 \r
12 #define BF_ALIGN_LEFT                   0\r
13 #define BF_ALIGN_MIDDLE                 1\r
14 #define BF_ALIGN_RIGHT                  2\r
15 \r
16 class CBA_FontMap;\r
17 \r
18 class CFFL_EditUndoItem //: public IUndoItem\r
19 {\r
20 public:\r
21         CFFL_EditUndoItem(CPWL_Edit* pEdit);\r
22         virtual ~CFFL_EditUndoItem();\r
23         \r
24         virtual void                                    Undo();\r
25         virtual void                                    Redo();\r
26         virtual CFX_WideString                  GetDescr();\r
27         virtual void                                    Release();\r
28         \r
29 private:\r
30         CPWL_Edit*                                              m_pEdit;\r
31 };\r
32 \r
33 struct FFL_TextFieldState\r
34 {\r
35         int nStart;\r
36         int nEnd;\r
37         CFX_WideString sValue;\r
38 };\r
39 \r
40 class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify\r
41 {\r
42 public:\r
43         CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);\r
44         virtual ~CFFL_TextField();\r
45         \r
46         virtual PWL_CREATEPARAM         GetCreateParam();\r
47         virtual CPWL_Wnd*                       NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);\r
48 \r
49         \r
50         virtual FX_BOOL                         OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);\r
51         \r
52         virtual FX_BOOL                         IsDataChanged(CPDFSDK_PageView* pPageView);\r
53         virtual void                            SaveData(CPDFSDK_PageView* pPageView);\r
54         \r
55         virtual void                            GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,\r
56                                                                                                 PDFSDK_FieldAction& fa);\r
57         virtual void                            SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, \r
58                                                                         const PDFSDK_FieldAction& fa);\r
59         virtual FX_BOOL                         IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, \r
60                                                                                                 const PDFSDK_FieldAction& faNew);\r
61         virtual void                            SaveState(CPDFSDK_PageView* pPageView);\r
62         virtual void                            RestoreState(CPDFSDK_PageView* pPageView);\r
63         \r
64         virtual CPWL_Wnd*                       ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);\r
65         \r
66 public:\r
67         virtual void                            OnSetFocus(CPWL_Wnd* pWnd);\r
68         virtual void                            OnKillFocus(CPWL_Wnd* pWnd);\r
69         \r
70 public:\r
71         virtual void                            OnAddUndo(CPWL_Edit* pEdit);\r
72         \r
73 public:\r
74         virtual FX_BOOL                         CanCopy(CPDFSDK_Document* pDocument); \r
75         virtual FX_BOOL                         CanCut(CPDFSDK_Document* pDocument); \r
76         virtual FX_BOOL                         CanPaste(CPDFSDK_Document* pDocument); \r
77         \r
78         virtual void                            DoCopy(CPDFSDK_Document* pDocument); \r
79         virtual void                            DoCut(CPDFSDK_Document* pDocument); \r
80         virtual void                            DoPaste(CPDFSDK_Document* pDocument); \r
81         \r
82 private:\r
83         CBA_FontMap*                            m_pFontMap;\r
84 //      CBA_SpellCheck*                         m_pSpellCheck;\r
85         FFL_TextFieldState                      m_State;\r
86 //      CFFL_IM_BOX                                     m_IMBox;\r
87 };\r
88 \r
89 #endif // !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)\r