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_INCLUDE_FXEDIT_FX_EDIT_H_ | 7 #ifndef FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ |
8 #define FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ | 8 #define FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ |
9 | 9 |
10 #include "core/include/fxcrt/fx_basic.h" | 10 #include "core/include/fxcrt/fx_basic.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #endif | 52 #endif |
53 | 53 |
54 class IFX_Edit_FontMap { | 54 class IFX_Edit_FontMap { |
55 public: | 55 public: |
56 virtual ~IFX_Edit_FontMap() {} | 56 virtual ~IFX_Edit_FontMap() {} |
57 // map a fontindex to pdf font. | 57 // map a fontindex to pdf font. |
58 virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0; | 58 virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0; |
59 // get the alias of a pdf font. | 59 // get the alias of a pdf font. |
60 virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0; | 60 virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0; |
61 // get the index of a font that can show a word. | 61 // get the index of a font that can show a word. |
62 virtual int32_t GetWordFontIndex(FX_WORD word, | 62 virtual int32_t GetWordFontIndex(uint16_t word, |
63 int32_t charset, | 63 int32_t charset, |
64 int32_t nFontIndex) = 0; | 64 int32_t nFontIndex) = 0; |
65 // get the charcode of word from unicode | 65 // get the charcode of word from unicode |
66 virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) = 0; | 66 virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) = 0; |
67 // get the charset of unicode | 67 // get the charset of unicode |
68 virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) = 0; | 68 virtual int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) = 0; |
69 }; | 69 }; |
70 | 70 |
71 class IFX_Edit_Notify { | 71 class IFX_Edit_Notify { |
72 public: | 72 public: |
73 virtual ~IFX_Edit_Notify() {} | 73 virtual ~IFX_Edit_Notify() {} |
74 // set the horizontal scrollbar information. | 74 // set the horizontal scrollbar information. |
75 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, | 75 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, |
76 FX_FLOAT fPlateMax, | 76 FX_FLOAT fPlateMax, |
77 FX_FLOAT fContentMin, | 77 FX_FLOAT fContentMin, |
78 FX_FLOAT fContentMax, | 78 FX_FLOAT fContentMax, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // set the scroll origin | 208 // set the scroll origin |
209 virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; | 209 virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; |
210 | 210 |
211 // set the horizontal text alignment in text box, nFormat (0:left 1:middle | 211 // set the horizontal text alignment in text box, nFormat (0:left 1:middle |
212 // 2:right). | 212 // 2:right). |
213 virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; | 213 virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; |
214 // set the vertical text alignment in text box, nFormat (0:top 1:center | 214 // set the vertical text alignment in text box, nFormat (0:top 1:center |
215 // 2:bottom). | 215 // 2:bottom). |
216 virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; | 216 virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; |
217 // if the text is shown in secret , set a character for substitute. | 217 // if the text is shown in secret , set a character for substitute. |
218 virtual void SetPasswordChar(FX_WORD wSubWord = '*', | 218 virtual void SetPasswordChar(uint16_t wSubWord = '*', |
219 FX_BOOL bPaint = TRUE) = 0; | 219 FX_BOOL bPaint = TRUE) = 0; |
220 // set the maximal count of words of the text. | 220 // set the maximal count of words of the text. |
221 virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0; | 221 virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0; |
222 // if set the count of charArray , then all words is shown in equal space. | 222 // if set the count of charArray , then all words is shown in equal space. |
223 virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0; | 223 virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0; |
224 // set the space of two characters. | 224 // set the space of two characters. |
225 virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, | 225 virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, |
226 FX_BOOL bPaint = TRUE) = 0; | 226 FX_BOOL bPaint = TRUE) = 0; |
227 // set the horizontal scale of all characters. | 227 // set the horizontal scale of all characters. |
228 virtual void SetHorzScale(int32_t nHorzScale = 100, | 228 virtual void SetHorzScale(int32_t nHorzScale = 100, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 329 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
330 // send the END key message to edit. | 330 // send the END key message to edit. |
331 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 331 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
332 | 332 |
333 // put text into edit. | 333 // put text into edit. |
334 virtual void SetText(const FX_WCHAR* text, | 334 virtual void SetText(const FX_WCHAR* text, |
335 int32_t charset = DEFAULT_CHARSET, | 335 int32_t charset = DEFAULT_CHARSET, |
336 const CPVT_SecProps* pSecProps = NULL, | 336 const CPVT_SecProps* pSecProps = NULL, |
337 const CPVT_WordProps* pWordProps = NULL) = 0; | 337 const CPVT_WordProps* pWordProps = NULL) = 0; |
338 // insert a word into the edit. | 338 // insert a word into the edit. |
339 virtual FX_BOOL InsertWord(FX_WORD word, | 339 virtual FX_BOOL InsertWord(uint16_t word, |
340 int32_t charset = DEFAULT_CHARSET, | 340 int32_t charset = DEFAULT_CHARSET, |
341 const CPVT_WordProps* pWordProps = NULL) = 0; | 341 const CPVT_WordProps* pWordProps = NULL) = 0; |
342 // insert a return into the edit. | 342 // insert a return into the edit. |
343 virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL, | 343 virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL, |
344 const CPVT_WordProps* pWordProps = NULL) = 0; | 344 const CPVT_WordProps* pWordProps = NULL) = 0; |
345 // insert text into the edit. | 345 // insert text into the edit. |
346 virtual FX_BOOL InsertText(const FX_WCHAR* text, | 346 virtual FX_BOOL InsertText(const FX_WCHAR* text, |
347 int32_t charset = DEFAULT_CHARSET, | 347 int32_t charset = DEFAULT_CHARSET, |
348 const CPVT_SecProps* pSecProps = NULL, | 348 const CPVT_SecProps* pSecProps = NULL, |
349 const CPVT_WordProps* pWordProps = NULL) = 0; | 349 const CPVT_WordProps* pWordProps = NULL) = 0; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 // get the ending position of a section | 397 // get the ending position of a section |
398 virtual CPVT_WordPlace GetSectionEndPlace( | 398 virtual CPVT_WordPlace GetSectionEndPlace( |
399 const CPVT_WordPlace& place) const = 0; | 399 const CPVT_WordPlace& place) const = 0; |
400 | 400 |
401 // search a wordplace form point | 401 // search a wordplace form point |
402 virtual CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const = 0; | 402 virtual CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const = 0; |
403 | 403 |
404 // get the font size of non_rich text or default font size of richtext. | 404 // get the font size of non_rich text or default font size of richtext. |
405 virtual FX_FLOAT GetFontSize() const = 0; | 405 virtual FX_FLOAT GetFontSize() const = 0; |
406 // get the mask character. | 406 // get the mask character. |
407 virtual FX_WORD GetPasswordChar() const = 0; | 407 virtual uint16_t GetPasswordChar() const = 0; |
408 // get the count of charArray | 408 // get the count of charArray |
409 virtual int32_t GetCharArray() const = 0; | 409 virtual int32_t GetCharArray() const = 0; |
410 // get the horizontal scale of all characters | 410 // get the horizontal scale of all characters |
411 virtual int32_t GetHorzScale() const = 0; | 411 virtual int32_t GetHorzScale() const = 0; |
412 // get the space of two characters | 412 // get the space of two characters |
413 virtual FX_FLOAT GetCharSpace() const = 0; | 413 virtual FX_FLOAT GetCharSpace() const = 0; |
414 // get the latin words of specified range | 414 // get the latin words of specified range |
415 virtual CFX_WideString GetRangeText(const CPVT_WordRange& range) const = 0; | 415 virtual CFX_WideString GetRangeText(const CPVT_WordRange& range) const = 0; |
416 // is the text full in bounding box | 416 // is the text full in bounding box |
417 virtual FX_BOOL IsTextFull() const = 0; | 417 virtual FX_BOOL IsTextFull() const = 0; |
418 virtual FX_BOOL CanUndo() const = 0; | 418 virtual FX_BOOL CanUndo() const = 0; |
419 virtual FX_BOOL CanRedo() const = 0; | 419 virtual FX_BOOL CanRedo() const = 0; |
420 // if the content is changed after settext? | 420 // if the content is changed after settext? |
421 virtual FX_BOOL IsModified() const = 0; | 421 virtual FX_BOOL IsModified() const = 0; |
422 // get the total words in edit | 422 // get the total words in edit |
423 virtual int32_t GetTotalWords() const = 0; | 423 virtual int32_t GetTotalWords() const = 0; |
424 | 424 |
425 virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0; | 425 virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0; |
426 | 426 |
427 static CFX_ByteString GetEditAppearanceStream( | 427 static CFX_ByteString GetEditAppearanceStream( |
428 IFX_Edit* pEdit, | 428 IFX_Edit* pEdit, |
429 const CFX_FloatPoint& ptOffset, | 429 const CFX_FloatPoint& ptOffset, |
430 const CPVT_WordRange* pRange = NULL, | 430 const CPVT_WordRange* pRange = NULL, |
431 FX_BOOL bContinuous = TRUE, | 431 FX_BOOL bContinuous = TRUE, |
432 FX_WORD SubWord = 0); | 432 uint16_t SubWord = 0); |
433 static CFX_ByteString GetSelectAppearanceStream( | 433 static CFX_ByteString GetSelectAppearanceStream( |
434 IFX_Edit* pEdit, | 434 IFX_Edit* pEdit, |
435 const CFX_FloatPoint& ptOffset, | 435 const CFX_FloatPoint& ptOffset, |
436 const CPVT_WordRange* pRange = NULL); | 436 const CPVT_WordRange* pRange = NULL); |
437 static void DrawEdit(CFX_RenderDevice* pDevice, | 437 static void DrawEdit(CFX_RenderDevice* pDevice, |
438 CFX_Matrix* pUser2Device, | 438 CFX_Matrix* pUser2Device, |
439 IFX_Edit* pEdit, | 439 IFX_Edit* pEdit, |
440 FX_COLORREF crTextFill, | 440 FX_COLORREF crTextFill, |
441 FX_COLORREF crTextStroke, | 441 FX_COLORREF crTextStroke, |
442 const CFX_FloatRect& rcClip, | 442 const CFX_FloatRect& rcClip, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 virtual void OnMouseMove(const CFX_FloatPoint& point, | 555 virtual void OnMouseMove(const CFX_FloatPoint& point, |
556 FX_BOOL bShift, | 556 FX_BOOL bShift, |
557 FX_BOOL bCtrl) = 0; | 557 FX_BOOL bCtrl) = 0; |
558 virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 558 virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
559 virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 559 virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
560 virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 560 virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
561 virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 561 virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
562 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 562 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
563 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 563 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
564 virtual void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 564 virtual void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
565 virtual FX_BOOL OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 565 virtual FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
566 | 566 |
567 protected: | 567 protected: |
568 virtual ~IFX_List() {} | 568 virtual ~IFX_List() {} |
569 }; | 569 }; |
570 | 570 |
571 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, | 571 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, |
572 int32_t nFontIndex, | 572 int32_t nFontIndex, |
573 FX_WORD Word, | 573 uint16_t Word, |
574 FX_WORD SubWord); | 574 uint16_t SubWord); |
575 | 575 |
576 #endif // FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ | 576 #endif // FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ |
OLD | NEW |