| 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 #include "fpdfsdk/include/fxedit/fxet_edit.h" | 7 #include "fpdfsdk/include/fxedit/fxet_edit.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 11 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 12 #include "core/fpdfdoc/include/cpvt_section.h" |
| 13 #include "core/fpdfdoc/include/cpvt_word.h" |
| 14 #include "core/fpdfdoc/include/ipvt_fontmap.h" |
| 12 | 15 |
| 13 #define FX_EDIT_UNDO_MAXITEM 10000 | 16 #define FX_EDIT_UNDO_MAXITEM 10000 |
| 14 | 17 |
| 15 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, | 18 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, |
| 16 IPDF_VariableText::Iterator* pVTIterator) | 19 CPDF_VariableText::Iterator* pVTIterator) |
| 17 : m_pEdit(pEdit), m_pVTIterator(pVTIterator) {} | 20 : m_pEdit(pEdit), m_pVTIterator(pVTIterator) {} |
| 18 | 21 |
| 19 CFX_Edit_Iterator::~CFX_Edit_Iterator() {} | 22 CFX_Edit_Iterator::~CFX_Edit_Iterator() {} |
| 20 | 23 |
| 21 FX_BOOL CFX_Edit_Iterator::NextWord() { | 24 FX_BOOL CFX_Edit_Iterator::NextWord() { |
| 22 return m_pVTIterator->NextWord(); | 25 return m_pVTIterator->NextWord(); |
| 23 } | 26 } |
| 24 | 27 |
| 25 FX_BOOL CFX_Edit_Iterator::NextLine() { | 28 FX_BOOL CFX_Edit_Iterator::NextLine() { |
| 26 return m_pVTIterator->NextLine(); | 29 return m_pVTIterator->NextLine(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 84 } |
| 82 | 85 |
| 83 const CPVT_WordPlace& CFX_Edit_Iterator::GetAt() const { | 86 const CPVT_WordPlace& CFX_Edit_Iterator::GetAt() const { |
| 84 return m_pVTIterator->GetAt(); | 87 return m_pVTIterator->GetAt(); |
| 85 } | 88 } |
| 86 | 89 |
| 87 IFX_Edit* CFX_Edit_Iterator::GetEdit() const { | 90 IFX_Edit* CFX_Edit_Iterator::GetEdit() const { |
| 88 return m_pEdit; | 91 return m_pEdit; |
| 89 } | 92 } |
| 90 | 93 |
| 91 CFX_Edit_Provider::CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap) | 94 CFX_Edit_Provider::CFX_Edit_Provider(IPVT_FontMap* pFontMap) |
| 92 : m_pFontMap(pFontMap) { | 95 : CPDF_VariableText::Provider(pFontMap), m_pFontMap(pFontMap) { |
| 93 ASSERT(m_pFontMap); | 96 ASSERT(m_pFontMap); |
| 94 } | 97 } |
| 95 | 98 |
| 96 CFX_Edit_Provider::~CFX_Edit_Provider() {} | 99 CFX_Edit_Provider::~CFX_Edit_Provider() {} |
| 97 | 100 |
| 98 IFX_Edit_FontMap* CFX_Edit_Provider::GetFontMap() { | 101 IPVT_FontMap* CFX_Edit_Provider::GetFontMap() { |
| 99 return m_pFontMap; | 102 return m_pFontMap; |
| 100 } | 103 } |
| 101 | 104 |
| 102 int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, | 105 int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, |
| 103 uint16_t word, | 106 uint16_t word, |
| 104 int32_t nWordStyle) { | 107 int32_t nWordStyle) { |
| 105 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { | 108 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { |
| 106 uint32_t charcode = word; | 109 uint32_t charcode = word; |
| 107 | 110 |
| 108 if (pPDFFont->IsUnicodeCompatible()) | 111 if (pPDFFont->IsUnicodeCompatible()) |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 m_pEdit->SetWordProps(m_eProps, m_wpPlace, &m_OldWordProps, m_wrPlace, | 735 m_pEdit->SetWordProps(m_eProps, m_wpPlace, &m_OldWordProps, m_wrPlace, |
| 733 FALSE); | 736 FALSE); |
| 734 if (IsFirst()) { | 737 if (IsFirst()) { |
| 735 m_pEdit->SelectNone(); | 738 m_pEdit->SelectNone(); |
| 736 m_pEdit->PaintSetProps(m_eProps, m_wrPlace); | 739 m_pEdit->PaintSetProps(m_eProps, m_wrPlace); |
| 737 m_pEdit->SetSel(m_wrPlace.BeginPos, m_wrPlace.EndPos); | 740 m_pEdit->SetSel(m_wrPlace.BeginPos, m_wrPlace.EndPos); |
| 738 } | 741 } |
| 739 } | 742 } |
| 740 } | 743 } |
| 741 | 744 |
| 742 CFX_Edit::CFX_Edit(IPDF_VariableText* pVT) | 745 CFX_Edit::CFX_Edit(CPDF_VariableText* pVT) |
| 743 : m_pVT(pVT), | 746 : m_pVT(pVT), |
| 744 m_pNotify(NULL), | 747 m_pNotify(NULL), |
| 745 m_pOprNotify(NULL), | 748 m_pOprNotify(NULL), |
| 746 m_pVTProvide(NULL), | 749 m_pVTProvide(NULL), |
| 747 m_wpCaret(-1, -1, -1), | 750 m_wpCaret(-1, -1, -1), |
| 748 m_wpOldCaret(-1, -1, -1), | 751 m_wpOldCaret(-1, -1, -1), |
| 749 m_SelState(), | 752 m_SelState(), |
| 750 m_ptScrollPos(0, 0), | 753 m_ptScrollPos(0, 0), |
| 751 m_ptRefreshScrollPos(0, 0), | 754 m_ptRefreshScrollPos(0, 0), |
| 752 m_bEnableScroll(FALSE), | 755 m_bEnableScroll(FALSE), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 772 m_pIterator = NULL; | 775 m_pIterator = NULL; |
| 773 ASSERT(!m_pGroupUndoItem); | 776 ASSERT(!m_pGroupUndoItem); |
| 774 } | 777 } |
| 775 | 778 |
| 776 void CFX_Edit::Initialize() { | 779 void CFX_Edit::Initialize() { |
| 777 m_pVT->Initialize(); | 780 m_pVT->Initialize(); |
| 778 SetCaret(m_pVT->GetBeginWordPlace()); | 781 SetCaret(m_pVT->GetBeginWordPlace()); |
| 779 SetCaretOrigin(); | 782 SetCaretOrigin(); |
| 780 } | 783 } |
| 781 | 784 |
| 782 void CFX_Edit::SetFontMap(IFX_Edit_FontMap* pFontMap) { | 785 void CFX_Edit::SetFontMap(IPVT_FontMap* pFontMap) { |
| 783 delete m_pVTProvide; | 786 delete m_pVTProvide; |
| 784 m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap)); | 787 m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap)); |
| 785 } | 788 } |
| 786 | 789 |
| 787 void CFX_Edit::SetVTProvider(IPDF_VariableText::Provider* pProvider) { | 790 void CFX_Edit::SetVTProvider(CPDF_VariableText::Provider* pProvider) { |
| 788 m_pVT->SetProvider(pProvider); | 791 m_pVT->SetProvider(pProvider); |
| 789 } | 792 } |
| 790 | 793 |
| 791 void CFX_Edit::SetNotify(IFX_Edit_Notify* pNotify) { | 794 void CFX_Edit::SetNotify(IFX_Edit_Notify* pNotify) { |
| 792 m_pNotify = pNotify; | 795 m_pNotify = pNotify; |
| 793 } | 796 } |
| 794 | 797 |
| 795 void CFX_Edit::SetOprNotify(IFX_Edit_OprNotify* pOprNotify) { | 798 void CFX_Edit::SetOprNotify(IFX_Edit_OprNotify* pOprNotify) { |
| 796 m_pOprNotify = pOprNotify; | 799 m_pOprNotify = pOprNotify; |
| 797 } | 800 } |
| 798 | 801 |
| 799 IFX_Edit_Iterator* CFX_Edit::GetIterator() { | 802 IFX_Edit_Iterator* CFX_Edit::GetIterator() { |
| 800 if (!m_pIterator) | 803 if (!m_pIterator) |
| 801 m_pIterator = new CFX_Edit_Iterator(this, m_pVT->GetIterator()); | 804 m_pIterator = new CFX_Edit_Iterator(this, m_pVT->GetIterator()); |
| 802 | 805 |
| 803 return m_pIterator; | 806 return m_pIterator; |
| 804 } | 807 } |
| 805 | 808 |
| 806 IPDF_VariableText* CFX_Edit::GetVariableText() { | 809 CPDF_VariableText* CFX_Edit::GetVariableText() { |
| 807 return m_pVT; | 810 return m_pVT; |
| 808 } | 811 } |
| 809 | 812 |
| 810 IFX_Edit_FontMap* CFX_Edit::GetFontMap() { | 813 IPVT_FontMap* CFX_Edit::GetFontMap() { |
| 811 if (m_pVTProvide) | 814 if (m_pVTProvide) |
| 812 return m_pVTProvide->GetFontMap(); | 815 return m_pVTProvide->GetFontMap(); |
| 813 | 816 |
| 814 return NULL; | 817 return NULL; |
| 815 } | 818 } |
| 816 | 819 |
| 817 void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint) { | 820 void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint) { |
| 818 m_pVT->SetPlateRect(rect); | 821 m_pVT->SetPlateRect(rect); |
| 819 m_ptScrollPos = CFX_FloatPoint(rect.left, rect.top); | 822 m_ptScrollPos = CFX_FloatPoint(rect.left, rect.top); |
| 820 if (bPaint) | 823 if (bPaint) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 } | 974 } |
| 972 | 975 |
| 973 CPVT_WordPlace CFX_Edit::GetCaretWordPlace() const { | 976 CPVT_WordPlace CFX_Edit::GetCaretWordPlace() const { |
| 974 return m_wpCaret; | 977 return m_wpCaret; |
| 975 } | 978 } |
| 976 | 979 |
| 977 CFX_WideString CFX_Edit::GetText() const { | 980 CFX_WideString CFX_Edit::GetText() const { |
| 978 CFX_WideString swRet; | 981 CFX_WideString swRet; |
| 979 | 982 |
| 980 if (m_pVT->IsValid()) { | 983 if (m_pVT->IsValid()) { |
| 981 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 984 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 982 FX_BOOL bRich = m_pVT->IsRichText(); | 985 FX_BOOL bRich = m_pVT->IsRichText(); |
| 983 | 986 |
| 984 pIterator->SetAt(0); | 987 pIterator->SetAt(0); |
| 985 | 988 |
| 986 CPVT_Word wordinfo; | 989 CPVT_Word wordinfo; |
| 987 CPVT_WordPlace oldplace = pIterator->GetAt(); | 990 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 988 while (pIterator->NextWord()) { | 991 while (pIterator->NextWord()) { |
| 989 CPVT_WordPlace place = pIterator->GetAt(); | 992 CPVT_WordPlace place = pIterator->GetAt(); |
| 990 | 993 |
| 991 if (pIterator->GetWord(wordinfo)) { | 994 if (pIterator->GetWord(wordinfo)) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1008 | 1011 |
| 1009 return swRet; | 1012 return swRet; |
| 1010 } | 1013 } |
| 1011 | 1014 |
| 1012 CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange& range) const { | 1015 CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange& range) const { |
| 1013 CFX_WideString swRet; | 1016 CFX_WideString swRet; |
| 1014 | 1017 |
| 1015 if (m_pVT->IsValid()) { | 1018 if (m_pVT->IsValid()) { |
| 1016 FX_BOOL bRich = m_pVT->IsRichText(); | 1019 FX_BOOL bRich = m_pVT->IsRichText(); |
| 1017 | 1020 |
| 1018 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 1021 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 1019 CPVT_WordRange wrTemp = range; | 1022 CPVT_WordRange wrTemp = range; |
| 1020 m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 1023 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 1021 m_pVT->UpdateWordPlace(wrTemp.EndPos); | 1024 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 1022 pIterator->SetAt(wrTemp.BeginPos); | 1025 pIterator->SetAt(wrTemp.BeginPos); |
| 1023 | 1026 |
| 1024 CPVT_Word wordinfo; | 1027 CPVT_Word wordinfo; |
| 1025 CPVT_WordPlace oldplace = wrTemp.BeginPos; | 1028 CPVT_WordPlace oldplace = wrTemp.BeginPos; |
| 1026 while (pIterator->NextWord()) { | 1029 while (pIterator->NextWord()) { |
| 1027 CPVT_WordPlace place = pIterator->GetAt(); | 1030 CPVT_WordPlace place = pIterator->GetAt(); |
| 1028 if (place.WordCmp(wrTemp.EndPos) > 0) | 1031 if (place.WordCmp(wrTemp.EndPos) > 0) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1053 return GetRangeText(m_SelState.ConvertToWordRange()); | 1056 return GetRangeText(m_SelState.ConvertToWordRange()); |
| 1054 } | 1057 } |
| 1055 | 1058 |
| 1056 int32_t CFX_Edit::GetTotalWords() const { | 1059 int32_t CFX_Edit::GetTotalWords() const { |
| 1057 return m_pVT->GetTotalWords(); | 1060 return m_pVT->GetTotalWords(); |
| 1058 } | 1061 } |
| 1059 | 1062 |
| 1060 int32_t CFX_Edit::GetTotalLines() const { | 1063 int32_t CFX_Edit::GetTotalLines() const { |
| 1061 int32_t nLines = 0; | 1064 int32_t nLines = 0; |
| 1062 | 1065 |
| 1063 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 1066 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 1064 pIterator->SetAt(0); | 1067 pIterator->SetAt(0); |
| 1065 while (pIterator->NextLine()) | 1068 while (pIterator->NextLine()) |
| 1066 nLines++; | 1069 nLines++; |
| 1067 } | 1070 } |
| 1068 | 1071 |
| 1069 return nLines + 1; | 1072 return nLines + 1; |
| 1070 } | 1073 } |
| 1071 | 1074 |
| 1072 CPVT_WordRange CFX_Edit::GetSelectWordRange() const { | 1075 CPVT_WordRange CFX_Edit::GetSelectWordRange() const { |
| 1073 return m_SelState.ConvertToWordRange(); | 1076 return m_SelState.ConvertToWordRange(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 WordProps.fFontSize = fFontSize; | 1116 WordProps.fFontSize = fFontSize; |
| 1114 return SetRichTextProps(EP_FONTSIZE, NULL, &WordProps); | 1117 return SetRichTextProps(EP_FONTSIZE, NULL, &WordProps); |
| 1115 } | 1118 } |
| 1116 | 1119 |
| 1117 FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) { | 1120 FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) { |
| 1118 CPVT_WordProps WordProps; | 1121 CPVT_WordProps WordProps; |
| 1119 WordProps.dwWordColor = dwColor; | 1122 WordProps.dwWordColor = dwColor; |
| 1120 return SetRichTextProps(EP_WORDCOLOR, NULL, &WordProps); | 1123 return SetRichTextProps(EP_WORDCOLOR, NULL, &WordProps); |
| 1121 } | 1124 } |
| 1122 | 1125 |
| 1123 FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) { | 1126 FX_BOOL CFX_Edit::SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) { |
| 1124 CPVT_WordProps WordProps; | 1127 CPVT_WordProps WordProps; |
| 1125 WordProps.nScriptType = nScriptType; | 1128 WordProps.nScriptType = nScriptType; |
| 1126 return SetRichTextProps(EP_SCRIPTTYPE, NULL, &WordProps); | 1129 return SetRichTextProps(EP_SCRIPTTYPE, NULL, &WordProps); |
| 1127 } | 1130 } |
| 1128 | 1131 |
| 1129 FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) { | 1132 FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) { |
| 1130 CPVT_WordProps WordProps; | 1133 CPVT_WordProps WordProps; |
| 1131 if (bBold) | 1134 if (bBold) |
| 1132 WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; | 1135 WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; |
| 1133 return SetRichTextProps(EP_BOLD, NULL, &WordProps); | 1136 return SetRichTextProps(EP_BOLD, NULL, &WordProps); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 SecProps.nAlignment = nAlignment; | 1186 SecProps.nAlignment = nAlignment; |
| 1184 return SetRichTextProps(EP_ALIGNMENT, &SecProps, NULL); | 1187 return SetRichTextProps(EP_ALIGNMENT, &SecProps, NULL); |
| 1185 } | 1188 } |
| 1186 | 1189 |
| 1187 FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, | 1190 FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, |
| 1188 const CPVT_SecProps* pSecProps, | 1191 const CPVT_SecProps* pSecProps, |
| 1189 const CPVT_WordProps* pWordProps) { | 1192 const CPVT_WordProps* pWordProps) { |
| 1190 FX_BOOL bSet = FALSE; | 1193 FX_BOOL bSet = FALSE; |
| 1191 FX_BOOL bSet1, bSet2; | 1194 FX_BOOL bSet1, bSet2; |
| 1192 if (m_pVT->IsValid() && m_pVT->IsRichText()) { | 1195 if (m_pVT->IsValid() && m_pVT->IsRichText()) { |
| 1193 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 1196 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 1194 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); | 1197 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); |
| 1195 | 1198 |
| 1196 m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 1199 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 1197 m_pVT->UpdateWordPlace(wrTemp.EndPos); | 1200 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 1198 pIterator->SetAt(wrTemp.BeginPos); | 1201 pIterator->SetAt(wrTemp.BeginPos); |
| 1199 | 1202 |
| 1200 BeginGroupUndo(L""); | 1203 BeginGroupUndo(L""); |
| 1201 bSet = SetSecProps(eProps, wrTemp.BeginPos, pSecProps, pWordProps, wrTemp, | 1204 bSet = SetSecProps(eProps, wrTemp.BeginPos, pSecProps, pWordProps, wrTemp, |
| 1202 TRUE); | 1205 TRUE); |
| 1203 | 1206 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 } | 1262 } |
| 1260 } | 1263 } |
| 1261 | 1264 |
| 1262 FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, | 1265 FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, |
| 1263 const CPVT_WordPlace& place, | 1266 const CPVT_WordPlace& place, |
| 1264 const CPVT_SecProps* pSecProps, | 1267 const CPVT_SecProps* pSecProps, |
| 1265 const CPVT_WordProps* pWordProps, | 1268 const CPVT_WordProps* pWordProps, |
| 1266 const CPVT_WordRange& wr, | 1269 const CPVT_WordRange& wr, |
| 1267 FX_BOOL bAddUndo) { | 1270 FX_BOOL bAddUndo) { |
| 1268 if (m_pVT->IsValid() && m_pVT->IsRichText()) { | 1271 if (m_pVT->IsValid() && m_pVT->IsRichText()) { |
| 1269 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 1272 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 1270 FX_BOOL bSet = FALSE; | 1273 FX_BOOL bSet = FALSE; |
| 1271 CPVT_Section secinfo; | 1274 CPVT_Section secinfo; |
| 1272 CPVT_Section OldSecinfo; | 1275 CPVT_Section OldSecinfo; |
| 1273 | 1276 |
| 1274 CPVT_WordPlace oldplace = pIterator->GetAt(); | 1277 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 1275 | 1278 |
| 1276 if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT || | 1279 if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT || |
| 1277 eProps == EP_ALIGNMENT) { | 1280 eProps == EP_ALIGNMENT) { |
| 1278 if (pSecProps) { | 1281 if (pSecProps) { |
| 1279 pIterator->SetAt(place); | 1282 pIterator->SetAt(place); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 | 1441 |
| 1439 return FALSE; | 1442 return FALSE; |
| 1440 } | 1443 } |
| 1441 | 1444 |
| 1442 FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, | 1445 FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, |
| 1443 const CPVT_WordPlace& place, | 1446 const CPVT_WordPlace& place, |
| 1444 const CPVT_WordProps* pWordProps, | 1447 const CPVT_WordProps* pWordProps, |
| 1445 const CPVT_WordRange& wr, | 1448 const CPVT_WordRange& wr, |
| 1446 FX_BOOL bAddUndo) { | 1449 FX_BOOL bAddUndo) { |
| 1447 if (m_pVT->IsValid() && m_pVT->IsRichText()) { | 1450 if (m_pVT->IsValid() && m_pVT->IsRichText()) { |
| 1448 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 1451 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 1449 FX_BOOL bSet = FALSE; | 1452 FX_BOOL bSet = FALSE; |
| 1450 CPVT_Word wordinfo; | 1453 CPVT_Word wordinfo; |
| 1451 CPVT_Word OldWordinfo; | 1454 CPVT_Word OldWordinfo; |
| 1452 | 1455 |
| 1453 CPVT_WordPlace oldplace = pIterator->GetAt(); | 1456 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 1454 | 1457 |
| 1455 if (pWordProps) { | 1458 if (pWordProps) { |
| 1456 pIterator->SetAt(place); | 1459 pIterator->SetAt(place); |
| 1457 if (pIterator->GetWord(wordinfo)) { | 1460 if (pIterator->GetWord(wordinfo)) { |
| 1458 if (bAddUndo) | 1461 if (bAddUndo) |
| 1459 OldWordinfo = wordinfo; | 1462 OldWordinfo = wordinfo; |
| 1460 | 1463 |
| 1461 switch (eProps) { | 1464 switch (eProps) { |
| 1462 case EP_FONTINDEX: | 1465 case EP_FONTINDEX: |
| 1463 if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { | 1466 if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { |
| 1464 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { | 1467 if (IPVT_FontMap* pFontMap = GetFontMap()) { |
| 1465 wordinfo.WordProps.nFontIndex = pFontMap->GetWordFontIndex( | 1468 wordinfo.WordProps.nFontIndex = pFontMap->GetWordFontIndex( |
| 1466 wordinfo.Word, wordinfo.nCharset, pWordProps->nFontIndex); | 1469 wordinfo.Word, wordinfo.nCharset, pWordProps->nFontIndex); |
| 1467 } | 1470 } |
| 1468 bSet = TRUE; | 1471 bSet = TRUE; |
| 1469 } | 1472 } |
| 1470 break; | 1473 break; |
| 1471 case EP_FONTSIZE: | 1474 case EP_FONTSIZE: |
| 1472 if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fFontSize, | 1475 if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fFontSize, |
| 1473 pWordProps->fFontSize)) { | 1476 pWordProps->fFontSize)) { |
| 1474 wordinfo.WordProps.fFontSize = pWordProps->fFontSize; | 1477 wordinfo.WordProps.fFontSize = pWordProps->fFontSize; |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 } | 1915 } |
| 1913 } | 1916 } |
| 1914 | 1917 |
| 1915 void CFX_Edit::ScrollToCaret() { | 1918 void CFX_Edit::ScrollToCaret() { |
| 1916 SetScrollLimit(); | 1919 SetScrollLimit(); |
| 1917 | 1920 |
| 1918 if (m_pVT->IsValid()) { | 1921 if (m_pVT->IsValid()) { |
| 1919 CFX_FloatPoint ptHead(0, 0); | 1922 CFX_FloatPoint ptHead(0, 0); |
| 1920 CFX_FloatPoint ptFoot(0, 0); | 1923 CFX_FloatPoint ptFoot(0, 0); |
| 1921 | 1924 |
| 1922 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 1925 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 1923 pIterator->SetAt(m_wpCaret); | 1926 pIterator->SetAt(m_wpCaret); |
| 1924 | 1927 |
| 1925 CPVT_Word word; | 1928 CPVT_Word word; |
| 1926 CPVT_Line line; | 1929 CPVT_Line line; |
| 1927 if (pIterator->GetWord(word)) { | 1930 if (pIterator->GetWord(word)) { |
| 1928 ptHead.x = word.ptWord.x + word.fWidth; | 1931 ptHead.x = word.ptWord.x + word.fWidth; |
| 1929 ptHead.y = word.ptWord.y + word.fAscent; | 1932 ptHead.y = word.ptWord.y + word.fAscent; |
| 1930 ptFoot.x = word.ptWord.x + word.fWidth; | 1933 ptFoot.x = word.ptWord.x + word.fWidth; |
| 1931 ptFoot.y = word.ptWord.y + word.fDescent; | 1934 ptFoot.y = word.ptWord.y + word.fDescent; |
| 1932 } else if (pIterator->GetLine(line)) { | 1935 } else if (pIterator->GetLine(line)) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 m_bNotifyFlag = FALSE; | 1989 m_bNotifyFlag = FALSE; |
| 1987 } | 1990 } |
| 1988 } | 1991 } |
| 1989 | 1992 |
| 1990 m_Refresh.EndRefresh(); | 1993 m_Refresh.EndRefresh(); |
| 1991 } | 1994 } |
| 1992 } | 1995 } |
| 1993 | 1996 |
| 1994 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) { | 1997 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) { |
| 1995 if (m_pVT->IsValid()) { | 1998 if (m_pVT->IsValid()) { |
| 1996 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 1999 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 1997 CPVT_WordPlace wpBegin = wr.BeginPos; | 2000 CPVT_WordPlace wpBegin = wr.BeginPos; |
| 1998 m_pVT->UpdateWordPlace(wpBegin); | 2001 m_pVT->UpdateWordPlace(wpBegin); |
| 1999 CPVT_WordPlace wpEnd = wr.EndPos; | 2002 CPVT_WordPlace wpEnd = wr.EndPos; |
| 2000 m_pVT->UpdateWordPlace(wpEnd); | 2003 m_pVT->UpdateWordPlace(wpEnd); |
| 2001 pIterator->SetAt(wpBegin); | 2004 pIterator->SetAt(wpBegin); |
| 2002 | 2005 |
| 2003 CPVT_Line lineinfo; | 2006 CPVT_Line lineinfo; |
| 2004 do { | 2007 do { |
| 2005 if (!pIterator->GetLine(lineinfo)) | 2008 if (!pIterator->GetLine(lineinfo)) |
| 2006 break; | 2009 break; |
| 2007 if (lineinfo.lineplace.LineCmp(wpEnd) > 0) | 2010 if (lineinfo.lineplace.LineCmp(wpEnd) > 0) |
| 2008 break; | 2011 break; |
| 2009 | 2012 |
| 2010 CFX_FloatRect rcLine(lineinfo.ptLine.x, | 2013 CFX_FloatRect rcLine(lineinfo.ptLine.x, |
| 2011 lineinfo.ptLine.y + lineinfo.fLineDescent, | 2014 lineinfo.ptLine.y + lineinfo.fLineDescent, |
| 2012 lineinfo.ptLine.x + lineinfo.fLineWidth, | 2015 lineinfo.ptLine.x + lineinfo.fLineWidth, |
| 2013 lineinfo.ptLine.y + lineinfo.fLineAscent); | 2016 lineinfo.ptLine.y + lineinfo.fLineAscent); |
| 2014 | 2017 |
| 2015 m_Refresh.Push(CPVT_WordRange(lineinfo.lineplace, lineinfo.lineEnd), | 2018 m_Refresh.Push(CPVT_WordRange(lineinfo.lineplace, lineinfo.lineEnd), |
| 2016 VTToEdit(rcLine)); | 2019 VTToEdit(rcLine)); |
| 2017 } while (pIterator->NextLine()); | 2020 } while (pIterator->NextLine()); |
| 2018 } | 2021 } |
| 2019 } | 2022 } |
| 2020 } | 2023 } |
| 2021 | 2024 |
| 2022 void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange& wr) { | 2025 void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange& wr) { |
| 2023 if (m_pVT->IsValid()) { | 2026 if (m_pVT->IsValid()) { |
| 2024 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2027 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2025 CPVT_WordRange wrTemp = wr; | 2028 CPVT_WordRange wrTemp = wr; |
| 2026 | 2029 |
| 2027 m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 2030 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 2028 m_pVT->UpdateWordPlace(wrTemp.EndPos); | 2031 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 2029 pIterator->SetAt(wrTemp.BeginPos); | 2032 pIterator->SetAt(wrTemp.BeginPos); |
| 2030 | 2033 |
| 2031 CPVT_Word wordinfo; | 2034 CPVT_Word wordinfo; |
| 2032 CPVT_Line lineinfo; | 2035 CPVT_Line lineinfo; |
| 2033 CPVT_WordPlace place; | 2036 CPVT_WordPlace place; |
| 2034 | 2037 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2057 m_Refresh.AddRefresh(VTToEdit(rcLine)); | 2060 m_Refresh.AddRefresh(VTToEdit(rcLine)); |
| 2058 | 2061 |
| 2059 pIterator->NextLine(); | 2062 pIterator->NextLine(); |
| 2060 } | 2063 } |
| 2061 } | 2064 } |
| 2062 } | 2065 } |
| 2063 } | 2066 } |
| 2064 } | 2067 } |
| 2065 | 2068 |
| 2066 void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { | 2069 void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { |
| 2067 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2070 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2068 CPVT_WordRange wrTemp = wr; | 2071 CPVT_WordRange wrTemp = wr; |
| 2069 | 2072 |
| 2070 m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 2073 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 2071 m_pVT->UpdateWordPlace(wrTemp.EndPos); | 2074 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 2072 pIterator->SetAt(wrTemp.BeginPos); | 2075 pIterator->SetAt(wrTemp.BeginPos); |
| 2073 | 2076 |
| 2074 CPVT_Word wordinfo; | 2077 CPVT_Word wordinfo; |
| 2075 CPVT_Line lineinfo; | 2078 CPVT_Line lineinfo; |
| 2076 CPVT_WordPlace place; | 2079 CPVT_WordPlace place; |
| 2077 | 2080 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 void CFX_Edit::SetCaret(const CPVT_WordPlace& place) { | 2125 void CFX_Edit::SetCaret(const CPVT_WordPlace& place) { |
| 2123 m_wpOldCaret = m_wpCaret; | 2126 m_wpOldCaret = m_wpCaret; |
| 2124 m_wpCaret = place; | 2127 m_wpCaret = place; |
| 2125 } | 2128 } |
| 2126 | 2129 |
| 2127 void CFX_Edit::SetCaretInfo() { | 2130 void CFX_Edit::SetCaretInfo() { |
| 2128 if (m_bNotify && m_pNotify) { | 2131 if (m_bNotify && m_pNotify) { |
| 2129 if (!m_bNotifyFlag) { | 2132 if (!m_bNotifyFlag) { |
| 2130 CFX_FloatPoint ptHead(0.0f, 0.0f), ptFoot(0.0f, 0.0f); | 2133 CFX_FloatPoint ptHead(0.0f, 0.0f), ptFoot(0.0f, 0.0f); |
| 2131 | 2134 |
| 2132 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2135 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2133 pIterator->SetAt(m_wpCaret); | 2136 pIterator->SetAt(m_wpCaret); |
| 2134 CPVT_Word word; | 2137 CPVT_Word word; |
| 2135 CPVT_Line line; | 2138 CPVT_Line line; |
| 2136 if (pIterator->GetWord(word)) { | 2139 if (pIterator->GetWord(word)) { |
| 2137 ptHead.x = word.ptWord.x + word.fWidth; | 2140 ptHead.x = word.ptWord.x + word.fWidth; |
| 2138 ptHead.y = word.ptWord.y + word.fAscent; | 2141 ptHead.y = word.ptWord.y + word.fAscent; |
| 2139 ptFoot.x = word.ptWord.x + word.fWidth; | 2142 ptFoot.x = word.ptWord.x + word.fWidth; |
| 2140 ptFoot.y = word.ptWord.y + word.fDescent; | 2143 ptFoot.y = word.ptWord.y + word.fDescent; |
| 2141 } else if (pIterator->GetLine(line)) { | 2144 } else if (pIterator->GetLine(line)) { |
| 2142 ptHead.x = line.ptLine.x; | 2145 ptHead.x = line.ptLine.x; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2157 } | 2160 } |
| 2158 | 2161 |
| 2159 void CFX_Edit::SetCaretChange() { | 2162 void CFX_Edit::SetCaretChange() { |
| 2160 if (m_wpCaret == m_wpOldCaret) | 2163 if (m_wpCaret == m_wpOldCaret) |
| 2161 return; | 2164 return; |
| 2162 | 2165 |
| 2163 if (m_bNotify && m_pVT->IsRichText() && m_pNotify) { | 2166 if (m_bNotify && m_pVT->IsRichText() && m_pNotify) { |
| 2164 CPVT_SecProps SecProps; | 2167 CPVT_SecProps SecProps; |
| 2165 CPVT_WordProps WordProps; | 2168 CPVT_WordProps WordProps; |
| 2166 | 2169 |
| 2167 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2170 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2168 pIterator->SetAt(m_wpCaret); | 2171 pIterator->SetAt(m_wpCaret); |
| 2169 CPVT_Word word; | 2172 CPVT_Word word; |
| 2170 CPVT_Section section; | 2173 CPVT_Section section; |
| 2171 | 2174 |
| 2172 if (pIterator->GetSection(section)) { | 2175 if (pIterator->GetSection(section)) { |
| 2173 SecProps = section.SecProps; | 2176 SecProps = section.SecProps; |
| 2174 WordProps = section.WordProps; | 2177 WordProps = section.WordProps; |
| 2175 } | 2178 } |
| 2176 | 2179 |
| 2177 if (pIterator->GetWord(word)) { | 2180 if (pIterator->GetWord(word)) { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2540 | 2543 |
| 2541 FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { | 2544 FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { |
| 2542 if (m_pVT->IsValid()) { | 2545 if (m_pVT->IsValid()) { |
| 2543 if (m_wpCaret == m_pVT->GetBeginWordPlace()) | 2546 if (m_wpCaret == m_pVT->GetBeginWordPlace()) |
| 2544 return FALSE; | 2547 return FALSE; |
| 2545 | 2548 |
| 2546 CPVT_Section section; | 2549 CPVT_Section section; |
| 2547 CPVT_Word word; | 2550 CPVT_Word word; |
| 2548 | 2551 |
| 2549 if (bAddUndo) { | 2552 if (bAddUndo) { |
| 2550 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2553 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2551 pIterator->SetAt(m_wpCaret); | 2554 pIterator->SetAt(m_wpCaret); |
| 2552 pIterator->GetSection(section); | 2555 pIterator->GetSection(section); |
| 2553 pIterator->GetWord(word); | 2556 pIterator->GetWord(word); |
| 2554 } | 2557 } |
| 2555 } | 2558 } |
| 2556 | 2559 |
| 2557 m_pVT->UpdateWordPlace(m_wpCaret); | 2560 m_pVT->UpdateWordPlace(m_wpCaret); |
| 2558 SetCaret(m_pVT->BackSpaceWord(m_wpCaret)); | 2561 SetCaret(m_pVT->BackSpaceWord(m_wpCaret)); |
| 2559 m_SelState.Set(m_wpCaret, m_wpCaret); | 2562 m_SelState.Set(m_wpCaret, m_wpCaret); |
| 2560 | 2563 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2603 | 2606 |
| 2604 FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { | 2607 FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { |
| 2605 if (m_pVT->IsValid()) { | 2608 if (m_pVT->IsValid()) { |
| 2606 if (m_wpCaret == m_pVT->GetEndWordPlace()) | 2609 if (m_wpCaret == m_pVT->GetEndWordPlace()) |
| 2607 return FALSE; | 2610 return FALSE; |
| 2608 | 2611 |
| 2609 CPVT_Section section; | 2612 CPVT_Section section; |
| 2610 CPVT_Word word; | 2613 CPVT_Word word; |
| 2611 | 2614 |
| 2612 if (bAddUndo) { | 2615 if (bAddUndo) { |
| 2613 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2616 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2614 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); | 2617 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); |
| 2615 pIterator->GetSection(section); | 2618 pIterator->GetSection(section); |
| 2616 pIterator->GetWord(word); | 2619 pIterator->GetWord(word); |
| 2617 } | 2620 } |
| 2618 } | 2621 } |
| 2619 | 2622 |
| 2620 m_pVT->UpdateWordPlace(m_wpCaret); | 2623 m_pVT->UpdateWordPlace(m_wpCaret); |
| 2621 FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); | 2624 FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); |
| 2622 | 2625 |
| 2623 SetCaret(m_pVT->DeleteWord(m_wpCaret)); | 2626 SetCaret(m_pVT->DeleteWord(m_wpCaret)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2677 | 2680 |
| 2678 FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { | 2681 FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { |
| 2679 if (m_pVT->IsValid()) { | 2682 if (m_pVT->IsValid()) { |
| 2680 if (m_SelState.IsExist()) { | 2683 if (m_SelState.IsExist()) { |
| 2681 CPVT_WordRange range = m_SelState.ConvertToWordRange(); | 2684 CPVT_WordRange range = m_SelState.ConvertToWordRange(); |
| 2682 | 2685 |
| 2683 if (bAddUndo && m_bEnableUndo) { | 2686 if (bAddUndo && m_bEnableUndo) { |
| 2684 if (m_pVT->IsRichText()) { | 2687 if (m_pVT->IsRichText()) { |
| 2685 BeginGroupUndo(L""); | 2688 BeginGroupUndo(L""); |
| 2686 | 2689 |
| 2687 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2690 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2688 pIterator->SetAt(range.EndPos); | 2691 pIterator->SetAt(range.EndPos); |
| 2689 | 2692 |
| 2690 CPVT_Word wordinfo; | 2693 CPVT_Word wordinfo; |
| 2691 CPVT_Section secinfo; | 2694 CPVT_Section secinfo; |
| 2692 do { | 2695 do { |
| 2693 CPVT_WordPlace place = pIterator->GetAt(); | 2696 CPVT_WordPlace place = pIterator->GetAt(); |
| 2694 if (place.WordCmp(range.BeginPos) <= 0) | 2697 if (place.WordCmp(range.BeginPos) <= 0) |
| 2695 break; | 2698 break; |
| 2696 | 2699 |
| 2697 CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place); | 2700 CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2810 m_Undo.Undo(); | 2813 m_Undo.Undo(); |
| 2811 return TRUE; | 2814 return TRUE; |
| 2812 } | 2815 } |
| 2813 } | 2816 } |
| 2814 | 2817 |
| 2815 return FALSE; | 2818 return FALSE; |
| 2816 } | 2819 } |
| 2817 | 2820 |
| 2818 void CFX_Edit::SetCaretOrigin() { | 2821 void CFX_Edit::SetCaretOrigin() { |
| 2819 if (m_pVT->IsValid()) { | 2822 if (m_pVT->IsValid()) { |
| 2820 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2823 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2821 pIterator->SetAt(m_wpCaret); | 2824 pIterator->SetAt(m_wpCaret); |
| 2822 CPVT_Word word; | 2825 CPVT_Word word; |
| 2823 CPVT_Line line; | 2826 CPVT_Line line; |
| 2824 if (pIterator->GetWord(word)) { | 2827 if (pIterator->GetWord(word)) { |
| 2825 m_ptCaret.x = word.ptWord.x + word.fWidth; | 2828 m_ptCaret.x = word.ptWord.x + word.fWidth; |
| 2826 m_ptCaret.y = word.ptWord.y; | 2829 m_ptCaret.y = word.ptWord.y; |
| 2827 } else if (pIterator->GetLine(line)) { | 2830 } else if (pIterator->GetLine(line)) { |
| 2828 m_ptCaret.x = line.ptLine.x; | 2831 m_ptCaret.x = line.ptLine.x; |
| 2829 m_ptCaret.y = line.ptLine.y; | 2832 m_ptCaret.y = line.ptLine.y; |
| 2830 } | 2833 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2923 | 2926 |
| 2924 void CFX_Edit::EnableNotify(FX_BOOL bNotify) { | 2927 void CFX_Edit::EnableNotify(FX_BOOL bNotify) { |
| 2925 m_bNotify = bNotify; | 2928 m_bNotify = bNotify; |
| 2926 } | 2929 } |
| 2927 | 2930 |
| 2928 void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) { | 2931 void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) { |
| 2929 m_bOprNotify = bNotify; | 2932 m_bOprNotify = bNotify; |
| 2930 } | 2933 } |
| 2931 | 2934 |
| 2932 FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const { | 2935 FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const { |
| 2933 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2936 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2934 CPVT_WordPlace wpOld = pIterator->GetAt(); | 2937 CPVT_WordPlace wpOld = pIterator->GetAt(); |
| 2935 | 2938 |
| 2936 pIterator->SetAt(place); | 2939 pIterator->SetAt(place); |
| 2937 CPVT_Line line; | 2940 CPVT_Line line; |
| 2938 pIterator->GetLine(line); | 2941 pIterator->GetLine(line); |
| 2939 | 2942 |
| 2940 pIterator->SetAt(wpOld); | 2943 pIterator->SetAt(wpOld); |
| 2941 | 2944 |
| 2942 return line.ptLine.y + line.fLineAscent; | 2945 return line.ptLine.y + line.fLineAscent; |
| 2943 } | 2946 } |
| 2944 | 2947 |
| 2945 return 0.0f; | 2948 return 0.0f; |
| 2946 } | 2949 } |
| 2947 | 2950 |
| 2948 FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const { | 2951 FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const { |
| 2949 if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { | 2952 if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { |
| 2950 CPVT_WordPlace wpOld = pIterator->GetAt(); | 2953 CPVT_WordPlace wpOld = pIterator->GetAt(); |
| 2951 | 2954 |
| 2952 pIterator->SetAt(place); | 2955 pIterator->SetAt(place); |
| 2953 CPVT_Line line; | 2956 CPVT_Line line; |
| 2954 pIterator->GetLine(line); | 2957 pIterator->GetLine(line); |
| 2955 | 2958 |
| 2956 pIterator->SetAt(wpOld); | 2959 pIterator->SetAt(wpOld); |
| 2957 | 2960 |
| 2958 return line.ptLine.y + line.fLineDescent; | 2961 return line.ptLine.y + line.fLineDescent; |
| 2959 } | 2962 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2991 pWordProps); | 2994 pWordProps); |
| 2992 break; | 2995 break; |
| 2993 } | 2996 } |
| 2994 } | 2997 } |
| 2995 } | 2998 } |
| 2996 | 2999 |
| 2997 return wp; | 3000 return wp; |
| 2998 } | 3001 } |
| 2999 | 3002 |
| 3000 int32_t CFX_Edit::GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset) { | 3003 int32_t CFX_Edit::GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset) { |
| 3001 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) | 3004 if (IPVT_FontMap* pFontMap = GetFontMap()) |
| 3002 return pFontMap->CharSetFromUnicode(word, nOldCharset); | 3005 return pFontMap->CharSetFromUnicode(word, nOldCharset); |
| 3003 return nOldCharset; | 3006 return nOldCharset; |
| 3004 } | 3007 } |
| 3005 | 3008 |
| 3006 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { | 3009 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { |
| 3007 ASSERT(!m_pGroupUndoItem); | 3010 ASSERT(!m_pGroupUndoItem); |
| 3008 | 3011 |
| 3009 m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle); | 3012 m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle); |
| 3010 } | 3013 } |
| 3011 | 3014 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3025 if (m_bOprNotify && m_pOprNotify) | 3028 if (m_bOprNotify && m_pOprNotify) |
| 3026 m_pOprNotify->OnAddUndo(pEditUndoItem); | 3029 m_pOprNotify->OnAddUndo(pEditUndoItem); |
| 3027 } | 3030 } |
| 3028 } | 3031 } |
| 3029 | 3032 |
| 3030 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { | 3033 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { |
| 3031 m_Undo.AddItem(pUndoItem); | 3034 m_Undo.AddItem(pUndoItem); |
| 3032 if (m_bOprNotify && m_pOprNotify) | 3035 if (m_bOprNotify && m_pOprNotify) |
| 3033 m_pOprNotify->OnAddUndo(pUndoItem); | 3036 m_pOprNotify->OnAddUndo(pUndoItem); |
| 3034 } | 3037 } |
| OLD | NEW |