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