| 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_FXET_EDIT_H_ | 7 #ifndef FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ |
| 8 #define FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ | 8 #define FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "core/fpdfdoc/include/cpvt_secprops.h" | 12 #include "core/fpdfdoc/include/cpvt_secprops.h" |
| 13 #include "core/fpdfdoc/include/cpvt_wordprops.h" | 13 #include "core/fpdfdoc/include/cpvt_wordprops.h" |
| 14 #include "fpdfsdk/fxedit/include/fx_edit.h" | 14 #include "fpdfsdk/fxedit/include/fx_edit.h" |
| 15 | 15 |
| 16 class CPDF_PageObjectHolder; | 16 class CPDF_PageObjectHolder; |
| 17 class CPDF_TextObject; | 17 class CPDF_TextObject; |
| 18 class CPWL_Edit; | 18 class CPWL_Edit; |
| 19 class CPWL_EditCtrl; | 19 class CPWL_EditCtrl; |
| 20 class CFX_Edit; | 20 class CFX_Edit; |
| 21 class CFX_Edit_Iterator; | 21 class CFX_Edit_Iterator; |
| 22 class CFX_Edit_Provider; | 22 class CFX_Edit_Provider; |
| 23 class CFX_RenderDevice; | 23 class CFX_RenderDevice; |
| 24 class CFX_SystemHandler; | 24 class CFX_SystemHandler; |
| 25 class IFX_Edit_UndoItem; | 25 class IFX_Edit_UndoItem; |
| 26 | 26 |
| 27 enum EDIT_PROPS_E { | |
| 28 EP_LINELEADING, | |
| 29 EP_LINEINDENT, | |
| 30 EP_ALIGNMENT, | |
| 31 EP_FONTINDEX, | |
| 32 EP_FONTSIZE, | |
| 33 EP_WORDCOLOR, | |
| 34 EP_SCRIPTTYPE, | |
| 35 EP_UNDERLINE, | |
| 36 EP_CROSSOUT, | |
| 37 EP_CHARSPACE, | |
| 38 EP_HORZSCALE, | |
| 39 EP_BOLD, | |
| 40 EP_ITALIC | |
| 41 }; | |
| 42 | |
| 43 struct CFX_Edit_LineRect { | 27 struct CFX_Edit_LineRect { |
| 44 CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) | 28 CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) |
| 45 : m_wrLine(wrLine), m_rcLine(rcLine) {} | 29 : m_wrLine(wrLine), m_rcLine(rcLine) {} |
| 46 | 30 |
| 47 FX_BOOL operator!=(const CFX_Edit_LineRect& linerect) const { | |
| 48 return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0; | |
| 49 } | |
| 50 | |
| 51 FX_BOOL IsSameHeight(const CFX_Edit_LineRect& linerect) const { | |
| 52 return IsFloatZero((m_rcLine.top - m_rcLine.bottom) - | |
| 53 (linerect.m_rcLine.top - linerect.m_rcLine.bottom)); | |
| 54 } | |
| 55 | |
| 56 FX_BOOL IsSameTop(const CFX_Edit_LineRect& linerect) const { | |
| 57 return IsFloatZero(m_rcLine.top - linerect.m_rcLine.top); | |
| 58 } | |
| 59 | |
| 60 FX_BOOL IsSameLeft(const CFX_Edit_LineRect& linerect) const { | |
| 61 return IsFloatZero(m_rcLine.left - linerect.m_rcLine.left); | |
| 62 } | |
| 63 | |
| 64 FX_BOOL IsSameRight(const CFX_Edit_LineRect& linerect) const { | |
| 65 return IsFloatZero(m_rcLine.right - linerect.m_rcLine.right); | |
| 66 } | |
| 67 | |
| 68 CPVT_WordRange m_wrLine; | 31 CPVT_WordRange m_wrLine; |
| 69 CFX_FloatRect m_rcLine; | 32 CFX_FloatRect m_rcLine; |
| 70 }; | 33 }; |
| 71 | 34 |
| 72 class CFX_Edit_LineRectArray { | 35 class CFX_Edit_LineRectArray { |
| 73 public: | 36 public: |
| 74 CFX_Edit_LineRectArray(); | 37 CFX_Edit_LineRectArray(); |
| 75 virtual ~CFX_Edit_LineRectArray(); | 38 virtual ~CFX_Edit_LineRectArray(); |
| 76 | 39 |
| 77 void Empty(); | 40 void Empty(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); | 88 CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); |
| 126 explicit CFX_Edit_Select(const CPVT_WordRange& range); | 89 explicit CFX_Edit_Select(const CPVT_WordRange& range); |
| 127 | 90 |
| 128 void Default(); | 91 void Default(); |
| 129 void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); | 92 void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); |
| 130 void SetBeginPos(const CPVT_WordPlace& begin); | 93 void SetBeginPos(const CPVT_WordPlace& begin); |
| 131 void SetEndPos(const CPVT_WordPlace& end); | 94 void SetEndPos(const CPVT_WordPlace& end); |
| 132 | 95 |
| 133 CPVT_WordRange ConvertToWordRange() const; | 96 CPVT_WordRange ConvertToWordRange() const; |
| 134 FX_BOOL IsExist() const; | 97 FX_BOOL IsExist() const; |
| 135 FX_BOOL operator!=(const CPVT_WordRange& wr) const; | |
| 136 | 98 |
| 137 CPVT_WordPlace BeginPos, EndPos; | 99 CPVT_WordPlace BeginPos, EndPos; |
| 138 }; | 100 }; |
| 139 | 101 |
| 140 class CFX_Edit_Undo { | 102 class CFX_Edit_Undo { |
| 141 public: | 103 public: |
| 142 explicit CFX_Edit_Undo(int32_t nBufsize); | 104 explicit CFX_Edit_Undo(int32_t nBufsize); |
| 143 virtual ~CFX_Edit_Undo(); | 105 virtual ~CFX_Edit_Undo(); |
| 144 | 106 |
| 145 void Undo(); | 107 void Undo(); |
| 146 void Redo(); | 108 void Redo(); |
| 147 | 109 |
| 148 void AddItem(IFX_Edit_UndoItem* pItem); | 110 void AddItem(IFX_Edit_UndoItem* pItem); |
| 149 | 111 |
| 150 FX_BOOL CanUndo() const; | 112 FX_BOOL CanUndo() const; |
| 151 FX_BOOL CanRedo() const; | 113 FX_BOOL CanRedo() const; |
| 152 FX_BOOL IsModified() const; | 114 FX_BOOL IsModified() const; |
| 153 FX_BOOL IsWorking() const; | |
| 154 | 115 |
| 155 void Reset(); | 116 void Reset(); |
| 156 | 117 |
| 157 IFX_Edit_UndoItem* GetItem(int32_t nIndex); | |
| 158 int32_t GetItemCount() { return m_UndoItemStack.GetSize(); } | |
| 159 int32_t GetCurUndoPos() { return m_nCurUndoPos; } | |
| 160 | |
| 161 private: | 118 private: |
| 162 void SetBufSize(int32_t nSize) { m_nBufSize = nSize; } | |
| 163 int32_t GetBufSize() { return m_nBufSize; } | |
| 164 | |
| 165 void RemoveHeads(); | 119 void RemoveHeads(); |
| 166 void RemoveTails(); | 120 void RemoveTails(); |
| 167 | 121 |
| 168 private: | 122 private: |
| 169 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; | 123 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; |
| 170 | 124 |
| 171 int32_t m_nCurUndoPos; | 125 int32_t m_nCurUndoPos; |
| 172 int32_t m_nBufSize; | 126 int32_t m_nBufSize; |
| 173 FX_BOOL m_bModified; | 127 FX_BOOL m_bModified; |
| 174 FX_BOOL m_bVirgin; | 128 FX_BOOL m_bVirgin; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 185 }; | 139 }; |
| 186 | 140 |
| 187 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { | 141 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { |
| 188 public: | 142 public: |
| 189 CFX_Edit_UndoItem(); | 143 CFX_Edit_UndoItem(); |
| 190 ~CFX_Edit_UndoItem() override; | 144 ~CFX_Edit_UndoItem() override; |
| 191 | 145 |
| 192 CFX_WideString GetUndoTitle() override; | 146 CFX_WideString GetUndoTitle() override; |
| 193 | 147 |
| 194 void SetFirst(FX_BOOL bFirst); | 148 void SetFirst(FX_BOOL bFirst); |
| 195 FX_BOOL IsFirst(); | |
| 196 void SetLast(FX_BOOL bLast); | 149 void SetLast(FX_BOOL bLast); |
| 197 FX_BOOL IsLast(); | 150 FX_BOOL IsLast(); |
| 198 | 151 |
| 199 private: | 152 private: |
| 200 FX_BOOL m_bFirst; | 153 FX_BOOL m_bFirst; |
| 201 FX_BOOL m_bLast; | 154 FX_BOOL m_bLast; |
| 202 }; | 155 }; |
| 203 | 156 |
| 204 class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem { | 157 class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem { |
| 205 public: | 158 public: |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 static void DrawEdit(CFX_RenderDevice* pDevice, | 326 static void DrawEdit(CFX_RenderDevice* pDevice, |
| 374 CFX_Matrix* pUser2Device, | 327 CFX_Matrix* pUser2Device, |
| 375 CFX_Edit* pEdit, | 328 CFX_Edit* pEdit, |
| 376 FX_COLORREF crTextFill, | 329 FX_COLORREF crTextFill, |
| 377 FX_COLORREF crTextStroke, | 330 FX_COLORREF crTextStroke, |
| 378 const CFX_FloatRect& rcClip, | 331 const CFX_FloatRect& rcClip, |
| 379 const CFX_FloatPoint& ptOffset, | 332 const CFX_FloatPoint& ptOffset, |
| 380 const CPVT_WordRange* pRange, | 333 const CPVT_WordRange* pRange, |
| 381 CFX_SystemHandler* pSystemHandler, | 334 CFX_SystemHandler* pSystemHandler, |
| 382 void* pFFLData); | 335 void* pFFLData); |
| 383 static void DrawUnderline(CFX_RenderDevice* pDevice, | |
| 384 CFX_Matrix* pUser2Device, | |
| 385 CFX_Edit* pEdit, | |
| 386 FX_COLORREF color, | |
| 387 const CFX_FloatRect& rcClip, | |
| 388 const CFX_FloatPoint& ptOffset, | |
| 389 const CPVT_WordRange* pRange); | |
| 390 static void DrawRichEdit(CFX_RenderDevice* pDevice, | |
| 391 CFX_Matrix* pUser2Device, | |
| 392 CFX_Edit* pEdit, | |
| 393 const CFX_FloatRect& rcClip, | |
| 394 const CFX_FloatPoint& ptOffset, | |
| 395 const CPVT_WordRange* pRange); | |
| 396 static void GeneratePageObjects( | 336 static void GeneratePageObjects( |
| 397 CPDF_PageObjectHolder* pObjectHolder, | 337 CPDF_PageObjectHolder* pObjectHolder, |
| 398 CFX_Edit* pEdit, | 338 CFX_Edit* pEdit, |
| 399 const CFX_FloatPoint& ptOffset, | 339 const CFX_FloatPoint& ptOffset, |
| 400 const CPVT_WordRange* pRange, | 340 const CPVT_WordRange* pRange, |
| 401 FX_COLORREF crText, | 341 FX_COLORREF crText, |
| 402 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | 342 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
| 403 static void GenerateRichPageObjects( | |
| 404 CPDF_PageObjectHolder* pObjectHolder, | |
| 405 CFX_Edit* pEdit, | |
| 406 const CFX_FloatPoint& ptOffset, | |
| 407 const CPVT_WordRange* pRange, | |
| 408 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | |
| 409 static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, | |
| 410 CFX_Edit* pEdit, | |
| 411 const CFX_FloatPoint& ptOffset, | |
| 412 const CPVT_WordRange* pRange, | |
| 413 FX_COLORREF color); | |
| 414 | 343 |
| 415 CFX_Edit(); | 344 CFX_Edit(); |
| 416 ~CFX_Edit(); | 345 ~CFX_Edit(); |
| 417 | 346 |
| 418 void SetFontMap(IPVT_FontMap* pFontMap); | 347 void SetFontMap(IPVT_FontMap* pFontMap); |
| 419 void SetNotify(CPWL_EditCtrl* pNotify); | 348 void SetNotify(CPWL_EditCtrl* pNotify); |
| 420 void SetOprNotify(CPWL_Edit* pOprNotify); | 349 void SetOprNotify(CPWL_Edit* pOprNotify); |
| 421 | 350 |
| 422 // Returns an iterator for the contents. Should not be released. | 351 // Returns an iterator for the contents. Should not be released. |
| 423 CFX_Edit_Iterator* GetIterator(); | 352 CFX_Edit_Iterator* GetIterator(); |
| 424 CPDF_VariableText* GetVariableText(); | |
| 425 IPVT_FontMap* GetFontMap(); | 353 IPVT_FontMap* GetFontMap(); |
| 426 void Initialize(); | 354 void Initialize(); |
| 427 | 355 |
| 428 // Set the bounding box of the text area. | 356 // Set the bounding box of the text area. |
| 429 void SetPlateRect(const CFX_FloatRect& rect); | 357 void SetPlateRect(const CFX_FloatRect& rect); |
| 430 void SetScrollPos(const CFX_FloatPoint& point); | 358 void SetScrollPos(const CFX_FloatPoint& point); |
| 431 | 359 |
| 432 // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) | 360 // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) |
| 433 void SetAlignmentH(int32_t nFormat, FX_BOOL bPaint); | 361 void SetAlignmentH(int32_t nFormat, FX_BOOL bPaint); |
| 434 // Set the vertical text alignment. (nFormat [0:left, 1:middle, 2:right]) | 362 // Set the vertical text alignment. (nFormat [0:left, 1:middle, 2:right]) |
| 435 void SetAlignmentV(int32_t nFormat, FX_BOOL bPaint); | 363 void SetAlignmentV(int32_t nFormat, FX_BOOL bPaint); |
| 436 | 364 |
| 437 // Set the substitution character for hidden text. | 365 // Set the substitution character for hidden text. |
| 438 void SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint); | 366 void SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint); |
| 439 | 367 |
| 440 // Set the maximum number of words in the text. | 368 // Set the maximum number of words in the text. |
| 441 void SetLimitChar(int32_t nLimitChar); | 369 void SetLimitChar(int32_t nLimitChar); |
| 442 void SetCharArray(int32_t nCharArray); | 370 void SetCharArray(int32_t nCharArray); |
| 443 void SetCharSpace(FX_FLOAT fCharSpace); | 371 void SetCharSpace(FX_FLOAT fCharSpace); |
| 444 void SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint); | 372 void SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint); |
| 445 void SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint); | 373 void SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint); |
| 446 void SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint); | 374 void SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint); |
| 447 void SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint); | 375 void SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint); |
| 448 void SetFontSize(FX_FLOAT fFontSize); | 376 void SetFontSize(FX_FLOAT fFontSize); |
| 449 void SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint); | 377 void SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint); |
| 450 FX_BOOL IsRichText() const; | |
| 451 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE); | |
| 452 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize); | |
| 453 FX_BOOL SetRichFontIndex(int32_t nFontIndex); | |
| 454 FX_BOOL SetRichTextColor(FX_COLORREF dwColor); | |
| 455 FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType); | |
| 456 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE); | |
| 457 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE); | |
| 458 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE); | |
| 459 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE); | |
| 460 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace); | |
| 461 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100); | |
| 462 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading); | |
| 463 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent); | |
| 464 FX_BOOL SetRichTextAlignment(int32_t nAlignment); | |
| 465 void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); | 378 void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); |
| 466 void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); | 379 void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); |
| 467 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); | 380 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); |
| 468 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); | 381 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); |
| 469 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); | 382 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); |
| 470 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); | 383 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); |
| 471 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); | 384 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); |
| 472 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); | 385 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); |
| 473 void SetText(const CFX_WideString& sText); | 386 void SetText(const CFX_WideString& sText); |
| 474 FX_BOOL InsertWord(uint16_t word, int32_t charset); | 387 FX_BOOL InsertWord(uint16_t word, int32_t charset); |
| 475 FX_BOOL InsertReturn(); | 388 FX_BOOL InsertReturn(); |
| 476 FX_BOOL Backspace(); | 389 FX_BOOL Backspace(); |
| 477 FX_BOOL Delete(); | 390 FX_BOOL Delete(); |
| 478 FX_BOOL Clear(); | 391 FX_BOOL Clear(); |
| 479 FX_BOOL InsertText(const CFX_WideString& sText, int32_t charset); | 392 FX_BOOL InsertText(const CFX_WideString& sText, int32_t charset); |
| 480 FX_BOOL Redo(); | 393 FX_BOOL Redo(); |
| 481 FX_BOOL Undo(); | 394 FX_BOOL Undo(); |
| 482 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; | 395 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; |
| 483 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; | 396 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; |
| 484 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const; | |
| 485 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const; | |
| 486 CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const; | |
| 487 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const; | |
| 488 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; | 397 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; |
| 489 int32_t GetCaret() const; | 398 int32_t GetCaret() const; |
| 490 CPVT_WordPlace GetCaretWordPlace() const; | 399 CPVT_WordPlace GetCaretWordPlace() const; |
| 491 CFX_WideString GetSelText() const; | 400 CFX_WideString GetSelText() const; |
| 492 CFX_WideString GetText() const; | 401 CFX_WideString GetText() const; |
| 493 FX_FLOAT GetFontSize() const; | 402 FX_FLOAT GetFontSize() const; |
| 494 uint16_t GetPasswordChar() const; | 403 uint16_t GetPasswordChar() const; |
| 495 CFX_FloatPoint GetScrollPos() const; | 404 CFX_FloatPoint GetScrollPos() const; |
| 496 int32_t GetCharArray() const; | 405 int32_t GetCharArray() const; |
| 497 CFX_FloatRect GetPlateRect() const; | |
| 498 CFX_FloatRect GetContentRect() const; | 406 CFX_FloatRect GetContentRect() const; |
| 499 CFX_WideString GetRangeText(const CPVT_WordRange& range) const; | 407 CFX_WideString GetRangeText(const CPVT_WordRange& range) const; |
| 500 int32_t GetHorzScale() const; | 408 int32_t GetHorzScale() const; |
| 501 FX_FLOAT GetCharSpace() const; | 409 FX_FLOAT GetCharSpace() const; |
| 502 int32_t GetTotalWords() const; | 410 int32_t GetTotalWords() const; |
| 503 void SetSel(int32_t nStartChar, int32_t nEndChar); | 411 void SetSel(int32_t nStartChar, int32_t nEndChar); |
| 504 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; | 412 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; |
| 505 void SelectAll(); | 413 void SelectAll(); |
| 506 void SelectNone(); | 414 void SelectNone(); |
| 507 FX_BOOL IsSelected() const; | 415 FX_BOOL IsSelected() const; |
| 508 void Paint(); | 416 void Paint(); |
| 509 void EnableNotify(FX_BOOL bNotify); | |
| 510 void EnableRefresh(FX_BOOL bRefresh); | 417 void EnableRefresh(FX_BOOL bRefresh); |
| 511 void RefreshWordRange(const CPVT_WordRange& wr); | 418 void RefreshWordRange(const CPVT_WordRange& wr); |
| 512 void SetCaret(int32_t nPos); | 419 void SetCaret(int32_t nPos); |
| 513 CPVT_WordRange GetWholeWordRange() const; | 420 CPVT_WordRange GetWholeWordRange() const; |
| 514 CPVT_WordRange GetSelectWordRange() const; | 421 CPVT_WordRange GetSelectWordRange() const; |
| 515 void EnableUndo(FX_BOOL bUndo); | 422 void EnableUndo(FX_BOOL bUndo); |
| 516 void EnableOprNotify(FX_BOOL bNotify); | 423 void EnableOprNotify(FX_BOOL bNotify); |
| 517 FX_BOOL IsTextFull() const; | 424 FX_BOOL IsTextFull() const; |
| 518 FX_BOOL IsTextOverflow() const; | 425 FX_BOOL IsTextOverflow() const; |
| 519 FX_BOOL CanUndo() const; | 426 FX_BOOL CanUndo() const; |
| 520 FX_BOOL CanRedo() const; | 427 FX_BOOL CanRedo() const; |
| 521 FX_BOOL IsModified() const; | |
| 522 CPVT_WordRange GetVisibleWordRange() const; | 428 CPVT_WordRange GetVisibleWordRange() const; |
| 523 void AddUndoItem(IFX_Edit_UndoItem* pUndoItem); | |
| 524 | 429 |
| 525 FX_BOOL Empty(); | 430 FX_BOOL Empty(); |
| 526 | 431 |
| 527 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, | 432 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, |
| 528 const CFX_WideString& sText, | 433 const CFX_WideString& sText, |
| 529 int32_t charset); | 434 int32_t charset); |
| 530 int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); | 435 int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); |
| 531 | 436 |
| 532 int32_t GetTotalLines() const; | 437 int32_t GetTotalLines() const; |
| 533 | 438 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 FX_BOOL InsertText(const CFX_WideString& sText, | 471 FX_BOOL InsertText(const CFX_WideString& sText, |
| 567 int32_t charset, | 472 int32_t charset, |
| 568 FX_BOOL bAddUndo, | 473 FX_BOOL bAddUndo, |
| 569 FX_BOOL bPaint); | 474 FX_BOOL bPaint); |
| 570 void PaintInsertText(const CPVT_WordPlace& wpOld, | 475 void PaintInsertText(const CPVT_WordPlace& wpOld, |
| 571 const CPVT_WordPlace& wpNew); | 476 const CPVT_WordPlace& wpNew); |
| 572 | 477 |
| 573 inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; | 478 inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; |
| 574 inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; | 479 inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; |
| 575 inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; | 480 inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; |
| 576 inline CFX_FloatRect EditToVT(const CFX_FloatRect& rect) const; | |
| 577 | 481 |
| 578 void Refresh(); | 482 void Refresh(); |
| 579 void RefreshPushLineRects(const CPVT_WordRange& wr); | 483 void RefreshPushLineRects(const CPVT_WordRange& wr); |
| 580 void RefreshPushRandomRects(const CPVT_WordRange& wr); | |
| 581 | 484 |
| 582 void SetCaret(const CPVT_WordPlace& place); | 485 void SetCaret(const CPVT_WordPlace& place); |
| 583 void SetCaretInfo(); | 486 void SetCaretInfo(); |
| 584 void SetCaretOrigin(); | 487 void SetCaretOrigin(); |
| 585 | 488 |
| 586 CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; | |
| 587 CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, | |
| 588 const CPVT_WordRange& wr2); | |
| 589 | |
| 590 void BeginGroupUndo(const CFX_WideString& sTitle); | |
| 591 void EndGroupUndo(); | |
| 592 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); | 489 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); |
| 593 | 490 |
| 594 void SetPageInfo(const CPVT_WordPlace& place); | |
| 595 CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, | |
| 596 const CFX_FloatPoint& point) const; | |
| 597 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; | |
| 598 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; | |
| 599 | |
| 600 private: | 491 private: |
| 601 std::unique_ptr<CPDF_VariableText> m_pVT; | 492 std::unique_ptr<CPDF_VariableText> m_pVT; |
| 602 CPWL_EditCtrl* m_pNotify; | 493 CPWL_EditCtrl* m_pNotify; |
| 603 CPWL_Edit* m_pOprNotify; | 494 CPWL_Edit* m_pOprNotify; |
| 604 std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; | 495 std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; |
| 605 | 496 |
| 606 CPVT_WordPlace m_wpCaret; | 497 CPVT_WordPlace m_wpCaret; |
| 607 CPVT_WordPlace m_wpOldCaret; | 498 CPVT_WordPlace m_wpOldCaret; |
| 608 CFX_Edit_Select m_SelState; | 499 CFX_Edit_Select m_SelState; |
| 609 | 500 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 623 FX_BOOL m_bOprNotify; | 514 FX_BOOL m_bOprNotify; |
| 624 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; | 515 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; |
| 625 }; | 516 }; |
| 626 | 517 |
| 627 class CFX_Edit_Iterator { | 518 class CFX_Edit_Iterator { |
| 628 public: | 519 public: |
| 629 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); | 520 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); |
| 630 ~CFX_Edit_Iterator(); | 521 ~CFX_Edit_Iterator(); |
| 631 | 522 |
| 632 FX_BOOL NextWord(); | 523 FX_BOOL NextWord(); |
| 633 FX_BOOL NextLine(); | |
| 634 FX_BOOL NextSection(); | |
| 635 FX_BOOL PrevWord(); | 524 FX_BOOL PrevWord(); |
| 636 FX_BOOL PrevLine(); | |
| 637 FX_BOOL PrevSection(); | |
| 638 FX_BOOL GetWord(CPVT_Word& word) const; | 525 FX_BOOL GetWord(CPVT_Word& word) const; |
| 639 FX_BOOL GetLine(CPVT_Line& line) const; | 526 FX_BOOL GetLine(CPVT_Line& line) const; |
| 640 FX_BOOL GetSection(CPVT_Section& section) const; | 527 FX_BOOL GetSection(CPVT_Section& section) const; |
| 641 void SetAt(int32_t nWordIndex); | 528 void SetAt(int32_t nWordIndex); |
| 642 void SetAt(const CPVT_WordPlace& place); | 529 void SetAt(const CPVT_WordPlace& place); |
| 643 const CPVT_WordPlace& GetAt() const; | 530 const CPVT_WordPlace& GetAt() const; |
| 644 CFX_Edit* GetEdit() const; | |
| 645 | 531 |
| 646 private: | 532 private: |
| 647 CFX_Edit* m_pEdit; | 533 CFX_Edit* m_pEdit; |
| 648 CPDF_VariableText::Iterator* m_pVTIterator; | 534 CPDF_VariableText::Iterator* m_pVTIterator; |
| 649 }; | 535 }; |
| 650 | 536 |
| 651 class CFX_Edit_Provider : public CPDF_VariableText::Provider { | 537 class CFX_Edit_Provider : public CPDF_VariableText::Provider { |
| 652 public: | 538 public: |
| 653 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); | 539 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); |
| 654 ~CFX_Edit_Provider() override; | 540 ~CFX_Edit_Provider() override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 665 int32_t charset, | 551 int32_t charset, |
| 666 int32_t nFontIndex) override; | 552 int32_t nFontIndex) override; |
| 667 int32_t GetDefaultFontIndex() override; | 553 int32_t GetDefaultFontIndex() override; |
| 668 FX_BOOL IsLatinWord(uint16_t word) override; | 554 FX_BOOL IsLatinWord(uint16_t word) override; |
| 669 | 555 |
| 670 private: | 556 private: |
| 671 IPVT_FontMap* m_pFontMap; | 557 IPVT_FontMap* m_pFontMap; |
| 672 }; | 558 }; |
| 673 | 559 |
| 674 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ | 560 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ |
| OLD | NEW |