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; |
| 17 class CPDF_TextObject; |
| 18 class CPWL_Edit; |
| 19 class CPWL_EditCtrl; |
16 class CFX_Edit; | 20 class CFX_Edit; |
17 class CFX_Edit_Iterator; | 21 class CFX_Edit_Iterator; |
18 class CFX_Edit_Provider; | 22 class CFX_Edit_Provider; |
| 23 class CFX_RenderDevice; |
| 24 class CFX_SystemHandler; |
| 25 class IFX_Edit_UndoItem; |
19 | 26 |
20 #define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001) | 27 #define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001) |
21 #define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb) | 28 #define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb) |
22 #define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb)) | 29 #define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb)) |
23 #define FX_EDIT_IsFloatSmaller(fa, fb) \ | 30 #define FX_EDIT_IsFloatSmaller(fa, fb) \ |
24 (fa < fb && !FX_EDIT_IsFloatEqual(fa, fb)) | 31 (fa < fb && !FX_EDIT_IsFloatEqual(fa, fb)) |
25 | 32 |
26 enum REFRESH_PLAN_E { RP_ANALYSE, RP_NOANALYSE, RP_OPTIONAL }; | 33 enum REFRESH_PLAN_E { RP_ANALYSE, RP_NOANALYSE, RP_OPTIONAL }; |
27 | 34 |
28 enum EDIT_PROPS_E { | 35 enum EDIT_PROPS_E { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 private: | 178 private: |
172 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; | 179 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; |
173 | 180 |
174 int32_t m_nCurUndoPos; | 181 int32_t m_nCurUndoPos; |
175 int32_t m_nBufSize; | 182 int32_t m_nBufSize; |
176 FX_BOOL m_bModified; | 183 FX_BOOL m_bModified; |
177 FX_BOOL m_bVirgin; | 184 FX_BOOL m_bVirgin; |
178 FX_BOOL m_bWorking; | 185 FX_BOOL m_bWorking; |
179 }; | 186 }; |
180 | 187 |
| 188 class IFX_Edit_UndoItem { |
| 189 public: |
| 190 virtual ~IFX_Edit_UndoItem() {} |
| 191 |
| 192 virtual void Undo() = 0; |
| 193 virtual void Redo() = 0; |
| 194 virtual CFX_WideString GetUndoTitle() = 0; |
| 195 }; |
| 196 |
181 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { | 197 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { |
182 public: | 198 public: |
183 CFX_Edit_UndoItem(); | 199 CFX_Edit_UndoItem(); |
184 ~CFX_Edit_UndoItem() override; | 200 ~CFX_Edit_UndoItem() override; |
185 | 201 |
186 CFX_WideString GetUndoTitle() override; | 202 CFX_WideString GetUndoTitle() override; |
187 | 203 |
188 void SetFirst(FX_BOOL bFirst); | 204 void SetFirst(FX_BOOL bFirst); |
189 FX_BOOL IsFirst(); | 205 FX_BOOL IsFirst(); |
190 void SetLast(FX_BOOL bLast); | 206 void SetLast(FX_BOOL bLast); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 private: | 446 private: |
431 CFX_Edit* m_pEdit; | 447 CFX_Edit* m_pEdit; |
432 CPVT_WordPlace m_wpPlace; | 448 CPVT_WordPlace m_wpPlace; |
433 CPVT_WordRange m_wrPlace; | 449 CPVT_WordRange m_wrPlace; |
434 EDIT_PROPS_E m_eProps; | 450 EDIT_PROPS_E m_eProps; |
435 | 451 |
436 CPVT_WordProps m_OldWordProps; | 452 CPVT_WordProps m_OldWordProps; |
437 CPVT_WordProps m_NewWordProps; | 453 CPVT_WordProps m_NewWordProps; |
438 }; | 454 }; |
439 | 455 |
440 class CFX_Edit : public IFX_Edit { | 456 class CFX_Edit { |
441 friend class CFX_Edit_Iterator; | 457 public: |
442 friend class CFXEU_InsertWord; | 458 static CFX_ByteString GetEditAppearanceStream( |
443 friend class CFXEU_InsertReturn; | 459 CFX_Edit* pEdit, |
444 friend class CFXEU_Backspace; | 460 const CFX_FloatPoint& ptOffset, |
445 friend class CFXEU_Delete; | 461 const CPVT_WordRange* pRange = nullptr, |
446 friend class CFXEU_Clear; | 462 FX_BOOL bContinuous = TRUE, |
447 friend class CFXEU_ClearRich; | 463 uint16_t SubWord = 0); |
448 friend class CFXEU_SetSecProps; | 464 static CFX_ByteString GetSelectAppearanceStream( |
449 friend class CFXEU_SetWordProps; | 465 CFX_Edit* pEdit, |
450 friend class CFXEU_InsertText; | 466 const CFX_FloatPoint& ptOffset, |
| 467 const CPVT_WordRange* pRange = nullptr); |
| 468 static void DrawEdit(CFX_RenderDevice* pDevice, |
| 469 CFX_Matrix* pUser2Device, |
| 470 CFX_Edit* pEdit, |
| 471 FX_COLORREF crTextFill, |
| 472 FX_COLORREF crTextStroke, |
| 473 const CFX_FloatRect& rcClip, |
| 474 const CFX_FloatPoint& ptOffset, |
| 475 const CPVT_WordRange* pRange, |
| 476 CFX_SystemHandler* pSystemHandler, |
| 477 void* pFFLData); |
| 478 static void DrawUnderline(CFX_RenderDevice* pDevice, |
| 479 CFX_Matrix* pUser2Device, |
| 480 CFX_Edit* pEdit, |
| 481 FX_COLORREF color, |
| 482 const CFX_FloatRect& rcClip, |
| 483 const CFX_FloatPoint& ptOffset, |
| 484 const CPVT_WordRange* pRange); |
| 485 static void DrawRichEdit(CFX_RenderDevice* pDevice, |
| 486 CFX_Matrix* pUser2Device, |
| 487 CFX_Edit* pEdit, |
| 488 const CFX_FloatRect& rcClip, |
| 489 const CFX_FloatPoint& ptOffset, |
| 490 const CPVT_WordRange* pRange); |
| 491 static void GeneratePageObjects( |
| 492 CPDF_PageObjectHolder* pObjectHolder, |
| 493 CFX_Edit* pEdit, |
| 494 const CFX_FloatPoint& ptOffset, |
| 495 const CPVT_WordRange* pRange, |
| 496 FX_COLORREF crText, |
| 497 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
| 498 static void GenerateRichPageObjects( |
| 499 CPDF_PageObjectHolder* pObjectHolder, |
| 500 CFX_Edit* pEdit, |
| 501 const CFX_FloatPoint& ptOffset, |
| 502 const CPVT_WordRange* pRange, |
| 503 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
| 504 static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, |
| 505 CFX_Edit* pEdit, |
| 506 const CFX_FloatPoint& ptOffset, |
| 507 const CPVT_WordRange* pRange, |
| 508 FX_COLORREF color); |
451 | 509 |
452 public: | 510 CFX_Edit(); |
453 explicit CFX_Edit(CPDF_VariableText* pVT); | 511 ~CFX_Edit(); |
454 ~CFX_Edit() override; | |
455 | 512 |
456 // IFX_Edit | 513 void SetFontMap(IPVT_FontMap* pFontMap); |
457 void SetFontMap(IPVT_FontMap* pFontMap) override; | 514 void SetNotify(CPWL_EditCtrl* pNotify); |
458 void SetNotify(IFX_Edit_Notify* pNotify) override; | 515 void SetOprNotify(CPWL_Edit* pOprNotify); |
459 void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override; | 516 CFX_Edit_Iterator* GetIterator(); |
460 IFX_Edit_Iterator* GetIterator() override; | 517 CPDF_VariableText* GetVariableText(); |
461 CPDF_VariableText* GetVariableText() override; | 518 IPVT_FontMap* GetFontMap(); |
462 IPVT_FontMap* GetFontMap() override; | 519 void Initialize(); |
463 void Initialize() override; | 520 void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE); |
464 void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE) override; | 521 void SetScrollPos(const CFX_FloatPoint& point); |
465 void SetScrollPos(const CFX_FloatPoint& point) override; | 522 void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE); |
466 void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; | 523 void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE); |
467 void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; | 524 void SetPasswordChar(uint16_t wSubWord = '*', FX_BOOL bPaint = TRUE); |
468 void SetPasswordChar(uint16_t wSubWord = '*', FX_BOOL bPaint = TRUE) override; | 525 void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE); |
469 void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) override; | 526 void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE); |
470 void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) override; | 527 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE); |
471 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) override; | 528 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE); |
472 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) override; | 529 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE); |
473 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) override; | 530 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE); |
474 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) override; | 531 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); |
475 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 532 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); |
476 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 533 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); |
477 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 534 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE); |
478 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) override; | 535 void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE); |
479 void SetTextOverflow(FX_BOOL bAllowed = FALSE, | 536 FX_BOOL IsRichText() const; |
480 FX_BOOL bPaint = TRUE) override; | 537 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE); |
481 FX_BOOL IsRichText() const override; | 538 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize); |
482 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) override; | 539 FX_BOOL SetRichFontIndex(int32_t nFontIndex); |
483 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) override; | 540 FX_BOOL SetRichTextColor(FX_COLORREF dwColor); |
484 FX_BOOL SetRichFontIndex(int32_t nFontIndex) override; | 541 FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType); |
485 FX_BOOL SetRichTextColor(FX_COLORREF dwColor) override; | 542 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE); |
486 FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) override; | 543 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE); |
487 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) override; | 544 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE); |
488 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) override; | 545 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE); |
489 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) override; | 546 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace); |
490 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) override; | 547 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100); |
491 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) override; | 548 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading); |
492 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) override; | 549 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent); |
493 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) override; | 550 FX_BOOL SetRichTextAlignment(int32_t nAlignment); |
494 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) override; | 551 void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); |
495 FX_BOOL SetRichTextAlignment(int32_t nAlignment) override; | 552 void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); |
496 void OnMouseDown(const CFX_FloatPoint& point, | 553 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); |
497 FX_BOOL bShift, | 554 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); |
498 FX_BOOL bCtrl) override; | 555 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); |
499 void OnMouseMove(const CFX_FloatPoint& point, | 556 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); |
500 FX_BOOL bShift, | 557 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); |
501 FX_BOOL bCtrl) override; | 558 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); |
502 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override; | |
503 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) override; | |
504 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) override; | |
505 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) override; | |
506 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) override; | |
507 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) override; | |
508 void SetText(const FX_WCHAR* text, | 559 void SetText(const FX_WCHAR* text, |
509 int32_t charset = DEFAULT_CHARSET, | 560 int32_t charset = DEFAULT_CHARSET, |
510 const CPVT_SecProps* pSecProps = nullptr, | 561 const CPVT_SecProps* pSecProps = nullptr, |
511 const CPVT_WordProps* pWordProps = nullptr) override; | 562 const CPVT_WordProps* pWordProps = nullptr); |
512 FX_BOOL InsertWord(uint16_t word, | 563 FX_BOOL InsertWord(uint16_t word, |
513 int32_t charset = DEFAULT_CHARSET, | 564 int32_t charset = DEFAULT_CHARSET, |
514 const CPVT_WordProps* pWordProps = nullptr) override; | 565 const CPVT_WordProps* pWordProps = nullptr); |
515 FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr, | 566 FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr, |
516 const CPVT_WordProps* pWordProps = nullptr) override; | 567 const CPVT_WordProps* pWordProps = nullptr); |
517 FX_BOOL Backspace() override; | 568 FX_BOOL Backspace(); |
518 FX_BOOL Delete() override; | 569 FX_BOOL Delete(); |
519 FX_BOOL Clear() override; | 570 FX_BOOL Clear(); |
520 FX_BOOL InsertText(const FX_WCHAR* text, | 571 FX_BOOL InsertText(const FX_WCHAR* text, |
521 int32_t charset = DEFAULT_CHARSET, | 572 int32_t charset = DEFAULT_CHARSET, |
522 const CPVT_SecProps* pSecProps = nullptr, | 573 const CPVT_SecProps* pSecProps = nullptr, |
523 const CPVT_WordProps* pWordProps = nullptr) override; | 574 const CPVT_WordProps* pWordProps = nullptr); |
524 FX_BOOL Redo() override; | 575 FX_BOOL Redo(); |
525 FX_BOOL Undo() override; | 576 FX_BOOL Undo(); |
526 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; | 577 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; |
527 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override; | 578 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; |
528 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override; | 579 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const; |
529 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override; | 580 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const; |
530 CPVT_WordPlace GetSectionBeginPlace( | 581 CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const; |
531 const CPVT_WordPlace& place) const override; | 582 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const; |
532 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override; | 583 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; |
533 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const override; | 584 int32_t GetCaret() const; |
534 int32_t GetCaret() const override; | 585 CPVT_WordPlace GetCaretWordPlace() const; |
535 CPVT_WordPlace GetCaretWordPlace() const override; | 586 CFX_WideString GetSelText() const; |
536 CFX_WideString GetSelText() const override; | 587 CFX_WideString GetText() const; |
537 CFX_WideString GetText() const override; | 588 FX_FLOAT GetFontSize() const; |
538 FX_FLOAT GetFontSize() const override; | 589 uint16_t GetPasswordChar() const; |
539 uint16_t GetPasswordChar() const override; | 590 CFX_FloatPoint GetScrollPos() const; |
540 CFX_FloatPoint GetScrollPos() const override; | 591 int32_t GetCharArray() const; |
541 int32_t GetCharArray() const override; | 592 CFX_FloatRect GetPlateRect() const; |
542 CFX_FloatRect GetPlateRect() const override; | 593 CFX_FloatRect GetContentRect() const; |
543 CFX_FloatRect GetContentRect() const override; | 594 CFX_WideString GetRangeText(const CPVT_WordRange& range) const; |
544 CFX_WideString GetRangeText(const CPVT_WordRange& range) const override; | 595 int32_t GetHorzScale() const; |
545 int32_t GetHorzScale() const override; | 596 FX_FLOAT GetCharSpace() const; |
546 FX_FLOAT GetCharSpace() const override; | 597 int32_t GetTotalWords() const; |
547 int32_t GetTotalWords() const override; | 598 void SetSel(int32_t nStartChar, int32_t nEndChar); |
548 void SetSel(int32_t nStartChar, int32_t nEndChar) override; | 599 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; |
549 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const override; | 600 void SelectAll(); |
550 void SelectAll() override; | 601 void SelectNone(); |
551 void SelectNone() override; | 602 FX_BOOL IsSelected() const; |
552 FX_BOOL IsSelected() const override; | 603 void Paint(); |
553 void Paint() override; | 604 void EnableNotify(FX_BOOL bNotify); |
554 void EnableNotify(FX_BOOL bNotify) override; | 605 void EnableRefresh(FX_BOOL bRefresh); |
555 void EnableRefresh(FX_BOOL bRefresh) override; | 606 void RefreshWordRange(const CPVT_WordRange& wr); |
556 void RefreshWordRange(const CPVT_WordRange& wr) override; | 607 void SetCaret(int32_t nPos); |
557 void SetCaret(int32_t nPos) override; | 608 CPVT_WordRange GetWholeWordRange() const; |
558 CPVT_WordRange GetWholeWordRange() const override; | 609 CPVT_WordRange GetSelectWordRange() const; |
559 CPVT_WordRange GetSelectWordRange() const override; | 610 void EnableUndo(FX_BOOL bUndo); |
560 void EnableUndo(FX_BOOL bUndo) override; | 611 void EnableOprNotify(FX_BOOL bNotify); |
561 void EnableOprNotify(FX_BOOL bNotify) override; | 612 FX_BOOL IsTextFull() const; |
562 FX_BOOL IsTextFull() const override; | |
563 FX_BOOL IsTextOverflow() const; | 613 FX_BOOL IsTextOverflow() const; |
564 FX_BOOL CanUndo() const override; | 614 FX_BOOL CanUndo() const; |
565 FX_BOOL CanRedo() const override; | 615 FX_BOOL CanRedo() const; |
566 FX_BOOL IsModified() const override; | 616 FX_BOOL IsModified() const; |
567 CPVT_WordRange GetVisibleWordRange() const override; | 617 CPVT_WordRange GetVisibleWordRange() const; |
568 void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) override; | 618 void AddUndoItem(IFX_Edit_UndoItem* pUndoItem); |
569 | 619 |
570 FX_BOOL Empty(); | 620 FX_BOOL Empty(); |
571 | 621 |
572 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, | 622 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, |
573 const FX_WCHAR* text, | 623 const FX_WCHAR* text, |
574 int32_t charset, | 624 int32_t charset, |
575 const CPVT_SecProps* pSecProps, | 625 const CPVT_SecProps* pSecProps, |
576 const CPVT_WordProps* pWordProps); | 626 const CPVT_WordProps* pWordProps); |
577 int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); | 627 int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); |
578 | 628 |
579 int32_t GetTotalLines() const; | 629 int32_t GetTotalLines() const; |
580 | 630 |
581 private: | 631 private: |
| 632 friend class CFX_Edit_Iterator; |
| 633 friend class CFXEU_InsertWord; |
| 634 friend class CFXEU_InsertReturn; |
| 635 friend class CFXEU_Backspace; |
| 636 friend class CFXEU_Delete; |
| 637 friend class CFXEU_Clear; |
| 638 friend class CFXEU_ClearRich; |
| 639 friend class CFXEU_SetSecProps; |
| 640 friend class CFXEU_SetWordProps; |
| 641 friend class CFXEU_InsertText; |
| 642 |
582 void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); | 643 void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); |
583 | 644 |
584 void RearrangeAll(); | 645 void RearrangeAll(); |
585 void RearrangePart(const CPVT_WordRange& range); | 646 void RearrangePart(const CPVT_WordRange& range); |
586 void ScrollToCaret(); | 647 void ScrollToCaret(); |
587 void SetScrollInfo(); | 648 void SetScrollInfo(); |
588 void SetScrollPosX(FX_FLOAT fx); | 649 void SetScrollPosX(FX_FLOAT fx); |
589 void SetScrollPosY(FX_FLOAT fy); | 650 void SetScrollPosY(FX_FLOAT fy); |
590 void SetScrollLimit(); | 651 void SetScrollLimit(); |
591 void SetContentChanged(); | 652 void SetContentChanged(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 void EndGroupUndo(); | 717 void EndGroupUndo(); |
657 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); | 718 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); |
658 | 719 |
659 void SetPageInfo(const CPVT_WordPlace& place); | 720 void SetPageInfo(const CPVT_WordPlace& place); |
660 CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, | 721 CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, |
661 const CFX_FloatPoint& point) const; | 722 const CFX_FloatPoint& point) const; |
662 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; | 723 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; |
663 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; | 724 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; |
664 | 725 |
665 private: | 726 private: |
666 CPDF_VariableText* m_pVT; | 727 std::unique_ptr<CPDF_VariableText> m_pVT; |
667 IFX_Edit_Notify* m_pNotify; | 728 CPWL_EditCtrl* m_pNotify; |
668 IFX_Edit_OprNotify* m_pOprNotify; | 729 CPWL_Edit* m_pOprNotify; |
669 std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; | 730 std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; |
670 | 731 |
671 CPVT_WordPlace m_wpCaret; | 732 CPVT_WordPlace m_wpCaret; |
672 CPVT_WordPlace m_wpOldCaret; | 733 CPVT_WordPlace m_wpOldCaret; |
673 CFX_Edit_Select m_SelState; | 734 CFX_Edit_Select m_SelState; |
674 | 735 |
675 CFX_FloatPoint m_ptScrollPos; | 736 CFX_FloatPoint m_ptScrollPos; |
676 CFX_FloatPoint m_ptRefreshScrollPos; | 737 CFX_FloatPoint m_ptRefreshScrollPos; |
677 FX_BOOL m_bEnableScroll; | 738 FX_BOOL m_bEnableScroll; |
678 std::unique_ptr<IFX_Edit_Iterator> m_pIterator; | 739 std::unique_ptr<CFX_Edit_Iterator> m_pIterator; |
679 CFX_Edit_Refresh m_Refresh; | 740 CFX_Edit_Refresh m_Refresh; |
680 CFX_FloatPoint m_ptCaret; | 741 CFX_FloatPoint m_ptCaret; |
681 CFX_Edit_Undo m_Undo; | 742 CFX_Edit_Undo m_Undo; |
682 int32_t m_nAlignment; | 743 int32_t m_nAlignment; |
683 FX_BOOL m_bNotifyFlag; | 744 FX_BOOL m_bNotifyFlag; |
684 FX_BOOL m_bEnableOverflow; | 745 FX_BOOL m_bEnableOverflow; |
685 FX_BOOL m_bEnableRefresh; | 746 FX_BOOL m_bEnableRefresh; |
686 CFX_FloatRect m_rcOldContent; | 747 CFX_FloatRect m_rcOldContent; |
687 FX_BOOL m_bEnableUndo; | 748 FX_BOOL m_bEnableUndo; |
688 FX_BOOL m_bNotify; | 749 FX_BOOL m_bNotify; |
689 FX_BOOL m_bOprNotify; | 750 FX_BOOL m_bOprNotify; |
690 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; | 751 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; |
691 }; | 752 }; |
692 | 753 |
693 class CFX_Edit_Iterator : public IFX_Edit_Iterator { | 754 class CFX_Edit_Iterator { |
694 public: | 755 public: |
695 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); | 756 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); |
696 ~CFX_Edit_Iterator() override; | 757 ~CFX_Edit_Iterator(); |
697 | 758 |
698 // IFX_Edit_Iterator | 759 FX_BOOL NextWord(); |
699 FX_BOOL NextWord() override; | 760 FX_BOOL NextLine(); |
700 FX_BOOL NextLine() override; | 761 FX_BOOL NextSection(); |
701 FX_BOOL NextSection() override; | 762 FX_BOOL PrevWord(); |
702 FX_BOOL PrevWord() override; | 763 FX_BOOL PrevLine(); |
703 FX_BOOL PrevLine() override; | 764 FX_BOOL PrevSection(); |
704 FX_BOOL PrevSection() override; | 765 FX_BOOL GetWord(CPVT_Word& word) const; |
705 FX_BOOL GetWord(CPVT_Word& word) const override; | 766 FX_BOOL GetLine(CPVT_Line& line) const; |
706 FX_BOOL GetLine(CPVT_Line& line) const override; | 767 FX_BOOL GetSection(CPVT_Section& section) const; |
707 FX_BOOL GetSection(CPVT_Section& section) const override; | 768 void SetAt(int32_t nWordIndex); |
708 void SetAt(int32_t nWordIndex) override; | 769 void SetAt(const CPVT_WordPlace& place); |
709 void SetAt(const CPVT_WordPlace& place) override; | 770 const CPVT_WordPlace& GetAt() const; |
710 const CPVT_WordPlace& GetAt() const override; | 771 CFX_Edit* GetEdit() const; |
711 IFX_Edit* GetEdit() const override; | |
712 | 772 |
713 private: | 773 private: |
714 CFX_Edit* m_pEdit; | 774 CFX_Edit* m_pEdit; |
715 CPDF_VariableText::Iterator* m_pVTIterator; | 775 CPDF_VariableText::Iterator* m_pVTIterator; |
716 }; | 776 }; |
717 | 777 |
718 class CFX_Edit_Provider : public CPDF_VariableText::Provider { | 778 class CFX_Edit_Provider : public CPDF_VariableText::Provider { |
719 public: | 779 public: |
720 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); | 780 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); |
721 ~CFX_Edit_Provider() override; | 781 ~CFX_Edit_Provider() override; |
(...skipping 10 matching lines...) Expand all Loading... |
732 int32_t charset, | 792 int32_t charset, |
733 int32_t nFontIndex) override; | 793 int32_t nFontIndex) override; |
734 int32_t GetDefaultFontIndex() override; | 794 int32_t GetDefaultFontIndex() override; |
735 FX_BOOL IsLatinWord(uint16_t word) override; | 795 FX_BOOL IsLatinWord(uint16_t word) override; |
736 | 796 |
737 private: | 797 private: |
738 IPVT_FontMap* m_pFontMap; | 798 IPVT_FontMap* m_pFontMap; |
739 }; | 799 }; |
740 | 800 |
741 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ | 801 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ |
OLD | NEW |