d2808e99c76425e38553aba8d8b9af6f34a298a0
[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 private:
30         CPWL_Edit*                                              m_pEdit;
31 };
32
33 struct FFL_TextFieldState
34 {
35         int nStart;
36         int nEnd;
37         CFX_WideString sValue;
38 };
39
40 class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
41 {
42 public:
43         CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
44         virtual ~CFFL_TextField();
45         
46         virtual PWL_CREATEPARAM         GetCreateParam();
47         virtual CPWL_Wnd*                       NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
48
49         
50         virtual FX_BOOL                         OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
51         
52         virtual FX_BOOL                         IsDataChanged(CPDFSDK_PageView* pPageView);
53         virtual void                            SaveData(CPDFSDK_PageView* pPageView);
54         
55         virtual void                            GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
56                                                                                                 PDFSDK_FieldAction& fa);
57         virtual void                            SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, 
58                                                                         const PDFSDK_FieldAction& fa);
59         virtual FX_BOOL                         IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, 
60                                                                                                 const PDFSDK_FieldAction& faNew);
61         virtual void                            SaveState(CPDFSDK_PageView* pPageView);
62         virtual void                            RestoreState(CPDFSDK_PageView* pPageView);
63         
64         virtual CPWL_Wnd*                       ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
65         
66 public:
67         virtual void                            OnSetFocus(CPWL_Wnd* pWnd);
68         virtual void                            OnKillFocus(CPWL_Wnd* pWnd);
69         
70 public:
71         virtual void                            OnAddUndo(CPWL_Edit* pEdit);
72         
73 public:
74         virtual FX_BOOL                         CanCopy(CPDFSDK_Document* pDocument); 
75         virtual FX_BOOL                         CanCut(CPDFSDK_Document* pDocument); 
76         virtual FX_BOOL                         CanPaste(CPDFSDK_Document* pDocument); 
77         
78         virtual void                            DoCopy(CPDFSDK_Document* pDocument); 
79         virtual void                            DoCut(CPDFSDK_Document* pDocument); 
80         virtual void                            DoPaste(CPDFSDK_Document* pDocument); 
81         
82 private:
83         CBA_FontMap*                            m_pFontMap;
84 //      CBA_SpellCheck*                         m_pSpellCheck;
85         FFL_TextFieldState                      m_State;
86 //      CFFL_IM_BOX                                     m_IMBox;
87 };
88
89 #endif // !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)