| 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 "../../include/fxedit/fxet_stub.h" | 7 #include "../../include/fxedit/fxet_stub.h" |
| 8 #include "../../include/fxedit/fxet_edit.h" | 8 #include "../../include/fxedit/fxet_edit.h" |
| 9 | 9 |
| 10 #define FX_EDIT_UNDO_MAXITEM» » » » 10000 | 10 #define FX_EDIT_UNDO_MAXITEM 10000 |
| 11 | 11 |
| 12 /* ---------------------------- CFX_Edit_Iterator ---------------------------- *
/ | 12 /* ---------------------------- CFX_Edit_Iterator ---------------------------- *
/ |
| 13 | 13 |
| 14 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator
* pVTIterator) : | 14 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator
* pVTIterator) : |
| 15 » m_pEdit(pEdit), | 15 m_pEdit(pEdit), |
| 16 » m_pVTIterator(pVTIterator) | 16 m_pVTIterator(pVTIterator) |
| 17 { | 17 { |
| 18 } | 18 } |
| 19 | 19 |
| 20 CFX_Edit_Iterator::~CFX_Edit_Iterator() | 20 CFX_Edit_Iterator::~CFX_Edit_Iterator() |
| 21 { | 21 { |
| 22 } | 22 } |
| 23 | 23 |
| 24 FX_BOOL»CFX_Edit_Iterator::NextWord() | 24 FX_BOOL CFX_Edit_Iterator::NextWord() |
| 25 { | 25 { |
| 26 » ASSERT(m_pVTIterator != NULL); | 26 return m_pVTIterator->NextWord(); |
| 27 | |
| 28 » return m_pVTIterator->NextWord(); | |
| 29 } | 27 } |
| 30 | 28 |
| 31 FX_BOOL CFX_Edit_Iterator::NextLine() | 29 FX_BOOL CFX_Edit_Iterator::NextLine() |
| 32 { | 30 { |
| 33 » ASSERT(m_pVTIterator != NULL); | 31 return m_pVTIterator->NextLine(); |
| 34 | |
| 35 » return m_pVTIterator->NextLine(); | |
| 36 } | 32 } |
| 37 | 33 |
| 38 FX_BOOL CFX_Edit_Iterator::NextSection() | 34 FX_BOOL CFX_Edit_Iterator::NextSection() |
| 39 { | 35 { |
| 40 » ASSERT(m_pVTIterator != NULL); | 36 return m_pVTIterator->NextSection(); |
| 41 | |
| 42 » return m_pVTIterator->NextSection(); | |
| 43 } | 37 } |
| 44 | 38 |
| 45 FX_BOOL»CFX_Edit_Iterator::PrevWord() | 39 FX_BOOL CFX_Edit_Iterator::PrevWord() |
| 46 { | 40 { |
| 47 » ASSERT(m_pVTIterator != NULL); | 41 return m_pVTIterator->PrevWord(); |
| 48 | |
| 49 » return m_pVTIterator->PrevWord(); | |
| 50 } | 42 } |
| 51 | 43 |
| 52 FX_BOOL»CFX_Edit_Iterator::PrevLine() | 44 FX_BOOL CFX_Edit_Iterator::PrevLine() |
| 53 { | 45 { |
| 54 » ASSERT(m_pVTIterator != NULL); | 46 return m_pVTIterator->PrevLine(); |
| 55 | |
| 56 » return m_pVTIterator->PrevLine(); | |
| 57 } | 47 } |
| 58 | 48 |
| 59 FX_BOOL»CFX_Edit_Iterator::PrevSection() | 49 FX_BOOL CFX_Edit_Iterator::PrevSection() |
| 60 { | 50 { |
| 61 » ASSERT(m_pVTIterator != NULL); | 51 return m_pVTIterator->PrevSection(); |
| 62 | |
| 63 » return m_pVTIterator->PrevSection(); | |
| 64 } | 52 } |
| 65 | 53 |
| 66 FX_BOOL CFX_Edit_Iterator::GetWord(CPVT_Word & word) const | 54 FX_BOOL CFX_Edit_Iterator::GetWord(CPVT_Word & word) const |
| 67 { | 55 { |
| 68 » ASSERT(m_pEdit != NULL); | 56 ASSERT(m_pEdit); |
| 69 » ASSERT(m_pVTIterator != NULL); | |
| 70 | 57 |
| 71 » if (m_pVTIterator->GetWord(word)) | 58 if (m_pVTIterator->GetWord(word)) |
| 72 » { | 59 { |
| 73 » » word.ptWord = m_pEdit->VTToEdit(word.ptWord); | 60 word.ptWord = m_pEdit->VTToEdit(word.ptWord); |
| 74 » » return TRUE; | 61 return TRUE; |
| 75 » } | 62 } |
| 76 | 63 return FALSE; |
| 77 » return FALSE; | |
| 78 } | 64 } |
| 79 | 65 |
| 80 FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line & line) const | 66 FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line & line) const |
| 81 { | 67 { |
| 82 » ASSERT(m_pEdit != NULL); | 68 ASSERT(m_pEdit); |
| 83 » ASSERT(m_pVTIterator != NULL); | |
| 84 | 69 |
| 85 » if (m_pVTIterator->GetLine(line)) | 70 if (m_pVTIterator->GetLine(line)) |
| 86 » { | 71 { |
| 87 » » line.ptLine = m_pEdit->VTToEdit(line.ptLine); | 72 line.ptLine = m_pEdit->VTToEdit(line.ptLine); |
| 88 » » return TRUE; | 73 return TRUE; |
| 89 » } | 74 } |
| 90 | 75 return FALSE; |
| 91 » return FALSE; | |
| 92 } | 76 } |
| 93 | 77 |
| 94 FX_BOOL CFX_Edit_Iterator::GetSection(CPVT_Section & section) const | 78 FX_BOOL CFX_Edit_Iterator::GetSection(CPVT_Section & section) const |
| 95 { | 79 { |
| 96 » ASSERT(m_pEdit != NULL); | 80 ASSERT(m_pEdit); |
| 97 » ASSERT(m_pVTIterator != NULL); | |
| 98 | 81 |
| 99 » if (m_pVTIterator->GetSection(section)) | 82 if (m_pVTIterator->GetSection(section)) |
| 100 » { | 83 { |
| 101 » » section.rcSection = m_pEdit->VTToEdit(section.rcSection); | 84 section.rcSection = m_pEdit->VTToEdit(section.rcSection); |
| 102 » » return TRUE; | 85 return TRUE; |
| 103 » } | 86 } |
| 104 | 87 return FALSE; |
| 105 » return FALSE; | |
| 106 } | 88 } |
| 107 | 89 |
| 108 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) | 90 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) |
| 109 { | 91 { |
| 110 » ASSERT(m_pVTIterator != NULL); | 92 m_pVTIterator->SetAt(nWordIndex); |
| 111 | |
| 112 » m_pVTIterator->SetAt(nWordIndex); | |
| 113 } | 93 } |
| 114 | 94 |
| 115 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace & place) | 95 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace & place) |
| 116 { | 96 { |
| 117 » ASSERT(m_pVTIterator != NULL); | 97 m_pVTIterator->SetAt(place); |
| 118 | |
| 119 » m_pVTIterator->SetAt(place); | |
| 120 } | 98 } |
| 121 | 99 |
| 122 const CPVT_WordPlace & CFX_Edit_Iterator::GetAt() const | 100 const CPVT_WordPlace & CFX_Edit_Iterator::GetAt() const |
| 123 { | 101 { |
| 124 » ASSERT(m_pVTIterator != NULL); | 102 return m_pVTIterator->GetAt(); |
| 125 | |
| 126 » return m_pVTIterator->GetAt(); | |
| 127 } | 103 } |
| 128 | 104 |
| 129 IFX_Edit* CFX_Edit_Iterator::GetEdit() const | 105 IFX_Edit* CFX_Edit_Iterator::GetEdit() const |
| 130 { | 106 { |
| 131 » return m_pEdit; | 107 return m_pEdit; |
| 132 } | 108 } |
| 133 | 109 |
| 134 /* --------------------------- CFX_Edit_Provider -------------------------------
*/ | 110 /* --------------------------- CFX_Edit_Provider -------------------------------
*/ |
| 135 | 111 |
| 136 CFX_Edit_Provider::CFX_Edit_Provider(IFX_Edit_FontMap * pFontMap) : m_pFontMap(p
FontMap) | 112 CFX_Edit_Provider::CFX_Edit_Provider(IFX_Edit_FontMap * pFontMap) : m_pFontMap(p
FontMap) |
| 137 { | 113 { |
| 138 » ASSERT(m_pFontMap != NULL); | 114 ASSERT(m_pFontMap != NULL); |
| 139 } | 115 } |
| 140 | 116 |
| 141 CFX_Edit_Provider::~CFX_Edit_Provider() | 117 CFX_Edit_Provider::~CFX_Edit_Provider() |
| 142 { | 118 { |
| 143 } | 119 } |
| 144 | 120 |
| 145 IFX_Edit_FontMap* CFX_Edit_Provider::GetFontMap() | 121 IFX_Edit_FontMap* CFX_Edit_Provider::GetFontMap() |
| 146 { | 122 { |
| 147 » return m_pFontMap; | 123 return m_pFontMap; |
| 148 } | 124 } |
| 149 | 125 |
| 150 int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_
t nWordStyle) | 126 int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_
t nWordStyle) |
| 151 { | 127 { |
| 152 » if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) | 128 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) |
| 153 » { | 129 { |
| 154 » » FX_DWORD charcode = word; | 130 FX_DWORD charcode = word; |
| 155 | 131 |
| 156 » » if (pPDFFont->IsUnicodeCompatible()) | 132 if (pPDFFont->IsUnicodeCompatible()) |
| 157 » » » charcode = pPDFFont->CharCodeFromUnicode(word); | 133 charcode = pPDFFont->CharCodeFromUnicode(word); |
| 158 » » else | 134 else |
| 159 » » » charcode = m_pFontMap->CharCodeFromUnicode(nFontIndex, w
ord); | 135 charcode = m_pFontMap->CharCodeFromUnicode(nFontIndex, word); |
| 160 | 136 |
| 161 » » if (charcode != -1) | 137 if (charcode != -1) |
| 162 » » » return pPDFFont->GetCharWidthF(charcode); | 138 return pPDFFont->GetCharWidthF(charcode); |
| 163 » } | 139 } |
| 164 | 140 |
| 165 » return 0; | 141 return 0; |
| 166 } | 142 } |
| 167 | 143 |
| 168 int32_t CFX_Edit_Provider::GetTypeAscent(int32_t nFontIndex) | 144 int32_t CFX_Edit_Provider::GetTypeAscent(int32_t nFontIndex) |
| 169 { | 145 { |
| 170 » if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) | 146 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) |
| 171 » » return pPDFFont->GetTypeAscent(); | 147 return pPDFFont->GetTypeAscent(); |
| 172 | 148 |
| 173 » return 0; | 149 return 0; |
| 174 } | 150 } |
| 175 | 151 |
| 176 int32_t CFX_Edit_Provider::GetTypeDescent(int32_t nFontIndex) | 152 int32_t CFX_Edit_Provider::GetTypeDescent(int32_t nFontIndex) |
| 177 { | 153 { |
| 178 » if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) | 154 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) |
| 179 » » return pPDFFont->GetTypeDescent(); | 155 return pPDFFont->GetTypeDescent(); |
| 180 | 156 |
| 181 » return 0; | 157 return 0; |
| 182 } | 158 } |
| 183 | 159 |
| 184 int32_t CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32
_t nFontIndex) | 160 int32_t CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32
_t nFontIndex) |
| 185 { | 161 { |
| 186 » return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex); | 162 return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex); |
| 187 } | 163 } |
| 188 | 164 |
| 189 int32_t CFX_Edit_Provider::GetDefaultFontIndex() | 165 int32_t CFX_Edit_Provider::GetDefaultFontIndex() |
| 190 { | 166 { |
| 191 » return 0; | 167 return 0; |
| 192 } | 168 } |
| 193 | 169 |
| 194 FX_BOOL»CFX_Edit_Provider::IsLatinWord(FX_WORD word) | 170 FX_BOOL CFX_Edit_Provider::IsLatinWord(FX_WORD word) |
| 195 { | 171 { |
| 196 » return FX_EDIT_ISLATINWORD(word); | 172 return FX_EDIT_ISLATINWORD(word); |
| 197 } | 173 } |
| 198 | 174 |
| 199 /* --------------------------------- CFX_Edit_Refresh --------------------------
------- */ | 175 /* --------------------------------- CFX_Edit_Refresh --------------------------
------- */ |
| 200 | 176 |
| 201 CFX_Edit_Refresh::CFX_Edit_Refresh() | 177 CFX_Edit_Refresh::CFX_Edit_Refresh() |
| 202 { | 178 { |
| 203 } | 179 } |
| 204 | 180 |
| 205 CFX_Edit_Refresh::~CFX_Edit_Refresh() | 181 CFX_Edit_Refresh::~CFX_Edit_Refresh() |
| 206 { | 182 { |
| 207 } | 183 } |
| 208 | 184 |
| 209 void CFX_Edit_Refresh::BeginRefresh() | 185 void CFX_Edit_Refresh::BeginRefresh() |
| 210 { | 186 { |
| 211 » m_RefreshRects.Empty(); | 187 m_RefreshRects.Empty(); |
| 212 » m_OldLineRects = m_NewLineRects; | 188 m_OldLineRects = m_NewLineRects; |
| 213 } | 189 } |
| 214 | 190 |
| 215 void CFX_Edit_Refresh::Push(const CPVT_WordRange & linerange,const CPDF_Rect & r
ect) | 191 void CFX_Edit_Refresh::Push(const CPVT_WordRange & linerange,const CPDF_Rect & r
ect) |
| 216 { | 192 { |
| 217 » m_NewLineRects.Add(linerange,rect); | 193 m_NewLineRects.Add(linerange,rect); |
| 218 } | 194 } |
| 219 | 195 |
| 220 void CFX_Edit_Refresh::NoAnalyse() | 196 void CFX_Edit_Refresh::NoAnalyse() |
| 221 { | 197 { |
| 222 » { | 198 { |
| 223 » » for (int32_t i = 0, sz = m_OldLineRects.GetSize(); i < sz; i++) | 199 for (int32_t i = 0, sz = m_OldLineRects.GetSize(); i < sz; i++) |
| 224 » » » if (CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(
i)) | 200 if (CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i)) |
| 225 » » » » m_RefreshRects.Add(pOldRect->m_rcLine); | 201 m_RefreshRects.Add(pOldRect->m_rcLine); |
| 226 » } | 202 } |
| 227 | 203 |
| 228 » { | 204 { |
| 229 » » for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) | 205 for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) |
| 230 » » » if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(
i)) | 206 if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i)) |
| 231 » » » » m_RefreshRects.Add(pNewRect->m_rcLine); | 207 m_RefreshRects.Add(pNewRect->m_rcLine); |
| 232 » } | 208 } |
| 233 } | 209 } |
| 234 | 210 |
| 235 void CFX_Edit_Refresh::Analyse(int32_t nAlignment) | 211 void CFX_Edit_Refresh::Analyse(int32_t nAlignment) |
| 236 { | 212 { |
| 237 » FX_BOOL bLineTopChanged = FALSE; | 213 FX_BOOL bLineTopChanged = FALSE; |
| 238 » CPDF_Rect rcResult; | 214 CPDF_Rect rcResult; |
| 239 » FX_FLOAT fWidthDiff; | 215 FX_FLOAT fWidthDiff; |
| 240 | 216 |
| 241 » int32_t szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetS
ize()); | 217 int32_t szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetSize(
)); |
| 242 » int32_t i = 0; | 218 int32_t i = 0; |
| 243 | 219 |
| 244 » while (i < szMax) | 220 while (i < szMax) |
| 245 » { | 221 { |
| 246 » » CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i); | 222 CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i); |
| 247 » » CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i); | 223 CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i); |
| 248 | 224 |
| 249 » » if (pOldRect) | 225 if (pOldRect) |
| 250 » » { | 226 { |
| 251 » » » if (pNewRect) | 227 if (pNewRect) |
| 252 » » » { | 228 { |
| 253 » » » » if (bLineTopChanged) | 229 if (bLineTopChanged) |
| 254 » » » » { | 230 { |
| 255 » » » » » rcResult = pOldRect->m_rcLine; | 231 rcResult = pOldRect->m_rcLine; |
| 256 » » » » » rcResult.Union(pNewRect->m_rcLine); | 232 rcResult.Union(pNewRect->m_rcLine); |
| 257 » » » » » m_RefreshRects.Add(rcResult); | 233 m_RefreshRects.Add(rcResult); |
| 258 » » » » } | 234 } |
| 259 » » » » else | 235 else |
| 260 » » » » { | 236 { |
| 261 » » » » » if (*pNewRect != *pOldRect) | 237 if (*pNewRect != *pOldRect) |
| 262 » » » » » { | 238 { |
| 263 » » » » » » if (!pNewRect->IsSameTop(*pOldRe
ct) || !pNewRect->IsSameHeight(*pOldRect)) | 239 if (!pNewRect->IsSameTop(*pOldRect) || !pNewRect->IsSame
Height(*pOldRect)) |
| 264 » » » » » » { | 240 { |
| 265 » » » » » » » bLineTopChanged = TRUE; | 241 bLineTopChanged = TRUE; |
| 266 » » » » » » » continue; | 242 continue; |
| 267 » » » » » » } | 243 } |
| 268 | 244 |
| 269 » » » » » » if (nAlignment == 0) | 245 if (nAlignment == 0) |
| 270 » » » » » » { | 246 { |
| 271 » » » » » » » if (pNewRect->m_wrLine.B
eginPos != pOldRect->m_wrLine.BeginPos) | 247 if (pNewRect->m_wrLine.BeginPos != pOldRect->m_wrLin
e.BeginPos) |
| 272 » » » » » » » { | 248 { |
| 273 » » » » » » » » rcResult = pOldR
ect->m_rcLine; | 249 rcResult = pOldRect->m_rcLine; |
| 274 » » » » » » » » rcResult.Union(p
NewRect->m_rcLine); | 250 rcResult.Union(pNewRect->m_rcLine); |
| 275 » » » » » » » » m_RefreshRects.A
dd(rcResult); | 251 m_RefreshRects.Add(rcResult); |
| 276 » » » » » » » } | 252 } |
| 277 » » » » » » » else | 253 else |
| 278 » » » » » » » { | 254 { |
| 279 » » » » » » » » if (!pNewRect->I
sSameLeft(*pOldRect)) | 255 if (!pNewRect->IsSameLeft(*pOldRect)) |
| 280 » » » » » » » » { | 256 { |
| 281 » » » » » » » » » rcResult
= pOldRect->m_rcLine; | 257 rcResult = pOldRect->m_rcLine; |
| 282 » » » » » » » » » rcResult
.Union(pNewRect->m_rcLine); | 258 rcResult.Union(pNewRect->m_rcLine); |
| 283 » » » » » » » » } | 259 } |
| 284 » » » » » » » » else | 260 else |
| 285 » » » » » » » » { | 261 { |
| 286 » » » » » » » » » fWidthDi
ff = pNewRect->m_rcLine.Width() - pOldRect->m_rcLine.Width(); | 262 fWidthDiff = pNewRect->m_rcLine.Width() - pO
ldRect->m_rcLine.Width(); |
| 287 » » » » » » » » » rcResult
= pNewRect->m_rcLine; | 263 rcResult = pNewRect->m_rcLine; |
| 288 » » » » » » » » » if (fWid
thDiff > 0.0f) | 264 if (fWidthDiff > 0.0f) |
| 289 » » » » » » » » » »
rcResult.left = rcResult.right - fWidthDiff; | 265 rcResult.left = rcResult.right - fWidthD
iff; |
| 290 » » » » » » » » » else | 266 else |
| 291 » » » » » » » » » { | 267 { |
| 292 » » » » » » » » » »
rcResult.left = rcResult.right; | 268 rcResult.left = rcResult.right; |
| 293 » » » » » » » » » »
rcResult.right += (-fWidthDiff); | 269 rcResult.right += (-fWidthDiff); |
| 294 » » » » » » » » » } | 270 } |
| 295 » » » » » » » » } | 271 } |
| 296 » » » » » » » » m_RefreshRects.A
dd(rcResult); | 272 m_RefreshRects.Add(rcResult); |
| 297 » » » » » » » } | 273 } |
| 298 » » » » » » } | 274 } |
| 299 » » » » » » else | 275 else |
| 300 » » » » » » { | 276 { |
| 301 » » » » » » » rcResult = pOldRect->m_r
cLine; | 277 rcResult = pOldRect->m_rcLine; |
| 302 » » » » » » » rcResult.Union(pNewRect-
>m_rcLine); | 278 rcResult.Union(pNewRect->m_rcLine); |
| 303 » » » » » » » m_RefreshRects.Add(rcRes
ult); | 279 m_RefreshRects.Add(rcResult); |
| 304 » » » » » » } | 280 } |
| 305 » » » » » } | 281 } |
| 306 » » » » » else | 282 else |
| 307 » » » » » { | 283 { |
| 308 » » » » » » //don't need to do anything | 284 //don't need to do anything |
| 309 » » » » » } | 285 } |
| 310 » » » » } | 286 } |
| 311 » » » } | 287 } |
| 312 » » » else | 288 else |
| 313 » » » { | 289 { |
| 314 » » » » m_RefreshRects.Add(pOldRect->m_rcLine); | 290 m_RefreshRects.Add(pOldRect->m_rcLine); |
| 315 » » » } | 291 } |
| 316 » » } | 292 } |
| 317 » » else | 293 else |
| 318 » » { | 294 { |
| 319 » » » if (pNewRect) | 295 if (pNewRect) |
| 320 » » » { | 296 { |
| 321 » » » » m_RefreshRects.Add(pNewRect->m_rcLine); | 297 m_RefreshRects.Add(pNewRect->m_rcLine); |
| 322 » » » } | 298 } |
| 323 » » » else | 299 else |
| 324 » » » { | 300 { |
| 325 » » » » //error | 301 //error |
| 326 » » » } | 302 } |
| 327 » » } | 303 } |
| 328 » » i++; | 304 i++; |
| 329 » } | 305 } |
| 330 } | 306 } |
| 331 | 307 |
| 332 void CFX_Edit_Refresh::AddRefresh(const CPDF_Rect & rect) | 308 void CFX_Edit_Refresh::AddRefresh(const CPDF_Rect & rect) |
| 333 { | 309 { |
| 334 » m_RefreshRects.Add(rect); | 310 m_RefreshRects.Add(rect); |
| 335 } | 311 } |
| 336 | 312 |
| 337 const CFX_Edit_RectArray * CFX_Edit_Refresh::GetRefreshRects() const | 313 const CFX_Edit_RectArray * CFX_Edit_Refresh::GetRefreshRects() const |
| 338 { | 314 { |
| 339 » return &m_RefreshRects; | 315 return &m_RefreshRects; |
| 340 } | 316 } |
| 341 | 317 |
| 342 void CFX_Edit_Refresh::EndRefresh() | 318 void CFX_Edit_Refresh::EndRefresh() |
| 343 { | 319 { |
| 344 » m_RefreshRects.Empty(); | 320 m_RefreshRects.Empty(); |
| 345 } | 321 } |
| 346 | 322 |
| 347 /* ------------------------------------- CFX_Edit_Undo -------------------------
------------ */ | 323 /* ------------------------------------- CFX_Edit_Undo -------------------------
------------ */ |
| 348 | 324 |
| 349 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), | 325 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), |
| 350 » m_nBufSize(nBufsize), | 326 m_nBufSize(nBufsize), |
| 351 » m_bModified(FALSE), | 327 m_bModified(FALSE), |
| 352 » m_bVirgin(TRUE), | 328 m_bVirgin(TRUE), |
| 353 » m_bWorking(FALSE) | 329 m_bWorking(FALSE) |
| 354 { | 330 { |
| 355 } | 331 } |
| 356 | 332 |
| 357 CFX_Edit_Undo::~CFX_Edit_Undo() | 333 CFX_Edit_Undo::~CFX_Edit_Undo() |
| 358 { | 334 { |
| 359 » Reset(); | 335 Reset(); |
| 360 } | 336 } |
| 361 | 337 |
| 362 FX_BOOL CFX_Edit_Undo::CanUndo() const | 338 FX_BOOL CFX_Edit_Undo::CanUndo() const |
| 363 { | 339 { |
| 364 » return m_nCurUndoPos > 0; | 340 return m_nCurUndoPos > 0; |
| 365 } | 341 } |
| 366 | 342 |
| 367 void CFX_Edit_Undo::Undo() | 343 void CFX_Edit_Undo::Undo() |
| 368 { | 344 { |
| 369 » m_bWorking = TRUE; | 345 m_bWorking = TRUE; |
| 370 | 346 |
| 371 » if (m_nCurUndoPos > 0) | 347 if (m_nCurUndoPos > 0) |
| 372 » { | 348 { |
| 373 » » IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos-
1); | 349 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos-1); |
| 374 » » ASSERT(pItem != NULL); | 350 ASSERT(pItem != NULL); |
| 375 | 351 |
| 376 » » pItem->Undo(); | 352 pItem->Undo(); |
| 377 | 353 |
| 378 » » m_nCurUndoPos--; | 354 m_nCurUndoPos--; |
| 379 » » m_bModified = (m_nCurUndoPos != 0); | 355 m_bModified = (m_nCurUndoPos != 0); |
| 380 » } | 356 } |
| 381 | 357 |
| 382 » m_bWorking = FALSE; | 358 m_bWorking = FALSE; |
| 383 } | 359 } |
| 384 | 360 |
| 385 FX_BOOL»CFX_Edit_Undo::CanRedo() const | 361 FX_BOOL CFX_Edit_Undo::CanRedo() const |
| 386 { | 362 { |
| 387 » return m_nCurUndoPos < m_UndoItemStack.GetSize(); | 363 return m_nCurUndoPos < m_UndoItemStack.GetSize(); |
| 388 } | 364 } |
| 389 | 365 |
| 390 void CFX_Edit_Undo::Redo() | 366 void CFX_Edit_Undo::Redo() |
| 391 { | 367 { |
| 392 » m_bWorking = TRUE; | 368 m_bWorking = TRUE; |
| 393 | 369 |
| 394 » int32_t nStackSize = m_UndoItemStack.GetSize(); | 370 int32_t nStackSize = m_UndoItemStack.GetSize(); |
| 395 | 371 |
| 396 » if (m_nCurUndoPos < nStackSize) | 372 if (m_nCurUndoPos < nStackSize) |
| 397 » { | 373 { |
| 398 » » IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos)
; | 374 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos); |
| 399 » » ASSERT(pItem != NULL); | 375 ASSERT(pItem != NULL); |
| 400 | 376 |
| 401 » » pItem->Redo(); | 377 pItem->Redo(); |
| 402 | 378 |
| 403 » » m_nCurUndoPos++; | 379 m_nCurUndoPos++; |
| 404 » » m_bModified = (m_nCurUndoPos != 0); | 380 m_bModified = (m_nCurUndoPos != 0); |
| 405 » } | 381 } |
| 406 | 382 |
| 407 » m_bWorking = FALSE; | 383 m_bWorking = FALSE; |
| 408 } | 384 } |
| 409 | 385 |
| 410 FX_BOOL»CFX_Edit_Undo::IsWorking() const | 386 FX_BOOL CFX_Edit_Undo::IsWorking() const |
| 411 { | 387 { |
| 412 » return m_bWorking; | 388 return m_bWorking; |
| 413 } | 389 } |
| 414 | 390 |
| 415 void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) | 391 void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) |
| 416 { | 392 { |
| 417 » ASSERT(!m_bWorking); | 393 ASSERT(!m_bWorking); |
| 418 » ASSERT(pItem != NULL); | 394 ASSERT(pItem != NULL); |
| 419 » ASSERT(m_nBufSize > 1); | 395 ASSERT(m_nBufSize > 1); |
| 420 | 396 |
| 421 » if (m_nCurUndoPos < m_UndoItemStack.GetSize()) | 397 if (m_nCurUndoPos < m_UndoItemStack.GetSize()) |
| 422 » » RemoveTails(); | 398 RemoveTails(); |
| 423 | 399 |
| 424 » if (m_UndoItemStack.GetSize() >= m_nBufSize) | 400 if (m_UndoItemStack.GetSize() >= m_nBufSize) |
| 425 » { | 401 { |
| 426 » » RemoveHeads(); | 402 RemoveHeads(); |
| 427 » » m_bVirgin = FALSE; | 403 m_bVirgin = FALSE; |
| 428 » } | 404 } |
| 429 | 405 |
| 430 » m_UndoItemStack.Add(pItem); | 406 m_UndoItemStack.Add(pItem); |
| 431 » m_nCurUndoPos = m_UndoItemStack.GetSize(); | 407 m_nCurUndoPos = m_UndoItemStack.GetSize(); |
| 432 | 408 |
| 433 » m_bModified = (m_nCurUndoPos != 0); | 409 m_bModified = (m_nCurUndoPos != 0); |
| 434 } | 410 } |
| 435 | 411 |
| 436 FX_BOOL»CFX_Edit_Undo::IsModified() const | 412 FX_BOOL CFX_Edit_Undo::IsModified() const |
| 437 { | 413 { |
| 438 » if (m_bVirgin) | 414 return m_bVirgin ? m_bModified : TRUE; |
| 439 » » return m_bModified; | |
| 440 » else | |
| 441 » » return TRUE; | |
| 442 } | 415 } |
| 443 | 416 |
| 444 IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) | 417 IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) |
| 445 { | 418 { |
| 446 » if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize()) | 419 if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize()) |
| 447 » » return m_UndoItemStack.GetAt(nIndex); | 420 return m_UndoItemStack.GetAt(nIndex); |
| 448 | 421 |
| 449 » return NULL; | 422 return NULL; |
| 450 } | 423 } |
| 451 | 424 |
| 452 void CFX_Edit_Undo::RemoveHeads() | 425 void CFX_Edit_Undo::RemoveHeads() |
| 453 { | 426 { |
| 454 » ASSERT(m_UndoItemStack.GetSize() > 1); | 427 ASSERT(m_UndoItemStack.GetSize() > 1); |
| 455 | 428 |
| 456 » delete m_UndoItemStack.GetAt(0); | 429 delete m_UndoItemStack.GetAt(0); |
| 457 » m_UndoItemStack.RemoveAt(0); | 430 m_UndoItemStack.RemoveAt(0); |
| 458 } | 431 } |
| 459 | 432 |
| 460 void CFX_Edit_Undo::RemoveTails() | 433 void CFX_Edit_Undo::RemoveTails() |
| 461 { | 434 { |
| 462 » for (int32_t i = m_UndoItemStack.GetSize()-1; i >= m_nCurUndoPos; i--) | 435 for (int32_t i = m_UndoItemStack.GetSize()-1; i >= m_nCurUndoPos; i--) |
| 463 » { | 436 { |
| 464 » » delete m_UndoItemStack.GetAt(i); | 437 delete m_UndoItemStack.GetAt(i); |
| 465 » » m_UndoItemStack.RemoveAt(i); | 438 m_UndoItemStack.RemoveAt(i); |
| 466 » } | 439 } |
| 467 } | 440 } |
| 468 | 441 |
| 469 void CFX_Edit_Undo::Reset() | 442 void CFX_Edit_Undo::Reset() |
| 470 { | 443 { |
| 471 » for (int32_t i=0, sz=m_UndoItemStack.GetSize(); i < sz; i++) | 444 for (int32_t i=0, sz=m_UndoItemStack.GetSize(); i < sz; i++) |
| 472 » { | 445 { |
| 473 » » delete m_UndoItemStack.GetAt(i); | 446 delete m_UndoItemStack.GetAt(i); |
| 474 » } | 447 } |
| 475 » m_nCurUndoPos = 0; | 448 m_nCurUndoPos = 0; |
| 476 » m_UndoItemStack.RemoveAll(); | 449 m_UndoItemStack.RemoveAll(); |
| 477 } | 450 } |
| 478 | 451 |
| 479 /* -------------------------------- CFX_Edit_GroupUndoItem ---------------------
----------- */ | 452 /* -------------------------------- CFX_Edit_GroupUndoItem ---------------------
----------- */ |
| 480 | 453 |
| 481 CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle) : m
_sTitle(sTitle) | 454 CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle) : m
_sTitle(sTitle) |
| 482 { | 455 { |
| 483 } | 456 } |
| 484 | 457 |
| 485 CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() | 458 CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() |
| 486 { | 459 { |
| 487 » for (int i=0,sz=m_Items.GetSize(); i<sz; i++) | 460 for (int i=0,sz=m_Items.GetSize(); i<sz; i++) |
| 488 » { | 461 { |
| 489 » » delete m_Items[i]; | 462 delete m_Items[i]; |
| 490 » } | 463 } |
| 491 | 464 |
| 492 » m_Items.RemoveAll(); | 465 m_Items.RemoveAll(); |
| 493 } | 466 } |
| 494 | 467 |
| 495 void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) | 468 void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) |
| 496 { | 469 { |
| 497 » ASSERT(pUndoItem != NULL); | 470 ASSERT(pUndoItem != NULL); |
| 498 | 471 |
| 499 » pUndoItem->SetFirst(FALSE); | 472 pUndoItem->SetFirst(FALSE); |
| 500 » pUndoItem->SetLast(FALSE); | 473 pUndoItem->SetLast(FALSE); |
| 501 | 474 |
| 502 » m_Items.Add(pUndoItem); | 475 m_Items.Add(pUndoItem); |
| 503 | 476 |
| 504 » if (m_sTitle.IsEmpty()) | 477 if (m_sTitle.IsEmpty()) |
| 505 » » m_sTitle = pUndoItem->GetUndoTitle(); | 478 m_sTitle = pUndoItem->GetUndoTitle(); |
| 506 } | 479 } |
| 507 | 480 |
| 508 void CFX_Edit_GroupUndoItem::UpdateItems() | 481 void CFX_Edit_GroupUndoItem::UpdateItems() |
| 509 { | 482 { |
| 510 » if (m_Items.GetSize() > 0) | 483 if (m_Items.GetSize() > 0) |
| 511 » { | 484 { |
| 512 » » CFX_Edit_UndoItem* pFirstItem = m_Items[0]; | 485 CFX_Edit_UndoItem* pFirstItem = m_Items[0]; |
| 513 » » ASSERT(pFirstItem != NULL); | 486 ASSERT(pFirstItem != NULL); |
| 514 » » pFirstItem->SetFirst(TRUE); | 487 pFirstItem->SetFirst(TRUE); |
| 515 | 488 |
| 516 » » CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; | 489 CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; |
| 517 » » ASSERT(pLastItem != NULL); | 490 ASSERT(pLastItem != NULL); |
| 518 » » pLastItem->SetLast(TRUE); | 491 pLastItem->SetLast(TRUE); |
| 519 » } | 492 } |
| 520 } | 493 } |
| 521 | 494 |
| 522 void CFX_Edit_GroupUndoItem::Undo() | 495 void CFX_Edit_GroupUndoItem::Undo() |
| 523 { | 496 { |
| 524 » for (int i=m_Items.GetSize()-1; i>=0; i--) | 497 for (int i=m_Items.GetSize()-1; i>=0; i--) |
| 525 » { | 498 { |
| 526 » » CFX_Edit_UndoItem* pUndoItem = m_Items[i]; | 499 CFX_Edit_UndoItem* pUndoItem = m_Items[i]; |
| 527 » » ASSERT(pUndoItem != NULL); | 500 ASSERT(pUndoItem != NULL); |
| 528 | 501 |
| 529 » » pUndoItem->Undo(); | 502 pUndoItem->Undo(); |
| 530 » } | 503 } |
| 531 } | 504 } |
| 532 | 505 |
| 533 void CFX_Edit_GroupUndoItem::Redo() | 506 void CFX_Edit_GroupUndoItem::Redo() |
| 534 { | 507 { |
| 535 » for (int i=0,sz=m_Items.GetSize(); i<sz; i++) | 508 for (int i=0,sz=m_Items.GetSize(); i<sz; i++) |
| 536 » { | 509 { |
| 537 » » CFX_Edit_UndoItem* pUndoItem = m_Items[i]; | 510 CFX_Edit_UndoItem* pUndoItem = m_Items[i]; |
| 538 » » ASSERT(pUndoItem != NULL); | 511 ASSERT(pUndoItem != NULL); |
| 539 | 512 |
| 540 » » pUndoItem->Redo(); | 513 pUndoItem->Redo(); |
| 541 » } | 514 } |
| 542 } | 515 } |
| 543 | 516 |
| 544 CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() | 517 CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() |
| 545 { | 518 { |
| 546 » return m_sTitle; | 519 return m_sTitle; |
| 547 } | 520 } |
| 548 | 521 |
| 549 /* ------------------------------------- CFX_Edit_UndoItem derived classes -----
-------------------------------- */ | 522 /* ------------------------------------- CFX_Edit_UndoItem derived classes -----
-------------------------------- */ |
| 550 | 523 |
| 551 CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl
dPlace, const CPVT_WordPlace & wpNewPlace, | 524 CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl
dPlace, const CPVT_WordPlace & wpNewPlace, |
| 552 » » » » » » » » FX_WORD word, i
nt32_t charset, const CPVT_WordProps * pWordProps) | 525 FX_WORD word, int32_t charset, const CPVT_WordP
rops * pWordProps) |
| 553 » : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_Word(word)
, m_nCharset(charset), m_WordProps() | 526 : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_Word(word), m_
nCharset(charset), m_WordProps() |
| 554 { | 527 { |
| 555 » if (pWordProps) | 528 if (pWordProps) |
| 556 » » m_WordProps = *pWordProps; | 529 m_WordProps = *pWordProps; |
| 557 } | 530 } |
| 558 | 531 |
| 559 CFXEU_InsertWord::~CFXEU_InsertWord() | 532 CFXEU_InsertWord::~CFXEU_InsertWord() |
| 560 { | 533 { |
| 561 } | 534 } |
| 562 | 535 |
| 563 void CFXEU_InsertWord::Redo() | 536 void CFXEU_InsertWord::Redo() |
| 564 { | 537 { |
| 565 » if (m_pEdit) | 538 if (m_pEdit) |
| 566 » { | 539 { |
| 567 » » m_pEdit->SelectNone(); | 540 m_pEdit->SelectNone(); |
| 568 » » m_pEdit->SetCaret(m_wpOld); | 541 m_pEdit->SetCaret(m_wpOld); |
| 569 » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); | 542 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); |
| 570 » } | 543 } |
| 571 } | 544 } |
| 572 | 545 |
| 573 void CFXEU_InsertWord::Undo() | 546 void CFXEU_InsertWord::Undo() |
| 574 { | 547 { |
| 575 » if (m_pEdit) | 548 if (m_pEdit) |
| 576 » { | 549 { |
| 577 » » m_pEdit->SelectNone(); | 550 m_pEdit->SelectNone(); |
| 578 » » m_pEdit->SetCaret(m_wpNew); | 551 m_pEdit->SetCaret(m_wpNew); |
| 579 » » m_pEdit->Backspace(FALSE,TRUE); | 552 m_pEdit->Backspace(FALSE,TRUE); |
| 580 » } | 553 } |
| 581 } | 554 } |
| 582 | 555 |
| 583 /* -------------------------------------------------------------------------- */ | 556 /* -------------------------------------------------------------------------- */ |
| 584 | 557 |
| 585 CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace &
wpOldPlace, const CPVT_WordPlace & wpNewPlace, | 558 CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace &
wpOldPlace, const CPVT_WordPlace & wpNewPlace, |
| 586 » » » const CPVT_SecProps * pSecProps, const CPVT_WordProps *
pWordProps) : | 559 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps)
: |
| 587 » » » m_pEdit(pEdit), | 560 m_pEdit(pEdit), |
| 588 » » » m_wpOld(wpOldPlace), | 561 m_wpOld(wpOldPlace), |
| 589 » » » m_wpNew(wpNewPlace), | 562 m_wpNew(wpNewPlace), |
| 590 » » » m_SecProps(), | 563 m_SecProps(), |
| 591 » » » m_WordProps() | 564 m_WordProps() |
| 592 { | 565 { |
| 593 » if (pSecProps) | 566 if (pSecProps) |
| 594 » » m_SecProps = *pSecProps; | 567 m_SecProps = *pSecProps; |
| 595 » if (pWordProps) | 568 if (pWordProps) |
| 596 » » m_WordProps = *pWordProps; | 569 m_WordProps = *pWordProps; |
| 597 } | 570 } |
| 598 | 571 |
| 599 CFXEU_InsertReturn::~CFXEU_InsertReturn() | 572 CFXEU_InsertReturn::~CFXEU_InsertReturn() |
| 600 { | 573 { |
| 601 } | 574 } |
| 602 | 575 |
| 603 void CFXEU_InsertReturn::Redo() | 576 void CFXEU_InsertReturn::Redo() |
| 604 { | 577 { |
| 605 » if (m_pEdit) | 578 if (m_pEdit) |
| 606 » { | 579 { |
| 607 » » m_pEdit->SelectNone(); | 580 m_pEdit->SelectNone(); |
| 608 » » m_pEdit->SetCaret(m_wpOld); | 581 m_pEdit->SetCaret(m_wpOld); |
| 609 » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRUE); | 582 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRUE); |
| 610 » } | 583 } |
| 611 } | 584 } |
| 612 | 585 |
| 613 void CFXEU_InsertReturn::Undo() | 586 void CFXEU_InsertReturn::Undo() |
| 614 { | 587 { |
| 615 » if (m_pEdit) | 588 if (m_pEdit) |
| 616 » { | 589 { |
| 617 » » m_pEdit->SelectNone(); | 590 m_pEdit->SelectNone(); |
| 618 » » m_pEdit->SetCaret(m_wpNew); | 591 m_pEdit->SetCaret(m_wpNew); |
| 619 » » m_pEdit->Backspace(FALSE,TRUE); | 592 m_pEdit->Backspace(FALSE,TRUE); |
| 620 » } | 593 } |
| 621 } | 594 } |
| 622 | 595 |
| 623 /* -------------------------------------------------------------------------- */ | 596 /* -------------------------------------------------------------------------- */ |
| 624 //CFXEU_Backspace | 597 //CFXEU_Backspace |
| 625 | 598 |
| 626 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, | 599 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, |
| 627 » » » » » » » FX_WORD word, int32_t
charset, | 600 FX_WORD word, int32_t charset, |
| 628 » » » » » » » const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : | 601 const CPVT_SecProps & SecProps, const CPVT_WordPr
ops & WordProps) : |
| 629 » » » m_pEdit(pEdit), | 602 m_pEdit(pEdit), |
| 630 » » » m_wpOld(wpOldPlace), | 603 m_wpOld(wpOldPlace), |
| 631 » » » m_wpNew(wpNewPlace), | 604 m_wpNew(wpNewPlace), |
| 632 » » » m_Word(word), | 605 m_Word(word), |
| 633 » » » m_nCharset(charset), | 606 m_nCharset(charset), |
| 634 » » » m_SecProps(SecProps), | 607 m_SecProps(SecProps), |
| 635 » » » m_WordProps(WordProps) | 608 m_WordProps(WordProps) |
| 636 { | 609 { |
| 637 } | 610 } |
| 638 | 611 |
| 639 CFXEU_Backspace::~CFXEU_Backspace() | 612 CFXEU_Backspace::~CFXEU_Backspace() |
| 640 { | 613 { |
| 641 } | 614 } |
| 642 | 615 |
| 643 void CFXEU_Backspace::Redo() | 616 void CFXEU_Backspace::Redo() |
| 644 { | 617 { |
| 645 » if (m_pEdit) | 618 if (m_pEdit) |
| 646 » { | 619 { |
| 647 » » m_pEdit->SelectNone(); | 620 m_pEdit->SelectNone(); |
| 648 » » m_pEdit->SetCaret(m_wpOld); | 621 m_pEdit->SetCaret(m_wpOld); |
| 649 » » m_pEdit->Backspace(FALSE,TRUE); | 622 m_pEdit->Backspace(FALSE,TRUE); |
| 650 » } | 623 } |
| 651 } | 624 } |
| 652 | 625 |
| 653 void CFXEU_Backspace::Undo() | 626 void CFXEU_Backspace::Undo() |
| 654 { | 627 { |
| 655 » if (m_pEdit) | 628 if (m_pEdit) |
| 656 » { | 629 { |
| 657 » » m_pEdit->SelectNone(); | 630 m_pEdit->SelectNone(); |
| 658 » » m_pEdit->SetCaret(m_wpNew); | 631 m_pEdit->SetCaret(m_wpNew); |
| 659 » » if (m_wpNew.SecCmp(m_wpOld) != 0) | 632 if (m_wpNew.SecCmp(m_wpOld) != 0) |
| 660 » » { | 633 { |
| 661 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRU
E); | 634 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRUE); |
| 662 » » } | 635 } |
| 663 » » else | 636 else |
| 664 » » { | 637 { |
| 665 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE
,TRUE); | 638 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); |
| 666 » » } | 639 } |
| 667 » } | 640 } |
| 668 } | 641 } |
| 669 | 642 |
| 670 /* -------------------------------------------------------------------------- */ | 643 /* -------------------------------------------------------------------------- */ |
| 671 //CFXEU_Delete | 644 //CFXEU_Delete |
| 672 | 645 |
| 673 CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace,
const CPVT_WordPlace & wpNewPlace, | 646 CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace,
const CPVT_WordPlace & wpNewPlace, |
| 674 » » » » » » » FX_WORD word, int32_t
charset, | 647 FX_WORD word, int32_t charset, |
| 675 » » » » » » » const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd) : | 648 const CPVT_SecProps & SecProps, const CPVT_WordPr
ops & WordProps, FX_BOOL bSecEnd) : |
| 676 » » » m_pEdit(pEdit), | 649 m_pEdit(pEdit), |
| 677 » » » m_wpOld(wpOldPlace), | 650 m_wpOld(wpOldPlace), |
| 678 » » » m_wpNew(wpNewPlace), | 651 m_wpNew(wpNewPlace), |
| 679 » » » m_Word(word), | 652 m_Word(word), |
| 680 » » » m_nCharset(charset), | 653 m_nCharset(charset), |
| 681 » » » m_SecProps(SecProps), | 654 m_SecProps(SecProps), |
| 682 » » » m_WordProps(WordProps), | 655 m_WordProps(WordProps), |
| 683 » » » m_bSecEnd(bSecEnd) | 656 m_bSecEnd(bSecEnd) |
| 684 { | 657 { |
| 685 } | 658 } |
| 686 | 659 |
| 687 CFXEU_Delete::~CFXEU_Delete() | 660 CFXEU_Delete::~CFXEU_Delete() |
| 688 { | 661 { |
| 689 } | 662 } |
| 690 | 663 |
| 691 void CFXEU_Delete::Redo() | 664 void CFXEU_Delete::Redo() |
| 692 { | 665 { |
| 693 » if (m_pEdit) | 666 if (m_pEdit) |
| 694 » { | 667 { |
| 695 » » m_pEdit->SelectNone(); | 668 m_pEdit->SelectNone(); |
| 696 » » m_pEdit->SetCaret(m_wpOld); | 669 m_pEdit->SetCaret(m_wpOld); |
| 697 » » m_pEdit->Delete(FALSE,TRUE); | 670 m_pEdit->Delete(FALSE,TRUE); |
| 698 » } | 671 } |
| 699 } | 672 } |
| 700 | 673 |
| 701 void CFXEU_Delete::Undo() | 674 void CFXEU_Delete::Undo() |
| 702 { | 675 { |
| 703 » if (m_pEdit) | 676 if (m_pEdit) |
| 704 » { | 677 { |
| 705 » » m_pEdit->SelectNone(); | 678 m_pEdit->SelectNone(); |
| 706 » » m_pEdit->SetCaret(m_wpNew); | 679 m_pEdit->SetCaret(m_wpNew); |
| 707 » » if (m_bSecEnd) | 680 if (m_bSecEnd) |
| 708 » » { | 681 { |
| 709 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRU
E); | 682 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRUE); |
| 710 » » } | 683 } |
| 711 » » else | 684 else |
| 712 » » { | 685 { |
| 713 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE
,TRUE); | 686 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); |
| 714 » » } | 687 } |
| 715 » } | 688 } |
| 716 } | 689 } |
| 717 | 690 |
| 718 /* -------------------------------------------------------------------------- */ | 691 /* -------------------------------------------------------------------------- */ |
| 719 //CFXEU_Clear | 692 //CFXEU_Clear |
| 720 | 693 |
| 721 CFXEU_Clear::CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const
CFX_WideString & swText) : | 694 CFXEU_Clear::CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const
CFX_WideString & swText) : |
| 722 » » » m_pEdit(pEdit), | 695 m_pEdit(pEdit), |
| 723 » » » m_wrSel(wrSel), | 696 m_wrSel(wrSel), |
| 724 » » » m_swText(swText) | 697 m_swText(swText) |
| 725 { | 698 { |
| 726 } | 699 } |
| 727 | 700 |
| 728 CFXEU_Clear::~CFXEU_Clear() | 701 CFXEU_Clear::~CFXEU_Clear() |
| 729 { | 702 { |
| 730 } | 703 } |
| 731 | 704 |
| 732 void CFXEU_Clear::Redo() | 705 void CFXEU_Clear::Redo() |
| 733 { | 706 { |
| 734 » if (m_pEdit) | 707 if (m_pEdit) |
| 735 » { | 708 { |
| 736 » » m_pEdit->SelectNone(); | 709 m_pEdit->SelectNone(); |
| 737 » » m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 710 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 738 » » m_pEdit->Clear(FALSE,TRUE); | 711 m_pEdit->Clear(FALSE,TRUE); |
| 739 » } | 712 } |
| 740 } | 713 } |
| 741 | 714 |
| 742 void CFXEU_Clear::Undo() | 715 void CFXEU_Clear::Undo() |
| 743 { | 716 { |
| 744 » if (m_pEdit) | 717 if (m_pEdit) |
| 745 » { | 718 { |
| 746 » » m_pEdit->SelectNone(); | 719 m_pEdit->SelectNone(); |
| 747 » » m_pEdit->SetCaret(m_wrSel.BeginPos); | 720 m_pEdit->SetCaret(m_wrSel.BeginPos); |
| 748 » » m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NUL
L, FALSE, TRUE); | 721 m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NULL, FALSE
, TRUE); |
| 749 » » m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 722 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 750 » } | 723 } |
| 751 } | 724 } |
| 752 | 725 |
| 753 /* -------------------------------------------------------------------------- */ | 726 /* -------------------------------------------------------------------------- */ |
| 754 //CFXEU_ClearRich | 727 //CFXEU_ClearRich |
| 755 | 728 |
| 756 CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, | 729 CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, |
| 757 » » » » » » » const CPVT_WordRange
& wrSel, FX_WORD word, int32_t charset, | 730 const CPVT_WordRange & wrSel, FX_WORD word, int32
_t charset, |
| 758 » » » » » » » const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : | 731 const CPVT_SecProps & SecProps, const CPVT_WordPr
ops & WordProps) : |
| 759 » » » m_pEdit(pEdit), | 732 m_pEdit(pEdit), |
| 760 » » » m_wpOld(wpOldPlace), | 733 m_wpOld(wpOldPlace), |
| 761 » » » m_wpNew(wpNewPlace), | 734 m_wpNew(wpNewPlace), |
| 762 » » » m_wrSel(wrSel), | 735 m_wrSel(wrSel), |
| 763 » » » m_Word(word), | 736 m_Word(word), |
| 764 » » » m_nCharset(charset), | 737 m_nCharset(charset), |
| 765 » » » m_SecProps(SecProps), | 738 m_SecProps(SecProps), |
| 766 » » » m_WordProps(WordProps) | 739 m_WordProps(WordProps) |
| 767 { | 740 { |
| 768 } | 741 } |
| 769 | 742 |
| 770 CFXEU_ClearRich::~CFXEU_ClearRich() | 743 CFXEU_ClearRich::~CFXEU_ClearRich() |
| 771 { | 744 { |
| 772 } | 745 } |
| 773 | 746 |
| 774 void CFXEU_ClearRich::Redo() | 747 void CFXEU_ClearRich::Redo() |
| 775 { | 748 { |
| 776 » if (m_pEdit && IsLast()) | 749 if (m_pEdit && IsLast()) |
| 777 » { | 750 { |
| 778 » » m_pEdit->SelectNone(); | 751 m_pEdit->SelectNone(); |
| 779 » » m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 752 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 780 » » m_pEdit->Clear(FALSE,TRUE); | 753 m_pEdit->Clear(FALSE,TRUE); |
| 781 » } | 754 } |
| 782 } | 755 } |
| 783 | 756 |
| 784 void CFXEU_ClearRich::Undo() | 757 void CFXEU_ClearRich::Undo() |
| 785 { | 758 { |
| 786 » if (m_pEdit) | 759 if (m_pEdit) |
| 787 » { | 760 { |
| 788 » » m_pEdit->SelectNone(); | 761 m_pEdit->SelectNone(); |
| 789 » » m_pEdit->SetCaret(m_wpOld); | 762 m_pEdit->SetCaret(m_wpOld); |
| 790 » » if (m_wpNew.SecCmp(m_wpOld) != 0) | 763 if (m_wpNew.SecCmp(m_wpOld) != 0) |
| 791 » » { | 764 { |
| 792 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,FAL
SE); | 765 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,FALSE); |
| 793 » » } | 766 } |
| 794 » » else | 767 else |
| 795 » » { | 768 { |
| 796 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE
,FALSE); | 769 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,FALSE); |
| 797 » » } | 770 } |
| 798 | 771 |
| 799 » » if (IsFirst()) | 772 if (IsFirst()) |
| 800 » » { | 773 { |
| 801 » » » m_pEdit->PaintInsertText(m_wrSel.BeginPos,m_wrSel.EndPos
); | 774 m_pEdit->PaintInsertText(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 802 » » » m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 775 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 803 » » } | 776 } |
| 804 » } | 777 } |
| 805 } | 778 } |
| 806 /* -------------------------------------------------------------------------- */ | 779 /* -------------------------------------------------------------------------- */ |
| 807 //CFXEU_InsertText | 780 //CFXEU_InsertText |
| 808 | 781 |
| 809 CFXEU_InsertText::CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl
dPlace, const CPVT_WordPlace & wpNewPlace, | 782 CFXEU_InsertText::CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl
dPlace, const CPVT_WordPlace & wpNewPlace, |
| 810 » » » » » » » const CFX_WideString
& swText, int32_t charset, | 783 const CFX_WideString & swText, int32_t charset, |
| 811 » » » » » » » const CPVT_SecProps *
pSecProps, const CPVT_WordProps * pWordProps) : | 784 const CPVT_SecProps * pSecProps, const CPVT_WordP
rops * pWordProps) : |
| 812 » » » m_pEdit(pEdit), | 785 m_pEdit(pEdit), |
| 813 » » » m_wpOld(wpOldPlace), | 786 m_wpOld(wpOldPlace), |
| 814 » » » m_wpNew(wpNewPlace), | 787 m_wpNew(wpNewPlace), |
| 815 » » » m_swText(swText), | 788 m_swText(swText), |
| 816 » » » m_nCharset(charset), | 789 m_nCharset(charset), |
| 817 » » » m_SecProps(), | 790 m_SecProps(), |
| 818 » » » m_WordProps() | 791 m_WordProps() |
| 819 { | 792 { |
| 820 » if (pSecProps) | 793 if (pSecProps) |
| 821 » » m_SecProps = *pSecProps; | 794 m_SecProps = *pSecProps; |
| 822 » if (pWordProps) | 795 if (pWordProps) |
| 823 » » m_WordProps = *pWordProps; | 796 m_WordProps = *pWordProps; |
| 824 } | 797 } |
| 825 | 798 |
| 826 CFXEU_InsertText::~CFXEU_InsertText() | 799 CFXEU_InsertText::~CFXEU_InsertText() |
| 827 { | 800 { |
| 828 } | 801 } |
| 829 | 802 |
| 830 void CFXEU_InsertText::Redo() | 803 void CFXEU_InsertText::Redo() |
| 831 { | 804 { |
| 832 » if (m_pEdit && IsLast()) | 805 if (m_pEdit && IsLast()) |
| 833 » { | 806 { |
| 834 » » m_pEdit->SelectNone(); | 807 m_pEdit->SelectNone(); |
| 835 » » m_pEdit->SetCaret(m_wpOld); | 808 m_pEdit->SetCaret(m_wpOld); |
| 836 » » m_pEdit->InsertText(m_swText.c_str(), m_nCharset, &m_SecProps, &
m_WordProps, FALSE, TRUE); | 809 m_pEdit->InsertText(m_swText.c_str(), m_nCharset, &m_SecProps, &m_WordPr
ops, FALSE, TRUE); |
| 837 » } | 810 } |
| 838 } | 811 } |
| 839 | 812 |
| 840 void CFXEU_InsertText::Undo() | 813 void CFXEU_InsertText::Undo() |
| 841 { | 814 { |
| 842 » if (m_pEdit) | 815 if (m_pEdit) |
| 843 » { | 816 { |
| 844 » » m_pEdit->SelectNone(); | 817 m_pEdit->SelectNone(); |
| 845 » » m_pEdit->SetSel(m_wpOld,m_wpNew); | 818 m_pEdit->SetSel(m_wpOld,m_wpNew); |
| 846 » » m_pEdit->Clear(FALSE,TRUE); | 819 m_pEdit->Clear(FALSE,TRUE); |
| 847 » } | 820 } |
| 848 } | 821 } |
| 849 | 822 |
| 850 /* -------------------------------------------------------------------------- */ | 823 /* -------------------------------------------------------------------------- */ |
| 851 | 824 |
| 852 CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & pl
ace, EDIT_PROPS_E ep, | 825 CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & pl
ace, EDIT_PROPS_E ep, |
| 853 » » const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwor
dprops, | 826 const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, |
| 854 » » const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwor
dprops, const CPVT_WordRange & range) | 827 const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops,
const CPVT_WordRange & range) |
| 855 » » : m_pEdit(pEdit), | 828 : m_pEdit(pEdit), |
| 856 » » m_wpPlace(place), | 829 m_wpPlace(place), |
| 857 » » m_wrPlace(range), | 830 m_wrPlace(range), |
| 858 » » m_eProps(ep), | 831 m_eProps(ep), |
| 859 » » m_OldSecProps(oldsecprops), | 832 m_OldSecProps(oldsecprops), |
| 860 » » m_NewSecProps(newsecprops), | 833 m_NewSecProps(newsecprops), |
| 861 » » m_OldWordProps(oldwordprops), | 834 m_OldWordProps(oldwordprops), |
| 862 » » m_NewWordProps(newwordprops) | 835 m_NewWordProps(newwordprops) |
| 863 { | 836 { |
| 864 } | 837 } |
| 865 | 838 |
| 866 CFXEU_SetSecProps::~CFXEU_SetSecProps() | 839 CFXEU_SetSecProps::~CFXEU_SetSecProps() |
| 867 { | 840 { |
| 868 } | 841 } |
| 869 | 842 |
| 870 void CFXEU_SetSecProps::Redo() | 843 void CFXEU_SetSecProps::Redo() |
| 871 { | 844 { |
| 872 » if (m_pEdit) | 845 if (m_pEdit) |
| 873 » { | 846 { |
| 874 » » m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_NewSecProps,&m_NewWor
dProps,m_wrPlace,FALSE); | 847 m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_NewSecProps,&m_NewWordProps,m
_wrPlace,FALSE); |
| 875 » » if (IsLast()) | 848 if (IsLast()) |
| 876 » » { | 849 { |
| 877 » » » m_pEdit->SelectNone(); | 850 m_pEdit->SelectNone(); |
| 878 » » » m_pEdit->PaintSetProps(m_eProps,m_wrPlace); | 851 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); |
| 879 » » » m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); | 852 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); |
| 880 » » } | 853 } |
| 881 » } | 854 } |
| 882 } | 855 } |
| 883 | 856 |
| 884 void CFXEU_SetSecProps::Undo() | 857 void CFXEU_SetSecProps::Undo() |
| 885 { | 858 { |
| 886 » if (m_pEdit) | 859 if (m_pEdit) |
| 887 » { | 860 { |
| 888 » » m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_OldSecProps,&m_OldWor
dProps,m_wrPlace,FALSE); | 861 m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_OldSecProps,&m_OldWordProps,m
_wrPlace,FALSE); |
| 889 » » if (IsFirst()) | 862 if (IsFirst()) |
| 890 » » { | 863 { |
| 891 » » » m_pEdit->SelectNone(); | 864 m_pEdit->SelectNone(); |
| 892 » » » m_pEdit->PaintSetProps(m_eProps,m_wrPlace); | 865 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); |
| 893 » » » m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); | 866 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); |
| 894 » » } | 867 } |
| 895 » } | 868 } |
| 896 } | 869 } |
| 897 | 870 |
| 898 /* -------------------------------------------------------------------------- */ | 871 /* -------------------------------------------------------------------------- */ |
| 899 | 872 |
| 900 CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace &
place, EDIT_PROPS_E ep, | 873 CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace &
place, EDIT_PROPS_E ep, |
| 901 » » const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops
, const CPVT_WordRange & range) | 874 const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const
CPVT_WordRange & range) |
| 902 » » : m_pEdit(pEdit), | 875 : m_pEdit(pEdit), |
| 903 » » m_wpPlace(place), | 876 m_wpPlace(place), |
| 904 » » m_wrPlace(range), | 877 m_wrPlace(range), |
| 905 » » m_eProps(ep), | 878 m_eProps(ep), |
| 906 » » m_OldWordProps(oldprops), | 879 m_OldWordProps(oldprops), |
| 907 » » m_NewWordProps(newprops) | 880 m_NewWordProps(newprops) |
| 908 { | 881 { |
| 909 } | 882 } |
| 910 | 883 |
| 911 CFXEU_SetWordProps::~CFXEU_SetWordProps() | 884 CFXEU_SetWordProps::~CFXEU_SetWordProps() |
| 912 { | 885 { |
| 913 } | 886 } |
| 914 | 887 |
| 915 void CFXEU_SetWordProps::Redo() | 888 void CFXEU_SetWordProps::Redo() |
| 916 { | 889 { |
| 917 » if (m_pEdit) | 890 if (m_pEdit) |
| 918 » { | 891 { |
| 919 » » m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_NewWordProps,m_wrPla
ce,FALSE); | 892 m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_NewWordProps,m_wrPlace,FALSE
); |
| 920 » » if (IsLast()) | 893 if (IsLast()) |
| 921 » » { | 894 { |
| 922 » » » m_pEdit->SelectNone(); | 895 m_pEdit->SelectNone(); |
| 923 » » » m_pEdit->PaintSetProps(m_eProps,m_wrPlace); | 896 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); |
| 924 » » » m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); | 897 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); |
| 925 » » } | 898 } |
| 926 » } | 899 } |
| 927 } | 900 } |
| 928 | 901 |
| 929 void CFXEU_SetWordProps::Undo() | 902 void CFXEU_SetWordProps::Undo() |
| 930 { | 903 { |
| 931 » if (m_pEdit) | 904 if (m_pEdit) |
| 932 » { | 905 { |
| 933 » » m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_OldWordProps,m_wrPla
ce,FALSE); | 906 m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_OldWordProps,m_wrPlace,FALSE
); |
| 934 » » if (IsFirst()) | 907 if (IsFirst()) |
| 935 » » { | 908 { |
| 936 » » » m_pEdit->SelectNone(); | 909 m_pEdit->SelectNone(); |
| 937 » » » m_pEdit->PaintSetProps(m_eProps,m_wrPlace); | 910 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); |
| 938 » » » m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); | 911 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); |
| 939 » » } | 912 } |
| 940 » } | 913 } |
| 941 } | 914 } |
| 942 | 915 |
| 943 /* ------------------------------------- CFX_Edit ------------------------------
------- */ | 916 /* ------------------------------------- CFX_Edit ------------------------------
------- */ |
| 944 | 917 |
| 945 CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) : | 918 CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) : |
| 946 » m_pVT(pVT), | 919 m_pVT(pVT), |
| 947 » m_pNotify(NULL), | 920 m_pNotify(NULL), |
| 948 » m_pOprNotify(NULL), | 921 m_pOprNotify(NULL), |
| 949 » m_pVTProvide(NULL), | 922 m_pVTProvide(NULL), |
| 950 » m_wpCaret(-1,-1,-1), | 923 m_wpCaret(-1,-1,-1), |
| 951 » m_wpOldCaret(-1,-1,-1), | 924 m_wpOldCaret(-1,-1,-1), |
| 952 » m_SelState(), | 925 m_SelState(), |
| 953 » m_ptScrollPos(0,0), | 926 m_ptScrollPos(0,0), |
| 954 » m_ptRefreshScrollPos(0,0), | 927 m_ptRefreshScrollPos(0,0), |
| 955 » m_bEnableScroll(FALSE), | 928 m_bEnableScroll(FALSE), |
| 956 » m_pIterator(NULL), | 929 m_pIterator(NULL), |
| 957 » m_ptCaret(0.0f,0.0f), | 930 m_ptCaret(0.0f,0.0f), |
| 958 » m_Undo(FX_EDIT_UNDO_MAXITEM), | 931 m_Undo(FX_EDIT_UNDO_MAXITEM), |
| 959 » m_nAlignment(0), | 932 m_nAlignment(0), |
| 960 » m_bNotifyFlag(FALSE), | 933 m_bNotifyFlag(FALSE), |
| 961 » m_bEnableOverflow(FALSE), | 934 m_bEnableOverflow(FALSE), |
| 962 » m_bEnableRefresh(TRUE), | 935 m_bEnableRefresh(TRUE), |
| 963 » m_rcOldContent(0.0f,0.0f,0.0f,0.0f), | 936 m_rcOldContent(0.0f,0.0f,0.0f,0.0f), |
| 964 » m_bEnableUndo(TRUE), | 937 m_bEnableUndo(TRUE), |
| 965 » m_bNotify(TRUE), | 938 m_bNotify(TRUE), |
| 966 » m_bOprNotify(FALSE), | 939 m_bOprNotify(FALSE), |
| 967 » m_pGroupUndoItem(NULL) | 940 m_pGroupUndoItem(NULL) |
| 968 { | 941 { |
| 969 » ASSERT(pVT != NULL); | 942 ASSERT(pVT != NULL); |
| 970 } | 943 } |
| 971 | 944 |
| 972 CFX_Edit::~CFX_Edit() | 945 CFX_Edit::~CFX_Edit() |
| 973 { | 946 { |
| 974 delete m_pVTProvide; | 947 delete m_pVTProvide; |
| 975 m_pVTProvide = NULL; | 948 m_pVTProvide = NULL; |
| 976 delete m_pIterator; | 949 delete m_pIterator; |
| 977 m_pIterator = NULL; | 950 m_pIterator = NULL; |
| 978 ASSERT(m_pGroupUndoItem == NULL); | 951 ASSERT(m_pGroupUndoItem == NULL); |
| 979 } | 952 } |
| 980 | 953 |
| 981 // public methods | 954 // public methods |
| 982 | 955 |
| 983 void CFX_Edit::Initialize() | 956 void CFX_Edit::Initialize() |
| 984 { | 957 { |
| 985 » m_pVT->Initialize(); | 958 m_pVT->Initialize(); |
| 986 » SetCaret(m_pVT->GetBeginWordPlace()); | 959 SetCaret(m_pVT->GetBeginWordPlace()); |
| 987 » SetCaretOrigin(); | 960 SetCaretOrigin(); |
| 988 } | 961 } |
| 989 | 962 |
| 990 void CFX_Edit::SetFontMap(IFX_Edit_FontMap * pFontMap) | 963 void CFX_Edit::SetFontMap(IFX_Edit_FontMap * pFontMap) |
| 991 { | 964 { |
| 992 delete m_pVTProvide; | 965 delete m_pVTProvide; |
| 993 m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap)); | 966 m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap)); |
| 994 } | 967 } |
| 995 | 968 |
| 996 void CFX_Edit::SetVTProvider(IPDF_VariableText_Provider* pProvider) | 969 void CFX_Edit::SetVTProvider(IPDF_VariableText_Provider* pProvider) |
| 997 { | 970 { |
| 998 » m_pVT->SetProvider(pProvider); | 971 m_pVT->SetProvider(pProvider); |
| 999 } | 972 } |
| 1000 | 973 |
| 1001 void CFX_Edit::SetNotify(IFX_Edit_Notify* pNotify) | 974 void CFX_Edit::SetNotify(IFX_Edit_Notify* pNotify) |
| 1002 { | 975 { |
| 1003 » m_pNotify = pNotify; | 976 m_pNotify = pNotify; |
| 1004 } | 977 } |
| 1005 | 978 |
| 1006 void CFX_Edit::SetOprNotify(IFX_Edit_OprNotify* pOprNotify) | 979 void CFX_Edit::SetOprNotify(IFX_Edit_OprNotify* pOprNotify) |
| 1007 { | 980 { |
| 1008 » m_pOprNotify = pOprNotify; | 981 m_pOprNotify = pOprNotify; |
| 1009 } | 982 } |
| 1010 | 983 |
| 1011 IFX_Edit_Iterator * CFX_Edit::GetIterator() | 984 IFX_Edit_Iterator * CFX_Edit::GetIterator() |
| 1012 { | 985 { |
| 1013 » if (!m_pIterator) | 986 if (!m_pIterator) |
| 1014 » » m_pIterator = new CFX_Edit_Iterator(this,m_pVT->GetIterator()); | 987 m_pIterator = new CFX_Edit_Iterator(this,m_pVT->GetIterator()); |
| 1015 | 988 |
| 1016 » return m_pIterator; | 989 return m_pIterator; |
| 1017 } | 990 } |
| 1018 | 991 |
| 1019 IPDF_VariableText *» CFX_Edit::GetVariableText() | 992 IPDF_VariableText * CFX_Edit::GetVariableText() |
| 1020 { | 993 { |
| 1021 » return m_pVT; | 994 return m_pVT; |
| 1022 } | 995 } |
| 1023 | 996 |
| 1024 IFX_Edit_FontMap* CFX_Edit::GetFontMap() | 997 IFX_Edit_FontMap* CFX_Edit::GetFontMap() |
| 1025 { | 998 { |
| 1026 » if (m_pVTProvide) | 999 if (m_pVTProvide) |
| 1027 » » return m_pVTProvide->GetFontMap(); | 1000 return m_pVTProvide->GetFontMap(); |
| 1028 | 1001 |
| 1029 » return NULL; | 1002 return NULL; |
| 1030 } | 1003 } |
| 1031 | 1004 |
| 1032 void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) | 1005 void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) |
| 1033 { | 1006 { |
| 1034 » m_pVT->SetPlateRect(rect); | 1007 m_pVT->SetPlateRect(rect); |
| 1035 » m_ptScrollPos = CPDF_Point(rect.left,rect.top); | 1008 m_ptScrollPos = CPDF_Point(rect.left,rect.top); |
| 1036 » if (bPaint) Paint(); | 1009 if (bPaint) Paint(); |
| 1037 } | 1010 } |
| 1038 | 1011 |
| 1039 void CFX_Edit::SetAlignmentH(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) | 1012 void CFX_Edit::SetAlignmentH(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) |
| 1040 { | 1013 { |
| 1041 » m_pVT->SetAlignment(nFormat); | 1014 m_pVT->SetAlignment(nFormat); |
| 1042 » if (bPaint) Paint(); | 1015 if (bPaint) Paint(); |
| 1043 } | 1016 } |
| 1044 | 1017 |
| 1045 void CFX_Edit::SetAlignmentV(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) | 1018 void CFX_Edit::SetAlignmentV(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) |
| 1046 { | 1019 { |
| 1047 » m_nAlignment = nFormat; | 1020 m_nAlignment = nFormat; |
| 1048 » if (bPaint) Paint(); | 1021 if (bPaint) Paint(); |
| 1049 } | 1022 } |
| 1050 | 1023 |
| 1051 void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, FX_BOOL bPaint/* = TR
UE*/) | 1024 void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, FX_BOOL bPaint/* = TR
UE*/) |
| 1052 { | 1025 { |
| 1053 » m_pVT->SetPasswordChar(wSubWord); | 1026 m_pVT->SetPasswordChar(wSubWord); |
| 1054 » if (bPaint) Paint(); | 1027 if (bPaint) Paint(); |
| 1055 } | 1028 } |
| 1056 | 1029 |
| 1057 void CFX_Edit::SetLimitChar(int32_t nLimitChar/* =0 */, FX_BOOL bPaint/* = TRUE*
/) | 1030 void CFX_Edit::SetLimitChar(int32_t nLimitChar/* =0 */, FX_BOOL bPaint/* = TRUE*
/) |
| 1058 { | 1031 { |
| 1059 » m_pVT->SetLimitChar(nLimitChar); | 1032 m_pVT->SetLimitChar(nLimitChar); |
| 1060 » if (bPaint) Paint(); | 1033 if (bPaint) Paint(); |
| 1061 } | 1034 } |
| 1062 | 1035 |
| 1063 void CFX_Edit::SetCharArray(int32_t nCharArray/* =0 */, FX_BOOL bPaint/* = TRUE*
/) | 1036 void CFX_Edit::SetCharArray(int32_t nCharArray/* =0 */, FX_BOOL bPaint/* = TRUE*
/) |
| 1064 { | 1037 { |
| 1065 » m_pVT->SetCharArray(nCharArray); | 1038 m_pVT->SetCharArray(nCharArray); |
| 1066 » if (bPaint) Paint(); | 1039 if (bPaint) Paint(); |
| 1067 } | 1040 } |
| 1068 | 1041 |
| 1069 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, FX_BOOL bPaint/* = T
RUE*/) | 1042 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, FX_BOOL bPaint/* = T
RUE*/) |
| 1070 { | 1043 { |
| 1071 » m_pVT->SetCharSpace(fCharSpace); | 1044 m_pVT->SetCharSpace(fCharSpace); |
| 1072 » if (bPaint) Paint(); | 1045 if (bPaint) Paint(); |
| 1073 } | 1046 } |
| 1074 | 1047 |
| 1075 void CFX_Edit::SetHorzScale(int32_t nHorzScale/* =100 */, FX_BOOL bPaint/* = TRU
E*/) | 1048 void CFX_Edit::SetHorzScale(int32_t nHorzScale/* =100 */, FX_BOOL bPaint/* = TRU
E*/) |
| 1076 { | 1049 { |
| 1077 » m_pVT->SetHorzScale(nHorzScale); | 1050 m_pVT->SetHorzScale(nHorzScale); |
| 1078 » if (bPaint) Paint(); | 1051 if (bPaint) Paint(); |
| 1079 } | 1052 } |
| 1080 | 1053 |
| 1081 void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine/* =TRUE */, FX_BOOL bPaint/* = TR
UE*/) | 1054 void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine/* =TRUE */, FX_BOOL bPaint/* = TR
UE*/) |
| 1082 { | 1055 { |
| 1083 » m_pVT->SetMultiLine(bMultiLine); | 1056 m_pVT->SetMultiLine(bMultiLine); |
| 1084 » if (bPaint) Paint(); | 1057 if (bPaint) Paint(); |
| 1085 } | 1058 } |
| 1086 | 1059 |
| 1087 void CFX_Edit::SetAutoReturn(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE*/
) | 1060 void CFX_Edit::SetAutoReturn(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE*/
) |
| 1088 { | 1061 { |
| 1089 » m_pVT->SetAutoReturn(bAuto); | 1062 m_pVT->SetAutoReturn(bAuto); |
| 1090 » if (bPaint) Paint(); | 1063 if (bPaint) Paint(); |
| 1091 } | 1064 } |
| 1092 | 1065 |
| 1093 void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading/* =TRUE */, FX_BOOL bPaint/*
= TRUE*/) | 1066 void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading/* =TRUE */, FX_BOOL bPaint/*
= TRUE*/) |
| 1094 { | 1067 { |
| 1095 » m_pVT->SetLineLeading(fLineLeading); | 1068 m_pVT->SetLineLeading(fLineLeading); |
| 1096 » if (bPaint) Paint(); | 1069 if (bPaint) Paint(); |
| 1097 } | 1070 } |
| 1098 | 1071 |
| 1099 void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE
*/) | 1072 void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE
*/) |
| 1100 { | 1073 { |
| 1101 » m_pVT->SetAutoFontSize(bAuto); | 1074 m_pVT->SetAutoFontSize(bAuto); |
| 1102 » if (bPaint) Paint(); | 1075 if (bPaint) Paint(); |
| 1103 } | 1076 } |
| 1104 | 1077 |
| 1105 void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint/* = TRUE*/) | 1078 void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint/* = TRUE*/) |
| 1106 { | 1079 { |
| 1107 » m_pVT->SetFontSize(fFontSize); | 1080 m_pVT->SetFontSize(fFontSize); |
| 1108 » if (bPaint) Paint(); | 1081 if (bPaint) Paint(); |
| 1109 } | 1082 } |
| 1110 | 1083 |
| 1111 void CFX_Edit::SetAutoScroll(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE*/
) | 1084 void CFX_Edit::SetAutoScroll(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE*/
) |
| 1112 { | 1085 { |
| 1113 » m_bEnableScroll = bAuto; | 1086 m_bEnableScroll = bAuto; |
| 1114 » if (bPaint) Paint(); | 1087 if (bPaint) Paint(); |
| 1115 } | 1088 } |
| 1116 | 1089 |
| 1117 void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed /*= FALSE*/, FX_BOOL bPaint/* =
TRUE*/) | 1090 void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed /*= FALSE*/, FX_BOOL bPaint/* =
TRUE*/) |
| 1118 { | 1091 { |
| 1119 » m_bEnableOverflow = bAllowed; | 1092 m_bEnableOverflow = bAllowed; |
| 1120 » if (bPaint) Paint(); | 1093 if (bPaint) Paint(); |
| 1121 } | 1094 } |
| 1122 | 1095 |
| 1123 void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) | 1096 void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) |
| 1124 { | 1097 { |
| 1125 » if (m_pVT->IsValid()) | 1098 if (m_pVT->IsValid()) |
| 1126 » { | 1099 { |
| 1127 » » if (nStartChar == 0 && nEndChar < 0) | 1100 if (nStartChar == 0 && nEndChar < 0) |
| 1128 » » { | 1101 { |
| 1129 » » » SelectAll(); | 1102 SelectAll(); |
| 1130 » » } | 1103 } |
| 1131 » » else if (nStartChar < 0) | 1104 else if (nStartChar < 0) |
| 1132 » » { | 1105 { |
| 1133 » » » SelectNone(); | 1106 SelectNone(); |
| 1134 » » } | 1107 } |
| 1135 » » else | 1108 else |
| 1136 » » { | 1109 { |
| 1137 » » » if (nStartChar < nEndChar) | 1110 if (nStartChar < nEndChar) |
| 1138 » » » { | 1111 { |
| 1139 » » » » SetSel(m_pVT->WordIndexToWordPlace(nStartChar),m
_pVT->WordIndexToWordPlace(nEndChar)); | 1112 SetSel(m_pVT->WordIndexToWordPlace(nStartChar),m_pVT->WordIndexT
oWordPlace(nEndChar)); |
| 1140 » » » } | 1113 } |
| 1141 » » » else | 1114 else |
| 1142 » » » { | 1115 { |
| 1143 » » » » SetSel(m_pVT->WordIndexToWordPlace(nEndChar),m_p
VT->WordIndexToWordPlace(nStartChar)); | 1116 SetSel(m_pVT->WordIndexToWordPlace(nEndChar),m_pVT->WordIndexToW
ordPlace(nStartChar)); |
| 1144 » » » } | 1117 } |
| 1145 » » } | 1118 } |
| 1146 » } | 1119 } |
| 1147 } | 1120 } |
| 1148 | 1121 |
| 1149 void CFX_Edit::SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) | 1122 void CFX_Edit::SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) |
| 1150 { | 1123 { |
| 1151 » if (m_pVT->IsValid()) | 1124 if (m_pVT->IsValid()) |
| 1152 » { | 1125 { |
| 1153 » » SelectNone(); | 1126 SelectNone(); |
| 1154 | 1127 |
| 1155 » » m_SelState.Set(begin,end); | 1128 m_SelState.Set(begin,end); |
| 1156 | 1129 |
| 1157 » » SetCaret(m_SelState.EndPos); | 1130 SetCaret(m_SelState.EndPos); |
| 1158 | 1131 |
| 1159 » » if (m_SelState.IsExist()) | 1132 if (m_SelState.IsExist()) |
| 1160 » » { | 1133 { |
| 1161 » » » ScrollToCaret(); | 1134 ScrollToCaret(); |
| 1162 » » » CPVT_WordRange wr(m_SelState.BeginPos,m_SelState.EndPos)
; | 1135 CPVT_WordRange wr(m_SelState.BeginPos,m_SelState.EndPos); |
| 1163 » » » Refresh(RP_OPTIONAL,&wr); | 1136 Refresh(RP_OPTIONAL,&wr); |
| 1164 » » » SetCaretInfo(); | 1137 SetCaretInfo(); |
| 1165 » » } | 1138 } |
| 1166 » » else | 1139 else |
| 1167 » » { | 1140 { |
| 1168 » » » ScrollToCaret(); | 1141 ScrollToCaret(); |
| 1169 » » » SetCaretInfo(); | 1142 SetCaretInfo(); |
| 1170 » » } | 1143 } |
| 1171 » } | 1144 } |
| 1172 } | 1145 } |
| 1173 | 1146 |
| 1174 void CFX_Edit::GetSel(int32_t & nStartChar, int32_t & nEndChar) const | 1147 void CFX_Edit::GetSel(int32_t & nStartChar, int32_t & nEndChar) const |
| 1175 { | 1148 { |
| 1176 » nStartChar = -1; | 1149 nStartChar = -1; |
| 1177 » nEndChar = -1; | 1150 nEndChar = -1; |
| 1178 | 1151 |
| 1179 » if (m_pVT->IsValid()) | 1152 if (m_pVT->IsValid()) |
| 1180 » { | 1153 { |
| 1181 » » if (m_SelState.IsExist()) | 1154 if (m_SelState.IsExist()) |
| 1182 » » { | 1155 { |
| 1183 » » » if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos)<0) | 1156 if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos)<0) |
| 1184 » » » { | 1157 { |
| 1185 » » » » nStartChar = m_pVT->WordPlaceToWordIndex(m_SelSt
ate.BeginPos); | 1158 nStartChar = m_pVT->WordPlaceToWordIndex(m_SelState.BeginPos); |
| 1186 » » » » nEndChar = m_pVT->WordPlaceToWordIndex(m_SelStat
e.EndPos); | 1159 nEndChar = m_pVT->WordPlaceToWordIndex(m_SelState.EndPos); |
| 1187 » » » } | 1160 } |
| 1188 » » » else | 1161 else |
| 1189 » » » { | 1162 { |
| 1190 » » » » nStartChar = m_pVT->WordPlaceToWordIndex(m_SelSt
ate.EndPos); | 1163 nStartChar = m_pVT->WordPlaceToWordIndex(m_SelState.EndPos); |
| 1191 » » » » nEndChar = m_pVT->WordPlaceToWordIndex(m_SelStat
e.BeginPos); | 1164 nEndChar = m_pVT->WordPlaceToWordIndex(m_SelState.BeginPos); |
| 1192 » » » } | 1165 } |
| 1193 » » } | 1166 } |
| 1194 » » else | 1167 else |
| 1195 » » { | 1168 { |
| 1196 » » » nStartChar = m_pVT->WordPlaceToWordIndex(m_wpCaret); | 1169 nStartChar = m_pVT->WordPlaceToWordIndex(m_wpCaret); |
| 1197 » » » nEndChar = m_pVT->WordPlaceToWordIndex(m_wpCaret); | 1170 nEndChar = m_pVT->WordPlaceToWordIndex(m_wpCaret); |
| 1198 » » } | 1171 } |
| 1199 » } | 1172 } |
| 1200 } | 1173 } |
| 1201 | 1174 |
| 1202 int32_t CFX_Edit::GetCaret() const | 1175 int32_t CFX_Edit::GetCaret() const |
| 1203 { | 1176 { |
| 1204 » if (m_pVT->IsValid()) | 1177 if (m_pVT->IsValid()) |
| 1205 » » return m_pVT->WordPlaceToWordIndex(m_wpCaret); | 1178 return m_pVT->WordPlaceToWordIndex(m_wpCaret); |
| 1206 | 1179 |
| 1207 » return -1; | 1180 return -1; |
| 1208 } | 1181 } |
| 1209 | 1182 |
| 1210 CPVT_WordPlace CFX_Edit::GetCaretWordPlace() const | 1183 CPVT_WordPlace CFX_Edit::GetCaretWordPlace() const |
| 1211 { | 1184 { |
| 1212 » return m_wpCaret; | 1185 return m_wpCaret; |
| 1213 } | 1186 } |
| 1214 | 1187 |
| 1215 CFX_WideString CFX_Edit::GetText() const | 1188 CFX_WideString CFX_Edit::GetText() const |
| 1216 { | 1189 { |
| 1217 » CFX_WideString swRet; | 1190 CFX_WideString swRet; |
| 1218 | 1191 |
| 1219 » if (m_pVT->IsValid()) | 1192 if (m_pVT->IsValid()) |
| 1220 » { | 1193 { |
| 1221 » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1194 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 1222 » » { | 1195 { |
| 1223 » » » FX_BOOL bRich = m_pVT->IsRichText(); | 1196 FX_BOOL bRich = m_pVT->IsRichText(); |
| 1224 | 1197 |
| 1225 » » » pIterator->SetAt(0); | 1198 pIterator->SetAt(0); |
| 1226 | 1199 |
| 1227 » » » CPVT_Word wordinfo; | 1200 CPVT_Word wordinfo; |
| 1228 » » » CPVT_WordPlace oldplace = pIterator->GetAt(); | 1201 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 1229 » » » while (pIterator->NextWord()) | 1202 while (pIterator->NextWord()) |
| 1230 » » » { | 1203 { |
| 1231 » » » » CPVT_WordPlace place = pIterator->GetAt(); | 1204 CPVT_WordPlace place = pIterator->GetAt(); |
| 1232 | 1205 |
| 1233 » » » » if (pIterator->GetWord(wordinfo)) | 1206 if (pIterator->GetWord(wordinfo)) |
| 1234 » » » » { | 1207 { |
| 1235 » » » » » if (bRich) | 1208 if (bRich) |
| 1236 » » » » » { | 1209 { |
| 1237 » » » » » » swRet += wordinfo.Word; | 1210 swRet += wordinfo.Word; |
| 1238 » » » » » } | 1211 } |
| 1239 » » » » » else | 1212 else |
| 1240 » » » » » { | 1213 { |
| 1241 » » » » » » swRet += wordinfo.Word; | 1214 swRet += wordinfo.Word; |
| 1242 » » » » » } | 1215 } |
| 1243 » » » » } | 1216 } |
| 1244 | 1217 |
| 1245 » » » » if (oldplace.SecCmp(place) != 0) | 1218 if (oldplace.SecCmp(place) != 0) |
| 1246 » » » » { | 1219 { |
| 1247 » » » » » swRet += 0x0D; | 1220 swRet += 0x0D; |
| 1248 » » » » » swRet += 0x0A; | 1221 swRet += 0x0A; |
| 1249 » » » » } | 1222 } |
| 1250 | 1223 |
| 1251 » » » » oldplace = place; | 1224 oldplace = place; |
| 1252 » » » } | 1225 } |
| 1253 » » } | 1226 } |
| 1254 » } | 1227 } |
| 1255 | 1228 |
| 1256 » return swRet; | 1229 return swRet; |
| 1257 } | 1230 } |
| 1258 | 1231 |
| 1259 CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const | 1232 CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const |
| 1260 { | 1233 { |
| 1261 » CFX_WideString swRet; | 1234 CFX_WideString swRet; |
| 1262 | 1235 |
| 1263 » if (m_pVT->IsValid()) | 1236 if (m_pVT->IsValid()) |
| 1264 » { | 1237 { |
| 1265 » » FX_BOOL bRich = m_pVT->IsRichText(); | 1238 FX_BOOL bRich = m_pVT->IsRichText(); |
| 1266 | 1239 |
| 1267 » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1240 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 1268 » » { | 1241 { |
| 1269 » » » CPVT_WordRange wrTemp = range; | 1242 CPVT_WordRange wrTemp = range; |
| 1270 » » » m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 1243 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 1271 » » » m_pVT->UpdateWordPlace(wrTemp.EndPos); | 1244 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 1272 » » » pIterator->SetAt(wrTemp.BeginPos); | 1245 pIterator->SetAt(wrTemp.BeginPos); |
| 1273 | 1246 |
| 1274 » » » CPVT_Word wordinfo; | 1247 CPVT_Word wordinfo; |
| 1275 » » » CPVT_WordPlace oldplace = wrTemp.BeginPos; | 1248 CPVT_WordPlace oldplace = wrTemp.BeginPos; |
| 1276 » » » while (pIterator->NextWord()) | 1249 while (pIterator->NextWord()) |
| 1277 » » » { | 1250 { |
| 1278 » » » » CPVT_WordPlace place = pIterator->GetAt(); | 1251 CPVT_WordPlace place = pIterator->GetAt(); |
| 1279 » » » » if (place.WordCmp(wrTemp.EndPos) > 0)break; | 1252 if (place.WordCmp(wrTemp.EndPos) > 0)break; |
| 1280 | 1253 |
| 1281 » » » » if (pIterator->GetWord(wordinfo)) | 1254 if (pIterator->GetWord(wordinfo)) |
| 1282 » » » » { | 1255 { |
| 1283 » » » » » if (bRich) | 1256 if (bRich) |
| 1284 » » » » » { | 1257 { |
| 1285 » » » » » » swRet += wordinfo.Word; | 1258 swRet += wordinfo.Word; |
| 1286 » » » » » } | 1259 } |
| 1287 » » » » » else | 1260 else |
| 1288 » » » » » { | 1261 { |
| 1289 » » » » » » swRet += wordinfo.Word; | 1262 swRet += wordinfo.Word; |
| 1290 » » » » » } | 1263 } |
| 1291 » » » » } | 1264 } |
| 1292 | 1265 |
| 1293 » » » » if (oldplace.SecCmp(place) != 0) | 1266 if (oldplace.SecCmp(place) != 0) |
| 1294 » » » » { | 1267 { |
| 1295 » » » » » swRet += 0x0D; | 1268 swRet += 0x0D; |
| 1296 » » » » » swRet += 0x0A; | 1269 swRet += 0x0A; |
| 1297 » » » » } | 1270 } |
| 1298 | 1271 |
| 1299 » » » » oldplace = place; | 1272 oldplace = place; |
| 1300 » » » } | 1273 } |
| 1301 » » } | 1274 } |
| 1302 » } | 1275 } |
| 1303 | 1276 |
| 1304 » return swRet; | 1277 return swRet; |
| 1305 } | 1278 } |
| 1306 | 1279 |
| 1307 CFX_WideString CFX_Edit::GetSelText() const | 1280 CFX_WideString CFX_Edit::GetSelText() const |
| 1308 { | 1281 { |
| 1309 » return GetRangeText(m_SelState.ConvertToWordRange()); | 1282 return GetRangeText(m_SelState.ConvertToWordRange()); |
| 1310 } | 1283 } |
| 1311 | 1284 |
| 1312 int32_t CFX_Edit::GetTotalWords() const | 1285 int32_t CFX_Edit::GetTotalWords() const |
| 1313 { | 1286 { |
| 1314 » return m_pVT->GetTotalWords(); | 1287 return m_pVT->GetTotalWords(); |
| 1315 } | 1288 } |
| 1316 | 1289 |
| 1317 int32_t CFX_Edit::GetTotalLines() const | 1290 int32_t CFX_Edit::GetTotalLines() const |
| 1318 { | 1291 { |
| 1319 » int32_t nLines = 0; | 1292 int32_t nLines = 0; |
| 1320 | 1293 |
| 1321 » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) | 1294 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 1322 » { | 1295 { |
| 1323 » » pIterator->SetAt(0); | 1296 pIterator->SetAt(0); |
| 1324 » » while (pIterator->NextLine()) | 1297 while (pIterator->NextLine()) |
| 1325 » » » nLines++; | 1298 nLines++; |
| 1326 » } | 1299 } |
| 1327 | 1300 |
| 1328 » return nLines+1; | 1301 return nLines+1; |
| 1329 } | 1302 } |
| 1330 | 1303 |
| 1331 CPVT_WordRange CFX_Edit::GetSelectWordRange() const | 1304 CPVT_WordRange CFX_Edit::GetSelectWordRange() const |
| 1332 { | 1305 { |
| 1333 » return m_SelState.ConvertToWordRange(); | 1306 return m_SelState.ConvertToWordRange(); |
| 1334 } | 1307 } |
| 1335 | 1308 |
| 1336 CPVT_WordRange CFX_Edit::CombineWordRange(const CPVT_WordRange & wr1, const CPVT
_WordRange & wr2) | 1309 CPVT_WordRange CFX_Edit::CombineWordRange(const CPVT_WordRange & wr1, const CPVT
_WordRange & wr2) |
| 1337 { | 1310 { |
| 1338 » CPVT_WordRange wrRet; | 1311 CPVT_WordRange wrRet; |
| 1339 | 1312 |
| 1340 » if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) | 1313 if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) |
| 1341 » { | 1314 { |
| 1342 » » wrRet.BeginPos = wr1.BeginPos; | 1315 wrRet.BeginPos = wr1.BeginPos; |
| 1343 » } | 1316 } |
| 1344 » else | 1317 else |
| 1345 » { | 1318 { |
| 1346 » » wrRet.BeginPos = wr2.BeginPos; | 1319 wrRet.BeginPos = wr2.BeginPos; |
| 1347 » } | 1320 } |
| 1348 | 1321 |
| 1349 » if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) | 1322 if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) |
| 1350 » { | 1323 { |
| 1351 » » wrRet.EndPos = wr2.EndPos; | 1324 wrRet.EndPos = wr2.EndPos; |
| 1352 » } | 1325 } |
| 1353 » else | 1326 else |
| 1354 » { | 1327 { |
| 1355 » » wrRet.EndPos = wr1.EndPos; | 1328 wrRet.EndPos = wr1.EndPos; |
| 1356 » } | 1329 } |
| 1357 | 1330 |
| 1358 » return wrRet; | 1331 return wrRet; |
| 1359 } | 1332 } |
| 1360 | 1333 |
| 1361 FX_BOOL»CFX_Edit::IsRichText() const | 1334 FX_BOOL CFX_Edit::IsRichText() const |
| 1362 { | 1335 { |
| 1363 » return m_pVT->IsRichText(); | 1336 return m_pVT->IsRichText(); |
| 1364 } | 1337 } |
| 1365 | 1338 |
| 1366 void CFX_Edit::SetRichText(FX_BOOL bRichText/* =TRUE */, FX_BOOL bPaint/* = TRUE
*/) | 1339 void CFX_Edit::SetRichText(FX_BOOL bRichText/* =TRUE */, FX_BOOL bPaint/* = TRUE
*/) |
| 1367 { | 1340 { |
| 1368 » m_pVT->SetRichText(bRichText); | 1341 m_pVT->SetRichText(bRichText); |
| 1369 » if (bPaint) Paint(); | 1342 if (bPaint) Paint(); |
| 1370 } | 1343 } |
| 1371 | 1344 |
| 1372 FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) | 1345 FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) |
| 1373 { | 1346 { |
| 1374 » CPVT_WordProps WordProps; | 1347 CPVT_WordProps WordProps; |
| 1375 » WordProps.nFontIndex = nFontIndex; | 1348 WordProps.nFontIndex = nFontIndex; |
| 1376 » return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); | 1349 return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); |
| 1377 } | 1350 } |
| 1378 | 1351 |
| 1379 FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) | 1352 FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) |
| 1380 { | 1353 { |
| 1381 » CPVT_WordProps WordProps; | 1354 CPVT_WordProps WordProps; |
| 1382 » WordProps.fFontSize = fFontSize; | 1355 WordProps.fFontSize = fFontSize; |
| 1383 » return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); | 1356 return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); |
| 1384 } | 1357 } |
| 1385 | 1358 |
| 1386 FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) | 1359 FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) |
| 1387 { | 1360 { |
| 1388 » CPVT_WordProps WordProps; | 1361 CPVT_WordProps WordProps; |
| 1389 » WordProps.dwWordColor = dwColor; | 1362 WordProps.dwWordColor = dwColor; |
| 1390 » return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); | 1363 return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); |
| 1391 } | 1364 } |
| 1392 | 1365 |
| 1393 FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) | 1366 FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) |
| 1394 { | 1367 { |
| 1395 » CPVT_WordProps WordProps; | 1368 CPVT_WordProps WordProps; |
| 1396 » WordProps.nScriptType = nScriptType; | 1369 WordProps.nScriptType = nScriptType; |
| 1397 » return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); | 1370 return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); |
| 1398 } | 1371 } |
| 1399 | 1372 |
| 1400 FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) | 1373 FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) |
| 1401 { | 1374 { |
| 1402 » CPVT_WordProps WordProps; | 1375 CPVT_WordProps WordProps; |
| 1403 » if (bBold) | 1376 if (bBold) |
| 1404 » » WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; | 1377 WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; |
| 1405 » return SetRichTextProps(EP_BOLD,NULL,&WordProps); | 1378 return SetRichTextProps(EP_BOLD,NULL,&WordProps); |
| 1406 } | 1379 } |
| 1407 | 1380 |
| 1408 FX_BOOL CFX_Edit::SetRichTextItalic(FX_BOOL bItalic) | 1381 FX_BOOL CFX_Edit::SetRichTextItalic(FX_BOOL bItalic) |
| 1409 { | 1382 { |
| 1410 » CPVT_WordProps WordProps; | 1383 CPVT_WordProps WordProps; |
| 1411 » if (bItalic) | 1384 if (bItalic) |
| 1412 » » WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; | 1385 WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; |
| 1413 » return SetRichTextProps(EP_ITALIC,NULL,&WordProps); | 1386 return SetRichTextProps(EP_ITALIC,NULL,&WordProps); |
| 1414 } | 1387 } |
| 1415 | 1388 |
| 1416 FX_BOOL CFX_Edit::SetRichTextUnderline(FX_BOOL bUnderline) | 1389 FX_BOOL CFX_Edit::SetRichTextUnderline(FX_BOOL bUnderline) |
| 1417 { | 1390 { |
| 1418 » CPVT_WordProps WordProps; | 1391 CPVT_WordProps WordProps; |
| 1419 » if (bUnderline) | 1392 if (bUnderline) |
| 1420 » » WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; | 1393 WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; |
| 1421 » return SetRichTextProps(EP_UNDERLINE,NULL,&WordProps); | 1394 return SetRichTextProps(EP_UNDERLINE,NULL,&WordProps); |
| 1422 } | 1395 } |
| 1423 | 1396 |
| 1424 FX_BOOL CFX_Edit::SetRichTextCrossout(FX_BOOL bCrossout) | 1397 FX_BOOL CFX_Edit::SetRichTextCrossout(FX_BOOL bCrossout) |
| 1425 { | 1398 { |
| 1426 » CPVT_WordProps WordProps; | 1399 CPVT_WordProps WordProps; |
| 1427 » if (bCrossout) | 1400 if (bCrossout) |
| 1428 » » WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; | 1401 WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; |
| 1429 » return SetRichTextProps(EP_CROSSOUT,NULL,&WordProps); | 1402 return SetRichTextProps(EP_CROSSOUT,NULL,&WordProps); |
| 1430 } | 1403 } |
| 1431 | 1404 |
| 1432 FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) | 1405 FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) |
| 1433 { | 1406 { |
| 1434 » CPVT_WordProps WordProps; | 1407 CPVT_WordProps WordProps; |
| 1435 » WordProps.fCharSpace = fCharSpace; | 1408 WordProps.fCharSpace = fCharSpace; |
| 1436 » return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); | 1409 return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); |
| 1437 } | 1410 } |
| 1438 | 1411 |
| 1439 FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) | 1412 FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) |
| 1440 { | 1413 { |
| 1441 » CPVT_WordProps WordProps; | 1414 CPVT_WordProps WordProps; |
| 1442 » WordProps.nHorzScale = nHorzScale; | 1415 WordProps.nHorzScale = nHorzScale; |
| 1443 » return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); | 1416 return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); |
| 1444 } | 1417 } |
| 1445 | 1418 |
| 1446 FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) | 1419 FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) |
| 1447 { | 1420 { |
| 1448 » CPVT_SecProps SecProps; | 1421 CPVT_SecProps SecProps; |
| 1449 » SecProps.fLineLeading = fLineLeading; | 1422 SecProps.fLineLeading = fLineLeading; |
| 1450 » return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); | 1423 return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); |
| 1451 } | 1424 } |
| 1452 | 1425 |
| 1453 FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) | 1426 FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) |
| 1454 { | 1427 { |
| 1455 » CPVT_SecProps SecProps; | 1428 CPVT_SecProps SecProps; |
| 1456 » SecProps.fLineIndent = fLineIndent; | 1429 SecProps.fLineIndent = fLineIndent; |
| 1457 » return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL); | 1430 return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL); |
| 1458 } | 1431 } |
| 1459 | 1432 |
| 1460 FX_BOOL»CFX_Edit::SetRichTextAlignment(int32_t nAlignment) | 1433 FX_BOOL CFX_Edit::SetRichTextAlignment(int32_t nAlignment) |
| 1461 { | 1434 { |
| 1462 » CPVT_SecProps SecProps; | 1435 CPVT_SecProps SecProps; |
| 1463 » SecProps.nAlignment = nAlignment; | 1436 SecProps.nAlignment = nAlignment; |
| 1464 » return SetRichTextProps(EP_ALIGNMENT,&SecProps,NULL); | 1437 return SetRichTextProps(EP_ALIGNMENT,&SecProps,NULL); |
| 1465 } | 1438 } |
| 1466 | 1439 |
| 1467 FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS
ecProps, const CPVT_WordProps * pWordProps) | 1440 FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS
ecProps, const CPVT_WordProps * pWordProps) |
| 1468 { | 1441 { |
| 1469 » FX_BOOL bSet = FALSE; | 1442 FX_BOOL bSet = FALSE; |
| 1470 » FX_BOOL bSet1,bSet2; | 1443 FX_BOOL bSet1,bSet2; |
| 1471 » if (m_pVT->IsValid() && m_pVT->IsRichText()) | 1444 if (m_pVT->IsValid() && m_pVT->IsRichText()) |
| 1472 » { | 1445 { |
| 1473 » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1446 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 1474 » » { | 1447 { |
| 1475 » » » CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); | 1448 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); |
| 1476 | 1449 |
| 1477 » » » m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 1450 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 1478 » » » m_pVT->UpdateWordPlace(wrTemp.EndPos); | 1451 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 1479 » » » pIterator->SetAt(wrTemp.BeginPos); | 1452 pIterator->SetAt(wrTemp.BeginPos); |
| 1480 | 1453 |
| 1481 » » » BeginGroupUndo(L"");; | 1454 BeginGroupUndo(L"");; |
| 1482 | 1455 |
| 1483 » » » bSet = SetSecProps(eProps,wrTemp.BeginPos,pSecProps,pWor
dProps,wrTemp,TRUE); | 1456 bSet = SetSecProps(eProps,wrTemp.BeginPos,pSecProps,pWordProps,wrTem
p,TRUE); |
| 1484 | 1457 |
| 1485 » » » while (pIterator->NextWord()) | 1458 while (pIterator->NextWord()) |
| 1486 » » » { | 1459 { |
| 1487 » » » » CPVT_WordPlace place = pIterator->GetAt(); | 1460 CPVT_WordPlace place = pIterator->GetAt(); |
| 1488 » » » » if (place.WordCmp(wrTemp.EndPos) > 0) break; | 1461 if (place.WordCmp(wrTemp.EndPos) > 0) break; |
| 1489 » » » » bSet1 = SetSecProps(eProps,place,pSecProps,pWord
Props,wrTemp,TRUE); | 1462 bSet1 = SetSecProps(eProps,place,pSecProps,pWordProps,wrTemp,TRU
E); |
| 1490 » » » » bSet2 = SetWordProps(eProps,place,pWordProps,wrT
emp,TRUE); | 1463 bSet2 = SetWordProps(eProps,place,pWordProps,wrTemp,TRUE); |
| 1491 | 1464 |
| 1492 » » » » if (!bSet) | 1465 if (!bSet) |
| 1493 » » » » » bSet = (bSet1 || bSet2); | 1466 bSet = (bSet1 || bSet2); |
| 1494 » » » } | 1467 } |
| 1495 | 1468 |
| 1496 » » » EndGroupUndo(); | 1469 EndGroupUndo(); |
| 1497 | 1470 |
| 1498 » » » if (bSet) | 1471 if (bSet) |
| 1499 » » » { | 1472 { |
| 1500 » » » » PaintSetProps(eProps,wrTemp); | 1473 PaintSetProps(eProps,wrTemp); |
| 1501 » » » } | 1474 } |
| 1502 » » } | 1475 } |
| 1503 » } | 1476 } |
| 1504 | 1477 |
| 1505 » return bSet; | 1478 return bSet; |
| 1506 } | 1479 } |
| 1507 | 1480 |
| 1508 void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) | 1481 void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) |
| 1509 { | 1482 { |
| 1510 » switch(eProps) | 1483 switch(eProps) |
| 1511 » { | 1484 { |
| 1512 » case EP_LINELEADING: | 1485 case EP_LINELEADING: |
| 1513 » case EP_LINEINDENT: | 1486 case EP_LINEINDENT: |
| 1514 » case EP_ALIGNMENT: | 1487 case EP_ALIGNMENT: |
| 1515 » » RearrangePart(wr); | 1488 RearrangePart(wr); |
| 1516 » » ScrollToCaret(); | 1489 ScrollToCaret(); |
| 1517 » » Refresh(RP_ANALYSE); | 1490 Refresh(RP_ANALYSE); |
| 1518 » » SetCaretOrigin(); | 1491 SetCaretOrigin(); |
| 1519 » » SetCaretInfo(); | 1492 SetCaretInfo(); |
| 1520 » » break; | 1493 break; |
| 1521 » case EP_WORDCOLOR: | 1494 case EP_WORDCOLOR: |
| 1522 » case EP_UNDERLINE: | 1495 case EP_UNDERLINE: |
| 1523 » case EP_CROSSOUT: | 1496 case EP_CROSSOUT: |
| 1524 » » Refresh(RP_OPTIONAL,&wr); | 1497 Refresh(RP_OPTIONAL,&wr); |
| 1525 » » break; | 1498 break; |
| 1526 » case EP_FONTINDEX: | 1499 case EP_FONTINDEX: |
| 1527 » case EP_FONTSIZE: | 1500 case EP_FONTSIZE: |
| 1528 » case EP_SCRIPTTYPE: | 1501 case EP_SCRIPTTYPE: |
| 1529 » case EP_CHARSPACE: | 1502 case EP_CHARSPACE: |
| 1530 » case EP_HORZSCALE: | 1503 case EP_HORZSCALE: |
| 1531 » case EP_BOLD: | 1504 case EP_BOLD: |
| 1532 » case EP_ITALIC: | 1505 case EP_ITALIC: |
| 1533 » » RearrangePart(wr); | 1506 RearrangePart(wr); |
| 1534 » » ScrollToCaret(); | 1507 ScrollToCaret(); |
| 1535 | 1508 |
| 1536 » » CPVT_WordRange wrRefresh(m_pVT->GetSectionBeginPlace(wr.BeginPos
), | 1509 CPVT_WordRange wrRefresh(m_pVT->GetSectionBeginPlace(wr.BeginPos), |
| 1537 » » » m_pVT->GetSectionEndPlace(wr.EndPos)); | 1510 m_pVT->GetSectionEndPlace(wr.EndPos)); |
| 1538 » » Refresh(RP_ANALYSE,&wrRefresh); | 1511 Refresh(RP_ANALYSE,&wrRefresh); |
| 1539 | 1512 |
| 1540 » » SetCaretOrigin(); | 1513 SetCaretOrigin(); |
| 1541 » » SetCaretInfo(); | 1514 SetCaretInfo(); |
| 1542 » » break; | 1515 break; |
| 1543 » } | 1516 } |
| 1544 } | 1517 } |
| 1545 | 1518 |
| 1546 FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, | 1519 FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, |
| 1547 const CPVT_SecProps *
pSecProps, const CPVT_WordProps * pWordProps, | 1520 const CPVT_SecProps * pSecProps, const CPVT_WordP
rops * pWordProps, |
| 1548 const CPVT_WordRange
& wr, FX_BOOL bAddUndo) | 1521 const CPVT_WordRange & wr, FX_BOOL bAddUndo) |
| 1549 { | 1522 { |
| 1550 if (m_pVT->IsValid() && m_pVT->IsRichText()) | 1523 if (m_pVT->IsValid() && m_pVT->IsRichText()) |
| 1551 { | 1524 { |
| 1552 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1525 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 1553 { | 1526 { |
| 1554 FX_BOOL bSet = FALSE; | 1527 FX_BOOL bSet = FALSE; |
| 1555 CPVT_Section secinfo; | 1528 CPVT_Section secinfo; |
| 1556 CPVT_Section OldSecinfo; | 1529 CPVT_Section OldSecinfo; |
| 1557 | 1530 |
| 1558 CPVT_WordPlace oldplace = pIterator->GetAt(); | 1531 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 1559 | 1532 |
| 1560 if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT
|| eProps == EP_ALIGNMENT) | 1533 if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT || eProps ==
EP_ALIGNMENT) |
| 1561 { | 1534 { |
| 1562 if (pSecProps) | 1535 if (pSecProps) |
| 1563 { | 1536 { |
| 1564 pIterator->SetAt(place); | 1537 pIterator->SetAt(place); |
| 1565 if (pIterator->GetSection(secinfo)) | 1538 if (pIterator->GetSection(secinfo)) |
| 1566 { | 1539 { |
| 1567 if (bAddUndo) OldSecinfo = secin
fo; | 1540 if (bAddUndo) OldSecinfo = secinfo; |
| 1568 | 1541 |
| 1569 switch(eProps) | 1542 switch(eProps) |
| 1570 { | 1543 { |
| 1571 case EP_LINELEADING: | 1544 case EP_LINELEADING: |
| 1572 if (!FX_EDIT_IsFloatEqua
l(secinfo.SecProps.fLineLeading,pSecProps->fLineLeading)) | 1545 if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineLead
ing,pSecProps->fLineLeading)) |
| 1573 { | 1546 { |
| 1574 secinfo.SecProps
.fLineLeading = pSecProps->fLineLeading; | 1547 secinfo.SecProps.fLineLeading = pSecProps->fLine
Leading; |
| 1575 bSet = TRUE; | 1548 bSet = TRUE; |
| 1576 } | 1549 } |
| 1577 break; | 1550 break; |
| 1578 case EP_LINEINDENT: | 1551 case EP_LINEINDENT: |
| 1579 if (!FX_EDIT_IsFloatEqua
l(secinfo.SecProps.fLineIndent,pSecProps->fLineIndent)) | 1552 if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineInde
nt,pSecProps->fLineIndent)) |
| 1580 { | 1553 { |
| 1581 secinfo.SecProps
.fLineIndent = pSecProps->fLineIndent; | 1554 secinfo.SecProps.fLineIndent = pSecProps->fLineI
ndent; |
| 1582 bSet = TRUE; | 1555 bSet = TRUE; |
| 1583 } | 1556 } |
| 1584 break; | 1557 break; |
| 1585 case EP_ALIGNMENT: | 1558 case EP_ALIGNMENT: |
| 1586 if (secinfo.SecProps.nAl
ignment != pSecProps->nAlignment) | 1559 if (secinfo.SecProps.nAlignment != pSecProps->nAlign
ment) |
| 1587 { | 1560 { |
| 1588 secinfo.SecProps
.nAlignment = pSecProps->nAlignment; | 1561 secinfo.SecProps.nAlignment = pSecProps->nAlignm
ent; |
| 1589 bSet = TRUE; | 1562 bSet = TRUE; |
| 1590 } | 1563 } |
| 1591 break; | 1564 break; |
| 1592 default: | 1565 default: |
| 1593 break; | 1566 break; |
| 1594 } | 1567 } |
| 1595 } | 1568 } |
| 1596 } | 1569 } |
| 1597 } | 1570 } |
| 1598 else | 1571 else |
| 1599 { | 1572 { |
| 1600 if (pWordProps && place == m_pVT->GetSectionBegi
nPlace(place)) | 1573 if (pWordProps && place == m_pVT->GetSectionBeginPlace(place)) |
| 1601 { | 1574 { |
| 1602 pIterator->SetAt(place); | 1575 pIterator->SetAt(place); |
| 1603 if (pIterator->GetSection(secinfo)) | 1576 if (pIterator->GetSection(secinfo)) |
| 1604 { | 1577 { |
| 1605 if (bAddUndo) OldSecinfo = secin
fo; | 1578 if (bAddUndo) OldSecinfo = secinfo; |
| 1606 | 1579 |
| 1607 switch(eProps) | 1580 switch(eProps) |
| 1608 { | 1581 { |
| 1609 case EP_FONTINDEX: | 1582 case EP_FONTINDEX: |
| 1610 if (secinfo.WordProps.nF
ontIndex != pWordProps->nFontIndex) | 1583 if (secinfo.WordProps.nFontIndex != pWordProps->nFon
tIndex) |
| 1611 { | 1584 { |
| 1612 secinfo.WordProp
s.nFontIndex = pWordProps->nFontIndex; | 1585 secinfo.WordProps.nFontIndex = pWordProps->nFont
Index; |
| 1613 bSet = TRUE; | 1586 bSet = TRUE; |
| 1614 } | 1587 } |
| 1615 break; | 1588 break; |
| 1616 case EP_FONTSIZE: | 1589 case EP_FONTSIZE: |
| 1617 if (!FX_EDIT_IsFloatEqua
l(secinfo.WordProps.fFontSize,pWordProps->fFontSize)) | 1590 if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fFontSiz
e,pWordProps->fFontSize)) |
| 1618 { | 1591 { |
| 1619 secinfo.WordProp
s.fFontSize = pWordProps->fFontSize; | 1592 secinfo.WordProps.fFontSize = pWordProps->fFontS
ize; |
| 1620 bSet = TRUE; | 1593 bSet = TRUE; |
| 1621 } | 1594 } |
| 1622 break; | 1595 break; |
| 1623 case EP_WORDCOLOR: | 1596 case EP_WORDCOLOR: |
| 1624 if (secinfo.WordProps.dw
WordColor != pWordProps->dwWordColor) | 1597 if (secinfo.WordProps.dwWordColor != pWordProps->dwW
ordColor) |
| 1625 { | 1598 { |
| 1626 secinfo.WordProp
s.dwWordColor = pWordProps->dwWordColor; | 1599 secinfo.WordProps.dwWordColor = pWordProps->dwWo
rdColor; |
| 1627 bSet = TRUE; | 1600 bSet = TRUE; |
| 1628 } | 1601 } |
| 1629 break; | 1602 break; |
| 1630 case EP_SCRIPTTYPE: | 1603 case EP_SCRIPTTYPE: |
| 1631 if (secinfo.WordProps.nS
criptType != pWordProps->nScriptType) | 1604 if (secinfo.WordProps.nScriptType != pWordProps->nSc
riptType) |
| 1632 { | 1605 { |
| 1633 secinfo.WordProp
s.nScriptType = pWordProps->nScriptType; | 1606 secinfo.WordProps.nScriptType = pWordProps->nScr
iptType; |
| 1634 bSet = TRUE; | 1607 bSet = TRUE; |
| 1635 } | 1608 } |
| 1636 break; | 1609 break; |
| 1637 case EP_CHARSPACE: | 1610 case EP_CHARSPACE: |
| 1638 if (!FX_EDIT_IsFloatEqua
l(secinfo.WordProps.fCharSpace,pWordProps->fCharSpace)) | 1611 if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fCharSpa
ce,pWordProps->fCharSpace)) |
| 1639 { | 1612 { |
| 1640 secinfo.WordProp
s.fCharSpace = pWordProps->fCharSpace; | 1613 secinfo.WordProps.fCharSpace = pWordProps->fChar
Space; |
| 1641 bSet = TRUE; | 1614 bSet = TRUE; |
| 1642 } | 1615 } |
| 1643 break; | 1616 break; |
| 1644 case EP_HORZSCALE: | 1617 case EP_HORZSCALE: |
| 1645 if (secinfo.WordProps.nH
orzScale != pWordProps->nHorzScale) | 1618 if (secinfo.WordProps.nHorzScale != pWordProps->nHor
zScale) |
| 1646 { | 1619 { |
| 1647 secinfo.WordProp
s.nHorzScale = pWordProps->nHorzScale; | 1620 secinfo.WordProps.nHorzScale = pWordProps->nHorz
Scale; |
| 1648 bSet = TRUE; | 1621 bSet = TRUE; |
| 1649 } | 1622 } |
| 1650 break; | 1623 break; |
| 1651 case EP_UNDERLINE: | 1624 case EP_UNDERLINE: |
| 1652 if (pWordProps->nWordSty
le & PVTWORD_STYLE_UNDERLINE) | 1625 if (pWordProps->nWordStyle & PVTWORD_STYLE_UNDERLINE
) |
| 1653 { | 1626 { |
| 1654 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) | 1627 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL
E_UNDERLINE) == 0) |
| 1655 { | 1628 { |
| 1656 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; | 1629 secinfo.WordProps.nWordStyle |= PVTWORD_STYL
E_UNDERLINE; |
| 1657 bSet = T
RUE; | 1630 bSet = TRUE; |
| 1658 } | 1631 } |
| 1659 } | 1632 } |
| 1660 else | 1633 else |
| 1661 { | 1634 { |
| 1662 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) != 0) | 1635 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL
E_UNDERLINE) != 0) |
| 1663 { | 1636 { |
| 1664 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_UNDERLINE; | 1637 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY
LE_UNDERLINE; |
| 1665 bSet = T
RUE; | 1638 bSet = TRUE; |
| 1666 } | 1639 } |
| 1667 } | 1640 } |
| 1668 break; | 1641 break; |
| 1669 case EP_CROSSOUT: | 1642 case EP_CROSSOUT: |
| 1670 if (pWordProps->nWordSty
le & PVTWORD_STYLE_CROSSOUT) | 1643 if (pWordProps->nWordStyle & PVTWORD_STYLE_CROSSOUT) |
| 1671 { | 1644 { |
| 1672 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) | 1645 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL
E_CROSSOUT) == 0) |
| 1673 { | 1646 { |
| 1674 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; | 1647 secinfo.WordProps.nWordStyle |= PVTWORD_STYL
E_CROSSOUT; |
| 1675 bSet = T
RUE; | 1648 bSet = TRUE; |
| 1676 } | 1649 } |
| 1677 } | 1650 } |
| 1678 else | 1651 else |
| 1679 { | 1652 { |
| 1680 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) != 0) | 1653 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL
E_CROSSOUT) != 0) |
| 1681 { | 1654 { |
| 1682 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_CROSSOUT; | 1655 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY
LE_CROSSOUT; |
| 1683 bSet = T
RUE; | 1656 bSet = TRUE; |
| 1684 } | 1657 } |
| 1685 } | 1658 } |
| 1686 break; | 1659 break; |
| 1687 case EP_BOLD: | 1660 case EP_BOLD: |
| 1688 if (pWordProps->nWordSty
le & PVTWORD_STYLE_BOLD) | 1661 if (pWordProps->nWordStyle & PVTWORD_STYLE_BOLD) |
| 1689 { | 1662 { |
| 1690 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) | 1663 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL
E_BOLD) == 0) |
| 1691 { | 1664 { |
| 1692 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; | 1665 secinfo.WordProps.nWordStyle |= PVTWORD_STYL
E_BOLD; |
| 1693 bSet = T
RUE; | 1666 bSet = TRUE; |
| 1694 } | 1667 } |
| 1695 } | 1668 } |
| 1696 else | 1669 else |
| 1697 { | 1670 { |
| 1698 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_BOLD) != 0) | 1671 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL
E_BOLD) != 0) |
| 1699 { | 1672 { |
| 1700 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_BOLD; | 1673 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY
LE_BOLD; |
| 1701 bSet = T
RUE; | 1674 bSet = TRUE; |
| 1702 } | 1675 } |
| 1703 } | 1676 } |
| 1704 break; | 1677 break; |
| 1705 case EP_ITALIC: | 1678 case EP_ITALIC: |
| 1706 if (pWordProps->nWordSty
le & PVTWORD_STYLE_ITALIC) | 1679 if (pWordProps->nWordStyle & PVTWORD_STYLE_ITALIC) |
| 1707 { | 1680 { |
| 1708 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) | 1681 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL
E_ITALIC) == 0) |
| 1709 { | 1682 { |
| 1710 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; | 1683 secinfo.WordProps.nWordStyle |= PVTWORD_STYL
E_ITALIC; |
| 1711 bSet = T
RUE; | 1684 bSet = TRUE; |
| 1712 } | 1685 } |
| 1713 } | 1686 } |
| 1714 else | 1687 else |
| 1715 { | 1688 { |
| 1716 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_ITALIC) != 0) | 1689 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL
E_ITALIC) != 0) |
| 1717 { | 1690 { |
| 1718 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_ITALIC; | 1691 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY
LE_ITALIC; |
| 1719 bSet = T
RUE; | 1692 bSet = TRUE; |
| 1720 } | 1693 } |
| 1721 } | 1694 } |
| 1722 break; | 1695 break; |
| 1723 default: | 1696 default: |
| 1724 break; | 1697 break; |
| 1725 } | 1698 } |
| 1726 } | 1699 } |
| 1727 } | 1700 } |
| 1728 } | 1701 } |
| 1729 | 1702 |
| 1730 if (bSet) | 1703 if (bSet) |
| 1731 { | 1704 { |
| 1732 pIterator->SetSection(secinfo); | 1705 pIterator->SetSection(secinfo); |
| 1733 | 1706 |
| 1734 if (bAddUndo && m_bEnableUndo) | 1707 if (bAddUndo && m_bEnableUndo) |
| 1735 { | 1708 { |
| 1736 AddEditUndoItem(new CFXEU_SetSecProps | 1709 AddEditUndoItem(new CFXEU_SetSecProps |
| 1737 (this,place,eProps,OldSecinfo.Se
cProps,OldSecinfo.WordProps,secinfo.SecProps,secinfo.WordProps,wr)); | 1710 (this,place,eProps,OldSecinfo.SecProps,OldSecinfo.WordPr
ops,secinfo.SecProps,secinfo.WordProps,wr)); |
| 1738 } | 1711 } |
| 1739 } | 1712 } |
| 1740 | 1713 |
| 1741 pIterator->SetAt(oldplace); | 1714 pIterator->SetAt(oldplace); |
| 1742 | 1715 |
| 1743 return bSet; | 1716 return bSet; |
| 1744 } | 1717 } |
| 1745 } | 1718 } |
| 1746 | 1719 |
| 1747 return FALSE; | 1720 return FALSE; |
| 1748 } | 1721 } |
| 1749 | 1722 |
| 1750 FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place
, | 1723 FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place
, |
| 1751 const CPVT_WordP
rops * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo) | 1724 const CPVT_WordProps * pWordProps, const CPVT_Wo
rdRange & wr, FX_BOOL bAddUndo) |
| 1752 { | 1725 { |
| 1753 if (m_pVT->IsValid() && m_pVT->IsRichText()) | 1726 if (m_pVT->IsValid() && m_pVT->IsRichText()) |
| 1754 { | 1727 { |
| 1755 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1728 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 1756 { | 1729 { |
| 1757 FX_BOOL bSet = FALSE; | 1730 FX_BOOL bSet = FALSE; |
| 1758 CPVT_Word wordinfo; | 1731 CPVT_Word wordinfo; |
| 1759 CPVT_Word OldWordinfo; | 1732 CPVT_Word OldWordinfo; |
| 1760 | 1733 |
| 1761 CPVT_WordPlace oldplace = pIterator->GetAt(); | 1734 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 1762 | 1735 |
| 1763 if (pWordProps) | 1736 if (pWordProps) |
| 1764 { | 1737 { |
| 1765 pIterator->SetAt(place); | 1738 pIterator->SetAt(place); |
| 1766 if (pIterator->GetWord(wordinfo)) | 1739 if (pIterator->GetWord(wordinfo)) |
| 1767 { | 1740 { |
| 1768 if (bAddUndo) OldWordinfo = wordinfo; | 1741 if (bAddUndo) OldWordinfo = wordinfo; |
| 1769 | 1742 |
| 1770 switch(eProps) | 1743 switch(eProps) |
| 1771 { | 1744 { |
| 1772 case EP_FONTINDEX: | 1745 case EP_FONTINDEX: |
| 1773 if (wordinfo.WordProps.nFontInde
x != pWordProps->nFontIndex) | 1746 if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIn
dex) |
| 1774 { | 1747 { |
| 1775 if (IFX_Edit_FontMap* pF
ontMap = GetFontMap()) | 1748 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) |
| 1776 { | 1749 { |
| 1777 wordinfo.WordPro
ps.nFontIndex = pFontMap->GetWordFontIndex(wordinfo.Word,wordinfo.nCharset,pWord
Props->nFontIndex); | 1750 wordinfo.WordProps.nFontIndex = pFontMap->GetWor
dFontIndex(wordinfo.Word,wordinfo.nCharset,pWordProps->nFontIndex); |
| 1778 } | 1751 } |
| 1779 bSet = TRUE; | 1752 bSet = TRUE; |
| 1780 } | 1753 } |
| 1781 break; | 1754 break; |
| 1782 case EP_FONTSIZE: | 1755 case EP_FONTSIZE: |
| 1783 if (!FX_EDIT_IsFloatEqual(wordin
fo.WordProps.fFontSize,pWordProps->fFontSize)) | 1756 if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fFontSize,p
WordProps->fFontSize)) |
| 1784 { | 1757 { |
| 1785 wordinfo.WordProps.fFont
Size = pWordProps->fFontSize; | 1758 wordinfo.WordProps.fFontSize = pWordProps->fFontSize
; |
| 1786 bSet = TRUE; | 1759 bSet = TRUE; |
| 1787 } | 1760 } |
| 1788 break; | 1761 break; |
| 1789 case EP_WORDCOLOR: | 1762 case EP_WORDCOLOR: |
| 1790 if (wordinfo.WordProps.dwWordCol
or != pWordProps->dwWordColor) | 1763 if (wordinfo.WordProps.dwWordColor != pWordProps->dwWord
Color) |
| 1791 { | 1764 { |
| 1792 wordinfo.WordProps.dwWor
dColor = pWordProps->dwWordColor; | 1765 wordinfo.WordProps.dwWordColor = pWordProps->dwWordC
olor; |
| 1793 bSet = TRUE; | 1766 bSet = TRUE; |
| 1794 } | 1767 } |
| 1795 break; | 1768 break; |
| 1796 case EP_SCRIPTTYPE: | 1769 case EP_SCRIPTTYPE: |
| 1797 if (wordinfo.WordProps.nScriptTy
pe != pWordProps->nScriptType) | 1770 if (wordinfo.WordProps.nScriptType != pWordProps->nScrip
tType) |
| 1798 { | 1771 { |
| 1799 wordinfo.WordProps.nScri
ptType = pWordProps->nScriptType; | 1772 wordinfo.WordProps.nScriptType = pWordProps->nScript
Type; |
| 1800 bSet = TRUE; | 1773 bSet = TRUE; |
| 1801 } | 1774 } |
| 1802 break; | 1775 break; |
| 1803 case EP_CHARSPACE: | 1776 case EP_CHARSPACE: |
| 1804 if (!FX_EDIT_IsFloatEqual(wordin
fo.WordProps.fCharSpace,pWordProps->fCharSpace)) | 1777 if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fCharSpace,
pWordProps->fCharSpace)) |
| 1805 { | 1778 { |
| 1806 wordinfo.WordProps.fChar
Space = pWordProps->fCharSpace; | 1779 wordinfo.WordProps.fCharSpace = pWordProps->fCharSpa
ce; |
| 1807 bSet = TRUE; | 1780 bSet = TRUE; |
| 1808 } | 1781 } |
| 1809 break; | 1782 break; |
| 1810 case EP_HORZSCALE: | 1783 case EP_HORZSCALE: |
| 1811 if (wordinfo.WordProps.nHorzScal
e != pWordProps->nHorzScale) | 1784 if (wordinfo.WordProps.nHorzScale != pWordProps->nHorzSc
ale) |
| 1812 { | 1785 { |
| 1813 wordinfo.WordProps.nHorz
Scale = pWordProps->nHorzScale; | 1786 wordinfo.WordProps.nHorzScale = pWordProps->nHorzSca
le; |
| 1814 bSet = TRUE; | 1787 bSet = TRUE; |
| 1815 } | 1788 } |
| 1816 break; | 1789 break; |
| 1817 case EP_UNDERLINE: | 1790 case EP_UNDERLINE: |
| 1818 if (pWordProps->nWordStyle & PVT
WORD_STYLE_UNDERLINE) | 1791 if (pWordProps->nWordStyle & PVTWORD_STYLE_UNDERLINE) |
| 1819 { | 1792 { |
| 1820 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) | 1793 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_U
NDERLINE) == 0) |
| 1821 { | 1794 { |
| 1822 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; | 1795 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_U
NDERLINE; |
| 1823 bSet = TRUE; | 1796 bSet = TRUE; |
| 1824 } | 1797 } |
| 1825 } | 1798 } |
| 1826 else | 1799 else |
| 1827 { | 1800 { |
| 1828 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_UNDERLINE) != 0) | 1801 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_U
NDERLINE) != 0) |
| 1829 { | 1802 { |
| 1830 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_UNDERLINE; | 1803 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_
UNDERLINE; |
| 1831 bSet = TRUE; | 1804 bSet = TRUE; |
| 1832 } | 1805 } |
| 1833 } | 1806 } |
| 1834 break; | 1807 break; |
| 1835 case EP_CROSSOUT: | 1808 case EP_CROSSOUT: |
| 1836 if (pWordProps->nWordStyle & PVT
WORD_STYLE_CROSSOUT) | 1809 if (pWordProps->nWordStyle & PVTWORD_STYLE_CROSSOUT) |
| 1837 { | 1810 { |
| 1838 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) | 1811 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_C
ROSSOUT) == 0) |
| 1839 { | 1812 { |
| 1840 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; | 1813 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_C
ROSSOUT; |
| 1841 bSet = TRUE; | 1814 bSet = TRUE; |
| 1842 } | 1815 } |
| 1843 } | 1816 } |
| 1844 else | 1817 else |
| 1845 { | 1818 { |
| 1846 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_CROSSOUT) != 0) | 1819 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_C
ROSSOUT) != 0) |
| 1847 { | 1820 { |
| 1848 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_CROSSOUT; | 1821 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_
CROSSOUT; |
| 1849 bSet = TRUE; | 1822 bSet = TRUE; |
| 1850 } | 1823 } |
| 1851 } | 1824 } |
| 1852 break; | 1825 break; |
| 1853 case EP_BOLD: | 1826 case EP_BOLD: |
| 1854 if (pWordProps->nWordStyle & PVT
WORD_STYLE_BOLD) | 1827 if (pWordProps->nWordStyle & PVTWORD_STYLE_BOLD) |
| 1855 { | 1828 { |
| 1856 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_BOLD) == 0) | 1829 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_B
OLD) == 0) |
| 1857 { | 1830 { |
| 1858 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_BOLD; | 1831 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_B
OLD; |
| 1859 bSet = TRUE; | 1832 bSet = TRUE; |
| 1860 } | 1833 } |
| 1861 } | 1834 } |
| 1862 else | 1835 else |
| 1863 { | 1836 { |
| 1864 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_BOLD) != 0) | 1837 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_B
OLD) != 0) |
| 1865 { | 1838 { |
| 1866 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_BOLD; | 1839 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_
BOLD; |
| 1867 bSet = TRUE; | 1840 bSet = TRUE; |
| 1868 } | 1841 } |
| 1869 } | 1842 } |
| 1870 break; | 1843 break; |
| 1871 case EP_ITALIC: | 1844 case EP_ITALIC: |
| 1872 if (pWordProps->nWordStyle & PVT
WORD_STYLE_ITALIC) | 1845 if (pWordProps->nWordStyle & PVTWORD_STYLE_ITALIC) |
| 1873 { | 1846 { |
| 1874 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_ITALIC) == 0) | 1847 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_I
TALIC) == 0) |
| 1875 { | 1848 { |
| 1876 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_ITALIC; | 1849 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_I
TALIC; |
| 1877 bSet = TRUE; | 1850 bSet = TRUE; |
| 1878 } | 1851 } |
| 1879 } | 1852 } |
| 1880 else | 1853 else |
| 1881 { | 1854 { |
| 1882 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_ITALIC) != 0) | 1855 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_I
TALIC) != 0) |
| 1883 { | 1856 { |
| 1884 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_ITALIC; | 1857 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_
ITALIC; |
| 1885 bSet = TRUE; | 1858 bSet = TRUE; |
| 1886 } | 1859 } |
| 1887 } | 1860 } |
| 1888 break; | 1861 break; |
| 1889 default: | 1862 default: |
| 1890 break; | 1863 break; |
| 1891 } | 1864 } |
| 1892 } | 1865 } |
| 1893 } | 1866 } |
| 1894 | 1867 |
| 1895 if (bSet) | 1868 if (bSet) |
| 1896 { | 1869 { |
| 1897 pIterator->SetWord(wordinfo); | 1870 pIterator->SetWord(wordinfo); |
| 1898 | 1871 |
| 1899 if (bAddUndo && m_bEnableUndo) | 1872 if (bAddUndo && m_bEnableUndo) |
| 1900 { | 1873 { |
| 1901 AddEditUndoItem(new CFXEU_SetWordProps | 1874 AddEditUndoItem(new CFXEU_SetWordProps |
| 1902 (this,place,eProps,OldWordinfo.W
ordProps,wordinfo.WordProps,wr)); | 1875 (this,place,eProps,OldWordinfo.WordProps,wordinfo.WordPr
ops,wr)); |
| 1903 } | 1876 } |
| 1904 } | 1877 } |
| 1905 | 1878 |
| 1906 pIterator->SetAt(oldplace); | 1879 pIterator->SetAt(oldplace); |
| 1907 return bSet; | 1880 return bSet; |
| 1908 } | 1881 } |
| 1909 } | 1882 } |
| 1910 | 1883 |
| 1911 return FALSE; | 1884 return FALSE; |
| 1912 } | 1885 } |
| 1913 | 1886 |
| 1914 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset /*= DEFAULT_CHARSET*
/, | 1887 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset /*= DEFAULT_CHARSET*
/, |
| 1915 » » » » » » const CPVT_SecProps * pSecProps
/*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) | 1888 const CPVT_SecProps * pSecProps /*= NULL*/,const CPVT_Wo
rdProps * pWordProps /*= NULL*/) |
| 1916 { | 1889 { |
| 1917 » SetText(text,charset,pSecProps,pWordProps,TRUE,TRUE); | 1890 SetText(text,charset,pSecProps,pWordProps,TRUE,TRUE); |
| 1918 } | 1891 } |
| 1919 | 1892 |
| 1920 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset /*= DEFAULT_CHARSET*/
, const CPVT_WordProps * pWordProps /*= NULL*/) | 1893 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset /*= DEFAULT_CHARSET*/
, const CPVT_WordProps * pWordProps /*= NULL*/) |
| 1921 { | 1894 { |
| 1922 » return InsertWord(word,charset,pWordProps,TRUE,TRUE); | 1895 return InsertWord(word,charset,pWordProps,TRUE,TRUE); |
| 1923 } | 1896 } |
| 1924 | 1897 |
| 1925 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps /*= NULL*/,const
CPVT_WordProps * pWordProps /*= NULL*/) | 1898 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps /*= NULL*/,const
CPVT_WordProps * pWordProps /*= NULL*/) |
| 1926 { | 1899 { |
| 1927 » return InsertReturn(pSecProps,pWordProps,TRUE,TRUE); | 1900 return InsertReturn(pSecProps,pWordProps,TRUE,TRUE); |
| 1928 } | 1901 } |
| 1929 | 1902 |
| 1930 FX_BOOL CFX_Edit::Backspace() | 1903 FX_BOOL CFX_Edit::Backspace() |
| 1931 { | 1904 { |
| 1932 » return Backspace(TRUE,TRUE); | 1905 return Backspace(TRUE,TRUE); |
| 1933 } | 1906 } |
| 1934 | 1907 |
| 1935 FX_BOOL CFX_Edit::Delete() | 1908 FX_BOOL CFX_Edit::Delete() |
| 1936 { | 1909 { |
| 1937 » return Delete(TRUE,TRUE); | 1910 return Delete(TRUE,TRUE); |
| 1938 } | 1911 } |
| 1939 | 1912 |
| 1940 FX_BOOL CFX_Edit::Clear() | 1913 FX_BOOL CFX_Edit::Clear() |
| 1941 { | 1914 { |
| 1942 » return Clear(TRUE,TRUE); | 1915 return Clear(TRUE,TRUE); |
| 1943 } | 1916 } |
| 1944 | 1917 |
| 1945 FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset /*= DEFAULT_C
HARSET*/, | 1918 FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset /*= DEFAULT_C
HARSET*/, |
| 1946 » » » » » » » » const CPVT_SecPr
ops * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) | 1919 const CPVT_SecProps * pSecProps /*= NULL*/,const
CPVT_WordProps * pWordProps /*= NULL*/) |
| 1947 { | 1920 { |
| 1948 » return InsertText(text,charset,pSecProps,pWordProps,TRUE,TRUE); | 1921 return InsertText(text,charset,pSecProps,pWordProps,TRUE,TRUE); |
| 1949 } | 1922 } |
| 1950 | 1923 |
| 1951 FX_FLOAT CFX_Edit::GetFontSize() const | 1924 FX_FLOAT CFX_Edit::GetFontSize() const |
| 1952 { | 1925 { |
| 1953 » return m_pVT->GetFontSize(); | 1926 return m_pVT->GetFontSize(); |
| 1954 } | 1927 } |
| 1955 | 1928 |
| 1956 FX_WORD CFX_Edit::GetPasswordChar() const | 1929 FX_WORD CFX_Edit::GetPasswordChar() const |
| 1957 { | 1930 { |
| 1958 » return m_pVT->GetPasswordChar(); | 1931 return m_pVT->GetPasswordChar(); |
| 1959 } | 1932 } |
| 1960 | 1933 |
| 1961 int32_t CFX_Edit::GetCharArray() const | 1934 int32_t CFX_Edit::GetCharArray() const |
| 1962 { | 1935 { |
| 1963 » return m_pVT->GetCharArray(); | 1936 return m_pVT->GetCharArray(); |
| 1964 } | 1937 } |
| 1965 | 1938 |
| 1966 CPDF_Rect CFX_Edit::GetPlateRect() const | 1939 CPDF_Rect CFX_Edit::GetPlateRect() const |
| 1967 { | 1940 { |
| 1968 » return m_pVT->GetPlateRect(); | 1941 return m_pVT->GetPlateRect(); |
| 1969 } | 1942 } |
| 1970 | 1943 |
| 1971 CPDF_Rect CFX_Edit::GetContentRect() const | 1944 CPDF_Rect CFX_Edit::GetContentRect() const |
| 1972 { | 1945 { |
| 1973 » return VTToEdit(m_pVT->GetContentRect()); | 1946 return VTToEdit(m_pVT->GetContentRect()); |
| 1974 } | 1947 } |
| 1975 | 1948 |
| 1976 int32_t CFX_Edit::GetHorzScale() const | 1949 int32_t CFX_Edit::GetHorzScale() const |
| 1977 { | 1950 { |
| 1978 » return m_pVT->GetHorzScale(); | 1951 return m_pVT->GetHorzScale(); |
| 1979 } | 1952 } |
| 1980 | 1953 |
| 1981 FX_FLOAT CFX_Edit::GetCharSpace() const | 1954 FX_FLOAT CFX_Edit::GetCharSpace() const |
| 1982 { | 1955 { |
| 1983 » return m_pVT->GetCharSpace(); | 1956 return m_pVT->GetCharSpace(); |
| 1984 } | 1957 } |
| 1985 | 1958 |
| 1986 // inner methods | 1959 // inner methods |
| 1987 | 1960 |
| 1988 CPVT_WordRange CFX_Edit::GetWholeWordRange() const | 1961 CPVT_WordRange CFX_Edit::GetWholeWordRange() const |
| 1989 { | 1962 { |
| 1990 » if (m_pVT->IsValid()) | 1963 if (m_pVT->IsValid()) |
| 1991 » » return CPVT_WordRange(m_pVT->GetBeginWordPlace(),m_pVT->GetEndWo
rdPlace()); | 1964 return CPVT_WordRange(m_pVT->GetBeginWordPlace(),m_pVT->GetEndWordPlace(
)); |
| 1992 | 1965 |
| 1993 » return CPVT_WordRange(); | 1966 return CPVT_WordRange(); |
| 1994 } | 1967 } |
| 1995 | 1968 |
| 1996 CPVT_WordRange CFX_Edit::GetVisibleWordRange() const | 1969 CPVT_WordRange CFX_Edit::GetVisibleWordRange() const |
| 1997 { | 1970 { |
| 1998 » if (m_bEnableOverflow) return GetWholeWordRange(); | 1971 if (m_bEnableOverflow) return GetWholeWordRange(); |
| 1999 | 1972 |
| 2000 » if (m_pVT->IsValid()) | 1973 if (m_pVT->IsValid()) |
| 2001 » { | 1974 { |
| 2002 » » CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 1975 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 2003 | 1976 |
| 2004 » » CPVT_WordPlace place1 = m_pVT->SearchWordPlace(EditToVT(CPDF_Poi
nt(rcPlate.left,rcPlate.top))); | 1977 CPVT_WordPlace place1 = m_pVT->SearchWordPlace(EditToVT(CPDF_Point(rcPla
te.left,rcPlate.top))); |
| 2005 » » CPVT_WordPlace place2 = m_pVT->SearchWordPlace(EditToVT(CPDF_Poi
nt(rcPlate.right,rcPlate.bottom))); | 1978 CPVT_WordPlace place2 = m_pVT->SearchWordPlace(EditToVT(CPDF_Point(rcPla
te.right,rcPlate.bottom))); |
| 2006 | 1979 |
| 2007 » » return CPVT_WordRange(place1,place2); | 1980 return CPVT_WordRange(place1,place2); |
| 2008 » } | 1981 } |
| 2009 | 1982 |
| 2010 » return CPVT_WordRange(); | 1983 return CPVT_WordRange(); |
| 2011 } | 1984 } |
| 2012 | 1985 |
| 2013 CPVT_WordPlace CFX_Edit::SearchWordPlace(const CPDF_Point& point) const | 1986 CPVT_WordPlace CFX_Edit::SearchWordPlace(const CPDF_Point& point) const |
| 2014 { | 1987 { |
| 2015 » if (m_pVT->IsValid()) | 1988 if (m_pVT->IsValid()) |
| 2016 » { | 1989 { |
| 2017 » » return m_pVT->SearchWordPlace(EditToVT(point)); | 1990 return m_pVT->SearchWordPlace(EditToVT(point)); |
| 2018 » } | 1991 } |
| 2019 | 1992 |
| 2020 » return CPVT_WordPlace(); | 1993 return CPVT_WordPlace(); |
| 2021 } | 1994 } |
| 2022 | 1995 |
| 2023 void CFX_Edit::Paint() | 1996 void CFX_Edit::Paint() |
| 2024 { | 1997 { |
| 2025 » if (m_pVT->IsValid()) | 1998 if (m_pVT->IsValid()) |
| 2026 » { | 1999 { |
| 2027 » » RearrangeAll(); | 2000 RearrangeAll(); |
| 2028 » » ScrollToCaret(); | 2001 ScrollToCaret(); |
| 2029 » » Refresh(RP_NOANALYSE); | 2002 Refresh(RP_NOANALYSE); |
| 2030 » » SetCaretOrigin(); | 2003 SetCaretOrigin(); |
| 2031 » » SetCaretInfo(); | 2004 SetCaretInfo(); |
| 2032 » } | 2005 } |
| 2033 } | 2006 } |
| 2034 | 2007 |
| 2035 void CFX_Edit::RearrangeAll() | 2008 void CFX_Edit::RearrangeAll() |
| 2036 { | 2009 { |
| 2037 » if (m_pVT->IsValid()) | 2010 if (m_pVT->IsValid()) |
| 2038 » { | 2011 { |
| 2039 » » m_pVT->UpdateWordPlace(m_wpCaret); | 2012 m_pVT->UpdateWordPlace(m_wpCaret); |
| 2040 » » m_pVT->RearrangeAll(); | 2013 m_pVT->RearrangeAll(); |
| 2041 » » m_pVT->UpdateWordPlace(m_wpCaret); | 2014 m_pVT->UpdateWordPlace(m_wpCaret); |
| 2042 » » SetScrollInfo(); | 2015 SetScrollInfo(); |
| 2043 » » SetContentChanged(); | 2016 SetContentChanged(); |
| 2044 » } | 2017 } |
| 2045 } | 2018 } |
| 2046 | 2019 |
| 2047 void CFX_Edit::RearrangePart(const CPVT_WordRange & range) | 2020 void CFX_Edit::RearrangePart(const CPVT_WordRange & range) |
| 2048 { | 2021 { |
| 2049 » if (m_pVT->IsValid()) | 2022 if (m_pVT->IsValid()) |
| 2050 » { | 2023 { |
| 2051 » » m_pVT->UpdateWordPlace(m_wpCaret); | 2024 m_pVT->UpdateWordPlace(m_wpCaret); |
| 2052 » » m_pVT->RearrangePart(range); | 2025 m_pVT->RearrangePart(range); |
| 2053 » » m_pVT->UpdateWordPlace(m_wpCaret); | 2026 m_pVT->UpdateWordPlace(m_wpCaret); |
| 2054 » » SetScrollInfo(); | 2027 SetScrollInfo(); |
| 2055 » » SetContentChanged(); | 2028 SetContentChanged(); |
| 2056 » } | 2029 } |
| 2057 } | 2030 } |
| 2058 | 2031 |
| 2059 void CFX_Edit::SetContentChanged() | 2032 void CFX_Edit::SetContentChanged() |
| 2060 { | 2033 { |
| 2061 » if (m_bNotify && m_pNotify) | 2034 if (m_bNotify && m_pNotify) |
| 2062 » { | 2035 { |
| 2063 » » CPDF_Rect rcContent = m_pVT->GetContentRect(); | 2036 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 2064 » » if (rcContent.Width() != m_rcOldContent.Width() || | 2037 if (rcContent.Width() != m_rcOldContent.Width() || |
| 2065 » » » rcContent.Height() != m_rcOldContent.Height()) | 2038 rcContent.Height() != m_rcOldContent.Height()) |
| 2066 » » { | 2039 { |
| 2067 » » » if (!m_bNotifyFlag) | 2040 if (!m_bNotifyFlag) |
| 2068 » » » { | 2041 { |
| 2069 » » » » m_bNotifyFlag = TRUE; | 2042 m_bNotifyFlag = TRUE; |
| 2070 » » » » m_pNotify->IOnContentChange(rcContent); | 2043 m_pNotify->IOnContentChange(rcContent); |
| 2071 » » » » m_bNotifyFlag = FALSE; | 2044 m_bNotifyFlag = FALSE; |
| 2072 » » » } | 2045 } |
| 2073 » » » m_rcOldContent = rcContent; | 2046 m_rcOldContent = rcContent; |
| 2074 » » } | 2047 } |
| 2075 » } | 2048 } |
| 2076 } | 2049 } |
| 2077 | 2050 |
| 2078 void CFX_Edit::SelectAll() | 2051 void CFX_Edit::SelectAll() |
| 2079 { | 2052 { |
| 2080 » if (m_pVT->IsValid()) | 2053 if (m_pVT->IsValid()) |
| 2081 » { | 2054 { |
| 2082 » » m_SelState = GetWholeWordRange(); | 2055 m_SelState = GetWholeWordRange(); |
| 2083 » » SetCaret(m_SelState.EndPos); | 2056 SetCaret(m_SelState.EndPos); |
| 2084 | 2057 |
| 2085 » » ScrollToCaret(); | 2058 ScrollToCaret(); |
| 2086 » » CPVT_WordRange wrVisible = GetVisibleWordRange(); | 2059 CPVT_WordRange wrVisible = GetVisibleWordRange(); |
| 2087 » » Refresh(RP_OPTIONAL,&wrVisible); | 2060 Refresh(RP_OPTIONAL,&wrVisible); |
| 2088 » » SetCaretInfo(); | 2061 SetCaretInfo(); |
| 2089 » } | 2062 } |
| 2090 } | 2063 } |
| 2091 | 2064 |
| 2092 void CFX_Edit::SelectNone() | 2065 void CFX_Edit::SelectNone() |
| 2093 { | 2066 { |
| 2094 » if (m_pVT->IsValid()) | 2067 if (m_pVT->IsValid()) |
| 2095 » { | 2068 { |
| 2096 » » if (m_SelState.IsExist()) | 2069 if (m_SelState.IsExist()) |
| 2097 » » { | 2070 { |
| 2098 » » » CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); | 2071 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); |
| 2099 » » » m_SelState.Default(); | 2072 m_SelState.Default(); |
| 2100 » » » Refresh(RP_OPTIONAL,&wrTemp); | 2073 Refresh(RP_OPTIONAL,&wrTemp); |
| 2101 » » } | 2074 } |
| 2102 » } | 2075 } |
| 2103 } | 2076 } |
| 2104 | 2077 |
| 2105 FX_BOOL»CFX_Edit::IsSelected() const | 2078 FX_BOOL CFX_Edit::IsSelected() const |
| 2106 { | 2079 { |
| 2107 » return m_SelState.IsExist(); | 2080 return m_SelState.IsExist(); |
| 2108 } | 2081 } |
| 2109 | 2082 |
| 2110 CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const | 2083 CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const |
| 2111 { | 2084 { |
| 2112 » CPDF_Rect rcContent = m_pVT->GetContentRect(); | 2085 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 2113 » CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 2086 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 2114 | 2087 |
| 2115 » FX_FLOAT fPadding = 0.0f; | 2088 FX_FLOAT fPadding = 0.0f; |
| 2116 | 2089 |
| 2117 » switch (m_nAlignment) | 2090 switch (m_nAlignment) |
| 2118 » { | 2091 { |
| 2119 » case 0: | 2092 case 0: |
| 2120 » » fPadding = 0.0f; | 2093 fPadding = 0.0f; |
| 2121 » » break; | 2094 break; |
| 2122 » case 1: | 2095 case 1: |
| 2123 » » fPadding = (rcPlate.Height() - rcContent.Height()) * 0.5f; | 2096 fPadding = (rcPlate.Height() - rcContent.Height()) * 0.5f; |
| 2124 » » break; | 2097 break; |
| 2125 » case 2: | 2098 case 2: |
| 2126 » » fPadding = rcPlate.Height() - rcContent.Height(); | 2099 fPadding = rcPlate.Height() - rcContent.Height(); |
| 2127 » » break; | 2100 break; |
| 2128 » } | 2101 } |
| 2129 | 2102 |
| 2130 » return CPDF_Point(point.x - (m_ptScrollPos.x - rcPlate.left), | 2103 return CPDF_Point(point.x - (m_ptScrollPos.x - rcPlate.left), |
| 2131 » » point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); | 2104 point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); |
| 2132 } | 2105 } |
| 2133 | 2106 |
| 2134 CPDF_Point CFX_Edit::EditToVT(const CPDF_Point & point) const | 2107 CPDF_Point CFX_Edit::EditToVT(const CPDF_Point & point) const |
| 2135 { | 2108 { |
| 2136 » CPDF_Rect rcContent = m_pVT->GetContentRect(); | 2109 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 2137 » CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 2110 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 2138 | 2111 |
| 2139 » FX_FLOAT fPadding = 0.0f; | 2112 FX_FLOAT fPadding = 0.0f; |
| 2140 | 2113 |
| 2141 » switch (m_nAlignment) | 2114 switch (m_nAlignment) |
| 2142 » { | 2115 { |
| 2143 » case 0: | 2116 case 0: |
| 2144 » » fPadding = 0.0f; | 2117 fPadding = 0.0f; |
| 2145 » » break; | 2118 break; |
| 2146 » case 1: | 2119 case 1: |
| 2147 » » fPadding = (rcPlate.Height() - rcContent.Height()) * 0.5f; | 2120 fPadding = (rcPlate.Height() - rcContent.Height()) * 0.5f; |
| 2148 » » break; | 2121 break; |
| 2149 » case 2: | 2122 case 2: |
| 2150 » » fPadding = rcPlate.Height() - rcContent.Height(); | 2123 fPadding = rcPlate.Height() - rcContent.Height(); |
| 2151 » » break; | 2124 break; |
| 2152 » } | 2125 } |
| 2153 | 2126 |
| 2154 » return CPDF_Point(point.x + (m_ptScrollPos.x - rcPlate.left), | 2127 return CPDF_Point(point.x + (m_ptScrollPos.x - rcPlate.left), |
| 2155 » » point.y + (m_ptScrollPos.y + fPadding - rcPlate.top)); | 2128 point.y + (m_ptScrollPos.y + fPadding - rcPlate.top)); |
| 2156 } | 2129 } |
| 2157 | 2130 |
| 2158 CPDF_Rect CFX_Edit::VTToEdit(const CPDF_Rect & rect) const | 2131 CPDF_Rect CFX_Edit::VTToEdit(const CPDF_Rect & rect) const |
| 2159 { | 2132 { |
| 2160 » CPDF_Point ptLeftBottom = VTToEdit(CPDF_Point(rect.left,rect.bottom)); | 2133 CPDF_Point ptLeftBottom = VTToEdit(CPDF_Point(rect.left,rect.bottom)); |
| 2161 » CPDF_Point ptRightTop = VTToEdit(CPDF_Point(rect.right,rect.top)); | 2134 CPDF_Point ptRightTop = VTToEdit(CPDF_Point(rect.right,rect.top)); |
| 2162 | 2135 |
| 2163 » return CPDF_Rect(ptLeftBottom.x,ptLeftBottom.y,ptRightTop.x,ptRightTop.y
); | 2136 return CPDF_Rect(ptLeftBottom.x,ptLeftBottom.y,ptRightTop.x,ptRightTop.y); |
| 2164 } | 2137 } |
| 2165 | 2138 |
| 2166 CPDF_Rect CFX_Edit::EditToVT(const CPDF_Rect & rect) const | 2139 CPDF_Rect CFX_Edit::EditToVT(const CPDF_Rect & rect) const |
| 2167 { | 2140 { |
| 2168 » CPDF_Point ptLeftBottom = EditToVT(CPDF_Point(rect.left,rect.bottom)); | 2141 CPDF_Point ptLeftBottom = EditToVT(CPDF_Point(rect.left,rect.bottom)); |
| 2169 » CPDF_Point ptRightTop = EditToVT(CPDF_Point(rect.right,rect.top)); | 2142 CPDF_Point ptRightTop = EditToVT(CPDF_Point(rect.right,rect.top)); |
| 2170 | 2143 |
| 2171 » return CPDF_Rect(ptLeftBottom.x,ptLeftBottom.y,ptRightTop.x,ptRightTop.y
); | 2144 return CPDF_Rect(ptLeftBottom.x,ptLeftBottom.y,ptRightTop.x,ptRightTop.y); |
| 2172 } | 2145 } |
| 2173 | 2146 |
| 2174 void CFX_Edit::SetScrollInfo() | 2147 void CFX_Edit::SetScrollInfo() |
| 2175 { | 2148 { |
| 2176 » if (m_bNotify && m_pNotify) | 2149 if (m_bNotify && m_pNotify) |
| 2177 » { | 2150 { |
| 2178 » » CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 2151 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 2179 » » CPDF_Rect rcContent = m_pVT->GetContentRect(); | 2152 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 2180 | 2153 |
| 2181 » » if (!m_bNotifyFlag) | 2154 if (!m_bNotifyFlag) |
| 2182 » » { | 2155 { |
| 2183 » » » m_bNotifyFlag = TRUE; | 2156 m_bNotifyFlag = TRUE; |
| 2184 » » » m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right
, | 2157 m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right, |
| 2185 » » » » » » » » rcContent.left,
rcContent.right, rcPlate.Width() / 3, rcPlate.Width()); | 2158 rcContent.left, rcContent.right, rcPlate.Width()
/ 3, rcPlate.Width()); |
| 2186 | 2159 |
| 2187 » » » m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top
, | 2160 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, |
| 2188 » » » » » rcContent.bottom, rcContent.top, rcPlate
.Height() / 3, rcPlate.Height()); | 2161 rcContent.bottom, rcContent.top, rcPlate.Height() / 3, rcPla
te.Height()); |
| 2189 » » » m_bNotifyFlag = FALSE; | 2162 m_bNotifyFlag = FALSE; |
| 2190 » » } | 2163 } |
| 2191 » } | 2164 } |
| 2192 } | 2165 } |
| 2193 | 2166 |
| 2194 void CFX_Edit::SetScrollPosX(FX_FLOAT fx) | 2167 void CFX_Edit::SetScrollPosX(FX_FLOAT fx) |
| 2195 { | 2168 { |
| 2196 » if (!m_bEnableScroll) return; | 2169 if (!m_bEnableScroll) return; |
| 2197 | 2170 |
| 2198 » if (m_pVT->IsValid()) | 2171 if (m_pVT->IsValid()) |
| 2199 » { | 2172 { |
| 2200 » » if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx)) | 2173 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx)) |
| 2201 » » { | 2174 { |
| 2202 » » » m_ptScrollPos.x = fx; | 2175 m_ptScrollPos.x = fx; |
| 2203 » » » Refresh(RP_NOANALYSE); | 2176 Refresh(RP_NOANALYSE); |
| 2204 | 2177 |
| 2205 » » » if (m_bNotify && m_pNotify) | 2178 if (m_bNotify && m_pNotify) |
| 2206 » » » { | 2179 { |
| 2207 » » » » if (!m_bNotifyFlag) | 2180 if (!m_bNotifyFlag) |
| 2208 » » » » { | 2181 { |
| 2209 » » » » » m_bNotifyFlag = TRUE; | 2182 m_bNotifyFlag = TRUE; |
| 2210 » » » » » m_pNotify->IOnSetScrollPosX(fx); | 2183 m_pNotify->IOnSetScrollPosX(fx); |
| 2211 » » » » » m_bNotifyFlag = FALSE; | 2184 m_bNotifyFlag = FALSE; |
| 2212 » » » » } | 2185 } |
| 2213 » » » } | 2186 } |
| 2214 » » } | 2187 } |
| 2215 » } | 2188 } |
| 2216 } | 2189 } |
| 2217 | 2190 |
| 2218 void CFX_Edit::SetScrollPosY(FX_FLOAT fy) | 2191 void CFX_Edit::SetScrollPosY(FX_FLOAT fy) |
| 2219 { | 2192 { |
| 2220 » if (!m_bEnableScroll) return; | 2193 if (!m_bEnableScroll) return; |
| 2221 | 2194 |
| 2222 » if (m_pVT->IsValid()) | 2195 if (m_pVT->IsValid()) |
| 2223 » { | 2196 { |
| 2224 » » if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) | 2197 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) |
| 2225 » » { | 2198 { |
| 2226 » » » m_ptScrollPos.y = fy; | 2199 m_ptScrollPos.y = fy; |
| 2227 » » » Refresh(RP_NOANALYSE); | 2200 Refresh(RP_NOANALYSE); |
| 2228 | 2201 |
| 2229 » » » if (m_bNotify && m_pNotify) | 2202 if (m_bNotify && m_pNotify) |
| 2230 » » » { | 2203 { |
| 2231 » » » » if (!m_bNotifyFlag) | 2204 if (!m_bNotifyFlag) |
| 2232 » » » » { | 2205 { |
| 2233 » » » » » m_bNotifyFlag = TRUE; | 2206 m_bNotifyFlag = TRUE; |
| 2234 » » » » » m_pNotify->IOnSetScrollPosY(fy); | 2207 m_pNotify->IOnSetScrollPosY(fy); |
| 2235 » » » » » m_bNotifyFlag = FALSE; | 2208 m_bNotifyFlag = FALSE; |
| 2236 » » » » } | 2209 } |
| 2237 » » » } | 2210 } |
| 2238 » » } | 2211 } |
| 2239 » } | 2212 } |
| 2240 } | 2213 } |
| 2241 | 2214 |
| 2242 void CFX_Edit::SetScrollPos(const CPDF_Point & point) | 2215 void CFX_Edit::SetScrollPos(const CPDF_Point & point) |
| 2243 { | 2216 { |
| 2244 » SetScrollPosX(point.x); | 2217 SetScrollPosX(point.x); |
| 2245 » SetScrollPosY(point.y); | 2218 SetScrollPosY(point.y); |
| 2246 » SetScrollLimit(); | 2219 SetScrollLimit(); |
| 2247 » SetCaretInfo(); | 2220 SetCaretInfo(); |
| 2248 } | 2221 } |
| 2249 | 2222 |
| 2250 CPDF_Point CFX_Edit::GetScrollPos() const | 2223 CPDF_Point CFX_Edit::GetScrollPos() const |
| 2251 { | 2224 { |
| 2252 » return m_ptScrollPos; | 2225 return m_ptScrollPos; |
| 2253 } | 2226 } |
| 2254 | 2227 |
| 2255 void CFX_Edit::SetScrollLimit() | 2228 void CFX_Edit::SetScrollLimit() |
| 2256 { | 2229 { |
| 2257 » if (m_pVT->IsValid()) | 2230 if (m_pVT->IsValid()) |
| 2258 » { | 2231 { |
| 2259 » » CPDF_Rect rcContent = m_pVT->GetContentRect(); | 2232 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 2260 » » CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 2233 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 2261 | 2234 |
| 2262 » » if (rcPlate.Width() > rcContent.Width()) | 2235 if (rcPlate.Width() > rcContent.Width()) |
| 2263 » » { | 2236 { |
| 2264 » » » SetScrollPosX(rcPlate.left); | 2237 SetScrollPosX(rcPlate.left); |
| 2265 » » } | 2238 } |
| 2266 » » else | 2239 else |
| 2267 » » { | 2240 { |
| 2268 » » » if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.x, rcContent.le
ft)) | 2241 if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.x, rcContent.left)) |
| 2269 » » » { | 2242 { |
| 2270 » » » » SetScrollPosX(rcContent.left); | 2243 SetScrollPosX(rcContent.left); |
| 2271 » » » } | 2244 } |
| 2272 » » » else if (FX_EDIT_IsFloatBigger(m_ptScrollPos.x, rcConten
t.right - rcPlate.Width())) | 2245 else if (FX_EDIT_IsFloatBigger(m_ptScrollPos.x, rcContent.right - rc
Plate.Width())) |
| 2273 » » » { | 2246 { |
| 2274 » » » » SetScrollPosX(rcContent.right - rcPlate.Width())
; | 2247 SetScrollPosX(rcContent.right - rcPlate.Width()); |
| 2275 » » » } | 2248 } |
| 2276 » » } | 2249 } |
| 2277 | 2250 |
| 2278 » » if (rcPlate.Height() > rcContent.Height()) | 2251 if (rcPlate.Height() > rcContent.Height()) |
| 2279 » » { | 2252 { |
| 2280 » » » SetScrollPosY(rcPlate.top); | 2253 SetScrollPosY(rcPlate.top); |
| 2281 » » } | 2254 } |
| 2282 » » else | 2255 else |
| 2283 » » { | 2256 { |
| 2284 » » » if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.y, rcContent.bo
ttom + rcPlate.Height())) | 2257 if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.y, rcContent.bottom + rcPla
te.Height())) |
| 2285 » » » { | 2258 { |
| 2286 » » » » SetScrollPosY(rcContent.bottom + rcPlate.Height(
)); | 2259 SetScrollPosY(rcContent.bottom + rcPlate.Height()); |
| 2287 » » » } | 2260 } |
| 2288 » » » else if (FX_EDIT_IsFloatBigger(m_ptScrollPos.y, rcConten
t.top)) | 2261 else if (FX_EDIT_IsFloatBigger(m_ptScrollPos.y, rcContent.top)) |
| 2289 » » » { | 2262 { |
| 2290 » » » » SetScrollPosY(rcContent.top); | 2263 SetScrollPosY(rcContent.top); |
| 2291 » » » } | 2264 } |
| 2292 » » } | 2265 } |
| 2293 » } | 2266 } |
| 2294 } | 2267 } |
| 2295 | 2268 |
| 2296 void CFX_Edit::ScrollToCaret() | 2269 void CFX_Edit::ScrollToCaret() |
| 2297 { | 2270 { |
| 2298 » SetScrollLimit(); | 2271 SetScrollLimit(); |
| 2299 | 2272 |
| 2300 » if (m_pVT->IsValid()) | 2273 if (m_pVT->IsValid()) |
| 2301 » { | 2274 { |
| 2302 » » CPDF_Point ptHead(0,0); | 2275 CPDF_Point ptHead(0,0); |
| 2303 » » CPDF_Point ptFoot(0,0); | 2276 CPDF_Point ptFoot(0,0); |
| 2304 | 2277 |
| 2305 » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 2278 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 2306 » » { | 2279 { |
| 2307 » » » pIterator->SetAt(m_wpCaret); | 2280 pIterator->SetAt(m_wpCaret); |
| 2308 | 2281 |
| 2309 » » » CPVT_Word word; | 2282 CPVT_Word word; |
| 2310 » » » CPVT_Line line; | 2283 CPVT_Line line; |
| 2311 » » » if (pIterator->GetWord(word)) | 2284 if (pIterator->GetWord(word)) |
| 2312 » » » { | 2285 { |
| 2313 » » » » ptHead.x = word.ptWord.x + word.fWidth; | 2286 ptHead.x = word.ptWord.x + word.fWidth; |
| 2314 » » » » ptHead.y = word.ptWord.y + word.fAscent; | 2287 ptHead.y = word.ptWord.y + word.fAscent; |
| 2315 » » » » ptFoot.x = word.ptWord.x + word.fWidth; | 2288 ptFoot.x = word.ptWord.x + word.fWidth; |
| 2316 » » » » ptFoot.y = word.ptWord.y + word.fDescent; | 2289 ptFoot.y = word.ptWord.y + word.fDescent; |
| 2317 » » » } | 2290 } |
| 2318 » » » else if (pIterator->GetLine(line)) | 2291 else if (pIterator->GetLine(line)) |
| 2319 » » » { | 2292 { |
| 2320 » » » » ptHead.x = line.ptLine.x; | 2293 ptHead.x = line.ptLine.x; |
| 2321 » » » » ptHead.y = line.ptLine.y + line.fLineAscent; | 2294 ptHead.y = line.ptLine.y + line.fLineAscent; |
| 2322 » » » » ptFoot.x = line.ptLine.x; | 2295 ptFoot.x = line.ptLine.x; |
| 2323 » » » » ptFoot.y = line.ptLine.y + line.fLineDescent; | 2296 ptFoot.y = line.ptLine.y + line.fLineDescent; |
| 2324 » » » } | 2297 } |
| 2325 » » } | 2298 } |
| 2326 | 2299 |
| 2327 » » CPDF_Point ptHeadEdit = VTToEdit(ptHead); | 2300 CPDF_Point ptHeadEdit = VTToEdit(ptHead); |
| 2328 » » CPDF_Point ptFootEdit = VTToEdit(ptFoot); | 2301 CPDF_Point ptFootEdit = VTToEdit(ptFoot); |
| 2329 | 2302 |
| 2330 » » CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 2303 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 2331 | 2304 |
| 2332 » » if (!FX_EDIT_IsFloatEqual(rcPlate.left,rcPlate.right)) | 2305 if (!FX_EDIT_IsFloatEqual(rcPlate.left,rcPlate.right)) |
| 2333 » » { | 2306 { |
| 2334 » » » if (FX_EDIT_IsFloatSmaller(ptHeadEdit.x, rcPlate.left) |
| | 2307 if (FX_EDIT_IsFloatSmaller(ptHeadEdit.x, rcPlate.left) || |
| 2335 » » » » FX_EDIT_IsFloatEqual(ptHeadEdit.x, rcPlate.left)
) | 2308 FX_EDIT_IsFloatEqual(ptHeadEdit.x, rcPlate.left)) |
| 2336 » » » { | 2309 { |
| 2337 » » » » SetScrollPosX(ptHead.x); | 2310 SetScrollPosX(ptHead.x); |
| 2338 » » » } | 2311 } |
| 2339 » » » else if (FX_EDIT_IsFloatBigger(ptHeadEdit.x, rcPlate.rig
ht)) | 2312 else if (FX_EDIT_IsFloatBigger(ptHeadEdit.x, rcPlate.right)) |
| 2340 » » » { | 2313 { |
| 2341 » » » » SetScrollPosX(ptHead.x - rcPlate.Width()); | 2314 SetScrollPosX(ptHead.x - rcPlate.Width()); |
| 2342 » » » } | 2315 } |
| 2343 » » } | 2316 } |
| 2344 | 2317 |
| 2345 » » if (!FX_EDIT_IsFloatEqual(rcPlate.top,rcPlate.bottom)) | 2318 if (!FX_EDIT_IsFloatEqual(rcPlate.top,rcPlate.bottom)) |
| 2346 » » { | 2319 { |
| 2347 » » » if (FX_EDIT_IsFloatSmaller(ptFootEdit.y, rcPlate.bottom)
|| | 2320 if (FX_EDIT_IsFloatSmaller(ptFootEdit.y, rcPlate.bottom) || |
| 2348 » » » » FX_EDIT_IsFloatEqual(ptFootEdit.y, rcPlate.botto
m)) | 2321 FX_EDIT_IsFloatEqual(ptFootEdit.y, rcPlate.bottom)) |
| 2349 » » » { | 2322 { |
| 2350 » » » » if (FX_EDIT_IsFloatSmaller(ptHeadEdit.y, rcPlate
.top)) | 2323 if (FX_EDIT_IsFloatSmaller(ptHeadEdit.y, rcPlate.top)) |
| 2351 » » » » { | 2324 { |
| 2352 » » » » » SetScrollPosY(ptFoot.y + rcPlate.Height(
)); | 2325 SetScrollPosY(ptFoot.y + rcPlate.Height()); |
| 2353 » » » » } | 2326 } |
| 2354 » » » } | 2327 } |
| 2355 » » » else if (FX_EDIT_IsFloatBigger(ptHeadEdit.y, rcPlate.top
)) | 2328 else if (FX_EDIT_IsFloatBigger(ptHeadEdit.y, rcPlate.top)) |
| 2356 » » » { | 2329 { |
| 2357 » » » » if (FX_EDIT_IsFloatBigger(ptFootEdit.y, rcPlate.
bottom)) | 2330 if (FX_EDIT_IsFloatBigger(ptFootEdit.y, rcPlate.bottom)) |
| 2358 » » » » { | 2331 { |
| 2359 » » » » » SetScrollPosY(ptHead.y); | 2332 SetScrollPosY(ptHead.y); |
| 2360 » » » » } | 2333 } |
| 2361 » » » } | 2334 } |
| 2362 » » } | 2335 } |
| 2363 » } | 2336 } |
| 2364 } | 2337 } |
| 2365 | 2338 |
| 2366 void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const
CPVT_WordRange * pRange2) | 2339 void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const
CPVT_WordRange * pRange2) |
| 2367 { | 2340 { |
| 2368 » if (m_bEnableRefresh && m_pVT->IsValid()) | 2341 if (m_bEnableRefresh && m_pVT->IsValid()) |
| 2369 » { | 2342 { |
| 2370 » » m_Refresh.BeginRefresh(); | 2343 m_Refresh.BeginRefresh(); |
| 2371 » » RefreshPushLineRects(GetVisibleWordRange()); | 2344 RefreshPushLineRects(GetVisibleWordRange()); |
| 2372 | 2345 |
| 2373 // » » if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x
) || | 2346 // if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x) || |
| 2374 // » » » !FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.y,m_ptScrollP
os.y)) | 2347 // !FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.y,m_ptScrollPos.y)) |
| 2375 // » » { | 2348 // { |
| 2376 » » » m_Refresh.NoAnalyse(); | 2349 m_Refresh.NoAnalyse(); |
| 2377 » » » m_ptRefreshScrollPos = m_ptScrollPos; | 2350 m_ptRefreshScrollPos = m_ptScrollPos; |
| 2378 // » » } | 2351 // } |
| 2379 // » » else | 2352 // else |
| 2380 // » » { | 2353 // { |
| 2381 // » » » switch (ePlan) | 2354 // switch (ePlan) |
| 2382 // » » » { | 2355 // { |
| 2383 // » » » case RP_ANALYSE: | 2356 // case RP_ANALYSE: |
| 2384 // » » » » m_Refresh.Analyse(m_pVT->GetAlignment()); | 2357 // m_Refresh.Analyse(m_pVT->GetAlignment()); |
| 2385 // | 2358 // |
| 2386 // » » » » if (pRange1) RefreshPushRandomRects(*pRange1); | 2359 // if (pRange1) RefreshPushRandomRects(*pRange1); |
| 2387 // » » » » if (pRange2) RefreshPushRandomRects(*pRange2); | 2360 // if (pRange2) RefreshPushRandomRects(*pRange2); |
| 2388 // » » » » break; | 2361 // break; |
| 2389 // » » » case RP_NOANALYSE: | 2362 // case RP_NOANALYSE: |
| 2390 // » » » » m_Refresh.NoAnalyse(); | 2363 // m_Refresh.NoAnalyse(); |
| 2391 // » » » » break; | 2364 // break; |
| 2392 // » » » case RP_OPTIONAL: | 2365 // case RP_OPTIONAL: |
| 2393 // » » » » if (pRange1) RefreshPushRandomRects(*pRange1); | 2366 // if (pRange1) RefreshPushRandomRects(*pRange1); |
| 2394 // » » » » if (pRange2) RefreshPushRandomRects(*pRange2); | 2367 // if (pRange2) RefreshPushRandomRects(*pRange2); |
| 2395 // » » » » break; | 2368 // break; |
| 2396 // » » » } | 2369 // } |
| 2397 // » » } | 2370 // } |
| 2398 | 2371 |
| 2399 » » if (m_bNotify && m_pNotify) | 2372 if (m_bNotify && m_pNotify) |
| 2400 » » { | 2373 { |
| 2401 » » » if (!m_bNotifyFlag) | 2374 if (!m_bNotifyFlag) |
| 2402 » » » { | 2375 { |
| 2403 » » » » m_bNotifyFlag = TRUE; | 2376 m_bNotifyFlag = TRUE; |
| 2404 » » » » if (const CFX_Edit_RectArray * pRects = m_Refres
h.GetRefreshRects()) | 2377 if (const CFX_Edit_RectArray * pRects = m_Refresh.GetRefreshRect
s()) |
| 2405 » » » » { | 2378 { |
| 2406 » » » » » for (int32_t i = 0, sz = pRects->GetSize
(); i < sz; i++) | 2379 for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++) |
| 2407 » » » » » » m_pNotify->IOnInvalidateRect(pRe
cts->GetAt(i)); | 2380 m_pNotify->IOnInvalidateRect(pRects->GetAt(i)); |
| 2408 » » » » } | 2381 } |
| 2409 » » » » m_bNotifyFlag = FALSE; | 2382 m_bNotifyFlag = FALSE; |
| 2410 » » » } | 2383 } |
| 2411 » » } | 2384 } |
| 2412 | 2385 |
| 2413 » » m_Refresh.EndRefresh(); | 2386 m_Refresh.EndRefresh(); |
| 2414 » } | 2387 } |
| 2415 } | 2388 } |
| 2416 | 2389 |
| 2417 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr) | 2390 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr) |
| 2418 { | 2391 { |
| 2419 » if (m_pVT->IsValid()) | 2392 if (m_pVT->IsValid()) |
| 2420 » { | 2393 { |
| 2421 » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 2394 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 2422 » » { | 2395 { |
| 2423 » » » CPVT_WordPlace wpBegin = wr.BeginPos; | 2396 CPVT_WordPlace wpBegin = wr.BeginPos; |
| 2424 » » » m_pVT->UpdateWordPlace(wpBegin); | 2397 m_pVT->UpdateWordPlace(wpBegin); |
| 2425 » » » CPVT_WordPlace wpEnd = wr.EndPos; | 2398 CPVT_WordPlace wpEnd = wr.EndPos; |
| 2426 » » » m_pVT->UpdateWordPlace(wpEnd); | 2399 m_pVT->UpdateWordPlace(wpEnd); |
| 2427 » » » pIterator->SetAt(wpBegin); | 2400 pIterator->SetAt(wpBegin); |
| 2428 | 2401 |
| 2429 » » » CPVT_Line lineinfo; | 2402 CPVT_Line lineinfo; |
| 2430 » » » do | 2403 do |
| 2431 » » » { | 2404 { |
| 2432 » » » » if (!pIterator->GetLine(lineinfo))break; | 2405 if (!pIterator->GetLine(lineinfo))break; |
| 2433 » » » » if (lineinfo.lineplace.LineCmp(wpEnd) > 0)break; | 2406 if (lineinfo.lineplace.LineCmp(wpEnd) > 0)break; |
| 2434 | 2407 |
| 2435 » » » » CPDF_Rect rcLine(lineinfo.ptLine.x, | 2408 CPDF_Rect rcLine(lineinfo.ptLine.x, |
| 2436 » » » » » » » » » lineinfo
.ptLine.y + lineinfo.fLineDescent, | 2409 lineinfo.ptLine.y + lineinfo.fLineDescent, |
| 2437 » » » » » » » » » lineinfo
.ptLine.x + lineinfo.fLineWidth, | 2410 lineinfo.ptLine.x + lineinfo.fLineWidth, |
| 2438 » » » » » » » » » lineinfo
.ptLine.y + lineinfo.fLineAscent); | 2411 lineinfo.ptLine.y + lineinfo.fLineAscent); |
| 2439 | 2412 |
| 2440 » » » » m_Refresh.Push(CPVT_WordRange(lineinfo.lineplace
,lineinfo.lineEnd),VTToEdit(rcLine)); | 2413 m_Refresh.Push(CPVT_WordRange(lineinfo.lineplace,lineinfo.lineEn
d),VTToEdit(rcLine)); |
| 2441 | 2414 |
| 2442 » » » }while (pIterator->NextLine()); | 2415 }while (pIterator->NextLine()); |
| 2443 » » } | 2416 } |
| 2444 » } | 2417 } |
| 2445 } | 2418 } |
| 2446 | 2419 |
| 2447 void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange & wr) | 2420 void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange & wr) |
| 2448 { | 2421 { |
| 2449 » if (m_pVT->IsValid()) | 2422 if (m_pVT->IsValid()) |
| 2450 » { | 2423 { |
| 2451 » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 2424 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 2452 » » { | 2425 { |
| 2453 » » » CPVT_WordRange wrTemp = wr; | 2426 CPVT_WordRange wrTemp = wr; |
| 2454 | 2427 |
| 2455 » » » m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 2428 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 2456 » » » m_pVT->UpdateWordPlace(wrTemp.EndPos); | 2429 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 2457 » » » pIterator->SetAt(wrTemp.BeginPos); | 2430 pIterator->SetAt(wrTemp.BeginPos); |
| 2458 | 2431 |
| 2459 » » » CPVT_Word wordinfo; | 2432 CPVT_Word wordinfo; |
| 2460 » » » CPVT_Line lineinfo; | 2433 CPVT_Line lineinfo; |
| 2461 » » » CPVT_WordPlace place; | 2434 CPVT_WordPlace place; |
| 2462 | 2435 |
| 2463 » » » while (pIterator->NextWord()) | 2436 while (pIterator->NextWord()) |
| 2464 » » » { | 2437 { |
| 2465 » » » » place = pIterator->GetAt(); | 2438 place = pIterator->GetAt(); |
| 2466 » » » » if (place.WordCmp(wrTemp.EndPos) > 0) break; | 2439 if (place.WordCmp(wrTemp.EndPos) > 0) break; |
| 2467 | 2440 |
| 2468 » » » » pIterator->GetWord(wordinfo); | 2441 pIterator->GetWord(wordinfo); |
| 2469 » » » » pIterator->GetLine(lineinfo); | 2442 pIterator->GetLine(lineinfo); |
| 2470 | 2443 |
| 2471 » » » » if (place.LineCmp(wrTemp.BeginPos) == 0 || place
.LineCmp(wrTemp.EndPos) == 0) | 2444 if (place.LineCmp(wrTemp.BeginPos) == 0 || place.LineCmp(wrTemp.
EndPos) == 0) |
| 2472 » » » » { | 2445 { |
| 2473 » » » » » CPDF_Rect rcWord(wordinfo.ptWord.x, | 2446 CPDF_Rect rcWord(wordinfo.ptWord.x, |
| 2474 » » » » » » » » » »
lineinfo.ptLine.y + lineinfo.fLineDescent, | 2447 lineinfo.ptLine.y + lineinfo.fLineDescen
t, |
| 2475 » » » » » » » » » »
wordinfo.ptWord.x + wordinfo.fWidth, | 2448 wordinfo.ptWord.x + wordinfo.fWidth, |
| 2476 » » » » » » » » » »
lineinfo.ptLine.y + lineinfo.fLineAscent); | 2449 lineinfo.ptLine.y + lineinfo.fLineAscent
); |
| 2477 | 2450 |
| 2478 » » » » » m_Refresh.AddRefresh(VTToEdit(rcWord)); | 2451 m_Refresh.AddRefresh(VTToEdit(rcWord)); |
| 2479 » » » » } | 2452 } |
| 2480 » » » » else | 2453 else |
| 2481 » » » » { | 2454 { |
| 2482 » » » » » CPDF_Rect rcLine(lineinfo.ptLine.x, | 2455 CPDF_Rect rcLine(lineinfo.ptLine.x, |
| 2483 » » » » » » » » » »
lineinfo.ptLine.y + lineinfo.fLineDescent, | 2456 lineinfo.ptLine.y + lineinfo.fLineDescen
t, |
| 2484 » » » » » » » » » »
lineinfo.ptLine.x + lineinfo.fLineWidth, | 2457 lineinfo.ptLine.x + lineinfo.fLineWidth, |
| 2485 » » » » » » » » » »
lineinfo.ptLine.y + lineinfo.fLineAscent); | 2458 lineinfo.ptLine.y + lineinfo.fLineAscent
); |
| 2486 | 2459 |
| 2487 » » » » » m_Refresh.AddRefresh(VTToEdit(rcLine)); | 2460 m_Refresh.AddRefresh(VTToEdit(rcLine)); |
| 2488 | 2461 |
| 2489 » » » » » pIterator->NextLine(); | 2462 pIterator->NextLine(); |
| 2490 » » » » } | 2463 } |
| 2491 » » » } | 2464 } |
| 2492 » » } | 2465 } |
| 2493 » } | 2466 } |
| 2494 } | 2467 } |
| 2495 | 2468 |
| 2496 void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) | 2469 void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) |
| 2497 { | 2470 { |
| 2498 » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) | 2471 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 2499 » { | 2472 { |
| 2500 » » CPVT_WordRange wrTemp = wr; | 2473 CPVT_WordRange wrTemp = wr; |
| 2501 | 2474 |
| 2502 » » m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 2475 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 2503 » » m_pVT->UpdateWordPlace(wrTemp.EndPos); | 2476 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 2504 » » pIterator->SetAt(wrTemp.BeginPos); | 2477 pIterator->SetAt(wrTemp.BeginPos); |
| 2505 | 2478 |
| 2506 » » CPVT_Word wordinfo; | 2479 CPVT_Word wordinfo; |
| 2507 » » CPVT_Line lineinfo; | 2480 CPVT_Line lineinfo; |
| 2508 » » CPVT_WordPlace place; | 2481 CPVT_WordPlace place; |
| 2509 | 2482 |
| 2510 » » while (pIterator->NextWord()) | 2483 while (pIterator->NextWord()) |
| 2511 » » { | 2484 { |
| 2512 » » » place = pIterator->GetAt(); | 2485 place = pIterator->GetAt(); |
| 2513 » » » if (place.WordCmp(wrTemp.EndPos) > 0) break; | 2486 if (place.WordCmp(wrTemp.EndPos) > 0) break; |
| 2514 | 2487 |
| 2515 » » » pIterator->GetWord(wordinfo); | 2488 pIterator->GetWord(wordinfo); |
| 2516 » » » pIterator->GetLine(lineinfo); | 2489 pIterator->GetLine(lineinfo); |
| 2517 | 2490 |
| 2518 » » » if (place.LineCmp(wrTemp.BeginPos) == 0 || place.LineCmp
(wrTemp.EndPos) == 0) | 2491 if (place.LineCmp(wrTemp.BeginPos) == 0 || place.LineCmp(wrTemp.EndP
os) == 0) |
| 2519 » » » { | 2492 { |
| 2520 » » » » CPDF_Rect rcWord(wordinfo.ptWord.x, | 2493 CPDF_Rect rcWord(wordinfo.ptWord.x, |
| 2521 » » » » » » » » » lineinfo
.ptLine.y + lineinfo.fLineDescent, | 2494 lineinfo.ptLine.y + lineinfo.fLineDescent, |
| 2522 » » » » » » » » » wordinfo
.ptWord.x + wordinfo.fWidth, | 2495 wordinfo.ptWord.x + wordinfo.fWidth, |
| 2523 » » » » » » » » » lineinfo
.ptLine.y + lineinfo.fLineAscent); | 2496 lineinfo.ptLine.y + lineinfo.fLineAscent); |
| 2524 | 2497 |
| 2525 » » » » if (m_bNotify && m_pNotify) | 2498 if (m_bNotify && m_pNotify) |
| 2526 » » » » { | 2499 { |
| 2527 » » » » » if (!m_bNotifyFlag) | 2500 if (!m_bNotifyFlag) |
| 2528 » » » » » { | 2501 { |
| 2529 » » » » » » m_bNotifyFlag = TRUE; | 2502 m_bNotifyFlag = TRUE; |
| 2530 » » » » » » CPDF_Rect rcRefresh = VTToEdit(r
cWord); | 2503 CPDF_Rect rcRefresh = VTToEdit(rcWord); |
| 2531 » » » » » » m_pNotify->IOnInvalidateRect(&rc
Refresh); | 2504 m_pNotify->IOnInvalidateRect(&rcRefresh); |
| 2532 » » » » » » m_bNotifyFlag = FALSE; | 2505 m_bNotifyFlag = FALSE; |
| 2533 » » » » » } | 2506 } |
| 2534 » » » » } | 2507 } |
| 2535 » » » } | 2508 } |
| 2536 » » » else | 2509 else |
| 2537 » » » { | 2510 { |
| 2538 » » » » CPDF_Rect rcLine(lineinfo.ptLine.x, | 2511 CPDF_Rect rcLine(lineinfo.ptLine.x, |
| 2539 » » » » » » » » » lineinfo
.ptLine.y + lineinfo.fLineDescent, | 2512 lineinfo.ptLine.y + lineinfo.fLineDescent, |
| 2540 » » » » » » » » » lineinfo
.ptLine.x + lineinfo.fLineWidth, | 2513 lineinfo.ptLine.x + lineinfo.fLineWidth, |
| 2541 » » » » » » » » » lineinfo
.ptLine.y + lineinfo.fLineAscent); | 2514 lineinfo.ptLine.y + lineinfo.fLineAscent); |
| 2542 | 2515 |
| 2543 » » » » if (m_bNotify && m_pNotify) | 2516 if (m_bNotify && m_pNotify) |
| 2544 » » » » { | 2517 { |
| 2545 » » » » » if (!m_bNotifyFlag) | 2518 if (!m_bNotifyFlag) |
| 2546 » » » » » { | 2519 { |
| 2547 » » » » » » m_bNotifyFlag = TRUE; | 2520 m_bNotifyFlag = TRUE; |
| 2548 » » » » » » CPDF_Rect rcRefresh = VTToEdit(r
cLine); | 2521 CPDF_Rect rcRefresh = VTToEdit(rcLine); |
| 2549 » » » » » » m_pNotify->IOnInvalidateRect(&rc
Refresh); | 2522 m_pNotify->IOnInvalidateRect(&rcRefresh); |
| 2550 » » » » » » m_bNotifyFlag = FALSE; | 2523 m_bNotifyFlag = FALSE; |
| 2551 » » » » » } | 2524 } |
| 2552 » » » » } | 2525 } |
| 2553 | 2526 |
| 2554 » » » » pIterator->NextLine(); | 2527 pIterator->NextLine(); |
| 2555 » » » } | 2528 } |
| 2556 » » } | 2529 } |
| 2557 » } | 2530 } |
| 2558 } | 2531 } |
| 2559 | 2532 |
| 2560 void CFX_Edit::SetCaret(const CPVT_WordPlace & place) | 2533 void CFX_Edit::SetCaret(const CPVT_WordPlace & place) |
| 2561 { | 2534 { |
| 2562 » m_wpOldCaret = m_wpCaret; | 2535 m_wpOldCaret = m_wpCaret; |
| 2563 » m_wpCaret = place; | 2536 m_wpCaret = place; |
| 2564 } | 2537 } |
| 2565 | 2538 |
| 2566 void CFX_Edit::SetCaretInfo() | 2539 void CFX_Edit::SetCaretInfo() |
| 2567 { | 2540 { |
| 2568 » if (m_bNotify && m_pNotify) | 2541 if (m_bNotify && m_pNotify) |
| 2569 » { | 2542 { |
| 2570 » » if (!m_bNotifyFlag) | 2543 if (!m_bNotifyFlag) |
| 2571 » » { | 2544 { |
| 2572 » » » CPDF_Point ptHead(0.0f,0.0f),ptFoot(0.0f,0.0f); | 2545 CPDF_Point ptHead(0.0f,0.0f),ptFoot(0.0f,0.0f); |
| 2573 | 2546 |
| 2574 » » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetI
terator()) | 2547 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 2575 » » » { | 2548 { |
| 2576 » » » » pIterator->SetAt(m_wpCaret); | 2549 pIterator->SetAt(m_wpCaret); |
| 2577 » » » » CPVT_Word word; | 2550 CPVT_Word word; |
| 2578 » » » » CPVT_Line line; | 2551 CPVT_Line line; |
| 2579 » » » » if (pIterator->GetWord(word)) | 2552 if (pIterator->GetWord(word)) |
| 2580 » » » » { | 2553 { |
| 2581 » » » » » ptHead.x = word.ptWord.x + word.fWidth; | 2554 ptHead.x = word.ptWord.x + word.fWidth; |
| 2582 » » » » » ptHead.y = word.ptWord.y + word.fAscent; | 2555 ptHead.y = word.ptWord.y + word.fAscent; |
| 2583 » » » » » ptFoot.x = word.ptWord.x + word.fWidth; | 2556 ptFoot.x = word.ptWord.x + word.fWidth; |
| 2584 » » » » » ptFoot.y = word.ptWord.y + word.fDescent
; | 2557 ptFoot.y = word.ptWord.y + word.fDescent; |
| 2585 » » » » } | 2558 } |
| 2586 » » » » else if (pIterator->GetLine(line)) | 2559 else if (pIterator->GetLine(line)) |
| 2587 » » » » { | 2560 { |
| 2588 » » » » » ptHead.x = line.ptLine.x; | 2561 ptHead.x = line.ptLine.x; |
| 2589 » » » » » ptHead.y = line.ptLine.y + line.fLineAsc
ent; | 2562 ptHead.y = line.ptLine.y + line.fLineAscent; |
| 2590 » » » » » ptFoot.x = line.ptLine.x; | 2563 ptFoot.x = line.ptLine.x; |
| 2591 » » » » » ptFoot.y = line.ptLine.y + line.fLineDes
cent; | 2564 ptFoot.y = line.ptLine.y + line.fLineDescent; |
| 2592 » » » » } | 2565 } |
| 2593 » » » } | 2566 } |
| 2594 | 2567 |
| 2595 » » » m_bNotifyFlag = TRUE; | 2568 m_bNotifyFlag = TRUE; |
| 2596 » » » m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(pt
Head),VTToEdit(ptFoot), m_wpCaret); | 2569 m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(ptHead),VTToEd
it(ptFoot), m_wpCaret); |
| 2597 » » » m_bNotifyFlag = FALSE; | 2570 m_bNotifyFlag = FALSE; |
| 2598 » » } | 2571 } |
| 2599 » } | 2572 } |
| 2600 | 2573 |
| 2601 » SetCaretChange(); | 2574 SetCaretChange(); |
| 2602 } | 2575 } |
| 2603 | 2576 |
| 2604 void CFX_Edit::SetCaretChange() | 2577 void CFX_Edit::SetCaretChange() |
| 2605 { | 2578 { |
| 2606 » if (m_wpCaret == m_wpOldCaret) return; | 2579 if (m_wpCaret == m_wpOldCaret) return; |
| 2607 | 2580 |
| 2608 » if (m_bNotify && m_pVT->IsRichText() && m_pNotify) | 2581 if (m_bNotify && m_pVT->IsRichText() && m_pNotify) |
| 2609 » { | 2582 { |
| 2610 » » CPVT_SecProps SecProps; | 2583 CPVT_SecProps SecProps; |
| 2611 » » CPVT_WordProps WordProps; | 2584 CPVT_WordProps WordProps; |
| 2612 | 2585 |
| 2613 » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 2586 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 2614 » » { | 2587 { |
| 2615 » » » pIterator->SetAt(m_wpCaret); | 2588 pIterator->SetAt(m_wpCaret); |
| 2616 » » » CPVT_Word word; | 2589 CPVT_Word word; |
| 2617 » » » CPVT_Section section; | 2590 CPVT_Section section; |
| 2618 | 2591 |
| 2619 » » » if (pIterator->GetSection(section)) | 2592 if (pIterator->GetSection(section)) |
| 2620 » » » { | 2593 { |
| 2621 » » » » SecProps = section.SecProps; | 2594 SecProps = section.SecProps; |
| 2622 » » » » WordProps = section.WordProps; | 2595 WordProps = section.WordProps; |
| 2623 » » » } | 2596 } |
| 2624 | 2597 |
| 2625 » » » if (pIterator->GetWord(word)) | 2598 if (pIterator->GetWord(word)) |
| 2626 » » » { | 2599 { |
| 2627 » » » » WordProps = word.WordProps; | 2600 WordProps = word.WordProps; |
| 2628 » » » } | 2601 } |
| 2629 » » } | 2602 } |
| 2630 | 2603 |
| 2631 » » if (!m_bNotifyFlag) | 2604 if (!m_bNotifyFlag) |
| 2632 » » { | 2605 { |
| 2633 » » » m_bNotifyFlag = TRUE; | 2606 m_bNotifyFlag = TRUE; |
| 2634 » » » m_pNotify->IOnCaretChange(SecProps,WordProps); | 2607 m_pNotify->IOnCaretChange(SecProps,WordProps); |
| 2635 » » » m_bNotifyFlag = FALSE; | 2608 m_bNotifyFlag = FALSE; |
| 2636 » » } | 2609 } |
| 2637 » } | 2610 } |
| 2638 } | 2611 } |
| 2639 | 2612 |
| 2640 void CFX_Edit::SetCaret(int32_t nPos) | 2613 void CFX_Edit::SetCaret(int32_t nPos) |
| 2641 { | 2614 { |
| 2642 » if (m_pVT->IsValid()) | 2615 if (m_pVT->IsValid()) |
| 2643 » { | 2616 { |
| 2644 » » SelectNone(); | 2617 SelectNone(); |
| 2645 » » SetCaret(m_pVT->WordIndexToWordPlace(nPos)); | 2618 SetCaret(m_pVT->WordIndexToWordPlace(nPos)); |
| 2646 » » m_SelState.Set(m_wpCaret,m_wpCaret); | 2619 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 2647 | 2620 |
| 2648 » » ScrollToCaret(); | 2621 ScrollToCaret(); |
| 2649 » » SetCaretOrigin(); | 2622 SetCaretOrigin(); |
| 2650 » » SetCaretInfo(); | 2623 SetCaretInfo(); |
| 2651 » } | 2624 } |
| 2652 } | 2625 } |
| 2653 | 2626 |
| 2654 void CFX_Edit::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl
) | 2627 void CFX_Edit::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl
) |
| 2655 { | 2628 { |
| 2656 » if (m_pVT->IsValid()) | 2629 if (m_pVT->IsValid()) |
| 2657 » { | 2630 { |
| 2658 » » SelectNone(); | 2631 SelectNone(); |
| 2659 » » SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); | 2632 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); |
| 2660 » » m_SelState.Set(m_wpCaret,m_wpCaret); | 2633 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 2661 | 2634 |
| 2662 » » ScrollToCaret(); | 2635 ScrollToCaret(); |
| 2663 » » SetCaretOrigin(); | 2636 SetCaretOrigin(); |
| 2664 » » SetCaretInfo(); | 2637 SetCaretInfo(); |
| 2665 » } | 2638 } |
| 2666 } | 2639 } |
| 2667 | 2640 |
| 2668 void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl
) | 2641 void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl
) |
| 2669 { | 2642 { |
| 2670 » if (m_pVT->IsValid()) | 2643 if (m_pVT->IsValid()) |
| 2671 » { | 2644 { |
| 2672 » » SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); | 2645 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); |
| 2673 | 2646 |
| 2674 » » if (m_wpCaret != m_wpOldCaret) | 2647 if (m_wpCaret != m_wpOldCaret) |
| 2675 » » { | 2648 { |
| 2676 » » » m_SelState.SetEndPos(m_wpCaret); | 2649 m_SelState.SetEndPos(m_wpCaret); |
| 2677 | 2650 |
| 2678 » » » ScrollToCaret(); | 2651 ScrollToCaret(); |
| 2679 » » » CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); | 2652 CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); |
| 2680 » » » Refresh(RP_OPTIONAL,&wr); | 2653 Refresh(RP_OPTIONAL,&wr); |
| 2681 » » » SetCaretOrigin(); | 2654 SetCaretOrigin(); |
| 2682 » » » SetCaretInfo(); | 2655 SetCaretInfo(); |
| 2683 » » } | 2656 } |
| 2684 » } | 2657 } |
| 2685 } | 2658 } |
| 2686 | 2659 |
| 2687 void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) | 2660 void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) |
| 2688 { | 2661 { |
| 2689 » if (m_pVT->IsValid()) | 2662 if (m_pVT->IsValid()) |
| 2690 » { | 2663 { |
| 2691 » » SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret)); | 2664 SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret)); |
| 2692 | 2665 |
| 2693 » » if (bShift) | 2666 if (bShift) |
| 2694 » » { | 2667 { |
| 2695 » » » if (m_SelState.IsExist()) | 2668 if (m_SelState.IsExist()) |
| 2696 » » » » m_SelState.SetEndPos(m_wpCaret); | 2669 m_SelState.SetEndPos(m_wpCaret); |
| 2697 » » » else | 2670 else |
| 2698 » » » » m_SelState.Set(m_wpOldCaret,m_wpCaret); | 2671 m_SelState.Set(m_wpOldCaret,m_wpCaret); |
| 2699 | 2672 |
| 2700 » » » if (m_wpOldCaret != m_wpCaret) | 2673 if (m_wpOldCaret != m_wpCaret) |
| 2701 » » » { | 2674 { |
| 2702 » » » » ScrollToCaret(); | 2675 ScrollToCaret(); |
| 2703 » » » » CPVT_WordRange wr(m_wpOldCaret, m_wpCaret); | 2676 CPVT_WordRange wr(m_wpOldCaret, m_wpCaret); |
| 2704 » » » » Refresh(RP_OPTIONAL, &wr); | 2677 Refresh(RP_OPTIONAL, &wr); |
| 2705 » » » » SetCaretInfo(); | 2678 SetCaretInfo(); |
| 2706 » » » } | 2679 } |
| 2707 » » } | 2680 } |
| 2708 » » else | 2681 else |
| 2709 » » { | 2682 { |
| 2710 » » » SelectNone(); | 2683 SelectNone(); |
| 2711 | 2684 |
| 2712 » » » ScrollToCaret(); | 2685 ScrollToCaret(); |
| 2713 » » » SetCaretInfo(); | 2686 SetCaretInfo(); |
| 2714 » » } | 2687 } |
| 2715 » } | 2688 } |
| 2716 } | 2689 } |
| 2717 | 2690 |
| 2718 void CFX_Edit::OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) | 2691 void CFX_Edit::OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) |
| 2719 { | 2692 { |
| 2720 » if (m_pVT->IsValid()) | 2693 if (m_pVT->IsValid()) |
| 2721 » { | 2694 { |
| 2722 » » SetCaret(m_pVT->GetDownWordPlace(m_wpCaret,m_ptCaret)); | 2695 SetCaret(m_pVT->GetDownWordPlace(m_wpCaret,m_ptCaret)); |
| 2723 | 2696 |
| 2724 » » if (bShift) | 2697 if (bShift) |
| 2725 » » { | 2698 { |
| 2726 » » » if (m_SelState.IsExist()) | 2699 if (m_SelState.IsExist()) |
| 2727 » » » » m_SelState.SetEndPos(m_wpCaret); | 2700 m_SelState.SetEndPos(m_wpCaret); |
| 2728 » » » else | 2701 else |
| 2729 » » » » m_SelState.Set(m_wpOldCaret,m_wpCaret); | 2702 m_SelState.Set(m_wpOldCaret,m_wpCaret); |
| 2730 | 2703 |
| 2731 » » » if (m_wpOldCaret != m_wpCaret) | 2704 if (m_wpOldCaret != m_wpCaret) |
| 2732 » » » { | 2705 { |
| 2733 » » » » ScrollToCaret(); | 2706 ScrollToCaret(); |
| 2734 » » » » CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); | 2707 CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); |
| 2735 » » » » Refresh(RP_OPTIONAL, &wr); | 2708 Refresh(RP_OPTIONAL, &wr); |
| 2736 » » » » SetCaretInfo(); | 2709 SetCaretInfo(); |
| 2737 » » » } | 2710 } |
| 2738 » » } | 2711 } |
| 2739 » » else | 2712 else |
| 2740 » » { | 2713 { |
| 2741 » » » SelectNone(); | 2714 SelectNone(); |
| 2742 | 2715 |
| 2743 » » » ScrollToCaret(); | 2716 ScrollToCaret(); |
| 2744 » » » SetCaretInfo(); | 2717 SetCaretInfo(); |
| 2745 » » } | 2718 } |
| 2746 » } | 2719 } |
| 2747 } | 2720 } |
| 2748 | 2721 |
| 2749 void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) | 2722 void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) |
| 2750 { | 2723 { |
| 2751 » if (m_pVT->IsValid()) | 2724 if (m_pVT->IsValid()) |
| 2752 » { | 2725 { |
| 2753 » » if (bShift) | 2726 if (bShift) |
| 2754 » » { | 2727 { |
| 2755 » » » if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && | 2728 if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && |
| 2756 » » » » m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCar
et)) | 2729 m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) |
| 2757 » » » » SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); | 2730 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); |
| 2758 | 2731 |
| 2759 » » » SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); | 2732 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); |
| 2760 | 2733 |
| 2761 » » » if (m_SelState.IsExist()) | 2734 if (m_SelState.IsExist()) |
| 2762 » » » » m_SelState.SetEndPos(m_wpCaret); | 2735 m_SelState.SetEndPos(m_wpCaret); |
| 2763 » » » else | 2736 else |
| 2764 » » » » m_SelState.Set(m_wpOldCaret, m_wpCaret); | 2737 m_SelState.Set(m_wpOldCaret, m_wpCaret); |
| 2765 | 2738 |
| 2766 » » » if (m_wpOldCaret != m_wpCaret) | 2739 if (m_wpOldCaret != m_wpCaret) |
| 2767 » » » { | 2740 { |
| 2768 » » » » ScrollToCaret(); | 2741 ScrollToCaret(); |
| 2769 » » » » CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); | 2742 CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); |
| 2770 » » » » Refresh(RP_OPTIONAL,&wr); | 2743 Refresh(RP_OPTIONAL,&wr); |
| 2771 » » » » SetCaretInfo(); | 2744 SetCaretInfo(); |
| 2772 » » » } | 2745 } |
| 2773 » » } | 2746 } |
| 2774 » » else | 2747 else |
| 2775 » » { | 2748 { |
| 2776 » » » if (m_SelState.IsExist()) | 2749 if (m_SelState.IsExist()) |
| 2777 » » » { | 2750 { |
| 2778 » » » » if (m_SelState.BeginPos.WordCmp(m_SelState.EndPo
s)<0) | 2751 if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos)<0) |
| 2779 » » » » » SetCaret(m_SelState.BeginPos); | 2752 SetCaret(m_SelState.BeginPos); |
| 2780 » » » » else | 2753 else |
| 2781 » » » » » SetCaret(m_SelState.EndPos); | 2754 SetCaret(m_SelState.EndPos); |
| 2782 | 2755 |
| 2783 » » » » SelectNone(); | 2756 SelectNone(); |
| 2784 » » » » ScrollToCaret(); | 2757 ScrollToCaret(); |
| 2785 » » » » SetCaretInfo(); | 2758 SetCaretInfo(); |
| 2786 » » » } | 2759 } |
| 2787 » » » else | 2760 else |
| 2788 » » » { | 2761 { |
| 2789 » » » » if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCa
ret) && | 2762 if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && |
| 2790 » » » » » m_wpCaret != m_pVT->GetSectionBeginPlace
(m_wpCaret)) | 2763 m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) |
| 2791 » » » » » SetCaret(m_pVT->GetPrevWordPlace(m_wpCar
et)); | 2764 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); |
| 2792 | 2765 |
| 2793 » » » » SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); | 2766 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); |
| 2794 | 2767 |
| 2795 » » » » ScrollToCaret(); | 2768 ScrollToCaret(); |
| 2796 » » » » SetCaretOrigin(); | 2769 SetCaretOrigin(); |
| 2797 » » » » SetCaretInfo(); | 2770 SetCaretInfo(); |
| 2798 » » » } | 2771 } |
| 2799 » » } | 2772 } |
| 2800 » } | 2773 } |
| 2801 } | 2774 } |
| 2802 | 2775 |
| 2803 void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) | 2776 void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) |
| 2804 { | 2777 { |
| 2805 » if (m_pVT->IsValid()) | 2778 if (m_pVT->IsValid()) |
| 2806 » { | 2779 { |
| 2807 » » if (bShift) | 2780 if (bShift) |
| 2808 » » { | 2781 { |
| 2809 » » » SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); | 2782 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); |
| 2810 | 2783 |
| 2811 » » » if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && | 2784 if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && |
| 2812 » » » » m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret
)) | 2785 m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret)) |
| 2813 » » » » SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); | 2786 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); |
| 2814 | 2787 |
| 2815 » » » if (m_SelState.IsExist()) | 2788 if (m_SelState.IsExist()) |
| 2816 » » » » m_SelState.SetEndPos(m_wpCaret); | 2789 m_SelState.SetEndPos(m_wpCaret); |
| 2817 » » » else | 2790 else |
| 2818 » » » » m_SelState.Set(m_wpOldCaret,m_wpCaret); | 2791 m_SelState.Set(m_wpOldCaret,m_wpCaret); |
| 2819 | 2792 |
| 2820 » » » if (m_wpOldCaret != m_wpCaret) | 2793 if (m_wpOldCaret != m_wpCaret) |
| 2821 » » » { | 2794 { |
| 2822 » » » » ScrollToCaret(); | 2795 ScrollToCaret(); |
| 2823 » » » » CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); | 2796 CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); |
| 2824 » » » » Refresh(RP_OPTIONAL,&wr); | 2797 Refresh(RP_OPTIONAL,&wr); |
| 2825 » » » » SetCaretInfo(); | 2798 SetCaretInfo(); |
| 2826 » » » } | 2799 } |
| 2827 » » } | 2800 } |
| 2828 » » else | 2801 else |
| 2829 » » { | 2802 { |
| 2830 » » » if (m_SelState.IsExist()) | 2803 if (m_SelState.IsExist()) |
| 2831 » » » { | 2804 { |
| 2832 » » » » if (m_SelState.BeginPos.WordCmp(m_SelState.EndPo
s)>0) | 2805 if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos)>0) |
| 2833 » » » » » SetCaret(m_SelState.BeginPos); | 2806 SetCaret(m_SelState.BeginPos); |
| 2834 » » » » else | 2807 else |
| 2835 » » » » » SetCaret(m_SelState.EndPos); | 2808 SetCaret(m_SelState.EndPos); |
| 2836 | 2809 |
| 2837 » » » » SelectNone(); | 2810 SelectNone(); |
| 2838 » » » » ScrollToCaret(); | 2811 ScrollToCaret(); |
| 2839 » » » » SetCaretInfo(); | 2812 SetCaretInfo(); |
| 2840 » » » } | 2813 } |
| 2841 » » » else | 2814 else |
| 2842 » » » { | 2815 { |
| 2843 » » » » SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); | 2816 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); |
| 2844 | 2817 |
| 2845 » » » » if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCare
t) && | 2818 if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && |
| 2846 » » » » » m_wpCaret != m_pVT->GetSectionEndPlace(m
_wpCaret)) | 2819 m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret)) |
| 2847 » » » » » SetCaret(m_pVT->GetNextWordPlace(m_wpCar
et)); | 2820 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); |
| 2848 | 2821 |
| 2849 » » » » ScrollToCaret(); | 2822 ScrollToCaret(); |
| 2850 » » » » SetCaretOrigin(); | 2823 SetCaretOrigin(); |
| 2851 » » » » SetCaretInfo(); | 2824 SetCaretInfo(); |
| 2852 » » » } | 2825 } |
| 2853 » » } | 2826 } |
| 2854 » } | 2827 } |
| 2855 } | 2828 } |
| 2856 | 2829 |
| 2857 void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) | 2830 void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) |
| 2858 { | 2831 { |
| 2859 » if (m_pVT->IsValid()) | 2832 if (m_pVT->IsValid()) |
| 2860 » { | 2833 { |
| 2861 » » if (bShift) | 2834 if (bShift) |
| 2862 » » { | 2835 { |
| 2863 » » » if (bCtrl) | 2836 if (bCtrl) |
| 2864 » » » » SetCaret(m_pVT->GetBeginWordPlace()); | 2837 SetCaret(m_pVT->GetBeginWordPlace()); |
| 2865 » » » else | 2838 else |
| 2866 » » » » SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); | 2839 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); |
| 2867 | 2840 |
| 2868 » » » if (m_SelState.IsExist()) | 2841 if (m_SelState.IsExist()) |
| 2869 » » » » m_SelState.SetEndPos(m_wpCaret); | 2842 m_SelState.SetEndPos(m_wpCaret); |
| 2870 » » » else | 2843 else |
| 2871 » » » » m_SelState.Set(m_wpOldCaret,m_wpCaret); | 2844 m_SelState.Set(m_wpOldCaret,m_wpCaret); |
| 2872 | 2845 |
| 2873 » » » ScrollToCaret(); | 2846 ScrollToCaret(); |
| 2874 » » » CPVT_WordRange wr(m_wpOldCaret, m_wpCaret); | 2847 CPVT_WordRange wr(m_wpOldCaret, m_wpCaret); |
| 2875 » » » Refresh(RP_OPTIONAL, &wr); | 2848 Refresh(RP_OPTIONAL, &wr); |
| 2876 » » » SetCaretInfo(); | 2849 SetCaretInfo(); |
| 2877 » » } | 2850 } |
| 2878 » » else | 2851 else |
| 2879 » » { | 2852 { |
| 2880 » » » if (m_SelState.IsExist()) | 2853 if (m_SelState.IsExist()) |
| 2881 » » » { | 2854 { |
| 2882 » » » » if (m_SelState.BeginPos.WordCmp(m_SelState.EndPo
s)<0) | 2855 if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos)<0) |
| 2883 » » » » » SetCaret(m_SelState.BeginPos); | 2856 SetCaret(m_SelState.BeginPos); |
| 2884 » » » » else | 2857 else |
| 2885 » » » » » SetCaret(m_SelState.EndPos); | 2858 SetCaret(m_SelState.EndPos); |
| 2886 | 2859 |
| 2887 » » » » SelectNone(); | 2860 SelectNone(); |
| 2888 » » » » ScrollToCaret(); | 2861 ScrollToCaret(); |
| 2889 » » » » SetCaretInfo(); | 2862 SetCaretInfo(); |
| 2890 » » » } | 2863 } |
| 2891 » » » else | 2864 else |
| 2892 » » » { | 2865 { |
| 2893 » » » » if (bCtrl) | 2866 if (bCtrl) |
| 2894 » » » » » SetCaret(m_pVT->GetBeginWordPlace()); | 2867 SetCaret(m_pVT->GetBeginWordPlace()); |
| 2895 » » » » else | 2868 else |
| 2896 » » » » » SetCaret(m_pVT->GetLineBeginPlace(m_wpCa
ret)); | 2869 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); |
| 2897 | 2870 |
| 2898 » » » » ScrollToCaret(); | 2871 ScrollToCaret(); |
| 2899 » » » » SetCaretOrigin(); | 2872 SetCaretOrigin(); |
| 2900 » » » » SetCaretInfo(); | 2873 SetCaretInfo(); |
| 2901 » » » } | 2874 } |
| 2902 » » } | 2875 } |
| 2903 » } | 2876 } |
| 2904 } | 2877 } |
| 2905 | 2878 |
| 2906 void CFX_Edit::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) | 2879 void CFX_Edit::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) |
| 2907 { | 2880 { |
| 2908 » if (m_pVT->IsValid()) | 2881 if (m_pVT->IsValid()) |
| 2909 » { | 2882 { |
| 2910 » » if (bShift) | 2883 if (bShift) |
| 2911 » » { | 2884 { |
| 2912 » » » if (bCtrl) | 2885 if (bCtrl) |
| 2913 » » » » SetCaret(m_pVT->GetEndWordPlace()); | 2886 SetCaret(m_pVT->GetEndWordPlace()); |
| 2914 » » » else | 2887 else |
| 2915 » » » » SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); | 2888 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); |
| 2916 | 2889 |
| 2917 » » » if (m_SelState.IsExist()) | 2890 if (m_SelState.IsExist()) |
| 2918 » » » » m_SelState.SetEndPos(m_wpCaret); | 2891 m_SelState.SetEndPos(m_wpCaret); |
| 2919 » » » else | 2892 else |
| 2920 » » » » m_SelState.Set(m_wpOldCaret, m_wpCaret); | 2893 m_SelState.Set(m_wpOldCaret, m_wpCaret); |
| 2921 | 2894 |
| 2922 » » » ScrollToCaret(); | 2895 ScrollToCaret(); |
| 2923 » » » CPVT_WordRange wr(m_wpOldCaret, m_wpCaret); | 2896 CPVT_WordRange wr(m_wpOldCaret, m_wpCaret); |
| 2924 » » » Refresh(RP_OPTIONAL, &wr); | 2897 Refresh(RP_OPTIONAL, &wr); |
| 2925 » » » SetCaretInfo(); | 2898 SetCaretInfo(); |
| 2926 » » } | 2899 } |
| 2927 » » else | 2900 else |
| 2928 » » { | 2901 { |
| 2929 » » » if (m_SelState.IsExist()) | 2902 if (m_SelState.IsExist()) |
| 2930 » » » { | 2903 { |
| 2931 » » » » if (m_SelState.BeginPos.WordCmp(m_SelState.EndPo
s)>0) | 2904 if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos)>0) |
| 2932 » » » » » SetCaret(m_SelState.BeginPos); | 2905 SetCaret(m_SelState.BeginPos); |
| 2933 » » » » else | 2906 else |
| 2934 » » » » » SetCaret(m_SelState.EndPos); | 2907 SetCaret(m_SelState.EndPos); |
| 2935 | 2908 |
| 2936 » » » » SelectNone(); | 2909 SelectNone(); |
| 2937 » » » » ScrollToCaret(); | 2910 ScrollToCaret(); |
| 2938 » » » » SetCaretInfo(); | 2911 SetCaretInfo(); |
| 2939 » » » } | 2912 } |
| 2940 » » » else | 2913 else |
| 2941 » » » { | 2914 { |
| 2942 » » » » if (bCtrl) | 2915 if (bCtrl) |
| 2943 » » » » » SetCaret(m_pVT->GetEndWordPlace()); | 2916 SetCaret(m_pVT->GetEndWordPlace()); |
| 2944 » » » » else | 2917 else |
| 2945 » » » » » SetCaret(m_pVT->GetLineEndPlace(m_wpCare
t)); | 2918 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); |
| 2946 | 2919 |
| 2947 » » » » ScrollToCaret(); | 2920 ScrollToCaret(); |
| 2948 » » » » SetCaretOrigin(); | 2921 SetCaretOrigin(); |
| 2949 » » » » SetCaretInfo(); | 2922 SetCaretInfo(); |
| 2950 » » » } | 2923 } |
| 2951 » » } | 2924 } |
| 2952 » } | 2925 } |
| 2953 } | 2926 } |
| 2954 | 2927 |
| 2955 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset, | 2928 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset, |
| 2956 » » » » » » const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 2929 const CPVT_SecProps * pSecProps,const CPVT_WordProps * p
WordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) |
| 2957 { | 2930 { |
| 2958 » Empty(); | 2931 Empty(); |
| 2959 » DoInsertText(CPVT_WordPlace(0,0,-1), text, charset, pSecProps, pWordProp
s); | 2932 DoInsertText(CPVT_WordPlace(0,0,-1), text, charset, pSecProps, pWordProps); |
| 2960 » if (bPaint) Paint(); | 2933 if (bPaint) Paint(); |
| 2961 » if (m_bOprNotify && m_pOprNotify) | 2934 if (m_bOprNotify && m_pOprNotify) |
| 2962 » » m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret); | 2935 m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret); |
| 2963 » //if (bAddUndo) | 2936 //if (bAddUndo) |
| 2964 } | 2937 } |
| 2965 | 2938 |
| 2966 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps
* pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 2939 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps
* pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) |
| 2967 { | 2940 { |
| 2968 » if (IsTextOverflow()) return FALSE; | 2941 if (IsTextOverflow()) return FALSE; |
| 2969 | 2942 |
| 2970 » if (m_pVT->IsValid()) | 2943 if (m_pVT->IsValid()) |
| 2971 » { | 2944 { |
| 2972 » » m_pVT->UpdateWordPlace(m_wpCaret); | 2945 m_pVT->UpdateWordPlace(m_wpCaret); |
| 2973 | 2946 |
| 2974 » » SetCaret(m_pVT->InsertWord(m_wpCaret,word,GetCharSetFromUnicode(
word, charset),pWordProps)); | 2947 SetCaret(m_pVT->InsertWord(m_wpCaret,word,GetCharSetFromUnicode(word, ch
arset),pWordProps)); |
| 2975 » » m_SelState.Set(m_wpCaret,m_wpCaret); | 2948 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 2976 | 2949 |
| 2977 » » if (m_wpCaret != m_wpOldCaret) | 2950 if (m_wpCaret != m_wpOldCaret) |
| 2978 » » { | 2951 { |
| 2979 » » » if (bAddUndo && m_bEnableUndo) | 2952 if (bAddUndo && m_bEnableUndo) |
| 2980 » » » { | 2953 { |
| 2981 » » » » AddEditUndoItem(new CFXEU_InsertWord(this,m_wpOl
dCaret,m_wpCaret,word,charset,pWordProps)); | 2954 AddEditUndoItem(new CFXEU_InsertWord(this,m_wpOldCaret,m_wpCaret
,word,charset,pWordProps)); |
| 2982 » » » } | 2955 } |
| 2983 | 2956 |
| 2984 » » » if (bPaint) | 2957 if (bPaint) |
| 2985 » » » » PaintInsertText(m_wpOldCaret, m_wpCaret); | 2958 PaintInsertText(m_wpOldCaret, m_wpCaret); |
| 2986 | 2959 |
| 2987 » » » if (m_bOprNotify && m_pOprNotify) | 2960 if (m_bOprNotify && m_pOprNotify) |
| 2988 » » » » m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCar
et); | 2961 m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCaret); |
| 2989 | 2962 |
| 2990 » » » return TRUE; | 2963 return TRUE; |
| 2991 » » } | 2964 } |
| 2992 » } | 2965 } |
| 2993 | 2966 |
| 2994 » return FALSE; | 2967 return FALSE; |
| 2995 } | 2968 } |
| 2996 | 2969 |
| 2997 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordPr
ops * pWordProps, | 2970 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordPr
ops * pWordProps, |
| 2998 » » » » » » » FX_BOOL bAddUndo, FX_
BOOL bPaint) | 2971 FX_BOOL bAddUndo, FX_BOOL bPaint) |
| 2999 { | 2972 { |
| 3000 » if (IsTextOverflow()) return FALSE; | 2973 if (IsTextOverflow()) return FALSE; |
| 3001 | 2974 |
| 3002 » if (m_pVT->IsValid()) | 2975 if (m_pVT->IsValid()) |
| 3003 » { | 2976 { |
| 3004 » » m_pVT->UpdateWordPlace(m_wpCaret); | 2977 m_pVT->UpdateWordPlace(m_wpCaret); |
| 3005 » » SetCaret(m_pVT->InsertSection(m_wpCaret,pSecProps,pWordProps)); | 2978 SetCaret(m_pVT->InsertSection(m_wpCaret,pSecProps,pWordProps)); |
| 3006 » » m_SelState.Set(m_wpCaret,m_wpCaret); | 2979 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 3007 | 2980 |
| 3008 » » if (m_wpCaret != m_wpOldCaret) | 2981 if (m_wpCaret != m_wpOldCaret) |
| 3009 » » { | 2982 { |
| 3010 » » » if (bAddUndo && m_bEnableUndo) | 2983 if (bAddUndo && m_bEnableUndo) |
| 3011 » » » { | 2984 { |
| 3012 » » » » AddEditUndoItem(new CFXEU_InsertReturn(this,m_wp
OldCaret,m_wpCaret,pSecProps,pWordProps)); | 2985 AddEditUndoItem(new CFXEU_InsertReturn(this,m_wpOldCaret,m_wpCar
et,pSecProps,pWordProps)); |
| 3013 » » » } | 2986 } |
| 3014 | 2987 |
| 3015 » » » if (bPaint) | 2988 if (bPaint) |
| 3016 » » » { | 2989 { |
| 3017 » » » » RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpC
aret)); | 2990 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret)); |
| 3018 » » » » ScrollToCaret(); | 2991 ScrollToCaret(); |
| 3019 » » » » CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRa
nge().EndPos); | 2992 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); |
| 3020 » » » » Refresh(RP_ANALYSE, &wr); | 2993 Refresh(RP_ANALYSE, &wr); |
| 3021 » » » » SetCaretOrigin(); | 2994 SetCaretOrigin(); |
| 3022 » » » » SetCaretInfo(); | 2995 SetCaretInfo(); |
| 3023 » » » } | 2996 } |
| 3024 | 2997 |
| 3025 » » » if (m_bOprNotify && m_pOprNotify) | 2998 if (m_bOprNotify && m_pOprNotify) |
| 3026 » » » » m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldC
aret); | 2999 m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret); |
| 3027 | 3000 |
| 3028 » » » return TRUE; | 3001 return TRUE; |
| 3029 » » } | 3002 } |
| 3030 » } | 3003 } |
| 3031 | 3004 |
| 3032 » return FALSE; | 3005 return FALSE; |
| 3033 } | 3006 } |
| 3034 | 3007 |
| 3035 FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) | 3008 FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) |
| 3036 { | 3009 { |
| 3037 » if (m_pVT->IsValid()) | 3010 if (m_pVT->IsValid()) |
| 3038 » { | 3011 { |
| 3039 » » if (m_wpCaret == m_pVT->GetBeginWordPlace()) return FALSE; | 3012 if (m_wpCaret == m_pVT->GetBeginWordPlace()) return FALSE; |
| 3040 | 3013 |
| 3041 » » CPVT_Section section; | 3014 CPVT_Section section; |
| 3042 » » CPVT_Word word; | 3015 CPVT_Word word; |
| 3043 | 3016 |
| 3044 » » if (bAddUndo) | 3017 if (bAddUndo) |
| 3045 » » { | 3018 { |
| 3046 » » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetI
terator()) | 3019 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 3047 » » » { | 3020 { |
| 3048 » » » » pIterator->SetAt(m_wpCaret); | 3021 pIterator->SetAt(m_wpCaret); |
| 3049 » » » » pIterator->GetSection(section); | 3022 pIterator->GetSection(section); |
| 3050 » » » » pIterator->GetWord(word); | 3023 pIterator->GetWord(word); |
| 3051 » » » } | 3024 } |
| 3052 » » } | 3025 } |
| 3053 | 3026 |
| 3054 » » m_pVT->UpdateWordPlace(m_wpCaret); | 3027 m_pVT->UpdateWordPlace(m_wpCaret); |
| 3055 » » SetCaret(m_pVT->BackSpaceWord(m_wpCaret)); | 3028 SetCaret(m_pVT->BackSpaceWord(m_wpCaret)); |
| 3056 » » m_SelState.Set(m_wpCaret,m_wpCaret); | 3029 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 3057 | 3030 |
| 3058 » » if (m_wpCaret != m_wpOldCaret) | 3031 if (m_wpCaret != m_wpOldCaret) |
| 3059 » » { | 3032 { |
| 3060 » » » if (bAddUndo && m_bEnableUndo) | 3033 if (bAddUndo && m_bEnableUndo) |
| 3061 » » » { | 3034 { |
| 3062 » » » » if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) | 3035 if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) |
| 3063 » » » » » AddEditUndoItem(new CFXEU_Backspace(this
,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, | 3036 AddEditUndoItem(new CFXEU_Backspace(this,m_wpOldCaret,m_wpCa
ret,word.Word,word.nCharset, |
| 3064 » » » » » » section.SecProps,section.WordPro
ps)); | 3037 section.SecProps,section.WordProps)); |
| 3065 » » » » else | 3038 else |
| 3066 » » » » » AddEditUndoItem(new CFXEU_Backspace(this
,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, | 3039 AddEditUndoItem(new CFXEU_Backspace(this,m_wpOldCaret,m_wpCa
ret,word.Word,word.nCharset, |
| 3067 » » » » » » section.SecProps,word.WordProps)
); | 3040 section.SecProps,word.WordProps)); |
| 3068 » » » } | 3041 } |
| 3069 | 3042 |
| 3070 » » » if (bPaint) | 3043 if (bPaint) |
| 3071 » » » { | 3044 { |
| 3072 » » » » RearrangePart(CPVT_WordRange(m_wpCaret,m_wpOldCa
ret)); | 3045 RearrangePart(CPVT_WordRange(m_wpCaret,m_wpOldCaret)); |
| 3073 » » » » ScrollToCaret(); | 3046 ScrollToCaret(); |
| 3074 | 3047 |
| 3075 » » » » CPVT_WordRange wr; | 3048 CPVT_WordRange wr; |
| 3076 » » » » if (m_wpCaret.SecCmp(m_wpOldCaret) !=0) | 3049 if (m_wpCaret.SecCmp(m_wpOldCaret) !=0) |
| 3077 » » » » » wr = CPVT_WordRange(m_pVT->GetPrevWordPl
ace(m_wpCaret),GetVisibleWordRange().EndPos); | 3050 wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),GetVi
sibleWordRange().EndPos); |
| 3078 » » » » else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) | 3051 else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) |
| 3079 » » » » » wr = CPVT_WordRange(m_pVT->GetLineBeginP
lace(m_wpCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); | 3052 wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),m_pV
T->GetSectionEndPlace(m_wpCaret)); |
| 3080 » » » » else | 3053 else |
| 3081 » » » » » wr = CPVT_WordRange(m_pVT->GetPrevWordPl
ace(m_wpCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); | 3054 wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),m_pVT
->GetSectionEndPlace(m_wpCaret)); |
| 3082 | 3055 |
| 3083 » » » » Refresh(RP_ANALYSE, &wr); | 3056 Refresh(RP_ANALYSE, &wr); |
| 3084 | 3057 |
| 3085 » » » » SetCaretOrigin(); | 3058 SetCaretOrigin(); |
| 3086 » » » » SetCaretInfo(); | 3059 SetCaretInfo(); |
| 3087 » » » } | 3060 } |
| 3088 | 3061 |
| 3089 » » » if (m_bOprNotify && m_pOprNotify) | 3062 if (m_bOprNotify && m_pOprNotify) |
| 3090 » » » » m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCare
t); | 3063 m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCaret); |
| 3091 | 3064 |
| 3092 » » » return TRUE; | 3065 return TRUE; |
| 3093 » » } | 3066 } |
| 3094 » } | 3067 } |
| 3095 | 3068 |
| 3096 » return FALSE; | 3069 return FALSE; |
| 3097 } | 3070 } |
| 3098 | 3071 |
| 3099 FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) | 3072 FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) |
| 3100 { | 3073 { |
| 3101 » if (m_pVT->IsValid()) | 3074 if (m_pVT->IsValid()) |
| 3102 » { | 3075 { |
| 3103 » » if (m_wpCaret == m_pVT->GetEndWordPlace()) return FALSE; | 3076 if (m_wpCaret == m_pVT->GetEndWordPlace()) return FALSE; |
| 3104 | 3077 |
| 3105 » » CPVT_Section section; | 3078 CPVT_Section section; |
| 3106 » » CPVT_Word word; | 3079 CPVT_Word word; |
| 3107 | 3080 |
| 3108 » » if (bAddUndo) | 3081 if (bAddUndo) |
| 3109 » » { | 3082 { |
| 3110 » » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetI
terator()) | 3083 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 3111 » » » { | 3084 { |
| 3112 » » » » pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCar
et)); | 3085 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); |
| 3113 » » » » pIterator->GetSection(section); | 3086 pIterator->GetSection(section); |
| 3114 » » » » pIterator->GetWord(word); | 3087 pIterator->GetWord(word); |
| 3115 » » » } | 3088 } |
| 3116 » » } | 3089 } |
| 3117 | 3090 |
| 3118 » » m_pVT->UpdateWordPlace(m_wpCaret); | 3091 m_pVT->UpdateWordPlace(m_wpCaret); |
| 3119 » » FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCa
ret)); | 3092 FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); |
| 3120 | 3093 |
| 3121 » » SetCaret(m_pVT->DeleteWord(m_wpCaret)); | 3094 SetCaret(m_pVT->DeleteWord(m_wpCaret)); |
| 3122 » » m_SelState.Set(m_wpCaret,m_wpCaret); | 3095 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 3123 | 3096 |
| 3124 » » if (bAddUndo && m_bEnableUndo) | 3097 if (bAddUndo && m_bEnableUndo) |
| 3125 » » { | 3098 { |
| 3126 » » » if (bSecEnd) | 3099 if (bSecEnd) |
| 3127 » » » » AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCar
et,m_wpCaret,word.Word,word.nCharset, | 3100 AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,wor
d.Word,word.nCharset, |
| 3128 » » » » » section.SecProps,section.WordProps,bSecE
nd)); | 3101 section.SecProps,section.WordProps,bSecEnd)); |
| 3129 » » » else | 3102 else |
| 3130 » » » » AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCar
et,m_wpCaret,word.Word,word.nCharset, | 3103 AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,wor
d.Word,word.nCharset, |
| 3131 » » » » » section.SecProps,word.WordProps,bSecEnd)
); | 3104 section.SecProps,word.WordProps,bSecEnd)); |
| 3132 » » } | 3105 } |
| 3133 | 3106 |
| 3134 » » if (bPaint) | 3107 if (bPaint) |
| 3135 » » { | 3108 { |
| 3136 » » » RearrangePart(CPVT_WordRange(m_wpOldCaret,m_wpCaret)); | 3109 RearrangePart(CPVT_WordRange(m_wpOldCaret,m_wpCaret)); |
| 3137 » » » ScrollToCaret(); | 3110 ScrollToCaret(); |
| 3138 | 3111 |
| 3139 » » » CPVT_WordRange wr; | 3112 CPVT_WordRange wr; |
| 3140 » » » if (bSecEnd) | 3113 if (bSecEnd) |
| 3141 » » » » wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wp
OldCaret),GetVisibleWordRange().EndPos); | 3114 wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),GetVis
ibleWordRange().EndPos); |
| 3142 » » » else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) | 3115 else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) |
| 3143 » » » » wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_w
pCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); | 3116 wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),m_pVT->G
etSectionEndPlace(m_wpCaret)); |
| 3144 » » » else | 3117 else |
| 3145 » » » » wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wp
OldCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); | 3118 wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),m_pVT-
>GetSectionEndPlace(m_wpCaret)); |
| 3146 | 3119 |
| 3147 » » » Refresh(RP_ANALYSE, &wr); | 3120 Refresh(RP_ANALYSE, &wr); |
| 3148 | 3121 |
| 3149 » » » SetCaretOrigin(); | 3122 SetCaretOrigin(); |
| 3150 » » » SetCaretInfo(); | 3123 SetCaretInfo(); |
| 3151 » » } | 3124 } |
| 3152 | 3125 |
| 3153 » » if (m_bOprNotify && m_pOprNotify) | 3126 if (m_bOprNotify && m_pOprNotify) |
| 3154 » » » m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); | 3127 m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); |
| 3155 | 3128 |
| 3156 » » return TRUE; | 3129 return TRUE; |
| 3157 » } | 3130 } |
| 3158 | 3131 |
| 3159 » return FALSE; | 3132 return FALSE; |
| 3160 } | 3133 } |
| 3161 | 3134 |
| 3162 FX_BOOL»CFX_Edit::Empty() | 3135 FX_BOOL CFX_Edit::Empty() |
| 3163 { | 3136 { |
| 3164 » if (m_pVT->IsValid()) | 3137 if (m_pVT->IsValid()) |
| 3165 » { | 3138 { |
| 3166 » » m_pVT->DeleteWords(GetWholeWordRange()); | 3139 m_pVT->DeleteWords(GetWholeWordRange()); |
| 3167 » » SetCaret(m_pVT->GetBeginWordPlace()); | 3140 SetCaret(m_pVT->GetBeginWordPlace()); |
| 3168 | 3141 |
| 3169 » » return TRUE; | 3142 return TRUE; |
| 3170 » } | 3143 } |
| 3171 | 3144 |
| 3172 » return FALSE; | 3145 return FALSE; |
| 3173 } | 3146 } |
| 3174 | 3147 |
| 3175 FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) | 3148 FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) |
| 3176 { | 3149 { |
| 3177 » if (m_pVT->IsValid()) | 3150 if (m_pVT->IsValid()) |
| 3178 » { | 3151 { |
| 3179 » » if (m_SelState.IsExist()) | 3152 if (m_SelState.IsExist()) |
| 3180 » » { | 3153 { |
| 3181 » » » CPVT_WordRange range = m_SelState.ConvertToWordRange(); | 3154 CPVT_WordRange range = m_SelState.ConvertToWordRange(); |
| 3182 | 3155 |
| 3183 » » » if (bAddUndo && m_bEnableUndo) | 3156 if (bAddUndo && m_bEnableUndo) |
| 3184 » » » { | 3157 { |
| 3185 » » » » if (m_pVT->IsRichText()) | 3158 if (m_pVT->IsRichText()) |
| 3186 » » » » { | 3159 { |
| 3187 » » » » » BeginGroupUndo(L""); | 3160 BeginGroupUndo(L""); |
| 3188 | 3161 |
| 3189 » » » » » if (IPDF_VariableText_Iterator * pIterat
or = m_pVT->GetIterator()) | 3162 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetItera
tor()) |
| 3190 » » » » » { | 3163 { |
| 3191 » » » » » » pIterator->SetAt(range.EndPos); | 3164 pIterator->SetAt(range.EndPos); |
| 3192 | 3165 |
| 3193 » » » » » » CPVT_Word wordinfo; | 3166 CPVT_Word wordinfo; |
| 3194 » » » » » » CPVT_Section secinfo; | 3167 CPVT_Section secinfo; |
| 3195 » » » » » » do | 3168 do |
| 3196 » » » » » » { | 3169 { |
| 3197 » » » » » » » CPVT_WordPlace place = p
Iterator->GetAt(); | 3170 CPVT_WordPlace place = pIterator->GetAt(); |
| 3198 » » » » » » » if (place.WordCmp(range.
BeginPos) <= 0)break; | 3171 if (place.WordCmp(range.BeginPos) <= 0)break; |
| 3199 | 3172 |
| 3200 » » » » » » » CPVT_WordPlace oldplace
= m_pVT->GetPrevWordPlace(place); | 3173 CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(pl
ace); |
| 3201 | 3174 |
| 3202 » » » » » » » if (oldplace.SecCmp(plac
e) != 0) | 3175 if (oldplace.SecCmp(place) != 0) |
| 3203 » » » » » » » { | 3176 { |
| 3204 » » » » » » » » if (pIterator->G
etSection(secinfo)) | 3177 if (pIterator->GetSection(secinfo)) |
| 3205 » » » » » » » » { | 3178 { |
| 3206 » » » » » » » » » AddEditU
ndoItem(new CFXEU_ClearRich(this,oldplace,place,range,wordinfo.Word, | 3179 AddEditUndoItem(new CFXEU_ClearRich(this,old
place,place,range,wordinfo.Word, |
| 3207 » » » » » » » » » »
wordinfo.nCharset,secinfo.SecProps,secinfo.WordProps)); | 3180 wordinfo.nCharset,secinfo.SecProps,secin
fo.WordProps)); |
| 3208 » » » » » » » » } | 3181 } |
| 3209 » » » » » » » } | 3182 } |
| 3210 » » » » » » » else | 3183 else |
| 3211 » » » » » » » { | 3184 { |
| 3212 » » » » » » » » if (pIterator->G
etWord(wordinfo)) | 3185 if (pIterator->GetWord(wordinfo)) |
| 3213 » » » » » » » » { | 3186 { |
| 3214 » » » » » » » » » oldplace
= m_pVT->AjustLineHeader(oldplace,TRUE); | 3187 oldplace = m_pVT->AjustLineHeader(oldplace,T
RUE); |
| 3215 » » » » » » » » » place =
m_pVT->AjustLineHeader(place,TRUE); | 3188 place = m_pVT->AjustLineHeader(place,TRUE); |
| 3216 | 3189 |
| 3217 » » » » » » » » » AddEditU
ndoItem(new CFXEU_ClearRich(this,oldplace,place,range,wordinfo.Word, | 3190 AddEditUndoItem(new CFXEU_ClearRich(this,old
place,place,range,wordinfo.Word, |
| 3218 » » » » » » » » » »
wordinfo.nCharset,secinfo.SecProps,wordinfo.WordProps)); | 3191 wordinfo.nCharset,secinfo.SecProps,wordi
nfo.WordProps)); |
| 3219 » » » » » » » » } | 3192 } |
| 3220 » » » » » » » } | 3193 } |
| 3221 » » » » » » }while (pIterator->PrevWord()); | 3194 }while (pIterator->PrevWord()); |
| 3222 » » » » » } | 3195 } |
| 3223 » » » » » EndGroupUndo(); | 3196 EndGroupUndo(); |
| 3224 » » » » } | 3197 } |
| 3225 » » » » else | 3198 else |
| 3226 » » » » { | 3199 { |
| 3227 » » » » » AddEditUndoItem(new CFXEU_Clear(this,ran
ge,GetSelText())); | 3200 AddEditUndoItem(new CFXEU_Clear(this,range,GetSelText())); |
| 3228 » » » » } | 3201 } |
| 3229 » » » } | 3202 } |
| 3230 | 3203 |
| 3231 » » » SelectNone(); | 3204 SelectNone(); |
| 3232 » » » SetCaret(m_pVT->DeleteWords(range)); | 3205 SetCaret(m_pVT->DeleteWords(range)); |
| 3233 » » » m_SelState.Set(m_wpCaret,m_wpCaret); | 3206 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 3234 | 3207 |
| 3235 » » » if (bPaint) | 3208 if (bPaint) |
| 3236 » » » { | 3209 { |
| 3237 » » » » RearrangePart(range); | 3210 RearrangePart(range); |
| 3238 » » » » ScrollToCaret(); | 3211 ScrollToCaret(); |
| 3239 | 3212 |
| 3240 » » » » CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRa
nge().EndPos); | 3213 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); |
| 3241 » » » » Refresh(RP_ANALYSE, &wr); | 3214 Refresh(RP_ANALYSE, &wr); |
| 3242 | 3215 |
| 3243 » » » » SetCaretOrigin(); | 3216 SetCaretOrigin(); |
| 3244 » » » » SetCaretInfo(); | 3217 SetCaretInfo(); |
| 3245 » » » } | 3218 } |
| 3246 | 3219 |
| 3247 » » » if (m_bOprNotify && m_pOprNotify) | 3220 if (m_bOprNotify && m_pOprNotify) |
| 3248 » » » » m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); | 3221 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); |
| 3249 | 3222 |
| 3250 » » » return TRUE; | 3223 return TRUE; |
| 3251 » » } | 3224 } |
| 3252 » } | 3225 } |
| 3253 | 3226 |
| 3254 » return FALSE; | 3227 return FALSE; |
| 3255 } | 3228 } |
| 3256 | 3229 |
| 3257 FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset, | 3230 FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset, |
| 3258 » » » » » const CPVT_SecProps * pSecProps, const C
PVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 3231 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWor
dProps, FX_BOOL bAddUndo, FX_BOOL bPaint) |
| 3259 { | 3232 { |
| 3260 » if (IsTextOverflow()) return FALSE; | 3233 if (IsTextOverflow()) return FALSE; |
| 3261 | 3234 |
| 3262 » m_pVT->UpdateWordPlace(m_wpCaret); | 3235 m_pVT->UpdateWordPlace(m_wpCaret); |
| 3263 » SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps)); | 3236 SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps)); |
| 3264 » m_SelState.Set(m_wpCaret,m_wpCaret); | 3237 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 3265 | 3238 |
| 3266 » if (m_wpCaret != m_wpOldCaret) | 3239 if (m_wpCaret != m_wpOldCaret) |
| 3267 » { | 3240 { |
| 3268 » » if (bAddUndo && m_bEnableUndo) | 3241 if (bAddUndo && m_bEnableUndo) |
| 3269 » » { | 3242 { |
| 3270 » » » AddEditUndoItem(new CFXEU_InsertText(this,m_wpOldCaret,m
_wpCaret,text,charset,pSecProps,pWordProps)); | 3243 AddEditUndoItem(new CFXEU_InsertText(this,m_wpOldCaret,m_wpCaret,tex
t,charset,pSecProps,pWordProps)); |
| 3271 » » } | 3244 } |
| 3272 | 3245 |
| 3273 » » if (bPaint) | 3246 if (bPaint) |
| 3274 » » » PaintInsertText(m_wpOldCaret, m_wpCaret); | 3247 PaintInsertText(m_wpOldCaret, m_wpCaret); |
| 3275 | 3248 |
| 3276 » » if (m_bOprNotify && m_pOprNotify) | 3249 if (m_bOprNotify && m_pOprNotify) |
| 3277 » » » m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); | 3250 m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); |
| 3278 | 3251 |
| 3279 » » return TRUE; | 3252 return TRUE; |
| 3280 » } | 3253 } |
| 3281 » return FALSE; | 3254 return FALSE; |
| 3282 } | 3255 } |
| 3283 | 3256 |
| 3284 void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac
e & wpNew) | 3257 void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac
e & wpNew) |
| 3285 { | 3258 { |
| 3286 » if (m_pVT->IsValid()) | 3259 if (m_pVT->IsValid()) |
| 3287 » { | 3260 { |
| 3288 » » RearrangePart(CPVT_WordRange(wpOld,wpNew)); | 3261 RearrangePart(CPVT_WordRange(wpOld,wpNew)); |
| 3289 » » ScrollToCaret(); | 3262 ScrollToCaret(); |
| 3290 | 3263 |
| 3291 » » CPVT_WordRange wr; | 3264 CPVT_WordRange wr; |
| 3292 » » if (m_wpCaret.LineCmp(wpOld) !=0) | 3265 if (m_wpCaret.LineCmp(wpOld) !=0) |
| 3293 » » » wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pV
T->GetSectionEndPlace(wpNew)); | 3266 wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectio
nEndPlace(wpNew)); |
| 3294 » » else | 3267 else |
| 3295 » » » wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNe
w)); | 3268 wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew)); |
| 3296 » » Refresh(RP_ANALYSE, &wr); | 3269 Refresh(RP_ANALYSE, &wr); |
| 3297 » » SetCaretOrigin(); | 3270 SetCaretOrigin(); |
| 3298 » » SetCaretInfo(); | 3271 SetCaretInfo(); |
| 3299 » } | 3272 } |
| 3300 } | 3273 } |
| 3301 | 3274 |
| 3302 FX_BOOL CFX_Edit::Redo() | 3275 FX_BOOL CFX_Edit::Redo() |
| 3303 { | 3276 { |
| 3304 » if (m_bEnableUndo) | 3277 if (m_bEnableUndo) |
| 3305 » { | 3278 { |
| 3306 » » if (m_Undo.CanRedo()) | 3279 if (m_Undo.CanRedo()) |
| 3307 » » { | 3280 { |
| 3308 » » » m_Undo.Redo(); | 3281 m_Undo.Redo(); |
| 3309 » » » return TRUE; | 3282 return TRUE; |
| 3310 » » } | 3283 } |
| 3311 » } | 3284 } |
| 3312 | 3285 |
| 3313 » return FALSE; | 3286 return FALSE; |
| 3314 } | 3287 } |
| 3315 | 3288 |
| 3316 FX_BOOL CFX_Edit::Undo() | 3289 FX_BOOL CFX_Edit::Undo() |
| 3317 { | 3290 { |
| 3318 » if (m_bEnableUndo) | 3291 if (m_bEnableUndo) |
| 3319 » { | 3292 { |
| 3320 » » if (m_Undo.CanUndo()) | 3293 if (m_Undo.CanUndo()) |
| 3321 » » { | 3294 { |
| 3322 » » » m_Undo.Undo(); | 3295 m_Undo.Undo(); |
| 3323 » » » return TRUE; | 3296 return TRUE; |
| 3324 » » } | 3297 } |
| 3325 » } | 3298 } |
| 3326 | 3299 |
| 3327 » return FALSE; | 3300 return FALSE; |
| 3328 } | 3301 } |
| 3329 | 3302 |
| 3330 void CFX_Edit::SetCaretOrigin() | 3303 void CFX_Edit::SetCaretOrigin() |
| 3331 { | 3304 { |
| 3332 » if (m_pVT->IsValid()) | 3305 if (m_pVT->IsValid()) |
| 3333 » { | 3306 { |
| 3334 » » if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 3307 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
| 3335 » » { | 3308 { |
| 3336 » » » pIterator->SetAt(m_wpCaret); | 3309 pIterator->SetAt(m_wpCaret); |
| 3337 » » » CPVT_Word word; | 3310 CPVT_Word word; |
| 3338 » » » CPVT_Line line; | 3311 CPVT_Line line; |
| 3339 » » » if (pIterator->GetWord(word)) | 3312 if (pIterator->GetWord(word)) |
| 3340 » » » { | 3313 { |
| 3341 » » » » m_ptCaret.x = word.ptWord.x + word.fWidth; | 3314 m_ptCaret.x = word.ptWord.x + word.fWidth; |
| 3342 » » » » m_ptCaret.y = word.ptWord.y; | 3315 m_ptCaret.y = word.ptWord.y; |
| 3343 » » » } | 3316 } |
| 3344 » » » else if (pIterator->GetLine(line)) | 3317 else if (pIterator->GetLine(line)) |
| 3345 » » » { | 3318 { |
| 3346 » » » » m_ptCaret.x = line.ptLine.x; | 3319 m_ptCaret.x = line.ptLine.x; |
| 3347 » » » » m_ptCaret.y = line.ptLine.y; | 3320 m_ptCaret.y = line.ptLine.y; |
| 3348 » » » } | 3321 } |
| 3349 » » } | 3322 } |
| 3350 » } | 3323 } |
| 3351 } | 3324 } |
| 3352 | 3325 |
| 3353 int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const | 3326 int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const |
| 3354 { | 3327 { |
| 3355 » if (m_pVT->IsValid()) | 3328 if (m_pVT->IsValid()) |
| 3356 » » return m_pVT->WordPlaceToWordIndex(place); | 3329 return m_pVT->WordPlaceToWordIndex(place); |
| 3357 | 3330 |
| 3358 » return -1; | 3331 return -1; |
| 3359 } | 3332 } |
| 3360 | 3333 |
| 3361 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const | 3334 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const |
| 3362 { | 3335 { |
| 3363 » if (m_pVT->IsValid()) | 3336 if (m_pVT->IsValid()) |
| 3364 » » return m_pVT->WordIndexToWordPlace(index); | 3337 return m_pVT->WordIndexToWordPlace(index); |
| 3365 | 3338 |
| 3366 » return CPVT_WordPlace(); | 3339 return CPVT_WordPlace(); |
| 3367 } | 3340 } |
| 3368 | 3341 |
| 3369 FX_BOOL»CFX_Edit::IsTextFull() const | 3342 FX_BOOL CFX_Edit::IsTextFull() const |
| 3370 { | 3343 { |
| 3371 » int32_t nTotalWords = m_pVT->GetTotalWords(); | 3344 int32_t nTotalWords = m_pVT->GetTotalWords(); |
| 3372 » int32_t nLimitChar = m_pVT->GetLimitChar(); | 3345 int32_t nLimitChar = m_pVT->GetLimitChar(); |
| 3373 » int32_t nCharArray = m_pVT->GetCharArray(); | 3346 int32_t nCharArray = m_pVT->GetCharArray(); |
| 3374 | 3347 |
| 3375 » return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar) | 3348 return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar) |
| 3376 » » || (nCharArray>0 && nTotalWords >= nCharArray); | 3349 || (nCharArray>0 && nTotalWords >= nCharArray); |
| 3377 } | 3350 } |
| 3378 | 3351 |
| 3379 FX_BOOL»CFX_Edit::IsTextOverflow() const | 3352 FX_BOOL CFX_Edit::IsTextOverflow() const |
| 3380 { | 3353 { |
| 3381 » if (!m_bEnableScroll && !m_bEnableOverflow) | 3354 if (!m_bEnableScroll && !m_bEnableOverflow) |
| 3382 » { | 3355 { |
| 3383 » » CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 3356 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 3384 » » CPDF_Rect rcContent = m_pVT->GetContentRect(); | 3357 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 3385 | 3358 |
| 3386 » » if (m_pVT->IsMultiLine() && GetTotalLines() > 1) | 3359 if (m_pVT->IsMultiLine() && GetTotalLines() > 1) |
| 3387 » » { | 3360 { |
| 3388 » » » if (FX_EDIT_IsFloatBigger(rcContent.Height(),rcPlate.Hei
ght())) return TRUE; | 3361 if (FX_EDIT_IsFloatBigger(rcContent.Height(),rcPlate.Height())) retu
rn TRUE; |
| 3389 » » } | 3362 } |
| 3390 | 3363 |
| 3391 » » if (FX_EDIT_IsFloatBigger(rcContent.Width(),rcPlate.Width())) re
turn TRUE; | 3364 if (FX_EDIT_IsFloatBigger(rcContent.Width(),rcPlate.Width())) return TRU
E; |
| 3392 » } | 3365 } |
| 3393 | 3366 |
| 3394 » return FALSE; | 3367 return FALSE; |
| 3395 } | 3368 } |
| 3396 | 3369 |
| 3397 CPVT_WordPlace CFX_Edit::GetLineBeginPlace(const CPVT_WordPlace & place) const | 3370 CPVT_WordPlace CFX_Edit::GetLineBeginPlace(const CPVT_WordPlace & place) const |
| 3398 { | 3371 { |
| 3399 » return m_pVT->GetLineBeginPlace(place); | 3372 return m_pVT->GetLineBeginPlace(place); |
| 3400 } | 3373 } |
| 3401 | 3374 |
| 3402 CPVT_WordPlace CFX_Edit::GetLineEndPlace(const CPVT_WordPlace & place) const | 3375 CPVT_WordPlace CFX_Edit::GetLineEndPlace(const CPVT_WordPlace & place) const |
| 3403 { | 3376 { |
| 3404 » return m_pVT->GetLineEndPlace(place); | 3377 return m_pVT->GetLineEndPlace(place); |
| 3405 } | 3378 } |
| 3406 | 3379 |
| 3407 CPVT_WordPlace CFX_Edit::GetSectionBeginPlace(const CPVT_WordPlace & place) cons
t | 3380 CPVT_WordPlace CFX_Edit::GetSectionBeginPlace(const CPVT_WordPlace & place) cons
t |
| 3408 { | 3381 { |
| 3409 » return m_pVT->GetSectionBeginPlace(place); | 3382 return m_pVT->GetSectionBeginPlace(place); |
| 3410 } | 3383 } |
| 3411 | 3384 |
| 3412 CPVT_WordPlace CFX_Edit::GetSectionEndPlace(const CPVT_WordPlace & place) const | 3385 CPVT_WordPlace CFX_Edit::GetSectionEndPlace(const CPVT_WordPlace & place) const |
| 3413 { | 3386 { |
| 3414 » return m_pVT->GetSectionEndPlace(place); | 3387 return m_pVT->GetSectionEndPlace(place); |
| 3415 } | 3388 } |
| 3416 | 3389 |
| 3417 FX_BOOL»CFX_Edit::CanUndo() const | 3390 FX_BOOL CFX_Edit::CanUndo() const |
| 3418 { | 3391 { |
| 3419 » if (m_bEnableUndo) | 3392 if (m_bEnableUndo) |
| 3420 » { | 3393 { |
| 3421 » » return m_Undo.CanUndo(); | 3394 return m_Undo.CanUndo(); |
| 3422 » } | 3395 } |
| 3423 | 3396 |
| 3424 » return FALSE; | 3397 return FALSE; |
| 3425 } | 3398 } |
| 3426 | 3399 |
| 3427 FX_BOOL»CFX_Edit::CanRedo() const | 3400 FX_BOOL CFX_Edit::CanRedo() const |
| 3428 { | 3401 { |
| 3429 » if (m_bEnableUndo) | 3402 if (m_bEnableUndo) |
| 3430 » { | 3403 { |
| 3431 » » return m_Undo.CanRedo(); | 3404 return m_Undo.CanRedo(); |
| 3432 » } | 3405 } |
| 3433 | 3406 |
| 3434 » return FALSE; | 3407 return FALSE; |
| 3435 } | 3408 } |
| 3436 | 3409 |
| 3437 FX_BOOL»CFX_Edit::IsModified() const | 3410 FX_BOOL CFX_Edit::IsModified() const |
| 3438 { | 3411 { |
| 3439 » if (m_bEnableUndo) | 3412 if (m_bEnableUndo) |
| 3440 » { | 3413 { |
| 3441 » » return m_Undo.IsModified(); | 3414 return m_Undo.IsModified(); |
| 3442 » } | 3415 } |
| 3443 | 3416 |
| 3444 » return FALSE; | 3417 return FALSE; |
| 3445 } | 3418 } |
| 3446 | 3419 |
| 3447 void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) | 3420 void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) |
| 3448 { | 3421 { |
| 3449 » m_bEnableRefresh = bRefresh; | 3422 m_bEnableRefresh = bRefresh; |
| 3450 } | 3423 } |
| 3451 | 3424 |
| 3452 void CFX_Edit::EnableUndo(FX_BOOL bUndo) | 3425 void CFX_Edit::EnableUndo(FX_BOOL bUndo) |
| 3453 { | 3426 { |
| 3454 m_bEnableUndo = bUndo; | 3427 m_bEnableUndo = bUndo; |
| 3455 } | 3428 } |
| 3456 | 3429 |
| 3457 void CFX_Edit::EnableNotify(FX_BOOL bNotify) | 3430 void CFX_Edit::EnableNotify(FX_BOOL bNotify) |
| 3458 { | 3431 { |
| 3459 m_bNotify = bNotify; | 3432 m_bNotify = bNotify; |
| 3460 } | 3433 } |
| 3461 | 3434 |
| 3462 void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) | 3435 void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) |
| 3463 { | 3436 { |
| 3464 m_bOprNotify = bNotify; | 3437 m_bOprNotify = bNotify; |
| 3465 } | 3438 } |
| 3466 | 3439 |
| 3467 FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const | 3440 FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const |
| 3468 { | 3441 { |
| 3469 » if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) | 3442 if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) |
| 3470 » { | 3443 { |
| 3471 » » CPVT_WordPlace wpOld = pIterator->GetAt(); | 3444 CPVT_WordPlace wpOld = pIterator->GetAt(); |
| 3472 | 3445 |
| 3473 » » pIterator->SetAt(place); | 3446 pIterator->SetAt(place); |
| 3474 » » CPVT_Line line; | 3447 CPVT_Line line; |
| 3475 » » pIterator->GetLine(line); | 3448 pIterator->GetLine(line); |
| 3476 | 3449 |
| 3477 » » pIterator->SetAt(wpOld); | 3450 pIterator->SetAt(wpOld); |
| 3478 | 3451 |
| 3479 » » return line.ptLine.y + line.fLineAscent; | 3452 return line.ptLine.y + line.fLineAscent; |
| 3480 » } | 3453 } |
| 3481 | 3454 |
| 3482 » return 0.0f; | 3455 return 0.0f; |
| 3483 } | 3456 } |
| 3484 | 3457 |
| 3485 FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const | 3458 FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const |
| 3486 { | 3459 { |
| 3487 » if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) | 3460 if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) |
| 3488 » { | 3461 { |
| 3489 » » CPVT_WordPlace wpOld = pIterator->GetAt(); | 3462 CPVT_WordPlace wpOld = pIterator->GetAt(); |
| 3490 | 3463 |
| 3491 » » pIterator->SetAt(place); | 3464 pIterator->SetAt(place); |
| 3492 » » CPVT_Line line; | 3465 CPVT_Line line; |
| 3493 » » pIterator->GetLine(line); | 3466 pIterator->GetLine(line); |
| 3494 | 3467 |
| 3495 » » pIterator->SetAt(wpOld); | 3468 pIterator->SetAt(wpOld); |
| 3496 | 3469 |
| 3497 » » return line.ptLine.y + line.fLineDescent; | 3470 return line.ptLine.y + line.fLineDescent; |
| 3498 » } | 3471 } |
| 3499 | 3472 |
| 3500 » return 0.0f; | 3473 return 0.0f; |
| 3501 } | 3474 } |
| 3502 | 3475 |
| 3503 CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHA
R* text, int32_t charset, | 3476 CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHA
R* text, int32_t charset, |
| 3504 » » » » » » » » » const
CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) | 3477 const CPVT_SecProps * pSecProps, const CPV
T_WordProps * pWordProps) |
| 3505 { | 3478 { |
| 3506 » CPVT_WordPlace wp = place; | 3479 CPVT_WordPlace wp = place; |
| 3507 | 3480 |
| 3508 » if (m_pVT->IsValid()) | 3481 if (m_pVT->IsValid()) |
| 3509 » { | 3482 { |
| 3510 » » CFX_WideString sText = text; | 3483 CFX_WideString sText = text; |
| 3511 | 3484 |
| 3512 » » for (int32_t i = 0, sz = sText.GetLength(); i < sz; i++) | 3485 for (int32_t i = 0, sz = sText.GetLength(); i < sz; i++) |
| 3513 » » { | 3486 { |
| 3514 » » » FX_WORD word = sText[i]; | 3487 FX_WORD word = sText[i]; |
| 3515 » » » switch (word) | 3488 switch (word) |
| 3516 » » » { | 3489 { |
| 3517 » » » case 0x0D: | 3490 case 0x0D: |
| 3518 » » » » wp = m_pVT->InsertSection(wp,pSecProps,pWordProp
s); | 3491 wp = m_pVT->InsertSection(wp,pSecProps,pWordProps); |
| 3519 » » » » if (sText[i+1] == 0x0A) | 3492 if (sText[i+1] == 0x0A) |
| 3520 » » » » » i++; | 3493 i++; |
| 3521 » » » » break; | 3494 break; |
| 3522 » » » case 0x0A: | 3495 case 0x0A: |
| 3523 » » » » wp = m_pVT->InsertSection(wp,pSecProps,pWordProp
s); | 3496 wp = m_pVT->InsertSection(wp,pSecProps,pWordProps); |
| 3524 » » » » if (sText[i+1] == 0x0D) | 3497 if (sText[i+1] == 0x0D) |
| 3525 » » » » » i++; | 3498 i++; |
| 3526 » » » » break; | 3499 break; |
| 3527 » » » case 0x09: | 3500 case 0x09: |
| 3528 » » » » word = 0x20; | 3501 word = 0x20; |
| 3529 » » » default: | 3502 default: |
| 3530 » » » » wp = m_pVT->InsertWord(wp,word,GetCharSetFromUni
code(word, charset),pWordProps); | 3503 wp = m_pVT->InsertWord(wp,word,GetCharSetFromUnicode(word, chars
et),pWordProps); |
| 3531 » » » » break; | 3504 break; |
| 3532 » » » } | 3505 } |
| 3533 » » } | 3506 } |
| 3534 » } | 3507 } |
| 3535 | 3508 |
| 3536 » return wp; | 3509 return wp; |
| 3537 } | 3510 } |
| 3538 | 3511 |
| 3539 int32_t CFX_Edit::GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset) | 3512 int32_t CFX_Edit::GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset) |
| 3540 { | 3513 { |
| 3541 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) | 3514 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) |
| 3542 return pFontMap->CharSetFromUnicode(word, nOldCharset); | 3515 return pFontMap->CharSetFromUnicode(word, nOldCharset); |
| 3543 return nOldCharset; | 3516 return nOldCharset; |
| 3544 } | 3517 } |
| 3545 | 3518 |
| 3546 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) | 3519 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) |
| 3547 { | 3520 { |
| 3548 » ASSERT(m_pGroupUndoItem == NULL); | 3521 ASSERT(m_pGroupUndoItem == NULL); |
| 3549 | 3522 |
| 3550 » m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle); | 3523 m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle); |
| 3551 } | 3524 } |
| 3552 | 3525 |
| 3553 void CFX_Edit::EndGroupUndo() | 3526 void CFX_Edit::EndGroupUndo() |
| 3554 { | 3527 { |
| 3555 » ASSERT(m_pGroupUndoItem != NULL); | 3528 ASSERT(m_pGroupUndoItem != NULL); |
| 3556 | 3529 |
| 3557 » m_pGroupUndoItem->UpdateItems(); | 3530 m_pGroupUndoItem->UpdateItems(); |
| 3558 » m_Undo.AddItem(m_pGroupUndoItem); | 3531 m_Undo.AddItem(m_pGroupUndoItem); |
| 3559 » if (m_bOprNotify && m_pOprNotify) | 3532 if (m_bOprNotify && m_pOprNotify) |
| 3560 » » m_pOprNotify->OnAddUndo(m_pGroupUndoItem); | 3533 m_pOprNotify->OnAddUndo(m_pGroupUndoItem); |
| 3561 » m_pGroupUndoItem = NULL; | 3534 m_pGroupUndoItem = NULL; |
| 3562 } | 3535 } |
| 3563 | 3536 |
| 3564 void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) | 3537 void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) |
| 3565 { | 3538 { |
| 3566 » if (m_pGroupUndoItem) | 3539 if (m_pGroupUndoItem) |
| 3567 » » m_pGroupUndoItem->AddUndoItem(pEditUndoItem); | 3540 m_pGroupUndoItem->AddUndoItem(pEditUndoItem); |
| 3568 » else | 3541 else |
| 3569 » { | 3542 { |
| 3570 » » m_Undo.AddItem(pEditUndoItem); | 3543 m_Undo.AddItem(pEditUndoItem); |
| 3571 » » if (m_bOprNotify && m_pOprNotify) | 3544 if (m_bOprNotify && m_pOprNotify) |
| 3572 » » » m_pOprNotify->OnAddUndo(pEditUndoItem); | 3545 m_pOprNotify->OnAddUndo(pEditUndoItem); |
| 3573 » } | 3546 } |
| 3574 } | 3547 } |
| 3575 | 3548 |
| 3576 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) | 3549 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) |
| 3577 { | 3550 { |
| 3578 » m_Undo.AddItem(pUndoItem); | 3551 m_Undo.AddItem(pUndoItem); |
| 3579 » if (m_bOprNotify && m_pOprNotify) | 3552 if (m_bOprNotify && m_pOprNotify) |
| 3580 » » m_pOprNotify->OnAddUndo(pUndoItem); | 3553 m_pOprNotify->OnAddUndo(pUndoItem); |
| 3581 } | 3554 } |
| 3582 | 3555 |
| OLD | NEW |