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