Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: fpdfsdk/pdfwindow/PWL_Edit.cpp

Issue 2144813002: Cleanup some PWL interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@ifx_cleanup
Patch Set: Rebase to master Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_Edit.h ('k') | fpdfsdk/pdfwindow/PWL_EditCtrl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "fpdfsdk/pdfwindow/PWL_Edit.h" 7 #include "fpdfsdk/pdfwindow/PWL_Edit.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 if (CPWL_ScrollBar* pVSB = GetVScrollBar()) { 98 if (CPWL_ScrollBar* pVSB = GetVScrollBar()) {
99 if (pVSB->IsVisible()) { 99 if (pVSB->IsVisible()) {
100 rcClient.right -= PWL_SCROLLBAR_WIDTH; 100 rcClient.right -= PWL_SCROLLBAR_WIDTH;
101 } 101 }
102 } 102 }
103 103
104 return rcClient; 104 return rcClient;
105 } 105 }
106 106
107 void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat,
108 FX_BOOL bPaint) {
109 m_pEdit->SetAlignmentH((int32_t)nFormat, bPaint);
110 }
111
112 void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, 107 void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat,
113 FX_BOOL bPaint) { 108 FX_BOOL bPaint) {
114 m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); 109 m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint);
115 } 110 }
116 111
117 FX_BOOL CPWL_Edit::CanSelectAll() const { 112 FX_BOOL CPWL_Edit::CanSelectAll() const {
118 return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); 113 return GetSelectWordRange() != m_pEdit->GetWholeWordRange();
119 } 114 }
120 115
121 FX_BOOL CPWL_Edit::CanClear() const { 116 FX_BOOL CPWL_Edit::CanClear() const {
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 452 }
458 453
459 m_bFocus = TRUE; 454 m_bFocus = TRUE;
460 } 455 }
461 456
462 void CPWL_Edit::OnKillFocus() { 457 void CPWL_Edit::OnKillFocus() {
463 ShowVScrollBar(FALSE); 458 ShowVScrollBar(FALSE);
464 459
465 m_pEdit->SelectNone(); 460 m_pEdit->SelectNone();
466 SetCaret(FALSE, CFX_FloatPoint(0.0f, 0.0f), CFX_FloatPoint(0.0f, 0.0f)); 461 SetCaret(FALSE, CFX_FloatPoint(0.0f, 0.0f), CFX_FloatPoint(0.0f, 0.0f));
467
468 SetCharSet(FXFONT_ANSI_CHARSET); 462 SetCharSet(FXFONT_ANSI_CHARSET);
469
470 if (!IsReadOnly()) {
471 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler())
472 pFocusHandler->OnKillFocus(this);
473 }
474
475 m_bFocus = FALSE; 463 m_bFocus = FALSE;
476 } 464 }
477 465
478 void CPWL_Edit::SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint /* = TRUE*/) { 466 void CPWL_Edit::SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint /* = TRUE*/) {
479 m_pEdit->SetHorzScale(nHorzScale, bPaint); 467 m_pEdit->SetHorzScale(nHorzScale, bPaint);
480 } 468 }
481 469
482 void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint /* = TRUE*/) { 470 void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint /* = TRUE*/) {
483 m_pEdit->SetCharSpace(fCharSpace, bPaint); 471 m_pEdit->SetCharSpace(fCharSpace, bPaint);
484 } 472 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 751
764 return FALSE; 752 return FALSE;
765 } 753 }
766 754
767 void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, 755 void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place,
768 const CPVT_WordPlace& oldplace) { 756 const CPVT_WordPlace& oldplace) {
769 if (HasFlag(PES_SPELLCHECK)) { 757 if (HasFlag(PES_SPELLCHECK)) {
770 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), 758 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace),
771 GetLatinWordsRange(place))); 759 GetLatinWordsRange(place)));
772 } 760 }
773
774 if (m_pEditNotify) {
775 m_pEditNotify->OnInsertReturn(place, oldplace);
776 }
777 } 761 }
778 762
779 void CPWL_Edit::OnBackSpace(const CPVT_WordPlace& place, 763 void CPWL_Edit::OnBackSpace(const CPVT_WordPlace& place,
780 const CPVT_WordPlace& oldplace) { 764 const CPVT_WordPlace& oldplace) {
781 if (HasFlag(PES_SPELLCHECK)) { 765 if (HasFlag(PES_SPELLCHECK)) {
782 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), 766 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace),
783 GetLatinWordsRange(place))); 767 GetLatinWordsRange(place)));
784 } 768 }
785
786 if (m_pEditNotify) {
787 m_pEditNotify->OnBackSpace(place, oldplace);
788 }
789 } 769 }
790 770
791 void CPWL_Edit::OnDelete(const CPVT_WordPlace& place, 771 void CPWL_Edit::OnDelete(const CPVT_WordPlace& place,
792 const CPVT_WordPlace& oldplace) { 772 const CPVT_WordPlace& oldplace) {
793 if (HasFlag(PES_SPELLCHECK)) { 773 if (HasFlag(PES_SPELLCHECK)) {
794 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), 774 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace),
795 GetLatinWordsRange(place))); 775 GetLatinWordsRange(place)));
796 } 776 }
797
798 if (m_pEditNotify) {
799 m_pEditNotify->OnDelete(place, oldplace);
800 }
801 } 777 }
802 778
803 void CPWL_Edit::OnClear(const CPVT_WordPlace& place, 779 void CPWL_Edit::OnClear(const CPVT_WordPlace& place,
804 const CPVT_WordPlace& oldplace) { 780 const CPVT_WordPlace& oldplace) {
805 if (HasFlag(PES_SPELLCHECK)) { 781 if (HasFlag(PES_SPELLCHECK)) {
806 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), 782 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace),
807 GetLatinWordsRange(place))); 783 GetLatinWordsRange(place)));
808 } 784 }
809
810 if (m_pEditNotify) {
811 m_pEditNotify->OnClear(place, oldplace);
812 }
813 } 785 }
814 786
815 void CPWL_Edit::OnInsertWord(const CPVT_WordPlace& place, 787 void CPWL_Edit::OnInsertWord(const CPVT_WordPlace& place,
816 const CPVT_WordPlace& oldplace) { 788 const CPVT_WordPlace& oldplace) {
817 if (HasFlag(PES_SPELLCHECK)) { 789 if (HasFlag(PES_SPELLCHECK)) {
818 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), 790 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace),
819 GetLatinWordsRange(place))); 791 GetLatinWordsRange(place)));
820 } 792 }
821
822 if (m_pEditNotify) {
823 m_pEditNotify->OnInsertWord(place, oldplace);
824 }
825 } 793 }
826 794
827 void CPWL_Edit::OnInsertText(const CPVT_WordPlace& place, 795 void CPWL_Edit::OnInsertText(const CPVT_WordPlace& place,
828 const CPVT_WordPlace& oldplace) { 796 const CPVT_WordPlace& oldplace) {
829 if (HasFlag(PES_SPELLCHECK)) { 797 if (HasFlag(PES_SPELLCHECK)) {
830 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), 798 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace),
831 GetLatinWordsRange(place))); 799 GetLatinWordsRange(place)));
832 } 800 }
833
834 if (m_pEditNotify) {
835 m_pEditNotify->OnInsertText(place, oldplace);
836 }
837 }
838
839 void CPWL_Edit::OnAddUndo(IFX_Edit_UndoItem* pUndoItem) {
840 if (m_pEditNotify) {
841 m_pEditNotify->OnAddUndo(this);
842 }
843 } 801 }
844 802
845 CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, 803 CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1,
846 const CPVT_WordRange& wr2) { 804 const CPVT_WordRange& wr2) {
847 CPVT_WordRange wrRet; 805 CPVT_WordRange wrRet;
848 806
849 if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) { 807 if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) {
850 wrRet.BeginPos = wr1.BeginPos; 808 wrRet.BeginPos = wr1.BeginPos;
851 } else { 809 } else {
852 wrRet.BeginPos = wr2.BeginPos; 810 wrRet.BeginPos = wr2.BeginPos;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 } 900 }
943 901
944 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, 902 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder,
945 const CFX_FloatPoint& ptOffset) { 903 const CFX_FloatPoint& ptOffset) {
946 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; 904 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
947 CFX_Edit::GeneratePageObjects( 905 CFX_Edit::GeneratePageObjects(
948 pObjectHolder, m_pEdit.get(), ptOffset, nullptr, 906 pObjectHolder, m_pEdit.get(), ptOffset, nullptr,
949 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), 907 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
950 ObjArray); 908 ObjArray);
951 } 909 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_Edit.h ('k') | fpdfsdk/pdfwindow/PWL_EditCtrl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698