Convert all line endings to LF.
[pdfium.git] / fpdfsdk / include / fxedit / fx_edit.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 #ifndef _FX_EDIT_H_
8 #define _FX_EDIT_H_
9
10 #define PVTWORD_STYLE_NORMAL                            0x0000L
11 #define PVTWORD_STYLE_HIGHLIGHT                         0x0001L
12 #define PVTWORD_STYLE_UNDERLINE                         0x0002L
13 #define PVTWORD_STYLE_CROSSOUT                          0x0004L
14 #define PVTWORD_STYLE_SQUIGGLY                          0x0008L
15 #define PVTWORD_STYLE_DUALCROSSOUT                      0x0010L
16 #define PVTWORD_STYLE_BOLD                                      0x0020L
17 #define PVTWORD_STYLE_ITALIC                            0x0040L
18
19 #define FX_EDIT_ISLATINWORD(u)  (u == 0x2D || (u <= 0x005A && u >= 0x0041) || (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0))
20
21 #ifdef FX_READER_DLL
22         #ifdef FXET_EXPORT
23                 #define FXET_CLASS __declspec(dllexport)
24         #else
25                 #define FXET_CLASS
26         #endif
27 #else
28         #define FXET_CLASS
29 #endif
30
31 #ifndef DEFAULT_CHARSET
32 #define DEFAULT_CHARSET         1
33 #endif 
34
35 class IFX_Edit_FontMap;
36 class IFX_Edit_Notify;
37 class IFX_Edit_Iterator;
38 class IFX_Edit_UndoItem;
39 class IFX_Edit;
40 class IFX_List_Notify;
41 class IFX_List;
42 class IFX_SystemHandler;
43
44 class IFX_Edit_FontMap
45 {
46 public:
47         //map a fontindex to pdf font.
48         virtual CPDF_Font *                                             GetPDFFont(FX_INT32 nFontIndex) = 0;
49         //get the alias of a pdf font.
50         virtual CFX_ByteString                                  GetPDFFontAlias(FX_INT32 nFontIndex) = 0;
51         //get the index of a font that can show a word.
52         virtual FX_INT32                                                GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0;
53         //get the charcode of word from unicode
54         virtual FX_INT32                                                CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0;
55         //get the charset of unicode
56         virtual FX_INT32                                                CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0;
57 };
58
59 class IFX_Edit_Notify
60 {
61         //this class is implemented by user
62 public:
63         //set the horizontal scrollbar information.
64         virtual void                                                    IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
65                                                                                                 FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
66                                                                                                 FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
67         //set the vertical scrollbar information.
68         virtual void                                                    IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
69                                                                                                 FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
70                                                                                                 FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
71         //set the position of horizontal scrollbar.
72         virtual void                                                    IOnSetScrollPosX(FX_FLOAT fx) = 0;
73         //set the position of vertical scrollbar.
74         virtual void                                                    IOnSetScrollPosY(FX_FLOAT fy) = 0;
75         //set the caret information.
76         virtual void                                                    IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place) = 0;
77         //if the caret position is changed ,send the information of current postion to user.
78         virtual void                                                    IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0;
79         //if the text area is changed, send the information to user.
80         virtual void                                                    IOnContentChange(const CPDF_Rect& rcContent) = 0;
81         //Invalidate the rectangle relative to the bounding box of edit.
82         virtual void                                                    IOnInvalidateRect(CPDF_Rect * pRect) = 0;
83 };
84
85 class IFX_Edit_OprNotify
86 {
87         //this class is implemented by user
88 public:
89         //OprType: 0
90         virtual void                                                    OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
91         //OprType: 1
92         virtual void                                                    OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
93         //OprType: 2
94         virtual void                                                    OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
95         //OprType: 3
96         virtual void                                                    OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
97         //OprType: 4
98         virtual void                                                    OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
99         //OprType: 5
100         virtual void                                                    OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
101         //OprType: 6
102         virtual void                                                    OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
103         //
104         virtual void                                                    OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0;
105 };
106
107 class IFX_Edit_Iterator
108 {
109 public:
110         virtual ~IFX_Edit_Iterator()  {}
111 public:
112         //move the current position to the next word.
113         virtual FX_BOOL                                                 NextWord() = 0;
114         //move the current position to the next line.
115         virtual FX_BOOL                                                 NextLine() = 0;
116         //move the current position to the next section. 
117         virtual FX_BOOL                                                 NextSection() = 0;
118
119         //move the current position to the previous word.
120         virtual FX_BOOL                                                 PrevWord() = 0;
121         //move the current position to the previous line.
122         virtual FX_BOOL                                                 PrevLine() = 0;
123         //move the current position to the previous section. 
124         virtual FX_BOOL                                                 PrevSection() = 0;
125
126         //get the information of the current word.
127         virtual FX_BOOL                                                 GetWord(CPVT_Word & word) const = 0;
128         //get the information of the current line.
129         virtual FX_BOOL                                                 GetLine(CPVT_Line & line) const = 0;
130         //get the information of the current section.
131         virtual FX_BOOL                                                 GetSection(CPVT_Section & section) const = 0;
132         //set the current position.
133         virtual void                                                    SetAt(FX_INT32 nWordIndex) = 0;
134         //set the current position.
135         virtual void                                                    SetAt(const CPVT_WordPlace & place) = 0;
136         //get the current position.
137         virtual const CPVT_WordPlace &                  GetAt() const = 0;
138
139         //get the edit which this iterator belongs to
140         virtual IFX_Edit*                                               GetEdit() const = 0;
141 };
142
143 class IFX_Edit_UndoItem
144 {
145 public:
146         virtual void                                                    Undo() = 0;
147         virtual void                                                    Redo() = 0;
148         virtual CFX_WideString                                  GetUndoTitle() = 0;
149         virtual void                                                    Release() = 0;
150 };
151
152 class FXET_CLASS IFX_Edit
153 {
154 public:
155         static IFX_Edit*                                                NewEdit();
156         static  void                                                    DelEdit(IFX_Edit* pEdit);
157
158 public:
159         //set a IFX_Edit_FontMap pointer implemented by user.
160         virtual void                                                    SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
161         //if user don't like to use FontMap, implement VTProvider and set it directly.
162         virtual void                                                    SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0;
163         //set a IFX_Edit_Notify pointer implemented by user.
164         virtual void                                                    SetNotify(IFX_Edit_Notify * pNotify) = 0;
165         virtual void                                                    SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;
166         //get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the contents of edit, but don't need to release.
167         virtual IFX_Edit_Iterator*                              GetIterator() = 0;
168         //get a VT pointer relative to this edit.
169         virtual IPDF_VariableText*                              GetVariableText() = 0;
170         //get the IFX_Edit_FontMap pointer set by user.
171         virtual IFX_Edit_FontMap*                               GetFontMap() = 0;
172
173         //initialize the edit.
174         virtual void                                                    Initialize() = 0;
175
176         //set the bounding box of the text area.
177         virtual void                                                    SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE) = 0;
178         //set the scroll origin
179         virtual void                                                    SetScrollPos(const CPDF_Point & point) = 0;
180
181         //set the horizontal text alignment in text box, nFormat (0:left 1:middle 2:right).
182         virtual void                                                    SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
183         //set the vertical text alignment in text box, nFormat (0:top 1:center 2:bottom).
184         virtual void                                                    SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
185         //if the text is shown in secret , set a character for substitute.
186         virtual void                                                    SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) = 0;
187         //set the maximal count of words of the text.
188         virtual void                                                    SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;
189         //if set the count of charArray , then all words is shown in equal space.
190         virtual void                                                    SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE) = 0;
191         //set the space of two characters.
192         virtual void                                                    SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) = 0;
193         //set the horizontal scale of all characters.
194         virtual void                                                    SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0;
195         //set the leading of all lines
196         virtual void                                                    SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0;
197         //if set, CRLF is allowed.
198         virtual void                                                    SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) = 0;
199         //if set, all words auto fit the width of the bounding box.     
200         virtual void                                                    SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
201         //if set, a font size is calculated to full fit the bounding box.
202         virtual void                                                    SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
203         //is set, the text is allowed to scroll.
204         virtual void                                                    SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
205         //set the font size of all words.
206         virtual void                                                    SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0;
207         //the text is allowed to auto-scroll, allow the text overflow?
208         virtual void                                                    SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE) = 0;
209
210         //query if the edit is richedit.
211         virtual FX_BOOL                                                 IsRichText() const = 0;
212         //set the edit is richedit.
213         virtual void                                                    SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0;
214         //set the fontsize of selected text.
215         virtual FX_BOOL                                                 SetRichFontSize(FX_FLOAT fFontSize) = 0;        
216         //set the fontindex of selected text, user can change the font of selected text.
217         virtual FX_BOOL                                                 SetRichFontIndex(FX_INT32 nFontIndex) = 0;
218         //set the textcolor of selected text.
219         virtual FX_BOOL                                                 SetRichTextColor(FX_COLORREF dwColor) = 0;
220         //set the text script type of selected text. (0:normal 1:superscript 2:subscript)
221         virtual FX_BOOL                                                 SetRichTextScript(FX_INT32 nScriptType) = 0;    
222         //set the bold font style of selected text.
223         virtual FX_BOOL                                                 SetRichTextBold(FX_BOOL bBold = TRUE) = 0;
224         //set the italic font style of selected text.
225         virtual FX_BOOL                                                 SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0;
226         //set the underline style of selected text.
227         virtual FX_BOOL                                                 SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0;
228         //set the crossout style of selected text.
229         virtual FX_BOOL                                                 SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0;
230         //set the charspace of selected text, in user coordinate.
231         virtual FX_BOOL                                                 SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0;
232         //set the horizontal scale of selected text, default value is 100.
233         virtual FX_BOOL                                                 SetRichTextHorzScale(FX_INT32 nHorzScale = 100) = 0;
234         //set the leading of selected section, in user coordinate.
235         virtual FX_BOOL                                                 SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0;
236         //set the indent of selected section, in user coordinate.
237         virtual FX_BOOL                                                 SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0;
238         //set the alignment of selected section, nAlignment(0:left 1:middle 2:right)
239         virtual FX_BOOL                                                 SetRichTextAlignment(FX_INT32 nAlignment) = 0;
240
241         //set the selected range of text.
242         //if nStartChar == 0 and nEndChar == -1, select all the text.
243         virtual void                                                    SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) = 0;
244         //get the selected range of text.
245         virtual void                                                    GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const = 0;
246         //select all the text.
247         virtual void                                                    SelectAll() = 0;
248         //set text is not selected.
249         virtual void                                                    SelectNone() = 0;               
250         //get the caret position.
251         virtual FX_INT32                                                GetCaret() const = 0;
252         virtual CPVT_WordPlace                                  GetCaretWordPlace() const = 0;
253         //get the string of selected text.
254         virtual CFX_WideString                                  GetSelText() const = 0;
255         //get the text conent
256         virtual CFX_WideString                                  GetText() const = 0;
257         //query if any text is selected.
258         virtual FX_BOOL                                                 IsSelected() const = 0; 
259         //get the scroll origin
260         virtual CPDF_Point                                              GetScrollPos() const = 0;
261         //get the bounding box of the text area.
262         virtual CPDF_Rect                                               GetPlateRect() const = 0;
263         //get the fact area of the text.
264         virtual CPDF_Rect                                               GetContentRect() const = 0;
265         //get the visible word range
266         virtual CPVT_WordRange                                  GetVisibleWordRange() const = 0;
267         //get the whole word range
268         virtual CPVT_WordRange                                  GetWholeWordRange() const = 0;
269         //get the word range of select text
270         virtual CPVT_WordRange                                  GetSelectWordRange() const = 0;
271
272         //send the mousedown message to edit for response.
273         //if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE.
274         virtual void                                                    OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
275         //send the mousemove message to edit when mouse down is TRUE.
276         virtual void                                                    OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
277         //send the UP key message to edit.
278         virtual void                                                    OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
279         //send the DOWN key message to edit.
280         virtual void                                                    OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
281         //send the LEFT key message to edit.
282         virtual void                                                    OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
283         //send the RIGHT key message to edit.
284         virtual void                                                    OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
285         //send the HOME key message to edit.
286         virtual void                                                    OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
287         //send the END key message to edit.
288         virtual void                                                    OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
289
290         //put text into edit.
291         virtual void                                                    SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,
292                                                                                                         const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;   
293         //insert a word into the edit.
294         virtual FX_BOOL                                                 InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL) = 0;
295         //insert a return into the edit.
296         virtual FX_BOOL                                                 InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;      
297         //insert text into the edit.
298         virtual FX_BOOL                                                 InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,
299                                                                                                         const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
300         //do backspace operation.
301         virtual FX_BOOL                                                 Backspace() = 0;
302         //do delete operation.
303         virtual FX_BOOL                                                 Delete() = 0;   
304         //delete the selected text.
305         virtual FX_BOOL                                                 Clear() = 0;
306
307         //do Redo operation.
308         virtual FX_BOOL                                                 Redo() = 0;
309         //do Undo operation.
310         virtual FX_BOOL                                                 Undo() = 0;
311         //move caret
312         virtual void                                                    SetCaret(FX_INT32 nPos) = 0;
313
314         //arrange all words over again
315         virtual void                                                    Paint() = 0;
316         
317         //allow to refresh screen?
318         virtual void                                                    EnableRefresh(FX_BOOL bRefresh) = 0;
319
320         virtual void                                                    RefreshWordRange(const CPVT_WordRange& wr) = 0;
321
322         //allow undo/redo?
323         virtual void                                                    EnableUndo(FX_BOOL bUndo) = 0;
324
325         //allow notify?
326         virtual void                                                    EnableNotify(FX_BOOL bNotify) = 0;
327
328         //allow opr notify?
329         virtual void                                                    EnableOprNotify(FX_BOOL bNotify) = 0;
330
331         //map word place to word index.
332         virtual FX_INT32                                                WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0;
333         //map word index to word place.
334         virtual CPVT_WordPlace                                  WordIndexToWordPlace(FX_INT32 index) const = 0;
335
336         //get the beginning position of a line
337         virtual CPVT_WordPlace                                  GetLineBeginPlace(const CPVT_WordPlace & place) const = 0;
338
339         //get the ending position of a line
340         virtual CPVT_WordPlace                                  GetLineEndPlace(const CPVT_WordPlace & place) const = 0;
341
342         //get the beginning position of a section
343         virtual CPVT_WordPlace                                  GetSectionBeginPlace(const CPVT_WordPlace & place) const = 0;
344
345         //get the ending position of a section
346         virtual CPVT_WordPlace                                  GetSectionEndPlace(const CPVT_WordPlace & place) const = 0;
347
348         //search a wordplace form point
349         virtual CPVT_WordPlace                                  SearchWordPlace(const CPDF_Point& point) const = 0;
350
351         //get the font size of non_rich text or default font size of richtext.
352         virtual FX_FLOAT                                                GetFontSize() const = 0;
353         //get the mask character.
354         virtual FX_WORD                                                 GetPasswordChar() const = 0;
355         //get the count of charArray
356         virtual FX_INT32                                                GetCharArray() const = 0;
357         //get the horizontal scale of all characters
358         virtual FX_INT32                                                GetHorzScale() const = 0;
359         //get the space of two characters
360         virtual FX_FLOAT                                                GetCharSpace() const = 0;
361         //get the latin words of specified range
362         virtual CFX_WideString                                  GetRangeText(const CPVT_WordRange & range) const = 0;
363         //is the text full in bounding box
364         virtual FX_BOOL                                                 IsTextFull() const = 0;
365         virtual FX_BOOL                                                 CanUndo() const = 0;
366         virtual FX_BOOL                                                 CanRedo() const = 0;
367         //if the content is changed after settext?
368         virtual FX_BOOL                                                 IsModified() const = 0;
369         //get the total words in edit
370         virtual FX_INT32                                                GetTotalWords() const = 0;
371
372         virtual void                                                    AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0;
373
374 public:
375         static CFX_ByteString                                   GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, 
376                                                                                                         const CPVT_WordRange* pRange = NULL, 
377                                                                                                         FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
378         static CFX_ByteString                                   GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pRange = NULL);
379         static void                                                             DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke,
380                                                                                                         const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData);
381         static void                                                             DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF color,
382                                                                                                         const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
383         static void                                                             DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,  
384                                                                                                         const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
385         static void                                                             GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
386                                                                                                         const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
387         static void                                                             GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
388                                                                                                         const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
389         static void                                                             GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
390                                                                                                         const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color);
391 };
392
393 class IFX_List_Notify
394 {
395         //this class is implemented by user
396 public:
397         //set the horizontal scrollbar information.
398         virtual void                                                    IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
399                                                                                                 FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
400                                                                                                 FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
401         //set the vertical scrollbar information.
402         virtual void                                                    IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
403                                                                                                 FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
404                                                                                                 FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
405         //set the position of horizontal scrollbar.
406         virtual void                                                    IOnSetScrollPosX(FX_FLOAT fx) = 0;
407         //set the position of vertical scrollbar.
408         virtual void                                                    IOnSetScrollPosY(FX_FLOAT fy) = 0;
409         //Invalidate the rectangle relative to the bounding box of edit.
410         virtual void                                                    IOnInvalidateRect(CPDF_Rect * pRect) = 0;
411 };
412
413 class FXET_CLASS IFX_List
414 {
415 public:
416         static IFX_List*                                                NewList();
417         static void                                                             DelList(IFX_List* pList);
418
419 public:
420         virtual void                                                    SetFontMap(IFX_Edit_FontMap * pFontMap) = 0;
421         virtual void                                                    SetNotify(IFX_List_Notify * pNotify) = 0;
422
423         virtual void                                                    SetPlateRect(const CPDF_Rect & rect) = 0;
424         virtual void                                                    SetFontSize(FX_FLOAT fFontSize) = 0;
425
426         virtual CPDF_Rect                                               GetPlateRect() const = 0;
427         virtual CPDF_Rect                                               GetContentRect() const = 0;
428
429         virtual FX_FLOAT                                                GetFontSize() const = 0;
430         virtual IFX_Edit*                                               GetItemEdit(FX_INT32 nIndex) const = 0;
431         virtual FX_INT32                                                GetCount() const = 0;
432         virtual FX_BOOL                                                 IsItemSelected(FX_INT32 nIndex) const = 0;
433         virtual FX_FLOAT                                                GetFirstHeight() const = 0;
434         
435         virtual void                                                    SetMultipleSel(FX_BOOL bMultiple) = 0;
436         virtual FX_BOOL                                                 IsMultipleSel() const = 0;      
437         virtual FX_BOOL                                                 IsValid(FX_INT32 nItemIndex) const = 0;
438         virtual FX_INT32                                                FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const = 0;     
439
440         virtual void                                                    SetScrollPos(const CPDF_Point & point) = 0;
441         virtual void                                                    ScrollToListItem(FX_INT32 nItemIndex) = 0;
442         virtual CPDF_Rect                                               GetItemRect(FX_INT32 nIndex) const = 0;
443         virtual FX_INT32                                                GetCaret() const = 0;
444         virtual FX_INT32                                                GetSelect() const = 0;  
445         virtual FX_INT32                                                GetTopItem() const = 0;
446         virtual FX_INT32                                                GetItemIndex(const CPDF_Point & point) const = 0;
447         virtual FX_INT32                                                GetFirstSelected() const = 0;
448
449         virtual void                                                    AddString(FX_LPCWSTR string) = 0;
450         virtual void                                                    SetTopItem(FX_INT32 nIndex) = 0;        
451         virtual void                                                    Select(FX_INT32 nItemIndex) = 0;
452         virtual void                                                    SetCaret(FX_INT32 nItemIndex) = 0;
453         virtual void                                                    Empty() = 0;
454         virtual void                                                    Cancel() = 0;
455         virtual CFX_WideString                                  GetText() const = 0;
456
457
458         virtual void                                                    OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
459         virtual void                                                    OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
460         virtual void                                                    OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
461         virtual void                                                    OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
462         virtual void                                                    OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
463         virtual void                                                    OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
464         virtual void                                                    OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
465         virtual void                                                    OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
466         virtual void                                                    OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
467         virtual FX_BOOL                                                 OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
468 };
469
470 #endif 
471