OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ | 7 #ifndef FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ |
8 #define FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ | 8 #define FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ |
9 | 9 |
10 #include "core/fpdfdoc/include/cpdf_variabletext.h" | |
11 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
12 #include "core/fxge/include/fx_dib.h" | |
13 | 11 |
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 CFX_SystemHandler; | |
21 class IFX_Edit; | |
22 class IPVT_FontMap; | 12 class IPVT_FontMap; |
23 class IFX_Edit_Iterator; | |
24 class IFX_Edit_Notify; | |
25 class IFX_Edit_UndoItem; | |
26 class IFX_List; | |
27 class IFX_List_Notify; | |
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 | 13 |
46 #define FX_EDIT_ISLATINWORD(u) \ | 14 #define FX_EDIT_ISLATINWORD(u) \ |
47 (u == 0x2D || (u <= 0x005A && u >= 0x0041) || \ | 15 (u == 0x2D || (u <= 0x005A && u >= 0x0041) || \ |
48 (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0)) | 16 (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0)) |
49 | 17 |
50 #ifndef DEFAULT_CHARSET | 18 #ifndef DEFAULT_CHARSET |
51 #define DEFAULT_CHARSET 1 | 19 #define DEFAULT_CHARSET 1 |
52 #endif | 20 #endif |
53 | 21 |
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 // set a IFX_Edit_Notify pointer implemented by user. | |
173 virtual void SetNotify(IFX_Edit_Notify* pNotify) = 0; | |
174 virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0; | |
175 | |
176 // get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the | |
177 // contents of edit, but don't need to release. | |
178 virtual IFX_Edit_Iterator* GetIterator() = 0; | |
179 | |
180 // get a VT pointer relative to this edit. | |
181 virtual CPDF_VariableText* GetVariableText() = 0; | |
182 | |
183 // get the IPVT_FontMap pointer set by user. | |
184 virtual IPVT_FontMap* GetFontMap() = 0; | |
185 | |
186 // initialize the edit. | |
187 virtual void Initialize() = 0; | |
188 | |
189 // set the bounding box of the text area. | |
190 virtual void SetPlateRect(const CFX_FloatRect& rect, | |
191 FX_BOOL bPaint = TRUE) = 0; | |
192 | |
193 // set the scroll origin | |
194 virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; | |
195 | |
196 // set the horizontal text alignment in text box, nFormat (0:left 1:middle | |
197 // 2:right). | |
198 virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; | |
199 | |
200 // set the vertical text alignment in text box, nFormat (0:top 1:center | |
201 // 2:bottom). | |
202 virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; | |
203 | |
204 // if the text is shown in secret , set a character for substitute. | |
Lei Zhang
2016/07/12 21:36:46
Are any of the comments useful? Maybe this one?
dsinclair
2016/07/13 14:05:45
Copied a few of them.
| |
205 virtual void SetPasswordChar(uint16_t wSubWord = '*', | |
206 FX_BOOL bPaint = TRUE) = 0; | |
207 | |
208 // set the maximal count of words of the text. | |
209 virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0; | |
210 | |
211 // if set the count of charArray , then all words is shown in equal space. | |
212 virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0; | |
213 | |
214 // set the space of two characters. | |
215 virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, | |
216 FX_BOOL bPaint = TRUE) = 0; | |
217 | |
218 // set the horizontal scale of all characters. | |
219 virtual void SetHorzScale(int32_t nHorzScale = 100, | |
220 FX_BOOL bPaint = TRUE) = 0; | |
221 | |
222 // set the leading of all lines | |
223 virtual void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0; | |
224 | |
225 // if set, CRLF is allowed. | |
226 virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE, | |
227 FX_BOOL bPaint = TRUE) = 0; | |
228 | |
229 // if set, all words auto fit the width of the bounding box. | |
230 virtual void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; | |
231 | |
232 // if set, a font size is calculated to full fit the bounding box. | |
233 virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; | |
234 | |
235 // is set, the text is allowed to scroll. | |
236 virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; | |
237 | |
238 // set the font size of all words. | |
239 virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0; | |
240 | |
241 // the text is allowed to auto-scroll, allow the text overflow? | |
242 virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE, | |
243 FX_BOOL bPaint = TRUE) = 0; | |
244 | |
245 // query if the edit is richedit. | |
246 virtual FX_BOOL IsRichText() const = 0; | |
247 | |
248 // set the edit is richedit. | |
249 virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0; | |
250 | |
251 // set the fontsize of selected text. | |
252 virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0; | |
253 | |
254 // set the fontindex of selected text, user can change the font of selected | |
255 // text. | |
256 virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0; | |
257 | |
258 // set the textcolor of selected text. | |
259 virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0; | |
260 | |
261 // set the text script type of selected text. (0:normal 1:superscript | |
262 // 2:subscript) | |
263 virtual FX_BOOL SetRichTextScript( | |
264 CPDF_VariableText::ScriptType nScriptType) = 0; | |
265 | |
266 // set the bold font style of selected text. | |
267 virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0; | |
268 | |
269 // set the italic font style of selected text. | |
270 virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0; | |
271 | |
272 // set the underline style of selected text. | |
273 virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0; | |
274 | |
275 // set the crossout style of selected text. | |
276 virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0; | |
277 | |
278 // set the charspace of selected text, in user coordinate. | |
279 virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0; | |
280 | |
281 // set the horizontal scale of selected text, default value is 100. | |
282 virtual FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) = 0; | |
283 | |
284 // set the leading of selected section, in user coordinate. | |
285 virtual FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0; | |
286 | |
287 // set the indent of selected section, in user coordinate. | |
288 virtual FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0; | |
289 | |
290 // set the alignment of selected section, nAlignment(0:left 1:middle 2:right) | |
291 virtual FX_BOOL SetRichTextAlignment(int32_t nAlignment) = 0; | |
292 | |
293 // set the selected range of text. | |
294 // if nStartChar == 0 and nEndChar == -1, select all the text. | |
295 virtual void SetSel(int32_t nStartChar, int32_t nEndChar) = 0; | |
296 | |
297 // get the selected range of text. | |
298 virtual void GetSel(int32_t& nStartChar, int32_t& nEndChar) const = 0; | |
299 | |
300 // select all the text. | |
301 virtual void SelectAll() = 0; | |
302 | |
303 // set text is not selected. | |
304 virtual void SelectNone() = 0; | |
305 | |
306 // get the caret position. | |
307 virtual int32_t GetCaret() const = 0; | |
308 virtual CPVT_WordPlace GetCaretWordPlace() const = 0; | |
309 | |
310 // get the string of selected text. | |
311 virtual CFX_WideString GetSelText() const = 0; | |
312 | |
313 // get the text conent | |
314 virtual CFX_WideString GetText() const = 0; | |
315 | |
316 // query if any text is selected. | |
317 virtual FX_BOOL IsSelected() const = 0; | |
318 | |
319 // get the scroll origin | |
320 virtual CFX_FloatPoint GetScrollPos() const = 0; | |
321 | |
322 // get the bounding box of the text area. | |
323 virtual CFX_FloatRect GetPlateRect() const = 0; | |
324 | |
325 // get the fact area of the text. | |
326 virtual CFX_FloatRect GetContentRect() const = 0; | |
327 | |
328 // get the visible word range | |
329 virtual CPVT_WordRange GetVisibleWordRange() const = 0; | |
330 | |
331 // get the whole word range | |
332 virtual CPVT_WordRange GetWholeWordRange() const = 0; | |
333 | |
334 // get the word range of select text | |
335 virtual CPVT_WordRange GetSelectWordRange() const = 0; | |
336 | |
337 // send the mousedown message to edit for response. | |
338 // if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE. | |
339 virtual void OnMouseDown(const CFX_FloatPoint& point, | |
340 FX_BOOL bShift, | |
341 FX_BOOL bCtrl) = 0; | |
342 | |
343 // send the mousemove message to edit when mouse down is TRUE. | |
344 virtual void OnMouseMove(const CFX_FloatPoint& point, | |
345 FX_BOOL bShift, | |
346 FX_BOOL bCtrl) = 0; | |
347 | |
348 // send the UP key message to edit. | |
349 virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
350 | |
351 // send the DOWN key message to edit. | |
352 virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
353 | |
354 // send the LEFT key message to edit. | |
355 virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
356 | |
357 // send the RIGHT key message to edit. | |
358 virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
359 | |
360 // send the HOME key message to edit. | |
361 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
362 | |
363 // send the END key message to edit. | |
364 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
365 | |
366 // put text into edit. | |
367 virtual void SetText(const FX_WCHAR* text, | |
368 int32_t charset = DEFAULT_CHARSET, | |
369 const CPVT_SecProps* pSecProps = nullptr, | |
370 const CPVT_WordProps* pWordProps = nullptr) = 0; | |
371 | |
372 // insert a word into the edit. | |
373 virtual FX_BOOL InsertWord(uint16_t word, | |
374 int32_t charset = DEFAULT_CHARSET, | |
375 const CPVT_WordProps* pWordProps = nullptr) = 0; | |
376 | |
377 // insert a return into the edit. | |
378 virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr, | |
379 const CPVT_WordProps* pWordProps = nullptr) = 0; | |
380 | |
381 // insert text into the edit. | |
382 virtual FX_BOOL InsertText(const FX_WCHAR* text, | |
383 int32_t charset = DEFAULT_CHARSET, | |
384 const CPVT_SecProps* pSecProps = nullptr, | |
385 const CPVT_WordProps* pWordProps = nullptr) = 0; | |
386 | |
387 // do backspace operation. | |
388 virtual FX_BOOL Backspace() = 0; | |
389 | |
390 // do delete operation. | |
391 virtual FX_BOOL Delete() = 0; | |
392 | |
393 // delete the selected text. | |
394 virtual FX_BOOL Clear() = 0; | |
395 | |
396 // do Redo operation. | |
397 virtual FX_BOOL Redo() = 0; | |
398 | |
399 // do Undo operation. | |
400 virtual FX_BOOL Undo() = 0; | |
401 | |
402 // move caret | |
403 virtual void SetCaret(int32_t nPos) = 0; | |
404 | |
405 // arrange all words over again | |
406 virtual void Paint() = 0; | |
407 | |
408 // allow to refresh screen? | |
409 virtual void EnableRefresh(FX_BOOL bRefresh) = 0; | |
410 | |
411 virtual void RefreshWordRange(const CPVT_WordRange& wr) = 0; | |
412 | |
413 // allow undo/redo? | |
414 virtual void EnableUndo(FX_BOOL bUndo) = 0; | |
415 | |
416 // allow notify? | |
417 virtual void EnableNotify(FX_BOOL bNotify) = 0; | |
418 | |
419 // allow opr notify? | |
420 virtual void EnableOprNotify(FX_BOOL bNotify) = 0; | |
421 | |
422 // map word place to word index. | |
423 virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const = 0; | |
424 // map word index to word place. | |
425 virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0; | |
426 | |
427 // get the beginning position of a line | |
428 virtual CPVT_WordPlace GetLineBeginPlace( | |
429 const CPVT_WordPlace& place) const = 0; | |
430 | |
431 // get the ending position of a line | |
432 virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const = 0; | |
433 | |
434 // get the beginning position of a section | |
435 virtual CPVT_WordPlace GetSectionBeginPlace( | |
436 const CPVT_WordPlace& place) const = 0; | |
437 | |
438 // get the ending position of a section | |
439 virtual CPVT_WordPlace GetSectionEndPlace( | |
440 const CPVT_WordPlace& place) const = 0; | |
441 | |
442 // search a wordplace form point | |
443 virtual CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const = 0; | |
444 | |
445 // get the font size of non_rich text or default font size of richtext. | |
446 virtual FX_FLOAT GetFontSize() const = 0; | |
447 | |
448 // get the mask character. | |
449 virtual uint16_t GetPasswordChar() const = 0; | |
450 | |
451 // get the count of charArray | |
452 virtual int32_t GetCharArray() const = 0; | |
453 | |
454 // get the horizontal scale of all characters | |
455 virtual int32_t GetHorzScale() const = 0; | |
456 | |
457 // get the space of two characters | |
458 virtual FX_FLOAT GetCharSpace() const = 0; | |
459 | |
460 // get the latin words of specified range | |
461 virtual CFX_WideString GetRangeText(const CPVT_WordRange& range) const = 0; | |
462 | |
463 // is the text full in bounding box | |
464 virtual FX_BOOL IsTextFull() const = 0; | |
465 virtual FX_BOOL CanUndo() const = 0; | |
466 virtual FX_BOOL CanRedo() const = 0; | |
467 | |
468 // if the content is changed after settext? | |
469 virtual FX_BOOL IsModified() const = 0; | |
470 | |
471 // get the total words in edit | |
472 virtual int32_t GetTotalWords() const = 0; | |
473 | |
474 virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0; | |
475 | |
476 static CFX_ByteString GetEditAppearanceStream( | |
477 IFX_Edit* pEdit, | |
478 const CFX_FloatPoint& ptOffset, | |
479 const CPVT_WordRange* pRange = nullptr, | |
480 FX_BOOL bContinuous = TRUE, | |
481 uint16_t SubWord = 0); | |
482 static CFX_ByteString GetSelectAppearanceStream( | |
483 IFX_Edit* pEdit, | |
484 const CFX_FloatPoint& ptOffset, | |
485 const CPVT_WordRange* pRange = nullptr); | |
486 static void DrawEdit(CFX_RenderDevice* pDevice, | |
487 CFX_Matrix* pUser2Device, | |
488 IFX_Edit* pEdit, | |
489 FX_COLORREF crTextFill, | |
490 FX_COLORREF crTextStroke, | |
491 const CFX_FloatRect& rcClip, | |
492 const CFX_FloatPoint& ptOffset, | |
493 const CPVT_WordRange* pRange, | |
494 CFX_SystemHandler* pSystemHandler, | |
495 void* pFFLData); | |
496 static void DrawUnderline(CFX_RenderDevice* pDevice, | |
497 CFX_Matrix* pUser2Device, | |
498 IFX_Edit* pEdit, | |
499 FX_COLORREF color, | |
500 const CFX_FloatRect& rcClip, | |
501 const CFX_FloatPoint& ptOffset, | |
502 const CPVT_WordRange* pRange); | |
503 static void DrawRichEdit(CFX_RenderDevice* pDevice, | |
504 CFX_Matrix* pUser2Device, | |
505 IFX_Edit* pEdit, | |
506 const CFX_FloatRect& rcClip, | |
507 const CFX_FloatPoint& ptOffset, | |
508 const CPVT_WordRange* pRange); | |
509 static void GeneratePageObjects( | |
510 CPDF_PageObjectHolder* pObjectHolder, | |
511 IFX_Edit* pEdit, | |
512 const CFX_FloatPoint& ptOffset, | |
513 const CPVT_WordRange* pRange, | |
514 FX_COLORREF crText, | |
515 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | |
516 static void GenerateRichPageObjects( | |
517 CPDF_PageObjectHolder* pObjectHolder, | |
518 IFX_Edit* pEdit, | |
519 const CFX_FloatPoint& ptOffset, | |
520 const CPVT_WordRange* pRange, | |
521 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | |
522 static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, | |
523 IFX_Edit* pEdit, | |
524 const CFX_FloatPoint& ptOffset, | |
525 const CPVT_WordRange* pRange, | |
526 FX_COLORREF color); | |
527 | |
528 protected: | |
529 virtual ~IFX_Edit() {} | |
530 }; | |
531 | |
532 class IFX_List_Notify { | |
533 public: | |
534 // set the horizontal scrollbar information. | |
535 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, | |
536 FX_FLOAT fPlateMax, | |
537 FX_FLOAT fContentMin, | |
538 FX_FLOAT fContentMax, | |
539 FX_FLOAT fSmallStep, | |
540 FX_FLOAT fBigStep) = 0; | |
541 // set the vertical scrollbar information. | |
542 virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, | |
543 FX_FLOAT fPlateMax, | |
544 FX_FLOAT fContentMin, | |
545 FX_FLOAT fContentMax, | |
546 FX_FLOAT fSmallStep, | |
547 FX_FLOAT fBigStep) = 0; | |
548 // set the position of horizontal scrollbar. | |
549 virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0; | |
550 // set the position of vertical scrollbar. | |
551 virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0; | |
552 // Invalidate the rectangle relative to the bounding box of edit. | |
553 virtual void IOnInvalidateRect(CFX_FloatRect* pRect) = 0; | |
554 | |
555 protected: | |
556 virtual ~IFX_List_Notify() {} | |
557 }; | |
558 | |
559 class IFX_List { | |
560 public: | |
561 static IFX_List* NewList(); | |
562 static void DelList(IFX_List* pList); | |
563 | |
564 virtual void SetFontMap(IPVT_FontMap* pFontMap) = 0; | |
565 virtual void SetNotify(IFX_List_Notify* pNotify) = 0; | |
566 | |
567 virtual void SetPlateRect(const CFX_FloatRect& rect) = 0; | |
568 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; | |
569 | |
570 virtual CFX_FloatRect GetPlateRect() const = 0; | |
571 virtual CFX_FloatRect GetContentRect() const = 0; | |
572 | |
573 virtual FX_FLOAT GetFontSize() const = 0; | |
574 virtual IFX_Edit* GetItemEdit(int32_t nIndex) const = 0; | |
575 virtual int32_t GetCount() const = 0; | |
576 virtual FX_BOOL IsItemSelected(int32_t nIndex) const = 0; | |
577 virtual FX_FLOAT GetFirstHeight() const = 0; | |
578 | |
579 virtual void SetMultipleSel(FX_BOOL bMultiple) = 0; | |
580 virtual FX_BOOL IsMultipleSel() const = 0; | |
581 virtual FX_BOOL IsValid(int32_t nItemIndex) const = 0; | |
582 virtual int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const = 0; | |
583 | |
584 virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; | |
585 virtual void ScrollToListItem(int32_t nItemIndex) = 0; | |
586 virtual CFX_FloatRect GetItemRect(int32_t nIndex) const = 0; | |
587 virtual int32_t GetCaret() const = 0; | |
588 virtual int32_t GetSelect() const = 0; | |
589 virtual int32_t GetTopItem() const = 0; | |
590 virtual int32_t GetItemIndex(const CFX_FloatPoint& point) const = 0; | |
591 virtual int32_t GetFirstSelected() const = 0; | |
592 | |
593 virtual void AddString(const FX_WCHAR* str) = 0; | |
594 virtual void SetTopItem(int32_t nIndex) = 0; | |
595 virtual void Select(int32_t nItemIndex) = 0; | |
596 virtual void SetCaret(int32_t nItemIndex) = 0; | |
597 virtual void Empty() = 0; | |
598 virtual void Cancel() = 0; | |
599 virtual CFX_WideString GetText() const = 0; | |
600 | |
601 virtual void OnMouseDown(const CFX_FloatPoint& point, | |
602 FX_BOOL bShift, | |
603 FX_BOOL bCtrl) = 0; | |
604 virtual void OnMouseMove(const CFX_FloatPoint& point, | |
605 FX_BOOL bShift, | |
606 FX_BOOL bCtrl) = 0; | |
607 virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
608 virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
609 virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
610 virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
611 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
612 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
613 virtual void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
614 virtual FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
615 | |
616 protected: | |
617 virtual ~IFX_List() {} | |
618 }; | |
619 | |
620 CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, | 22 CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, |
621 int32_t nFontIndex, | 23 int32_t nFontIndex, |
622 uint16_t Word, | 24 uint16_t Word, |
623 uint16_t SubWord); | 25 uint16_t SubWord); |
624 | 26 |
625 #endif // FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ | 27 #endif // FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ |
OLD | NEW |