Merge to XFA: Use stdint.h types throughout PDFium.
[pdfium.git] / xfa / include / fwl / basewidget / fwl_edit.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 #ifndef _FWL_EDIT_H\r
8 #define _FWL_EDIT_H\r
9 class CFWL_WidgetImpProperties;\r
10 class IFWL_Widget;\r
11 class IFWL_EditDP;\r
12 class IFWL_Edit;\r
13 #define FWL_CLASS_Edit                                          L"FWL_EDIT"\r
14 #define FWL_CLASSHASH_Edit                                      2893987822\r
15 #define FWL_STYLEEXT_EDT_ReadOnly                       (1L << 0)\r
16 #define FWL_STYLEEXT_EDT_MultiLine                      (1L << 1)\r
17 #define FWL_STYLEEXT_EDT_WantReturn                     (1L << 2)\r
18 #define FWL_STYLEEXT_EDT_NoHideSel                      (1L << 3)\r
19 #define FWL_STYLEEXT_EDT_AutoHScroll            (1L << 4)\r
20 #define FWL_STYLEEXT_EDT_AutoVScroll            (1L << 5)\r
21 #define FWL_STYLEEXT_EDT_NoRedoUndo                     (1L << 6)\r
22 #define FWL_STYLEEXT_EDT_Validate                       (1L << 7)\r
23 #define FWL_STYLEEXT_EDT_Password                       (1L << 8)\r
24 #define FWL_STYLEEXT_EDT_Number                         (1L << 9)\r
25 #define FWL_STYLEEXT_EDT_HSelfAdaption      (1L << 10)\r
26 #define FWL_STYLEEXT_EDT_VSelfAdaption      (1L << 11)\r
27 #define FWL_STYLEEXT_EDT_VerticalLayout         (1L << 12)\r
28 #define FWL_STYLEEXT_EDT_VerticalChars          (1L << 13)\r
29 #define FWL_STYLEEXT_EDT_ReverseLine            (1L << 14)\r
30 #define FWL_STYLEEXT_EDT_ArabicShapes           (1L << 15)\r
31 #define FWL_STYLEEXT_EDT_ExpandTab                      (1L << 16)\r
32 #define FWL_STYLEEXT_EDT_CombText                       (1L << 17)\r
33 #define FWL_STYLEEXT_EDT_HNear                          (0L << 18)\r
34 #define FWL_STYLEEXT_EDT_HCenter                        (1L << 18)\r
35 #define FWL_STYLEEXT_EDT_HFar                           (2L     << 18)\r
36 #define FWL_STYLEEXT_EDT_VNear                          (0L << 20)\r
37 #define FWL_STYLEEXT_EDT_VCenter                        (1L << 20)\r
38 #define FWL_STYLEEXT_EDT_VFar                           (2L << 20)\r
39 #define FWL_STYLEEXT_EDT_Justified                      (1L << 22)\r
40 #define FWL_STYLEEXT_EDT_Distributed            (2L << 22)\r
41 #define FWL_STYLEEXT_EDT_HAlignMask                     (3L     << 18)\r
42 #define FWL_STYLEEXT_EDT_VAlignMask                     (3L     << 20)\r
43 #define FWL_STYLEEXT_EDT_HAlignModeMask         (3L     << 22)\r
44 #define FWL_STYLEEXT_EDT_InnerCaret                     (1L     << 24)\r
45 #define FWL_STYLEEXT_EDT_ShowScrollbarFocus     (1L     << 25)\r
46 #define FWL_STYLEEXT_EDT_OuterScrollbar         (1L     << 26)\r
47 #define FWL_STYLEEXT_EDT_LastLineHeight         (1L << 27)\r
48 #define FWL_STATE_EDT_Editing               (1 << FWL_WGTSTATE_MAX)\r
49 #define FWL_PART_EDT_Border                     1\r
50 #define FWL_PART_EDT_Edge                       2\r
51 #define FWL_PART_EDT_Background         3\r
52 #define FWL_PART_EDT_CombTextLine       4\r
53 #define FWL_PARTDATA_EDT_Background                     0\r
54 #define FWL_PARTDATA_EDT_StaticBackground       1\r
55 #define FWL_PARTSTATE_EDT_Normal                (0L << 0)\r
56 #define FWL_PARTSTATE_EDT_ReadOnly              (1L << 0)\r
57 #define FWL_PARTSTATE_EDT_Disable               (2L << 0)\r
58 enum FWL_EDT_TEXTCHANGED {\r
59     FWL_EDT_TEXTCHANGED_Insert  = 0     ,\r
60     FWL_EDT_TEXTCHANGED_Delete          ,\r
61     FWL_EDT_TEXTCHANGED_Replace         ,\r
62 };\r
63 #define FWL_EVT_EDT_AddDoRecord                                 L"FWL_EVENT_EDT_AddDoRecord"\r
64 #define FWL_EVTHASH_EDT_AddDoRecord                             3701672224\r
65 #define FWL_EVT_EDT_TextChanged                                 L"FWL_EVENT_EDT_TextChanged"\r
66 #define FWL_EVTHASH_EDT_TextChanged                             1064022132\r
67 #define FWL_EVT_EDT_PreSelfAdaption                             L"FWL_EVENT_PreSelfAdaption"\r
68 #define FWL_EVTHASH_EDT_PreSelfAdaption                 1001979178\r
69 #define FWL_EVT_EDT_Validate                                    L"FWL_EVTHASH_EDT_Validate"\r
70 #define FWL_EVTHASH_EDT_Validate                                3373308608\r
71 #define FWL_EVT_EDT_CheckWord                                   L"FWL_EVTHASH_EDT_CheckWord"\r
72 #define FWL_EVTHASH_EDT_CheckWord                               2897181520\r
73 #define FWL_EVT_EDT_GetSuggestWords                             L"FWL_EVTHASH_EDT_GetSuggestWords"\r
74 #define FWL_EVTHASH_EDT_GetSuggestWords                 315782791\r
75 #define FWL_EVT_EDT_TextFull                                    L"FWL_EVTHASH_EDT_TextFull"\r
76 #define FWL_EVTHASH_EDT_TextFull                                2158580174\r
77 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtAddDoRecord, FWL_EVTHASH_EDT_AddDoRecord)\r
78 CFX_ByteString m_wsDoRecord;\r
79 END_FWL_EVENT_DEF\r
80 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextChanged, FWL_EVTHASH_EDT_TextChanged)\r
81 int32_t nChangeType;\r
82 CFX_WideString wsInsert;\r
83 CFX_WideString wsDelete;\r
84 CFX_WideString wsPrevText;\r
85 END_FWL_EVENT_DEF\r
86 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextFull, FWL_EVTHASH_EDT_TextFull)\r
87 END_FWL_EVENT_DEF\r
88 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption, FWL_EVTHASH_EDT_PreSelfAdaption)\r
89 FX_BOOL bHSelfAdaption;\r
90 FX_BOOL bVSelfAdaption;\r
91 CFX_RectF rtAfterChange;\r
92 END_FWL_EVENT_DEF\r
93 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtValidate, FWL_EVTHASH_EDT_Validate)\r
94 IFWL_Widget* pDstWidget;\r
95 CFX_WideString wsInsert;\r
96 FX_BOOL bValidate;\r
97 END_FWL_EVENT_DEF\r
98 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtCheckWord, FWL_EVTHASH_EDT_CheckWord)\r
99 CFX_ByteString bsWord;\r
100 FX_BOOL bCheckWord;\r
101 END_FWL_EVENT_DEF\r
102 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, FWL_EVTHASH_EDT_GetSuggestWords)\r
103 FX_BOOL bSuggestWords;\r
104 CFX_ByteString bsWord;\r
105 CFX_ByteStringArray bsArraySuggestWords;\r
106 END_FWL_EVENT_DEF\r
107 class IFWL_EditDP : public IFWL_DataProvider\r
108 {\r
109 };\r
110 #define FWL_EDT_FIND_FLAGS_Prev                 (0L << 0)\r
111 #define FWL_EDT_FIND_FLAGS_Next                 (1L << 0)\r
112 #define FWL_EDT_FIND_FLAGS_WholeWord    (1L << 1)\r
113 #define FWL_EDT_FIND_FLAGS_NoCase               (1L << 2)\r
114 typedef struct _FWL_HEDTFIND {\r
115     FX_LPVOID pData;\r
116 }* FWL_HEDTFIND;\r
117 class IFWL_Edit : public IFWL_Widget\r
118 {\r
119 public:\r
120     static IFWL_Edit* Create();\r
121     FWL_ERR             Initialize(IFWL_Widget *pOuter = NULL);\r
122     FWL_ERR             Initialize(const CFWL_WidgetImpProperties &properties, IFWL_Widget *pOuter = NULL);\r
123     FWL_ERR             SetText(const CFX_WideString &wsText);\r
124     int32_t     GetTextLength() const;\r
125     FWL_ERR             GetText(CFX_WideString &wsText, int32_t nStart = 0, int32_t nCount = -1) const;\r
126     FWL_ERR             ClearText();\r
127     int32_t     GetCaretPos() const;\r
128     int32_t     SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE);\r
129     FWL_ERR             AddSelRange(int32_t nStart, int32_t nCount = -1);\r
130     int32_t     CountSelRanges();\r
131     int32_t     GetSelRange(int32_t nIndex, int32_t &nStart);\r
132     FWL_ERR             ClearSelections();\r
133     int32_t     GetLimit();\r
134     FWL_ERR             SetLimit(int32_t nLimit);\r
135     FWL_ERR             SetAliasChar(FX_WCHAR wAlias);\r
136     FWL_ERR             SetFormatString(const CFX_WideString &wsFormat);\r
137     FWL_ERR Insert(int32_t nStart, FX_LPCWSTR lpText, int32_t nLen);\r
138     FWL_ERR DeleteSelections();\r
139     FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1);\r
140     FWL_ERR ReplaceSelections(const CFX_WideStringC &wsReplace);\r
141     FWL_ERR Replace(int32_t nStart, int32_t nLen, const CFX_WideStringC &wsReplace);\r
142     FWL_ERR     DoClipboard(int32_t iCmd);\r
143     FX_BOOL     Copy(CFX_WideString &wsCopy);\r
144     FX_BOOL     Cut(CFX_WideString &wsCut);\r
145     FX_BOOL     Paste(const CFX_WideString &wsPaste);\r
146     FX_BOOL     Delete();\r
147     FX_BOOL     Redo(FX_BSTR bsRecord);\r
148     FX_BOOL     Undo(FX_BSTR bsRecord);\r
149     FX_BOOL     Undo();\r
150     FX_BOOL     Redo();\r
151     FX_BOOL     CanUndo();\r
152     FX_BOOL     CanRedo();\r
153     FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant);\r
154     FWL_ERR     SetOuter(IFWL_Widget *pOuter);\r
155     FWL_ERR     SetNumberRange(int32_t iMin, int32_t iMax);\r
156     FWL_ERR SetBackColor(FX_DWORD dwColor);\r
157     FWL_ERR SetFont(const CFX_WideString &wsFont, FX_FLOAT fSize);\r
158     void        SetScrollOffset(FX_FLOAT fScrollOffset);\r
159     FX_BOOL GetSuggestWords(CFX_PointF pointf, CFX_ByteStringArray &sSuggest);\r
160     FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, FX_BSTR bsReplace);\r
161 protected:\r
162     IFWL_Edit();\r
163     virtual ~IFWL_Edit();\r
164 };\r
165 #endif\r