| 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 text area is changed, send the information to user. | |
| 81 virtual void IOnContentChange(const CFX_FloatRect& rcContent) = 0; | |
| 82 // Invalidate the rectangle relative to the bounding box of edit. | |
| 83 virtual void IOnInvalidateRect(CFX_FloatRect* pRect) = 0; | |
| 84 }; | |
| 85 | |
| 86 class IFX_Edit_OprNotify { | |
| 87 public: | |
| 88 virtual ~IFX_Edit_OprNotify() {} | |
| 89 | |
| 90 // OprType: 0 | |
| 91 virtual void OnInsertWord(const CPVT_WordPlace& place, | |
| 92 const CPVT_WordPlace& oldplace) = 0; | |
| 93 // OprType: 1 | |
| 94 virtual void OnInsertReturn(const CPVT_WordPlace& place, | |
| 95 const CPVT_WordPlace& oldplace) = 0; | |
| 96 // OprType: 2 | |
| 97 virtual void OnBackSpace(const CPVT_WordPlace& place, | |
| 98 const CPVT_WordPlace& oldplace) = 0; | |
| 99 // OprType: 3 | |
| 100 virtual void OnDelete(const CPVT_WordPlace& place, | |
| 101 const CPVT_WordPlace& oldplace) = 0; | |
| 102 // OprType: 4 | |
| 103 virtual void OnClear(const CPVT_WordPlace& place, | |
| 104 const CPVT_WordPlace& oldplace) = 0; | |
| 105 // OprType: 5 | |
| 106 virtual void OnInsertText(const CPVT_WordPlace& place, | |
| 107 const CPVT_WordPlace& oldplace) = 0; | |
| 108 // OprType: 6 | |
| 109 virtual void OnSetText(const CPVT_WordPlace& place, | |
| 110 const CPVT_WordPlace& oldplace) = 0; | |
| 111 // | |
| 112 virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0; | |
| 113 }; | |
| 114 | |
| 115 class IFX_Edit_Iterator { | |
| 116 public: | |
| 117 virtual ~IFX_Edit_Iterator() {} | |
| 118 | |
| 119 public: | |
| 120 // move the current position to the next word. | |
| 121 virtual FX_BOOL NextWord() = 0; | |
| 122 // move the current position to the next line. | |
| 123 virtual FX_BOOL NextLine() = 0; | |
| 124 // move the current position to the next section. | |
| 125 virtual FX_BOOL NextSection() = 0; | |
| 126 | |
| 127 // move the current position to the previous word. | |
| 128 virtual FX_BOOL PrevWord() = 0; | |
| 129 // move the current position to the previous line. | |
| 130 virtual FX_BOOL PrevLine() = 0; | |
| 131 // move the current position to the previous section. | |
| 132 virtual FX_BOOL PrevSection() = 0; | |
| 133 | |
| 134 // get the information of the current word. | |
| 135 virtual FX_BOOL GetWord(CPVT_Word& word) const = 0; | |
| 136 // get the information of the current line. | |
| 137 virtual FX_BOOL GetLine(CPVT_Line& line) const = 0; | |
| 138 // get the information of the current section. | |
| 139 virtual FX_BOOL GetSection(CPVT_Section& section) const = 0; | |
| 140 // set the current position. | |
| 141 virtual void SetAt(int32_t nWordIndex) = 0; | |
| 142 // set the current position. | |
| 143 virtual void SetAt(const CPVT_WordPlace& place) = 0; | |
| 144 // get the current position. | |
| 145 virtual const CPVT_WordPlace& GetAt() const = 0; | |
| 146 | |
| 147 // get the edit which this iterator belongs to | |
| 148 virtual IFX_Edit* GetEdit() const = 0; | |
| 149 }; | |
| 150 | |
| 151 class IFX_Edit_UndoItem { | |
| 152 public: | |
| 153 virtual ~IFX_Edit_UndoItem() {} | |
| 154 | |
| 155 virtual void Undo() = 0; | |
| 156 virtual void Redo() = 0; | |
| 157 virtual CFX_WideString GetUndoTitle() = 0; | |
| 158 }; | |
| 159 | |
| 160 class IFX_Edit { | |
| 161 public: | |
| 162 static IFX_Edit* NewEdit(); | |
| 163 static void DelEdit(IFX_Edit* pEdit); | |
| 164 | |
| 165 // set a IPVT_FontMap pointer implemented by user. | |
| 166 virtual void SetFontMap(IPVT_FontMap* pFontMap) = 0; | |
| 167 | |
| 168 // set a IFX_Edit_Notify pointer implemented by user. | |
| 169 virtual void SetNotify(IFX_Edit_Notify* pNotify) = 0; | |
| 170 virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0; | |
| 171 | |
| 172 // get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the | |
| 173 // contents of edit, but don't need to release. | |
| 174 virtual IFX_Edit_Iterator* GetIterator() = 0; | |
| 175 | |
| 176 // get a VT pointer relative to this edit. | |
| 177 virtual CPDF_VariableText* GetVariableText() = 0; | |
| 178 | |
| 179 // get the IPVT_FontMap pointer set by user. | |
| 180 virtual IPVT_FontMap* GetFontMap() = 0; | |
| 181 | |
| 182 // initialize the edit. | |
| 183 virtual void Initialize() = 0; | |
| 184 | |
| 185 // set the bounding box of the text area. | |
| 186 virtual void SetPlateRect(const CFX_FloatRect& rect, | |
| 187 FX_BOOL bPaint = TRUE) = 0; | |
| 188 | |
| 189 // set the scroll origin | |
| 190 virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; | |
| 191 | |
| 192 // set the horizontal text alignment in text box, nFormat (0:left 1:middle | |
| 193 // 2:right). | |
| 194 virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; | |
| 195 | |
| 196 // set the vertical text alignment in text box, nFormat (0:top 1:center | |
| 197 // 2:bottom). | |
| 198 virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; | |
| 199 | |
| 200 // if the text is shown in secret , set a character for substitute. | |
| 201 virtual void SetPasswordChar(uint16_t wSubWord = '*', | |
| 202 FX_BOOL bPaint = TRUE) = 0; | |
| 203 | |
| 204 // set the maximal count of words of the text. | |
| 205 virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0; | |
| 206 | |
| 207 // if set the count of charArray , then all words is shown in equal space. | |
| 208 virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0; | |
| 209 | |
| 210 // set the space of two characters. | |
| 211 virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, | |
| 212 FX_BOOL bPaint = TRUE) = 0; | |
| 213 | |
| 214 // set the horizontal scale of all characters. | |
| 215 virtual void SetHorzScale(int32_t nHorzScale = 100, | |
| 216 FX_BOOL bPaint = TRUE) = 0; | |
| 217 | |
| 218 // set the leading of all lines | |
| 219 virtual void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0; | |
| 220 | |
| 221 // if set, CRLF is allowed. | |
| 222 virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE, | |
| 223 FX_BOOL bPaint = TRUE) = 0; | |
| 224 | |
| 225 // if set, all words auto fit the width of the bounding box. | |
| 226 virtual void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; | |
| 227 | |
| 228 // if set, a font size is calculated to full fit the bounding box. | |
| 229 virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; | |
| 230 | |
| 231 // is set, the text is allowed to scroll. | |
| 232 virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; | |
| 233 | |
| 234 // set the font size of all words. | |
| 235 virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0; | |
| 236 | |
| 237 // the text is allowed to auto-scroll, allow the text overflow? | |
| 238 virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE, | |
| 239 FX_BOOL bPaint = TRUE) = 0; | |
| 240 | |
| 241 // set the selected range of text. | |
| 242 // if nStartChar == 0 and nEndChar == -1, select all the text. | |
| 243 virtual void SetSel(int32_t nStartChar, int32_t nEndChar) = 0; | |
| 244 | |
| 245 // get the selected range of text. | |
| 246 virtual void GetSel(int32_t& nStartChar, int32_t& nEndChar) const = 0; | |
| 247 | |
| 248 // select all the text. | |
| 249 virtual void SelectAll() = 0; | |
| 250 | |
| 251 // set text is not selected. | |
| 252 virtual void SelectNone() = 0; | |
| 253 | |
| 254 // get the caret position. | |
| 255 virtual int32_t GetCaret() const = 0; | |
| 256 virtual CPVT_WordPlace GetCaretWordPlace() const = 0; | |
| 257 | |
| 258 // get the string of selected text. | |
| 259 virtual CFX_WideString GetSelText() const = 0; | |
| 260 | |
| 261 // get the text conent | |
| 262 virtual CFX_WideString GetText() const = 0; | |
| 263 | |
| 264 // query if any text is selected. | |
| 265 virtual FX_BOOL IsSelected() const = 0; | |
| 266 | |
| 267 // get the scroll origin | |
| 268 virtual CFX_FloatPoint GetScrollPos() const = 0; | |
| 269 | |
| 270 // get the bounding box of the text area. | |
| 271 virtual CFX_FloatRect GetPlateRect() const = 0; | |
| 272 | |
| 273 // get the fact area of the text. | |
| 274 virtual CFX_FloatRect GetContentRect() const = 0; | |
| 275 | |
| 276 // get the visible word range | |
| 277 virtual CPVT_WordRange GetVisibleWordRange() const = 0; | |
| 278 | |
| 279 // get the whole word range | |
| 280 virtual CPVT_WordRange GetWholeWordRange() const = 0; | |
| 281 | |
| 282 // get the word range of select text | |
| 283 virtual CPVT_WordRange GetSelectWordRange() const = 0; | |
| 284 | |
| 285 // send the mousedown message to edit for response. | |
| 286 // if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE. | |
| 287 virtual void OnMouseDown(const CFX_FloatPoint& point, | |
| 288 FX_BOOL bShift, | |
| 289 FX_BOOL bCtrl) = 0; | |
| 290 | |
| 291 // send the mousemove message to edit when mouse down is TRUE. | |
| 292 virtual void OnMouseMove(const CFX_FloatPoint& point, | |
| 293 FX_BOOL bShift, | |
| 294 FX_BOOL bCtrl) = 0; | |
| 295 | |
| 296 // send the UP key message to edit. | |
| 297 virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 298 | |
| 299 // send the DOWN key message to edit. | |
| 300 virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 301 | |
| 302 // send the LEFT key message to edit. | |
| 303 virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 304 | |
| 305 // send the RIGHT key message to edit. | |
| 306 virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 307 | |
| 308 // send the HOME key message to edit. | |
| 309 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 310 | |
| 311 // send the END key message to edit. | |
| 312 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 313 | |
| 314 // put text into edit. | |
| 315 virtual void SetText(const FX_WCHAR* text, | |
| 316 int32_t charset = DEFAULT_CHARSET, | |
| 317 const CPVT_SecProps* pSecProps = nullptr, | |
| 318 const CPVT_WordProps* pWordProps = nullptr) = 0; | |
| 319 | |
| 320 // insert a word into the edit. | |
| 321 virtual FX_BOOL InsertWord(uint16_t word, | |
| 322 int32_t charset = DEFAULT_CHARSET, | |
| 323 const CPVT_WordProps* pWordProps = nullptr) = 0; | |
| 324 | |
| 325 // insert a return into the edit. | |
| 326 virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr, | |
| 327 const CPVT_WordProps* pWordProps = nullptr) = 0; | |
| 328 | |
| 329 // insert text into the edit. | |
| 330 virtual FX_BOOL InsertText(const FX_WCHAR* text, | |
| 331 int32_t charset = DEFAULT_CHARSET, | |
| 332 const CPVT_SecProps* pSecProps = nullptr, | |
| 333 const CPVT_WordProps* pWordProps = nullptr) = 0; | |
| 334 | |
| 335 // do backspace operation. | |
| 336 virtual FX_BOOL Backspace() = 0; | |
| 337 | |
| 338 // do delete operation. | |
| 339 virtual FX_BOOL Delete() = 0; | |
| 340 | |
| 341 // delete the selected text. | |
| 342 virtual FX_BOOL Clear() = 0; | |
| 343 | |
| 344 // do Redo operation. | |
| 345 virtual FX_BOOL Redo() = 0; | |
| 346 | |
| 347 // do Undo operation. | |
| 348 virtual FX_BOOL Undo() = 0; | |
| 349 | |
| 350 // move caret | |
| 351 virtual void SetCaret(int32_t nPos) = 0; | |
| 352 | |
| 353 // arrange all words over again | |
| 354 virtual void Paint() = 0; | |
| 355 | |
| 356 // allow to refresh screen? | |
| 357 virtual void EnableRefresh(FX_BOOL bRefresh) = 0; | |
| 358 | |
| 359 virtual void RefreshWordRange(const CPVT_WordRange& wr) = 0; | |
| 360 | |
| 361 // allow undo/redo? | |
| 362 virtual void EnableUndo(FX_BOOL bUndo) = 0; | |
| 363 | |
| 364 // allow opr notify? | |
| 365 virtual void EnableOprNotify(FX_BOOL bNotify) = 0; | |
| 366 | |
| 367 // map word place to word index. | |
| 368 virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const = 0; | |
| 369 // map word index to word place. | |
| 370 virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0; | |
| 371 | |
| 372 // get the beginning position of a line | |
| 373 virtual CPVT_WordPlace GetLineBeginPlace( | |
| 374 const CPVT_WordPlace& place) const = 0; | |
| 375 | |
| 376 // get the ending position of a line | |
| 377 virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const = 0; | |
| 378 | |
| 379 // get the beginning position of a section | |
| 380 virtual CPVT_WordPlace GetSectionBeginPlace( | |
| 381 const CPVT_WordPlace& place) const = 0; | |
| 382 | |
| 383 // get the ending position of a section | |
| 384 virtual CPVT_WordPlace GetSectionEndPlace( | |
| 385 const CPVT_WordPlace& place) const = 0; | |
| 386 | |
| 387 // search a wordplace form point | |
| 388 virtual CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const = 0; | |
| 389 | |
| 390 // get the font size of non_rich text or default font size of richtext. | |
| 391 virtual FX_FLOAT GetFontSize() const = 0; | |
| 392 | |
| 393 // get the mask character. | |
| 394 virtual uint16_t GetPasswordChar() const = 0; | |
| 395 | |
| 396 // get the count of charArray | |
| 397 virtual int32_t GetCharArray() const = 0; | |
| 398 | |
| 399 // get the horizontal scale of all characters | |
| 400 virtual int32_t GetHorzScale() const = 0; | |
| 401 | |
| 402 // get the space of two characters | |
| 403 virtual FX_FLOAT GetCharSpace() const = 0; | |
| 404 | |
| 405 // get the latin words of specified range | |
| 406 virtual CFX_WideString GetRangeText(const CPVT_WordRange& range) const = 0; | |
| 407 | |
| 408 // is the text full in bounding box | |
| 409 virtual FX_BOOL IsTextFull() const = 0; | |
| 410 virtual FX_BOOL CanUndo() const = 0; | |
| 411 virtual FX_BOOL CanRedo() const = 0; | |
| 412 | |
| 413 // if the content is changed after settext? | |
| 414 virtual FX_BOOL IsModified() const = 0; | |
| 415 | |
| 416 // get the total words in edit | |
| 417 virtual int32_t GetTotalWords() const = 0; | |
| 418 | |
| 419 virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0; | |
| 420 | |
| 421 static CFX_ByteString GetEditAppearanceStream( | |
| 422 IFX_Edit* pEdit, | |
| 423 const CFX_FloatPoint& ptOffset, | |
| 424 const CPVT_WordRange* pRange = nullptr, | |
| 425 FX_BOOL bContinuous = TRUE, | |
| 426 uint16_t SubWord = 0); | |
| 427 static CFX_ByteString GetSelectAppearanceStream( | |
| 428 IFX_Edit* pEdit, | |
| 429 const CFX_FloatPoint& ptOffset, | |
| 430 const CPVT_WordRange* pRange = nullptr); | |
| 431 static void DrawEdit(CFX_RenderDevice* pDevice, | |
| 432 CFX_Matrix* pUser2Device, | |
| 433 IFX_Edit* pEdit, | |
| 434 FX_COLORREF crTextFill, | |
| 435 FX_COLORREF crTextStroke, | |
| 436 const CFX_FloatRect& rcClip, | |
| 437 const CFX_FloatPoint& ptOffset, | |
| 438 const CPVT_WordRange* pRange, | |
| 439 CFX_SystemHandler* pSystemHandler, | |
| 440 void* pFFLData); | |
| 441 static void GeneratePageObjects( | |
| 442 CPDF_PageObjectHolder* pObjectHolder, | |
| 443 IFX_Edit* pEdit, | |
| 444 const CFX_FloatPoint& ptOffset, | |
| 445 const CPVT_WordRange* pRange, | |
| 446 FX_COLORREF crText, | |
| 447 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | |
| 448 | |
| 449 protected: | |
| 450 virtual ~IFX_Edit() {} | |
| 451 }; | |
| 452 | |
| 453 class IFX_List_Notify { | |
| 454 public: | |
| 455 // set the horizontal scrollbar information. | |
| 456 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, | |
| 457 FX_FLOAT fPlateMax, | |
| 458 FX_FLOAT fContentMin, | |
| 459 FX_FLOAT fContentMax, | |
| 460 FX_FLOAT fSmallStep, | |
| 461 FX_FLOAT fBigStep) = 0; | |
| 462 // set the vertical scrollbar information. | |
| 463 virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, | |
| 464 FX_FLOAT fPlateMax, | |
| 465 FX_FLOAT fContentMin, | |
| 466 FX_FLOAT fContentMax, | |
| 467 FX_FLOAT fSmallStep, | |
| 468 FX_FLOAT fBigStep) = 0; | |
| 469 // set the position of horizontal scrollbar. | |
| 470 virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0; | |
| 471 // set the position of vertical scrollbar. | |
| 472 virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0; | |
| 473 // Invalidate the rectangle relative to the bounding box of edit. | |
| 474 virtual void IOnInvalidateRect(CFX_FloatRect* pRect) = 0; | |
| 475 | |
| 476 protected: | |
| 477 virtual ~IFX_List_Notify() {} | |
| 478 }; | |
| 479 | |
| 480 class IFX_List { | |
| 481 public: | |
| 482 static IFX_List* NewList(); | |
| 483 static void DelList(IFX_List* pList); | |
| 484 | |
| 485 virtual void SetFontMap(IPVT_FontMap* pFontMap) = 0; | |
| 486 virtual void SetNotify(IFX_List_Notify* pNotify) = 0; | |
| 487 | |
| 488 virtual void SetPlateRect(const CFX_FloatRect& rect) = 0; | |
| 489 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; | |
| 490 | |
| 491 virtual CFX_FloatRect GetPlateRect() const = 0; | |
| 492 virtual CFX_FloatRect GetContentRect() const = 0; | |
| 493 | |
| 494 virtual FX_FLOAT GetFontSize() const = 0; | |
| 495 virtual IFX_Edit* GetItemEdit(int32_t nIndex) const = 0; | |
| 496 virtual int32_t GetCount() const = 0; | |
| 497 virtual FX_BOOL IsItemSelected(int32_t nIndex) const = 0; | |
| 498 virtual FX_FLOAT GetFirstHeight() const = 0; | |
| 499 | |
| 500 virtual void SetMultipleSel(FX_BOOL bMultiple) = 0; | |
| 501 virtual FX_BOOL IsMultipleSel() const = 0; | |
| 502 virtual FX_BOOL IsValid(int32_t nItemIndex) const = 0; | |
| 503 virtual int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const = 0; | |
| 504 | |
| 505 virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; | |
| 506 virtual void ScrollToListItem(int32_t nItemIndex) = 0; | |
| 507 virtual CFX_FloatRect GetItemRect(int32_t nIndex) const = 0; | |
| 508 virtual int32_t GetCaret() const = 0; | |
| 509 virtual int32_t GetSelect() const = 0; | |
| 510 virtual int32_t GetTopItem() const = 0; | |
| 511 virtual int32_t GetItemIndex(const CFX_FloatPoint& point) const = 0; | |
| 512 virtual int32_t GetFirstSelected() const = 0; | |
| 513 | |
| 514 virtual void AddString(const FX_WCHAR* str) = 0; | |
| 515 virtual void SetTopItem(int32_t nIndex) = 0; | |
| 516 virtual void Select(int32_t nItemIndex) = 0; | |
| 517 virtual void SetCaret(int32_t nItemIndex) = 0; | |
| 518 virtual void Empty() = 0; | |
| 519 virtual void Cancel() = 0; | |
| 520 virtual CFX_WideString GetText() const = 0; | |
| 521 | |
| 522 virtual void OnMouseDown(const CFX_FloatPoint& point, | |
| 523 FX_BOOL bShift, | |
| 524 FX_BOOL bCtrl) = 0; | |
| 525 virtual void OnMouseMove(const CFX_FloatPoint& point, | |
| 526 FX_BOOL bShift, | |
| 527 FX_BOOL bCtrl) = 0; | |
| 528 virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 529 virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 530 virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 531 virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 532 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 533 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 534 virtual void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 535 virtual FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl) = 0; | |
| 536 | |
| 537 protected: | |
| 538 virtual ~IFX_List() {} | |
| 539 }; | |
| 540 | |
| 541 CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, | 22 CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, |
| 542 int32_t nFontIndex, | 23 int32_t nFontIndex, |
| 543 uint16_t Word, | 24 uint16_t Word, |
| 544 uint16_t SubWord); | 25 uint16_t SubWord); |
| 545 | 26 |
| 546 #endif // FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ | 27 #endif // FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ |
| OLD | NEW |