• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef _FXFA_FORMFILLER_TEXTEDIT_IMP_H
8 #define _FXFA_FORMFILLER_TEXTEDIT_IMP_H
9 class CXFA_FFTextEdit : public CXFA_FFField {
10  public:
11   CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc);
12   virtual ~CXFA_FFTextEdit();
13   virtual FX_BOOL LoadWidget();
14   virtual void UpdateWidgetProperty();
15   virtual FX_BOOL OnLButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy);
16   virtual FX_BOOL OnRButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy);
17   virtual FX_BOOL OnRButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy);
18   virtual FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget);
19   virtual FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget);
20   virtual FX_BOOL CanUndo();
21   virtual FX_BOOL CanRedo();
22   virtual FX_BOOL Undo();
23   virtual FX_BOOL Redo();
24   virtual FX_BOOL CanCopy();
25   virtual FX_BOOL CanCut();
26   virtual FX_BOOL CanPaste();
27   virtual FX_BOOL CanSelectAll();
28   virtual FX_BOOL Copy(CFX_WideString& wsCopy);
29   virtual FX_BOOL Cut(CFX_WideString& wsCut);
30   virtual FX_BOOL Paste(const CFX_WideString& wsPaste);
31   virtual FX_BOOL SelectAll();
32   virtual FX_BOOL Delete();
33   virtual FX_BOOL DeSelect();
34   FX_BOOL GetSuggestWords(CFX_PointF pointf, CFX_ByteStringArray& sSuggest);
35   FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf,
36                                 const CFX_ByteStringC& bsReplace);
37 
38  protected:
39   FX_DWORD GetAlignment();
40   virtual FX_BOOL CommitData();
41   virtual FX_BOOL UpdateFWLData();
42   virtual FX_BOOL IsDataChanged();
43   void ValidateNumberField(const CFX_WideString& wsText);
44   IFWL_WidgetDelegate* m_pOldDelegate;
45 
46  public:
47   void OnTextChanged(IFWL_Widget* pWidget,
48                      const CFX_WideString& wsChanged,
49                      const CFX_WideString& wsPrevText);
50   void OnTextFull(IFWL_Widget* pWidget);
51   void OnAddDoRecord(IFWL_Widget* pWidget);
52   FX_BOOL CheckWord(const CFX_ByteStringC& sWord);
53   FX_BOOL GetSuggestWords(const CFX_ByteStringC& sWord,
54                           CFX_ByteStringArray& sSuggest);
55   virtual int32_t OnProcessMessage(CFWL_Message* pMessage);
56   virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent);
57   virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics,
58                                const CFX_Matrix* pMatrix = NULL);
59 };
60 class CXFA_FFNumericEdit : public CXFA_FFTextEdit {
61  public:
62   CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc);
63   virtual ~CXFA_FFNumericEdit();
64   virtual FX_BOOL LoadWidget();
65   virtual void UpdateWidgetProperty();
66   virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent);
67 
68  public:
69   FX_BOOL OnValidate(IFWL_Widget* pWidget, CFX_WideString& wsText);
70 };
71 class CXFA_FFPasswordEdit : public CXFA_FFTextEdit {
72  public:
73   CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc);
74   virtual ~CXFA_FFPasswordEdit();
75   virtual FX_BOOL LoadWidget();
76   virtual void UpdateWidgetProperty();
77 
78  protected:
79 };
80 enum XFA_DATETIMETYPE {
81   XFA_DATETIMETYPE_Date = 0,
82   XFA_DATETIMETYPE_Time,
83   XFA_DATETIMETYPE_DateAndTime
84 };
85 class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
86  public:
87   CXFA_FFDateTimeEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc);
88   virtual ~CXFA_FFDateTimeEdit();
89 
90   virtual FX_BOOL GetBBox(CFX_RectF& rtBox,
91                           FX_DWORD dwStatus,
92                           FX_BOOL bDrawFocus = FALSE);
93   virtual FX_BOOL LoadWidget();
94   virtual void UpdateWidgetProperty();
95 
96   virtual FX_BOOL CanUndo();
97   virtual FX_BOOL CanRedo();
98   virtual FX_BOOL Undo();
99   virtual FX_BOOL Redo();
100 
101   virtual FX_BOOL CanCopy();
102   virtual FX_BOOL CanCut();
103   virtual FX_BOOL CanPaste();
104   virtual FX_BOOL CanSelectAll();
105   virtual FX_BOOL Copy(CFX_WideString& wsCopy);
106   virtual FX_BOOL Cut(CFX_WideString& wsCut);
107   virtual FX_BOOL Paste(const CFX_WideString& wsPaste);
108   virtual FX_BOOL SelectAll();
109   virtual FX_BOOL Delete();
110   virtual FX_BOOL DeSelect();
111 
112  protected:
113   FX_DWORD GetAlignment();
114 
115   virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy);
116   virtual FX_BOOL CommitData();
117   virtual FX_BOOL UpdateFWLData();
118   virtual FX_BOOL IsDataChanged();
119 
120  public:
121   void OnSelectChanged(IFWL_Widget* pWidget,
122                        int32_t iYear,
123                        int32_t iMonth,
124                        int32_t iDay);
125   virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent);
126 };
127 #endif
128