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