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

Side by Side Diff: fpdfsdk/fxedit/fxet_edit.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fxedit/fxet_edit.h ('k') | fpdfsdk/fxedit/fxet_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/fxedit/fxet_edit.h" 7 #include "fpdfsdk/fxedit/fxet_edit.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 158
159 } // namespace 159 } // namespace
160 160
161 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, 161 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit,
162 CPDF_VariableText::Iterator* pVTIterator) 162 CPDF_VariableText::Iterator* pVTIterator)
163 : m_pEdit(pEdit), m_pVTIterator(pVTIterator) {} 163 : m_pEdit(pEdit), m_pVTIterator(pVTIterator) {}
164 164
165 CFX_Edit_Iterator::~CFX_Edit_Iterator() {} 165 CFX_Edit_Iterator::~CFX_Edit_Iterator() {}
166 166
167 FX_BOOL CFX_Edit_Iterator::NextWord() { 167 bool CFX_Edit_Iterator::NextWord() {
168 return m_pVTIterator->NextWord(); 168 return m_pVTIterator->NextWord();
169 } 169 }
170 170
171 FX_BOOL CFX_Edit_Iterator::PrevWord() { 171 bool CFX_Edit_Iterator::PrevWord() {
172 return m_pVTIterator->PrevWord(); 172 return m_pVTIterator->PrevWord();
173 } 173 }
174 174
175 FX_BOOL CFX_Edit_Iterator::GetWord(CPVT_Word& word) const { 175 bool CFX_Edit_Iterator::GetWord(CPVT_Word& word) const {
176 ASSERT(m_pEdit); 176 ASSERT(m_pEdit);
177 177
178 if (m_pVTIterator->GetWord(word)) { 178 if (m_pVTIterator->GetWord(word)) {
179 word.ptWord = m_pEdit->VTToEdit(word.ptWord); 179 word.ptWord = m_pEdit->VTToEdit(word.ptWord);
180 return TRUE; 180 return true;
181 } 181 }
182 return FALSE; 182 return false;
183 } 183 }
184 184
185 FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line& line) const { 185 bool CFX_Edit_Iterator::GetLine(CPVT_Line& line) const {
186 ASSERT(m_pEdit); 186 ASSERT(m_pEdit);
187 187
188 if (m_pVTIterator->GetLine(line)) { 188 if (m_pVTIterator->GetLine(line)) {
189 line.ptLine = m_pEdit->VTToEdit(line.ptLine); 189 line.ptLine = m_pEdit->VTToEdit(line.ptLine);
190 return TRUE; 190 return true;
191 } 191 }
192 return FALSE; 192 return false;
193 } 193 }
194 194
195 FX_BOOL CFX_Edit_Iterator::GetSection(CPVT_Section& section) const { 195 bool CFX_Edit_Iterator::GetSection(CPVT_Section& section) const {
196 ASSERT(m_pEdit); 196 ASSERT(m_pEdit);
197 197
198 if (m_pVTIterator->GetSection(section)) { 198 if (m_pVTIterator->GetSection(section)) {
199 section.rcSection = m_pEdit->VTToEdit(section.rcSection); 199 section.rcSection = m_pEdit->VTToEdit(section.rcSection);
200 return TRUE; 200 return true;
201 } 201 }
202 return FALSE; 202 return false;
203 } 203 }
204 204
205 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) { 205 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) {
206 m_pVTIterator->SetAt(nWordIndex); 206 m_pVTIterator->SetAt(nWordIndex);
207 } 207 }
208 208
209 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace& place) { 209 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace& place) {
210 m_pVTIterator->SetAt(place); 210 m_pVTIterator->SetAt(place);
211 } 211 }
212 212
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 int32_t CFX_Edit_Provider::GetWordFontIndex(uint16_t word, 258 int32_t CFX_Edit_Provider::GetWordFontIndex(uint16_t word,
259 int32_t charset, 259 int32_t charset,
260 int32_t nFontIndex) { 260 int32_t nFontIndex) {
261 return m_pFontMap->GetWordFontIndex(word, charset, nFontIndex); 261 return m_pFontMap->GetWordFontIndex(word, charset, nFontIndex);
262 } 262 }
263 263
264 int32_t CFX_Edit_Provider::GetDefaultFontIndex() { 264 int32_t CFX_Edit_Provider::GetDefaultFontIndex() {
265 return 0; 265 return 0;
266 } 266 }
267 267
268 FX_BOOL CFX_Edit_Provider::IsLatinWord(uint16_t word) { 268 bool CFX_Edit_Provider::IsLatinWord(uint16_t word) {
269 return FX_EDIT_ISLATINWORD(word); 269 return FX_EDIT_ISLATINWORD(word);
270 } 270 }
271 271
272 CFX_Edit_Refresh::CFX_Edit_Refresh() {} 272 CFX_Edit_Refresh::CFX_Edit_Refresh() {}
273 273
274 CFX_Edit_Refresh::~CFX_Edit_Refresh() {} 274 CFX_Edit_Refresh::~CFX_Edit_Refresh() {}
275 275
276 void CFX_Edit_Refresh::BeginRefresh() { 276 void CFX_Edit_Refresh::BeginRefresh() {
277 m_RefreshRects.Empty(); 277 m_RefreshRects.Empty();
278 m_OldLineRects = m_NewLineRects; 278 m_OldLineRects = m_NewLineRects;
(...skipping 26 matching lines...) Expand all
305 return &m_RefreshRects; 305 return &m_RefreshRects;
306 } 306 }
307 307
308 void CFX_Edit_Refresh::EndRefresh() { 308 void CFX_Edit_Refresh::EndRefresh() {
309 m_RefreshRects.Empty(); 309 m_RefreshRects.Empty();
310 } 310 }
311 311
312 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) 312 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize)
313 : m_nCurUndoPos(0), 313 : m_nCurUndoPos(0),
314 m_nBufSize(nBufsize), 314 m_nBufSize(nBufsize),
315 m_bModified(FALSE), 315 m_bModified(false),
316 m_bVirgin(TRUE), 316 m_bVirgin(true),
317 m_bWorking(FALSE) {} 317 m_bWorking(false) {}
318 318
319 CFX_Edit_Undo::~CFX_Edit_Undo() { 319 CFX_Edit_Undo::~CFX_Edit_Undo() {
320 Reset(); 320 Reset();
321 } 321 }
322 322
323 FX_BOOL CFX_Edit_Undo::CanUndo() const { 323 bool CFX_Edit_Undo::CanUndo() const {
324 return m_nCurUndoPos > 0; 324 return m_nCurUndoPos > 0;
325 } 325 }
326 326
327 void CFX_Edit_Undo::Undo() { 327 void CFX_Edit_Undo::Undo() {
328 m_bWorking = TRUE; 328 m_bWorking = true;
329 329
330 if (m_nCurUndoPos > 0) { 330 if (m_nCurUndoPos > 0) {
331 IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos - 1); 331 IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos - 1);
332 pItem->Undo(); 332 pItem->Undo();
333 333
334 m_nCurUndoPos--; 334 m_nCurUndoPos--;
335 m_bModified = (m_nCurUndoPos != 0); 335 m_bModified = (m_nCurUndoPos != 0);
336 } 336 }
337 337
338 m_bWorking = FALSE; 338 m_bWorking = false;
339 } 339 }
340 340
341 FX_BOOL CFX_Edit_Undo::CanRedo() const { 341 bool CFX_Edit_Undo::CanRedo() const {
342 return m_nCurUndoPos < m_UndoItemStack.GetSize(); 342 return m_nCurUndoPos < m_UndoItemStack.GetSize();
343 } 343 }
344 344
345 void CFX_Edit_Undo::Redo() { 345 void CFX_Edit_Undo::Redo() {
346 m_bWorking = TRUE; 346 m_bWorking = true;
347 347
348 int32_t nStackSize = m_UndoItemStack.GetSize(); 348 int32_t nStackSize = m_UndoItemStack.GetSize();
349 349
350 if (m_nCurUndoPos < nStackSize) { 350 if (m_nCurUndoPos < nStackSize) {
351 IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos); 351 IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos);
352 pItem->Redo(); 352 pItem->Redo();
353 353
354 m_nCurUndoPos++; 354 m_nCurUndoPos++;
355 m_bModified = (m_nCurUndoPos != 0); 355 m_bModified = (m_nCurUndoPos != 0);
356 } 356 }
357 357
358 m_bWorking = FALSE; 358 m_bWorking = false;
359 } 359 }
360 360
361 void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { 361 void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) {
362 ASSERT(!m_bWorking); 362 ASSERT(!m_bWorking);
363 ASSERT(pItem); 363 ASSERT(pItem);
364 ASSERT(m_nBufSize > 1); 364 ASSERT(m_nBufSize > 1);
365 365
366 if (m_nCurUndoPos < m_UndoItemStack.GetSize()) 366 if (m_nCurUndoPos < m_UndoItemStack.GetSize())
367 RemoveTails(); 367 RemoveTails();
368 368
369 if (m_UndoItemStack.GetSize() >= m_nBufSize) { 369 if (m_UndoItemStack.GetSize() >= m_nBufSize) {
370 RemoveHeads(); 370 RemoveHeads();
371 m_bVirgin = FALSE; 371 m_bVirgin = false;
372 } 372 }
373 373
374 m_UndoItemStack.Add(pItem); 374 m_UndoItemStack.Add(pItem);
375 m_nCurUndoPos = m_UndoItemStack.GetSize(); 375 m_nCurUndoPos = m_UndoItemStack.GetSize();
376 376
377 m_bModified = (m_nCurUndoPos != 0); 377 m_bModified = (m_nCurUndoPos != 0);
378 } 378 }
379 379
380 FX_BOOL CFX_Edit_Undo::IsModified() const { 380 bool CFX_Edit_Undo::IsModified() const {
381 return m_bVirgin ? m_bModified : TRUE; 381 return m_bVirgin ? m_bModified : true;
382 } 382 }
383 383
384 void CFX_Edit_Undo::RemoveHeads() { 384 void CFX_Edit_Undo::RemoveHeads() {
385 ASSERT(m_UndoItemStack.GetSize() > 1); 385 ASSERT(m_UndoItemStack.GetSize() > 1);
386 386
387 delete m_UndoItemStack.GetAt(0); 387 delete m_UndoItemStack.GetAt(0);
388 m_UndoItemStack.RemoveAt(0); 388 m_UndoItemStack.RemoveAt(0);
389 } 389 }
390 390
391 void CFX_Edit_Undo::RemoveTails() { 391 void CFX_Edit_Undo::RemoveTails() {
392 for (int32_t i = m_UndoItemStack.GetSize() - 1; i >= m_nCurUndoPos; i--) { 392 for (int32_t i = m_UndoItemStack.GetSize() - 1; i >= m_nCurUndoPos; i--) {
393 delete m_UndoItemStack.GetAt(i); 393 delete m_UndoItemStack.GetAt(i);
394 m_UndoItemStack.RemoveAt(i); 394 m_UndoItemStack.RemoveAt(i);
395 } 395 }
396 } 396 }
397 397
398 void CFX_Edit_Undo::Reset() { 398 void CFX_Edit_Undo::Reset() {
399 for (int32_t i = 0, sz = m_UndoItemStack.GetSize(); i < sz; i++) { 399 for (int32_t i = 0, sz = m_UndoItemStack.GetSize(); i < sz; i++) {
400 delete m_UndoItemStack.GetAt(i); 400 delete m_UndoItemStack.GetAt(i);
401 } 401 }
402 m_nCurUndoPos = 0; 402 m_nCurUndoPos = 0;
403 m_UndoItemStack.RemoveAll(); 403 m_UndoItemStack.RemoveAll();
404 } 404 }
405 405
406 CFX_Edit_UndoItem::CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {} 406 CFX_Edit_UndoItem::CFX_Edit_UndoItem() : m_bFirst(true), m_bLast(true) {}
407 407
408 CFX_Edit_UndoItem::~CFX_Edit_UndoItem() {} 408 CFX_Edit_UndoItem::~CFX_Edit_UndoItem() {}
409 409
410 CFX_WideString CFX_Edit_UndoItem::GetUndoTitle() { 410 CFX_WideString CFX_Edit_UndoItem::GetUndoTitle() {
411 return L""; 411 return L"";
412 } 412 }
413 413
414 void CFX_Edit_UndoItem::SetFirst(FX_BOOL bFirst) { 414 void CFX_Edit_UndoItem::SetFirst(bool bFirst) {
415 m_bFirst = bFirst; 415 m_bFirst = bFirst;
416 } 416 }
417 417
418 void CFX_Edit_UndoItem::SetLast(FX_BOOL bLast) { 418 void CFX_Edit_UndoItem::SetLast(bool bLast) {
419 m_bLast = bLast; 419 m_bLast = bLast;
420 } 420 }
421 421
422 FX_BOOL CFX_Edit_UndoItem::IsLast() { 422 bool CFX_Edit_UndoItem::IsLast() {
423 return m_bLast; 423 return m_bLast;
424 } 424 }
425 425
426 CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle) 426 CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle)
427 : m_sTitle(sTitle) {} 427 : m_sTitle(sTitle) {}
428 428
429 CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() { 429 CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() {
430 for (int i = 0, sz = m_Items.GetSize(); i < sz; i++) { 430 for (int i = 0, sz = m_Items.GetSize(); i < sz; i++) {
431 delete m_Items[i]; 431 delete m_Items[i];
432 } 432 }
433 433
434 m_Items.RemoveAll(); 434 m_Items.RemoveAll();
435 } 435 }
436 436
437 void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { 437 void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) {
438 pUndoItem->SetFirst(FALSE); 438 pUndoItem->SetFirst(false);
439 pUndoItem->SetLast(FALSE); 439 pUndoItem->SetLast(false);
440 440
441 m_Items.Add(pUndoItem); 441 m_Items.Add(pUndoItem);
442 442
443 if (m_sTitle.IsEmpty()) 443 if (m_sTitle.IsEmpty())
444 m_sTitle = pUndoItem->GetUndoTitle(); 444 m_sTitle = pUndoItem->GetUndoTitle();
445 } 445 }
446 446
447 void CFX_Edit_GroupUndoItem::UpdateItems() { 447 void CFX_Edit_GroupUndoItem::UpdateItems() {
448 if (m_Items.GetSize() > 0) { 448 if (m_Items.GetSize() > 0) {
449 CFX_Edit_UndoItem* pFirstItem = m_Items[0]; 449 CFX_Edit_UndoItem* pFirstItem = m_Items[0];
450 pFirstItem->SetFirst(TRUE); 450 pFirstItem->SetFirst(true);
451 451
452 CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; 452 CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1];
453 pLastItem->SetLast(TRUE); 453 pLastItem->SetLast(true);
454 } 454 }
455 } 455 }
456 456
457 void CFX_Edit_GroupUndoItem::Undo() { 457 void CFX_Edit_GroupUndoItem::Undo() {
458 for (int i = m_Items.GetSize() - 1; i >= 0; i--) { 458 for (int i = m_Items.GetSize() - 1; i >= 0; i--) {
459 CFX_Edit_UndoItem* pUndoItem = m_Items[i]; 459 CFX_Edit_UndoItem* pUndoItem = m_Items[i];
460 pUndoItem->Undo(); 460 pUndoItem->Undo();
461 } 461 }
462 } 462 }
463 463
(...skipping 23 matching lines...) Expand all
487 if (pWordProps) 487 if (pWordProps)
488 m_WordProps = *pWordProps; 488 m_WordProps = *pWordProps;
489 } 489 }
490 490
491 CFXEU_InsertWord::~CFXEU_InsertWord() {} 491 CFXEU_InsertWord::~CFXEU_InsertWord() {}
492 492
493 void CFXEU_InsertWord::Redo() { 493 void CFXEU_InsertWord::Redo() {
494 if (m_pEdit) { 494 if (m_pEdit) {
495 m_pEdit->SelectNone(); 495 m_pEdit->SelectNone();
496 m_pEdit->SetCaret(m_wpOld); 496 m_pEdit->SetCaret(m_wpOld);
497 m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, TRUE); 497 m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true);
498 } 498 }
499 } 499 }
500 500
501 void CFXEU_InsertWord::Undo() { 501 void CFXEU_InsertWord::Undo() {
502 if (m_pEdit) { 502 if (m_pEdit) {
503 m_pEdit->SelectNone(); 503 m_pEdit->SelectNone();
504 m_pEdit->SetCaret(m_wpNew); 504 m_pEdit->SetCaret(m_wpNew);
505 m_pEdit->Backspace(FALSE, TRUE); 505 m_pEdit->Backspace(false, true);
506 } 506 }
507 } 507 }
508 508
509 CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit* pEdit, 509 CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit* pEdit,
510 const CPVT_WordPlace& wpOldPlace, 510 const CPVT_WordPlace& wpOldPlace,
511 const CPVT_WordPlace& wpNewPlace, 511 const CPVT_WordPlace& wpNewPlace,
512 const CPVT_SecProps* pSecProps, 512 const CPVT_SecProps* pSecProps,
513 const CPVT_WordProps* pWordProps) 513 const CPVT_WordProps* pWordProps)
514 : m_pEdit(pEdit), 514 : m_pEdit(pEdit),
515 m_wpOld(wpOldPlace), 515 m_wpOld(wpOldPlace),
516 m_wpNew(wpNewPlace), 516 m_wpNew(wpNewPlace),
517 m_SecProps(), 517 m_SecProps(),
518 m_WordProps() { 518 m_WordProps() {
519 if (pSecProps) 519 if (pSecProps)
520 m_SecProps = *pSecProps; 520 m_SecProps = *pSecProps;
521 if (pWordProps) 521 if (pWordProps)
522 m_WordProps = *pWordProps; 522 m_WordProps = *pWordProps;
523 } 523 }
524 524
525 CFXEU_InsertReturn::~CFXEU_InsertReturn() {} 525 CFXEU_InsertReturn::~CFXEU_InsertReturn() {}
526 526
527 void CFXEU_InsertReturn::Redo() { 527 void CFXEU_InsertReturn::Redo() {
528 if (m_pEdit) { 528 if (m_pEdit) {
529 m_pEdit->SelectNone(); 529 m_pEdit->SelectNone();
530 m_pEdit->SetCaret(m_wpOld); 530 m_pEdit->SetCaret(m_wpOld);
531 m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, TRUE); 531 m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true);
532 } 532 }
533 } 533 }
534 534
535 void CFXEU_InsertReturn::Undo() { 535 void CFXEU_InsertReturn::Undo() {
536 if (m_pEdit) { 536 if (m_pEdit) {
537 m_pEdit->SelectNone(); 537 m_pEdit->SelectNone();
538 m_pEdit->SetCaret(m_wpNew); 538 m_pEdit->SetCaret(m_wpNew);
539 m_pEdit->Backspace(FALSE, TRUE); 539 m_pEdit->Backspace(false, true);
540 } 540 }
541 } 541 }
542 542
543 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit* pEdit, 543 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit* pEdit,
544 const CPVT_WordPlace& wpOldPlace, 544 const CPVT_WordPlace& wpOldPlace,
545 const CPVT_WordPlace& wpNewPlace, 545 const CPVT_WordPlace& wpNewPlace,
546 uint16_t word, 546 uint16_t word,
547 int32_t charset, 547 int32_t charset,
548 const CPVT_SecProps& SecProps, 548 const CPVT_SecProps& SecProps,
549 const CPVT_WordProps& WordProps) 549 const CPVT_WordProps& WordProps)
550 : m_pEdit(pEdit), 550 : m_pEdit(pEdit),
551 m_wpOld(wpOldPlace), 551 m_wpOld(wpOldPlace),
552 m_wpNew(wpNewPlace), 552 m_wpNew(wpNewPlace),
553 m_Word(word), 553 m_Word(word),
554 m_nCharset(charset), 554 m_nCharset(charset),
555 m_SecProps(SecProps), 555 m_SecProps(SecProps),
556 m_WordProps(WordProps) {} 556 m_WordProps(WordProps) {}
557 557
558 CFXEU_Backspace::~CFXEU_Backspace() {} 558 CFXEU_Backspace::~CFXEU_Backspace() {}
559 559
560 void CFXEU_Backspace::Redo() { 560 void CFXEU_Backspace::Redo() {
561 if (m_pEdit) { 561 if (m_pEdit) {
562 m_pEdit->SelectNone(); 562 m_pEdit->SelectNone();
563 m_pEdit->SetCaret(m_wpOld); 563 m_pEdit->SetCaret(m_wpOld);
564 m_pEdit->Backspace(FALSE, TRUE); 564 m_pEdit->Backspace(false, true);
565 } 565 }
566 } 566 }
567 567
568 void CFXEU_Backspace::Undo() { 568 void CFXEU_Backspace::Undo() {
569 if (m_pEdit) { 569 if (m_pEdit) {
570 m_pEdit->SelectNone(); 570 m_pEdit->SelectNone();
571 m_pEdit->SetCaret(m_wpNew); 571 m_pEdit->SetCaret(m_wpNew);
572 if (m_wpNew.SecCmp(m_wpOld) != 0) { 572 if (m_wpNew.SecCmp(m_wpOld) != 0) {
573 m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, TRUE); 573 m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true);
574 } else { 574 } else {
575 m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, TRUE); 575 m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true);
576 } 576 }
577 } 577 }
578 } 578 }
579 579
580 CFXEU_Delete::CFXEU_Delete(CFX_Edit* pEdit, 580 CFXEU_Delete::CFXEU_Delete(CFX_Edit* pEdit,
581 const CPVT_WordPlace& wpOldPlace, 581 const CPVT_WordPlace& wpOldPlace,
582 const CPVT_WordPlace& wpNewPlace, 582 const CPVT_WordPlace& wpNewPlace,
583 uint16_t word, 583 uint16_t word,
584 int32_t charset, 584 int32_t charset,
585 const CPVT_SecProps& SecProps, 585 const CPVT_SecProps& SecProps,
586 const CPVT_WordProps& WordProps, 586 const CPVT_WordProps& WordProps,
587 FX_BOOL bSecEnd) 587 bool bSecEnd)
588 : m_pEdit(pEdit), 588 : m_pEdit(pEdit),
589 m_wpOld(wpOldPlace), 589 m_wpOld(wpOldPlace),
590 m_wpNew(wpNewPlace), 590 m_wpNew(wpNewPlace),
591 m_Word(word), 591 m_Word(word),
592 m_nCharset(charset), 592 m_nCharset(charset),
593 m_SecProps(SecProps), 593 m_SecProps(SecProps),
594 m_WordProps(WordProps), 594 m_WordProps(WordProps),
595 m_bSecEnd(bSecEnd) {} 595 m_bSecEnd(bSecEnd) {}
596 596
597 CFXEU_Delete::~CFXEU_Delete() {} 597 CFXEU_Delete::~CFXEU_Delete() {}
598 598
599 void CFXEU_Delete::Redo() { 599 void CFXEU_Delete::Redo() {
600 if (m_pEdit) { 600 if (m_pEdit) {
601 m_pEdit->SelectNone(); 601 m_pEdit->SelectNone();
602 m_pEdit->SetCaret(m_wpOld); 602 m_pEdit->SetCaret(m_wpOld);
603 m_pEdit->Delete(FALSE, TRUE); 603 m_pEdit->Delete(false, true);
604 } 604 }
605 } 605 }
606 606
607 void CFXEU_Delete::Undo() { 607 void CFXEU_Delete::Undo() {
608 if (m_pEdit) { 608 if (m_pEdit) {
609 m_pEdit->SelectNone(); 609 m_pEdit->SelectNone();
610 m_pEdit->SetCaret(m_wpNew); 610 m_pEdit->SetCaret(m_wpNew);
611 if (m_bSecEnd) { 611 if (m_bSecEnd) {
612 m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, TRUE); 612 m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true);
613 } else { 613 } else {
614 m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, TRUE); 614 m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true);
615 } 615 }
616 } 616 }
617 } 617 }
618 618
619 CFXEU_Clear::CFXEU_Clear(CFX_Edit* pEdit, 619 CFXEU_Clear::CFXEU_Clear(CFX_Edit* pEdit,
620 const CPVT_WordRange& wrSel, 620 const CPVT_WordRange& wrSel,
621 const CFX_WideString& swText) 621 const CFX_WideString& swText)
622 : m_pEdit(pEdit), m_wrSel(wrSel), m_swText(swText) {} 622 : m_pEdit(pEdit), m_wrSel(wrSel), m_swText(swText) {}
623 623
624 CFXEU_Clear::~CFXEU_Clear() {} 624 CFXEU_Clear::~CFXEU_Clear() {}
625 625
626 void CFXEU_Clear::Redo() { 626 void CFXEU_Clear::Redo() {
627 if (m_pEdit) { 627 if (m_pEdit) {
628 m_pEdit->SelectNone(); 628 m_pEdit->SelectNone();
629 m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); 629 m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos);
630 m_pEdit->Clear(FALSE, TRUE); 630 m_pEdit->Clear(false, true);
631 } 631 }
632 } 632 }
633 633
634 void CFXEU_Clear::Undo() { 634 void CFXEU_Clear::Undo() {
635 if (m_pEdit) { 635 if (m_pEdit) {
636 m_pEdit->SelectNone(); 636 m_pEdit->SelectNone();
637 m_pEdit->SetCaret(m_wrSel.BeginPos); 637 m_pEdit->SetCaret(m_wrSel.BeginPos);
638 m_pEdit->InsertText(m_swText, FXFONT_DEFAULT_CHARSET, FALSE, TRUE); 638 m_pEdit->InsertText(m_swText, FXFONT_DEFAULT_CHARSET, false, true);
639 m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); 639 m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos);
640 } 640 }
641 } 641 }
642 642
643 CFXEU_InsertText::CFXEU_InsertText(CFX_Edit* pEdit, 643 CFXEU_InsertText::CFXEU_InsertText(CFX_Edit* pEdit,
644 const CPVT_WordPlace& wpOldPlace, 644 const CPVT_WordPlace& wpOldPlace,
645 const CPVT_WordPlace& wpNewPlace, 645 const CPVT_WordPlace& wpNewPlace,
646 const CFX_WideString& swText, 646 const CFX_WideString& swText,
647 int32_t charset) 647 int32_t charset)
648 : m_pEdit(pEdit), 648 : m_pEdit(pEdit),
649 m_wpOld(wpOldPlace), 649 m_wpOld(wpOldPlace),
650 m_wpNew(wpNewPlace), 650 m_wpNew(wpNewPlace),
651 m_swText(swText), 651 m_swText(swText),
652 m_nCharset(charset) {} 652 m_nCharset(charset) {}
653 653
654 CFXEU_InsertText::~CFXEU_InsertText() {} 654 CFXEU_InsertText::~CFXEU_InsertText() {}
655 655
656 void CFXEU_InsertText::Redo() { 656 void CFXEU_InsertText::Redo() {
657 if (m_pEdit && IsLast()) { 657 if (m_pEdit && IsLast()) {
658 m_pEdit->SelectNone(); 658 m_pEdit->SelectNone();
659 m_pEdit->SetCaret(m_wpOld); 659 m_pEdit->SetCaret(m_wpOld);
660 m_pEdit->InsertText(m_swText, m_nCharset, FALSE, TRUE); 660 m_pEdit->InsertText(m_swText, m_nCharset, false, true);
661 } 661 }
662 } 662 }
663 663
664 void CFXEU_InsertText::Undo() { 664 void CFXEU_InsertText::Undo() {
665 if (m_pEdit) { 665 if (m_pEdit) {
666 m_pEdit->SelectNone(); 666 m_pEdit->SelectNone();
667 m_pEdit->SetSel(m_wpOld, m_wpNew); 667 m_pEdit->SetSel(m_wpOld, m_wpNew);
668 m_pEdit->Clear(FALSE, TRUE); 668 m_pEdit->Clear(false, true);
669 } 669 }
670 } 670 }
671 671
672 // static 672 // static
673 CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, 673 CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit,
674 const CFX_FloatPoint& ptOffset, 674 const CFX_FloatPoint& ptOffset,
675 const CPVT_WordRange* pRange, 675 const CPVT_WordRange* pRange,
676 FX_BOOL bContinuous, 676 bool bContinuous,
677 uint16_t SubWord) { 677 uint16_t SubWord) {
678 CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); 678 CFX_Edit_Iterator* pIterator = pEdit->GetIterator();
679 if (pRange) 679 if (pRange)
680 pIterator->SetAt(pRange->BeginPos); 680 pIterator->SetAt(pRange->BeginPos);
681 else 681 else
682 pIterator->SetAt(0); 682 pIterator->SetAt(0);
683 683
684 CFX_ByteTextBuf sEditStream; 684 CFX_ByteTextBuf sEditStream;
685 CFX_ByteTextBuf sWords; 685 CFX_ByteTextBuf sWords;
686 int32_t nCurFontIndex = -1; 686 int32_t nCurFontIndex = -1;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 const bool bContinuous = 826 const bool bContinuous =
827 pEdit->GetCharArray() == 0 && pEdit->GetCharSpace() <= 0.0f; 827 pEdit->GetCharArray() == 0 && pEdit->GetCharSpace() <= 0.0f;
828 uint16_t SubWord = pEdit->GetPasswordChar(); 828 uint16_t SubWord = pEdit->GetPasswordChar();
829 FX_FLOAT fFontSize = pEdit->GetFontSize(); 829 FX_FLOAT fFontSize = pEdit->GetFontSize();
830 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); 830 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange();
831 int32_t nHorzScale = pEdit->GetHorzScale(); 831 int32_t nHorzScale = pEdit->GetHorzScale();
832 832
833 FX_COLORREF crCurFill = crTextFill; 833 FX_COLORREF crCurFill = crTextFill;
834 FX_COLORREF crOldFill = crCurFill; 834 FX_COLORREF crOldFill = crCurFill;
835 835
836 FX_BOOL bSelect = FALSE; 836 bool bSelect = false;
837 const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); 837 const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255);
838 const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); 838 const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113);
839 839
840 CFX_ByteTextBuf sTextBuf; 840 CFX_ByteTextBuf sTextBuf;
841 int32_t nFontIndex = -1; 841 int32_t nFontIndex = -1;
842 CFX_FloatPoint ptBT; 842 CFX_FloatPoint ptBT;
843 pDevice->SaveState(); 843 pDevice->SaveState();
844 if (!rcClip.IsEmpty()) { 844 if (!rcClip.IsEmpty()) {
845 CFX_FloatRect rcTemp = rcClip; 845 CFX_FloatRect rcTemp = rcClip;
846 pUser2Device->TransformRect(rcTemp); 846 pUser2Device->TransformRect(rcTemp);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } 998 }
999 } 999 }
1000 1000
1001 CFX_Edit::CFX_Edit() 1001 CFX_Edit::CFX_Edit()
1002 : m_pVT(new CPDF_VariableText), 1002 : m_pVT(new CPDF_VariableText),
1003 m_pNotify(nullptr), 1003 m_pNotify(nullptr),
1004 m_pOprNotify(nullptr), 1004 m_pOprNotify(nullptr),
1005 m_wpCaret(-1, -1, -1), 1005 m_wpCaret(-1, -1, -1),
1006 m_wpOldCaret(-1, -1, -1), 1006 m_wpOldCaret(-1, -1, -1),
1007 m_SelState(), 1007 m_SelState(),
1008 m_bEnableScroll(FALSE), 1008 m_bEnableScroll(false),
1009 m_Undo(kEditUndoMaxItems), 1009 m_Undo(kEditUndoMaxItems),
1010 m_nAlignment(0), 1010 m_nAlignment(0),
1011 m_bNotifyFlag(FALSE), 1011 m_bNotifyFlag(false),
1012 m_bEnableOverflow(FALSE), 1012 m_bEnableOverflow(false),
1013 m_bEnableRefresh(TRUE), 1013 m_bEnableRefresh(true),
1014 m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f), 1014 m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f),
1015 m_bEnableUndo(TRUE), 1015 m_bEnableUndo(true),
1016 m_bOprNotify(FALSE), 1016 m_bOprNotify(false),
1017 m_pGroupUndoItem(nullptr) {} 1017 m_pGroupUndoItem(nullptr) {}
1018 1018
1019 CFX_Edit::~CFX_Edit() { 1019 CFX_Edit::~CFX_Edit() {
1020 ASSERT(!m_pGroupUndoItem); 1020 ASSERT(!m_pGroupUndoItem);
1021 } 1021 }
1022 1022
1023 void CFX_Edit::Initialize() { 1023 void CFX_Edit::Initialize() {
1024 m_pVT->Initialize(); 1024 m_pVT->Initialize();
1025 SetCaret(m_pVT->GetBeginWordPlace()); 1025 SetCaret(m_pVT->GetBeginWordPlace());
1026 SetCaretOrigin(); 1026 SetCaretOrigin();
(...skipping 23 matching lines...) Expand all
1050 IPVT_FontMap* CFX_Edit::GetFontMap() { 1050 IPVT_FontMap* CFX_Edit::GetFontMap() {
1051 return m_pVTProvider ? m_pVTProvider->GetFontMap() : nullptr; 1051 return m_pVTProvider ? m_pVTProvider->GetFontMap() : nullptr;
1052 } 1052 }
1053 1053
1054 void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) { 1054 void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) {
1055 m_pVT->SetPlateRect(rect); 1055 m_pVT->SetPlateRect(rect);
1056 m_ptScrollPos = CFX_FloatPoint(rect.left, rect.top); 1056 m_ptScrollPos = CFX_FloatPoint(rect.left, rect.top);
1057 Paint(); 1057 Paint();
1058 } 1058 }
1059 1059
1060 void CFX_Edit::SetAlignmentH(int32_t nFormat, FX_BOOL bPaint) { 1060 void CFX_Edit::SetAlignmentH(int32_t nFormat, bool bPaint) {
1061 m_pVT->SetAlignment(nFormat); 1061 m_pVT->SetAlignment(nFormat);
1062 if (bPaint) 1062 if (bPaint)
1063 Paint(); 1063 Paint();
1064 } 1064 }
1065 1065
1066 void CFX_Edit::SetAlignmentV(int32_t nFormat, FX_BOOL bPaint) { 1066 void CFX_Edit::SetAlignmentV(int32_t nFormat, bool bPaint) {
1067 m_nAlignment = nFormat; 1067 m_nAlignment = nFormat;
1068 if (bPaint) 1068 if (bPaint)
1069 Paint(); 1069 Paint();
1070 } 1070 }
1071 1071
1072 void CFX_Edit::SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint) { 1072 void CFX_Edit::SetPasswordChar(uint16_t wSubWord, bool bPaint) {
1073 m_pVT->SetPasswordChar(wSubWord); 1073 m_pVT->SetPasswordChar(wSubWord);
1074 if (bPaint) 1074 if (bPaint)
1075 Paint(); 1075 Paint();
1076 } 1076 }
1077 1077
1078 void CFX_Edit::SetLimitChar(int32_t nLimitChar) { 1078 void CFX_Edit::SetLimitChar(int32_t nLimitChar) {
1079 m_pVT->SetLimitChar(nLimitChar); 1079 m_pVT->SetLimitChar(nLimitChar);
1080 Paint(); 1080 Paint();
1081 } 1081 }
1082 1082
1083 void CFX_Edit::SetCharArray(int32_t nCharArray) { 1083 void CFX_Edit::SetCharArray(int32_t nCharArray) {
1084 m_pVT->SetCharArray(nCharArray); 1084 m_pVT->SetCharArray(nCharArray);
1085 Paint(); 1085 Paint();
1086 } 1086 }
1087 1087
1088 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace) { 1088 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace) {
1089 m_pVT->SetCharSpace(fCharSpace); 1089 m_pVT->SetCharSpace(fCharSpace);
1090 Paint(); 1090 Paint();
1091 } 1091 }
1092 1092
1093 void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint) { 1093 void CFX_Edit::SetMultiLine(bool bMultiLine, bool bPaint) {
1094 m_pVT->SetMultiLine(bMultiLine); 1094 m_pVT->SetMultiLine(bMultiLine);
1095 if (bPaint) 1095 if (bPaint)
1096 Paint(); 1096 Paint();
1097 } 1097 }
1098 1098
1099 void CFX_Edit::SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint) { 1099 void CFX_Edit::SetAutoReturn(bool bAuto, bool bPaint) {
1100 m_pVT->SetAutoReturn(bAuto); 1100 m_pVT->SetAutoReturn(bAuto);
1101 if (bPaint) 1101 if (bPaint)
1102 Paint(); 1102 Paint();
1103 } 1103 }
1104 1104
1105 void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint) { 1105 void CFX_Edit::SetAutoFontSize(bool bAuto, bool bPaint) {
1106 m_pVT->SetAutoFontSize(bAuto); 1106 m_pVT->SetAutoFontSize(bAuto);
1107 if (bPaint) 1107 if (bPaint)
1108 Paint(); 1108 Paint();
1109 } 1109 }
1110 1110
1111 void CFX_Edit::SetFontSize(FX_FLOAT fFontSize) { 1111 void CFX_Edit::SetFontSize(FX_FLOAT fFontSize) {
1112 m_pVT->SetFontSize(fFontSize); 1112 m_pVT->SetFontSize(fFontSize);
1113 Paint(); 1113 Paint();
1114 } 1114 }
1115 1115
1116 void CFX_Edit::SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint) { 1116 void CFX_Edit::SetAutoScroll(bool bAuto, bool bPaint) {
1117 m_bEnableScroll = bAuto; 1117 m_bEnableScroll = bAuto;
1118 if (bPaint) 1118 if (bPaint)
1119 Paint(); 1119 Paint();
1120 } 1120 }
1121 1121
1122 void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint) { 1122 void CFX_Edit::SetTextOverflow(bool bAllowed, bool bPaint) {
1123 m_bEnableOverflow = bAllowed; 1123 m_bEnableOverflow = bAllowed;
1124 if (bPaint) 1124 if (bPaint)
1125 Paint(); 1125 Paint();
1126 } 1126 }
1127 1127
1128 void CFX_Edit::SetSel(int32_t nStartChar, int32_t nEndChar) { 1128 void CFX_Edit::SetSel(int32_t nStartChar, int32_t nEndChar) {
1129 if (m_pVT->IsValid()) { 1129 if (m_pVT->IsValid()) {
1130 if (nStartChar == 0 && nEndChar < 0) { 1130 if (nStartChar == 0 && nEndChar < 0) {
1131 SelectAll(); 1131 SelectAll();
1132 } else if (nStartChar < 0) { 1132 } else if (nStartChar < 0) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 CPVT_WordRange CFX_Edit::GetSelectWordRange() const { 1272 CPVT_WordRange CFX_Edit::GetSelectWordRange() const {
1273 return m_SelState.ConvertToWordRange(); 1273 return m_SelState.ConvertToWordRange();
1274 } 1274 }
1275 1275
1276 void CFX_Edit::SetText(const CFX_WideString& sText) { 1276 void CFX_Edit::SetText(const CFX_WideString& sText) {
1277 Empty(); 1277 Empty();
1278 DoInsertText(CPVT_WordPlace(0, 0, -1), sText, FXFONT_DEFAULT_CHARSET); 1278 DoInsertText(CPVT_WordPlace(0, 0, -1), sText, FXFONT_DEFAULT_CHARSET);
1279 Paint(); 1279 Paint();
1280 } 1280 }
1281 1281
1282 FX_BOOL CFX_Edit::InsertWord(uint16_t word, int32_t charset) { 1282 bool CFX_Edit::InsertWord(uint16_t word, int32_t charset) {
1283 return InsertWord(word, charset, nullptr, TRUE, TRUE); 1283 return InsertWord(word, charset, nullptr, true, true);
1284 } 1284 }
1285 1285
1286 FX_BOOL CFX_Edit::InsertReturn() { 1286 bool CFX_Edit::InsertReturn() {
1287 return InsertReturn(nullptr, nullptr, TRUE, TRUE); 1287 return InsertReturn(nullptr, nullptr, true, true);
1288 } 1288 }
1289 1289
1290 FX_BOOL CFX_Edit::Backspace() { 1290 bool CFX_Edit::Backspace() {
1291 return Backspace(TRUE, TRUE); 1291 return Backspace(true, true);
1292 } 1292 }
1293 1293
1294 FX_BOOL CFX_Edit::Delete() { 1294 bool CFX_Edit::Delete() {
1295 return Delete(TRUE, TRUE); 1295 return Delete(true, true);
1296 } 1296 }
1297 1297
1298 FX_BOOL CFX_Edit::Clear() { 1298 bool CFX_Edit::Clear() {
1299 return Clear(TRUE, TRUE); 1299 return Clear(true, true);
1300 } 1300 }
1301 1301
1302 FX_BOOL CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) { 1302 bool CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) {
1303 return InsertText(sText, charset, TRUE, TRUE); 1303 return InsertText(sText, charset, true, true);
1304 } 1304 }
1305 1305
1306 FX_FLOAT CFX_Edit::GetFontSize() const { 1306 FX_FLOAT CFX_Edit::GetFontSize() const {
1307 return m_pVT->GetFontSize(); 1307 return m_pVT->GetFontSize();
1308 } 1308 }
1309 1309
1310 uint16_t CFX_Edit::GetPasswordChar() const { 1310 uint16_t CFX_Edit::GetPasswordChar() const {
1311 return m_pVT->GetPasswordChar(); 1311 return m_pVT->GetPasswordChar();
1312 } 1312 }
1313 1313
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 SetContentChanged(); 1389 SetContentChanged();
1390 } 1390 }
1391 } 1391 }
1392 1392
1393 void CFX_Edit::SetContentChanged() { 1393 void CFX_Edit::SetContentChanged() {
1394 if (m_pNotify) { 1394 if (m_pNotify) {
1395 CFX_FloatRect rcContent = m_pVT->GetContentRect(); 1395 CFX_FloatRect rcContent = m_pVT->GetContentRect();
1396 if (rcContent.Width() != m_rcOldContent.Width() || 1396 if (rcContent.Width() != m_rcOldContent.Width() ||
1397 rcContent.Height() != m_rcOldContent.Height()) { 1397 rcContent.Height() != m_rcOldContent.Height()) {
1398 if (!m_bNotifyFlag) { 1398 if (!m_bNotifyFlag) {
1399 m_bNotifyFlag = TRUE; 1399 m_bNotifyFlag = true;
1400 m_pNotify->IOnContentChange(rcContent); 1400 m_pNotify->IOnContentChange(rcContent);
1401 m_bNotifyFlag = FALSE; 1401 m_bNotifyFlag = false;
1402 } 1402 }
1403 m_rcOldContent = rcContent; 1403 m_rcOldContent = rcContent;
1404 } 1404 }
1405 } 1405 }
1406 } 1406 }
1407 1407
1408 void CFX_Edit::SelectAll() { 1408 void CFX_Edit::SelectAll() {
1409 if (m_pVT->IsValid()) { 1409 if (m_pVT->IsValid()) {
1410 m_SelState = CFX_Edit_Select(GetWholeWordRange()); 1410 m_SelState = CFX_Edit_Select(GetWholeWordRange());
1411 SetCaret(m_SelState.EndPos); 1411 SetCaret(m_SelState.EndPos);
1412 1412
1413 ScrollToCaret(); 1413 ScrollToCaret();
1414 Refresh(); 1414 Refresh();
1415 SetCaretInfo(); 1415 SetCaretInfo();
1416 } 1416 }
1417 } 1417 }
1418 1418
1419 void CFX_Edit::SelectNone() { 1419 void CFX_Edit::SelectNone() {
1420 if (m_pVT->IsValid()) { 1420 if (m_pVT->IsValid()) {
1421 if (m_SelState.IsExist()) { 1421 if (m_SelState.IsExist()) {
1422 m_SelState.Default(); 1422 m_SelState.Default();
1423 Refresh(); 1423 Refresh();
1424 } 1424 }
1425 } 1425 }
1426 } 1426 }
1427 1427
1428 FX_BOOL CFX_Edit::IsSelected() const { 1428 bool CFX_Edit::IsSelected() const {
1429 return m_SelState.IsExist(); 1429 return m_SelState.IsExist();
1430 } 1430 }
1431 1431
1432 CFX_FloatPoint CFX_Edit::VTToEdit(const CFX_FloatPoint& point) const { 1432 CFX_FloatPoint CFX_Edit::VTToEdit(const CFX_FloatPoint& point) const {
1433 CFX_FloatRect rcContent = m_pVT->GetContentRect(); 1433 CFX_FloatRect rcContent = m_pVT->GetContentRect();
1434 CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); 1434 CFX_FloatRect rcPlate = m_pVT->GetPlateRect();
1435 1435
1436 FX_FLOAT fPadding = 0.0f; 1436 FX_FLOAT fPadding = 0.0f;
1437 1437
1438 switch (m_nAlignment) { 1438 switch (m_nAlignment) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, 1481 return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x,
1482 ptRightTop.y); 1482 ptRightTop.y);
1483 } 1483 }
1484 1484
1485 void CFX_Edit::SetScrollInfo() { 1485 void CFX_Edit::SetScrollInfo() {
1486 if (m_pNotify) { 1486 if (m_pNotify) {
1487 CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); 1487 CFX_FloatRect rcPlate = m_pVT->GetPlateRect();
1488 CFX_FloatRect rcContent = m_pVT->GetContentRect(); 1488 CFX_FloatRect rcContent = m_pVT->GetContentRect();
1489 1489
1490 if (!m_bNotifyFlag) { 1490 if (!m_bNotifyFlag) {
1491 m_bNotifyFlag = TRUE; 1491 m_bNotifyFlag = true;
1492 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, 1492 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top,
1493 rcContent.bottom, rcContent.top, 1493 rcContent.bottom, rcContent.top,
1494 rcPlate.Height() / 3, rcPlate.Height()); 1494 rcPlate.Height() / 3, rcPlate.Height());
1495 m_bNotifyFlag = FALSE; 1495 m_bNotifyFlag = false;
1496 } 1496 }
1497 } 1497 }
1498 } 1498 }
1499 1499
1500 void CFX_Edit::SetScrollPosX(FX_FLOAT fx) { 1500 void CFX_Edit::SetScrollPosX(FX_FLOAT fx) {
1501 if (!m_bEnableScroll) 1501 if (!m_bEnableScroll)
1502 return; 1502 return;
1503 1503
1504 if (m_pVT->IsValid()) { 1504 if (m_pVT->IsValid()) {
1505 if (!IsFloatEqual(m_ptScrollPos.x, fx)) { 1505 if (!IsFloatEqual(m_ptScrollPos.x, fx)) {
1506 m_ptScrollPos.x = fx; 1506 m_ptScrollPos.x = fx;
1507 Refresh(); 1507 Refresh();
1508 } 1508 }
1509 } 1509 }
1510 } 1510 }
1511 1511
1512 void CFX_Edit::SetScrollPosY(FX_FLOAT fy) { 1512 void CFX_Edit::SetScrollPosY(FX_FLOAT fy) {
1513 if (!m_bEnableScroll) 1513 if (!m_bEnableScroll)
1514 return; 1514 return;
1515 1515
1516 if (m_pVT->IsValid()) { 1516 if (m_pVT->IsValid()) {
1517 if (!IsFloatEqual(m_ptScrollPos.y, fy)) { 1517 if (!IsFloatEqual(m_ptScrollPos.y, fy)) {
1518 m_ptScrollPos.y = fy; 1518 m_ptScrollPos.y = fy;
1519 Refresh(); 1519 Refresh();
1520 1520
1521 if (m_pNotify) { 1521 if (m_pNotify) {
1522 if (!m_bNotifyFlag) { 1522 if (!m_bNotifyFlag) {
1523 m_bNotifyFlag = TRUE; 1523 m_bNotifyFlag = true;
1524 m_pNotify->IOnSetScrollPosY(fy); 1524 m_pNotify->IOnSetScrollPosY(fy);
1525 m_bNotifyFlag = FALSE; 1525 m_bNotifyFlag = false;
1526 } 1526 }
1527 } 1527 }
1528 } 1528 }
1529 } 1529 }
1530 } 1530 }
1531 1531
1532 void CFX_Edit::SetScrollPos(const CFX_FloatPoint& point) { 1532 void CFX_Edit::SetScrollPos(const CFX_FloatPoint& point) {
1533 SetScrollPosX(point.x); 1533 SetScrollPosX(point.x);
1534 SetScrollPosY(point.y); 1534 SetScrollPosY(point.y);
1535 SetScrollLimit(); 1535 SetScrollLimit();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 void CFX_Edit::Refresh() { 1623 void CFX_Edit::Refresh() {
1624 if (m_bEnableRefresh && m_pVT->IsValid()) { 1624 if (m_bEnableRefresh && m_pVT->IsValid()) {
1625 m_Refresh.BeginRefresh(); 1625 m_Refresh.BeginRefresh();
1626 RefreshPushLineRects(GetVisibleWordRange()); 1626 RefreshPushLineRects(GetVisibleWordRange());
1627 1627
1628 m_Refresh.NoAnalyse(); 1628 m_Refresh.NoAnalyse();
1629 m_ptRefreshScrollPos = m_ptScrollPos; 1629 m_ptRefreshScrollPos = m_ptScrollPos;
1630 1630
1631 if (m_pNotify) { 1631 if (m_pNotify) {
1632 if (!m_bNotifyFlag) { 1632 if (!m_bNotifyFlag) {
1633 m_bNotifyFlag = TRUE; 1633 m_bNotifyFlag = true;
1634 if (const CFX_Edit_RectArray* pRects = m_Refresh.GetRefreshRects()) { 1634 if (const CFX_Edit_RectArray* pRects = m_Refresh.GetRefreshRects()) {
1635 for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++) 1635 for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++)
1636 m_pNotify->IOnInvalidateRect(pRects->GetAt(i)); 1636 m_pNotify->IOnInvalidateRect(pRects->GetAt(i));
1637 } 1637 }
1638 m_bNotifyFlag = FALSE; 1638 m_bNotifyFlag = false;
1639 } 1639 }
1640 } 1640 }
1641 1641
1642 m_Refresh.EndRefresh(); 1642 m_Refresh.EndRefresh();
1643 } 1643 }
1644 } 1644 }
1645 1645
1646 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) { 1646 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) {
1647 if (!m_pVT->IsValid()) 1647 if (!m_pVT->IsValid())
1648 return; 1648 return;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 1693
1694 if (place.LineCmp(wrTemp.BeginPos) == 0 || 1694 if (place.LineCmp(wrTemp.BeginPos) == 0 ||
1695 place.LineCmp(wrTemp.EndPos) == 0) { 1695 place.LineCmp(wrTemp.EndPos) == 0) {
1696 CFX_FloatRect rcWord(wordinfo.ptWord.x, 1696 CFX_FloatRect rcWord(wordinfo.ptWord.x,
1697 lineinfo.ptLine.y + lineinfo.fLineDescent, 1697 lineinfo.ptLine.y + lineinfo.fLineDescent,
1698 wordinfo.ptWord.x + wordinfo.fWidth, 1698 wordinfo.ptWord.x + wordinfo.fWidth,
1699 lineinfo.ptLine.y + lineinfo.fLineAscent); 1699 lineinfo.ptLine.y + lineinfo.fLineAscent);
1700 1700
1701 if (m_pNotify) { 1701 if (m_pNotify) {
1702 if (!m_bNotifyFlag) { 1702 if (!m_bNotifyFlag) {
1703 m_bNotifyFlag = TRUE; 1703 m_bNotifyFlag = true;
1704 CFX_FloatRect rcRefresh = VTToEdit(rcWord); 1704 CFX_FloatRect rcRefresh = VTToEdit(rcWord);
1705 m_pNotify->IOnInvalidateRect(&rcRefresh); 1705 m_pNotify->IOnInvalidateRect(&rcRefresh);
1706 m_bNotifyFlag = FALSE; 1706 m_bNotifyFlag = false;
1707 } 1707 }
1708 } 1708 }
1709 } else { 1709 } else {
1710 CFX_FloatRect rcLine(lineinfo.ptLine.x, 1710 CFX_FloatRect rcLine(lineinfo.ptLine.x,
1711 lineinfo.ptLine.y + lineinfo.fLineDescent, 1711 lineinfo.ptLine.y + lineinfo.fLineDescent,
1712 lineinfo.ptLine.x + lineinfo.fLineWidth, 1712 lineinfo.ptLine.x + lineinfo.fLineWidth,
1713 lineinfo.ptLine.y + lineinfo.fLineAscent); 1713 lineinfo.ptLine.y + lineinfo.fLineAscent);
1714 1714
1715 if (m_pNotify) { 1715 if (m_pNotify) {
1716 if (!m_bNotifyFlag) { 1716 if (!m_bNotifyFlag) {
1717 m_bNotifyFlag = TRUE; 1717 m_bNotifyFlag = true;
1718 CFX_FloatRect rcRefresh = VTToEdit(rcLine); 1718 CFX_FloatRect rcRefresh = VTToEdit(rcLine);
1719 m_pNotify->IOnInvalidateRect(&rcRefresh); 1719 m_pNotify->IOnInvalidateRect(&rcRefresh);
1720 m_bNotifyFlag = FALSE; 1720 m_bNotifyFlag = false;
1721 } 1721 }
1722 } 1722 }
1723 1723
1724 pIterator->NextLine(); 1724 pIterator->NextLine();
1725 } 1725 }
1726 } 1726 }
1727 } 1727 }
1728 1728
1729 void CFX_Edit::SetCaret(const CPVT_WordPlace& place) { 1729 void CFX_Edit::SetCaret(const CPVT_WordPlace& place) {
1730 m_wpOldCaret = m_wpCaret; 1730 m_wpOldCaret = m_wpCaret;
(...skipping 15 matching lines...) Expand all
1746 ptHead.y = word.ptWord.y + word.fAscent; 1746 ptHead.y = word.ptWord.y + word.fAscent;
1747 ptFoot.x = word.ptWord.x + word.fWidth; 1747 ptFoot.x = word.ptWord.x + word.fWidth;
1748 ptFoot.y = word.ptWord.y + word.fDescent; 1748 ptFoot.y = word.ptWord.y + word.fDescent;
1749 } else if (pIterator->GetLine(line)) { 1749 } else if (pIterator->GetLine(line)) {
1750 ptHead.x = line.ptLine.x; 1750 ptHead.x = line.ptLine.x;
1751 ptHead.y = line.ptLine.y + line.fLineAscent; 1751 ptHead.y = line.ptLine.y + line.fLineAscent;
1752 ptFoot.x = line.ptLine.x; 1752 ptFoot.x = line.ptLine.x;
1753 ptFoot.y = line.ptLine.y + line.fLineDescent; 1753 ptFoot.y = line.ptLine.y + line.fLineDescent;
1754 } 1754 }
1755 1755
1756 m_bNotifyFlag = TRUE; 1756 m_bNotifyFlag = true;
1757 m_pNotify->IOnSetCaret(!m_SelState.IsExist(), VTToEdit(ptHead), 1757 m_pNotify->IOnSetCaret(!m_SelState.IsExist(), VTToEdit(ptHead),
1758 VTToEdit(ptFoot), m_wpCaret); 1758 VTToEdit(ptFoot), m_wpCaret);
1759 m_bNotifyFlag = FALSE; 1759 m_bNotifyFlag = false;
1760 } 1760 }
1761 } 1761 }
1762 } 1762 }
1763 1763
1764 void CFX_Edit::SetCaret(int32_t nPos) { 1764 void CFX_Edit::SetCaret(int32_t nPos) {
1765 if (m_pVT->IsValid()) { 1765 if (m_pVT->IsValid()) {
1766 SelectNone(); 1766 SelectNone();
1767 SetCaret(m_pVT->WordIndexToWordPlace(nPos)); 1767 SetCaret(m_pVT->WordIndexToWordPlace(nPos));
1768 m_SelState.Set(m_wpCaret, m_wpCaret); 1768 m_SelState.Set(m_wpCaret, m_wpCaret);
1769 1769
1770 ScrollToCaret(); 1770 ScrollToCaret();
1771 SetCaretOrigin(); 1771 SetCaretOrigin();
1772 SetCaretInfo(); 1772 SetCaretInfo();
1773 } 1773 }
1774 } 1774 }
1775 1775
1776 void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, 1776 void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point,
1777 FX_BOOL bShift, 1777 bool bShift,
1778 FX_BOOL bCtrl) { 1778 bool bCtrl) {
1779 if (m_pVT->IsValid()) { 1779 if (m_pVT->IsValid()) {
1780 SelectNone(); 1780 SelectNone();
1781 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); 1781 SetCaret(m_pVT->SearchWordPlace(EditToVT(point)));
1782 m_SelState.Set(m_wpCaret, m_wpCaret); 1782 m_SelState.Set(m_wpCaret, m_wpCaret);
1783 1783
1784 ScrollToCaret(); 1784 ScrollToCaret();
1785 SetCaretOrigin(); 1785 SetCaretOrigin();
1786 SetCaretInfo(); 1786 SetCaretInfo();
1787 } 1787 }
1788 } 1788 }
1789 1789
1790 void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point, 1790 void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point,
1791 FX_BOOL bShift, 1791 bool bShift,
1792 FX_BOOL bCtrl) { 1792 bool bCtrl) {
1793 if (m_pVT->IsValid()) { 1793 if (m_pVT->IsValid()) {
1794 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); 1794 SetCaret(m_pVT->SearchWordPlace(EditToVT(point)));
1795 1795
1796 if (m_wpCaret != m_wpOldCaret) { 1796 if (m_wpCaret != m_wpOldCaret) {
1797 m_SelState.SetEndPos(m_wpCaret); 1797 m_SelState.SetEndPos(m_wpCaret);
1798 1798
1799 ScrollToCaret(); 1799 ScrollToCaret();
1800 Refresh(); 1800 Refresh();
1801 SetCaretOrigin(); 1801 SetCaretOrigin();
1802 SetCaretInfo(); 1802 SetCaretInfo();
1803 } 1803 }
1804 } 1804 }
1805 } 1805 }
1806 1806
1807 void CFX_Edit::OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) { 1807 void CFX_Edit::OnVK_UP(bool bShift, bool bCtrl) {
1808 if (m_pVT->IsValid()) { 1808 if (m_pVT->IsValid()) {
1809 SetCaret(m_pVT->GetUpWordPlace(m_wpCaret, m_ptCaret)); 1809 SetCaret(m_pVT->GetUpWordPlace(m_wpCaret, m_ptCaret));
1810 1810
1811 if (bShift) { 1811 if (bShift) {
1812 if (m_SelState.IsExist()) 1812 if (m_SelState.IsExist())
1813 m_SelState.SetEndPos(m_wpCaret); 1813 m_SelState.SetEndPos(m_wpCaret);
1814 else 1814 else
1815 m_SelState.Set(m_wpOldCaret, m_wpCaret); 1815 m_SelState.Set(m_wpOldCaret, m_wpCaret);
1816 1816
1817 if (m_wpOldCaret != m_wpCaret) { 1817 if (m_wpOldCaret != m_wpCaret) {
1818 ScrollToCaret(); 1818 ScrollToCaret();
1819 Refresh(); 1819 Refresh();
1820 SetCaretInfo(); 1820 SetCaretInfo();
1821 } 1821 }
1822 } else { 1822 } else {
1823 SelectNone(); 1823 SelectNone();
1824 1824
1825 ScrollToCaret(); 1825 ScrollToCaret();
1826 SetCaretInfo(); 1826 SetCaretInfo();
1827 } 1827 }
1828 } 1828 }
1829 } 1829 }
1830 1830
1831 void CFX_Edit::OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) { 1831 void CFX_Edit::OnVK_DOWN(bool bShift, bool bCtrl) {
1832 if (m_pVT->IsValid()) { 1832 if (m_pVT->IsValid()) {
1833 SetCaret(m_pVT->GetDownWordPlace(m_wpCaret, m_ptCaret)); 1833 SetCaret(m_pVT->GetDownWordPlace(m_wpCaret, m_ptCaret));
1834 1834
1835 if (bShift) { 1835 if (bShift) {
1836 if (m_SelState.IsExist()) 1836 if (m_SelState.IsExist())
1837 m_SelState.SetEndPos(m_wpCaret); 1837 m_SelState.SetEndPos(m_wpCaret);
1838 else 1838 else
1839 m_SelState.Set(m_wpOldCaret, m_wpCaret); 1839 m_SelState.Set(m_wpOldCaret, m_wpCaret);
1840 1840
1841 if (m_wpOldCaret != m_wpCaret) { 1841 if (m_wpOldCaret != m_wpCaret) {
1842 ScrollToCaret(); 1842 ScrollToCaret();
1843 Refresh(); 1843 Refresh();
1844 SetCaretInfo(); 1844 SetCaretInfo();
1845 } 1845 }
1846 } else { 1846 } else {
1847 SelectNone(); 1847 SelectNone();
1848 1848
1849 ScrollToCaret(); 1849 ScrollToCaret();
1850 SetCaretInfo(); 1850 SetCaretInfo();
1851 } 1851 }
1852 } 1852 }
1853 } 1853 }
1854 1854
1855 void CFX_Edit::OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) { 1855 void CFX_Edit::OnVK_LEFT(bool bShift, bool bCtrl) {
1856 if (m_pVT->IsValid()) { 1856 if (m_pVT->IsValid()) {
1857 if (bShift) { 1857 if (bShift) {
1858 if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && 1858 if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) &&
1859 m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) 1859 m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret))
1860 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); 1860 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
1861 1861
1862 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); 1862 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
1863 1863
1864 if (m_SelState.IsExist()) 1864 if (m_SelState.IsExist())
1865 m_SelState.SetEndPos(m_wpCaret); 1865 m_SelState.SetEndPos(m_wpCaret);
(...skipping 23 matching lines...) Expand all
1889 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); 1889 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
1890 1890
1891 ScrollToCaret(); 1891 ScrollToCaret();
1892 SetCaretOrigin(); 1892 SetCaretOrigin();
1893 SetCaretInfo(); 1893 SetCaretInfo();
1894 } 1894 }
1895 } 1895 }
1896 } 1896 }
1897 } 1897 }
1898 1898
1899 void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) { 1899 void CFX_Edit::OnVK_RIGHT(bool bShift, bool bCtrl) {
1900 if (m_pVT->IsValid()) { 1900 if (m_pVT->IsValid()) {
1901 if (bShift) { 1901 if (bShift) {
1902 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); 1902 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
1903 1903
1904 if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && 1904 if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) &&
1905 m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret)) 1905 m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret))
1906 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); 1906 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
1907 1907
1908 if (m_SelState.IsExist()) 1908 if (m_SelState.IsExist())
1909 m_SelState.SetEndPos(m_wpCaret); 1909 m_SelState.SetEndPos(m_wpCaret);
(...skipping 23 matching lines...) Expand all
1933 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); 1933 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
1934 1934
1935 ScrollToCaret(); 1935 ScrollToCaret();
1936 SetCaretOrigin(); 1936 SetCaretOrigin();
1937 SetCaretInfo(); 1937 SetCaretInfo();
1938 } 1938 }
1939 } 1939 }
1940 } 1940 }
1941 } 1941 }
1942 1942
1943 void CFX_Edit::OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) { 1943 void CFX_Edit::OnVK_HOME(bool bShift, bool bCtrl) {
1944 if (m_pVT->IsValid()) { 1944 if (m_pVT->IsValid()) {
1945 if (bShift) { 1945 if (bShift) {
1946 if (bCtrl) 1946 if (bCtrl)
1947 SetCaret(m_pVT->GetBeginWordPlace()); 1947 SetCaret(m_pVT->GetBeginWordPlace());
1948 else 1948 else
1949 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); 1949 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret));
1950 1950
1951 if (m_SelState.IsExist()) 1951 if (m_SelState.IsExist())
1952 m_SelState.SetEndPos(m_wpCaret); 1952 m_SelState.SetEndPos(m_wpCaret);
1953 else 1953 else
(...skipping 19 matching lines...) Expand all
1973 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); 1973 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret));
1974 1974
1975 ScrollToCaret(); 1975 ScrollToCaret();
1976 SetCaretOrigin(); 1976 SetCaretOrigin();
1977 SetCaretInfo(); 1977 SetCaretInfo();
1978 } 1978 }
1979 } 1979 }
1980 } 1980 }
1981 } 1981 }
1982 1982
1983 void CFX_Edit::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) { 1983 void CFX_Edit::OnVK_END(bool bShift, bool bCtrl) {
1984 if (m_pVT->IsValid()) { 1984 if (m_pVT->IsValid()) {
1985 if (bShift) { 1985 if (bShift) {
1986 if (bCtrl) 1986 if (bCtrl)
1987 SetCaret(m_pVT->GetEndWordPlace()); 1987 SetCaret(m_pVT->GetEndWordPlace());
1988 else 1988 else
1989 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); 1989 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret));
1990 1990
1991 if (m_SelState.IsExist()) 1991 if (m_SelState.IsExist())
1992 m_SelState.SetEndPos(m_wpCaret); 1992 m_SelState.SetEndPos(m_wpCaret);
1993 else 1993 else
(...skipping 19 matching lines...) Expand all
2013 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); 2013 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret));
2014 2014
2015 ScrollToCaret(); 2015 ScrollToCaret();
2016 SetCaretOrigin(); 2016 SetCaretOrigin();
2017 SetCaretInfo(); 2017 SetCaretInfo();
2018 } 2018 }
2019 } 2019 }
2020 } 2020 }
2021 } 2021 }
2022 2022
2023 FX_BOOL CFX_Edit::InsertWord(uint16_t word, 2023 bool CFX_Edit::InsertWord(uint16_t word,
2024 int32_t charset, 2024 int32_t charset,
2025 const CPVT_WordProps* pWordProps, 2025 const CPVT_WordProps* pWordProps,
2026 FX_BOOL bAddUndo, 2026 bool bAddUndo,
2027 FX_BOOL bPaint) { 2027 bool bPaint) {
2028 if (IsTextOverflow()) 2028 if (IsTextOverflow())
2029 return FALSE; 2029 return false;
2030 2030
2031 if (m_pVT->IsValid()) { 2031 if (m_pVT->IsValid()) {
2032 m_pVT->UpdateWordPlace(m_wpCaret); 2032 m_pVT->UpdateWordPlace(m_wpCaret);
2033 2033
2034 SetCaret(m_pVT->InsertWord( 2034 SetCaret(m_pVT->InsertWord(
2035 m_wpCaret, word, GetCharSetFromUnicode(word, charset), pWordProps)); 2035 m_wpCaret, word, GetCharSetFromUnicode(word, charset), pWordProps));
2036 m_SelState.Set(m_wpCaret, m_wpCaret); 2036 m_SelState.Set(m_wpCaret, m_wpCaret);
2037 2037
2038 if (m_wpCaret != m_wpOldCaret) { 2038 if (m_wpCaret != m_wpOldCaret) {
2039 if (bAddUndo && m_bEnableUndo) { 2039 if (bAddUndo && m_bEnableUndo) {
2040 AddEditUndoItem(new CFXEU_InsertWord(this, m_wpOldCaret, m_wpCaret, 2040 AddEditUndoItem(new CFXEU_InsertWord(this, m_wpOldCaret, m_wpCaret,
2041 word, charset, pWordProps)); 2041 word, charset, pWordProps));
2042 } 2042 }
2043 2043
2044 if (bPaint) 2044 if (bPaint)
2045 PaintInsertText(m_wpOldCaret, m_wpCaret); 2045 PaintInsertText(m_wpOldCaret, m_wpCaret);
2046 2046
2047 if (m_bOprNotify && m_pOprNotify) 2047 if (m_bOprNotify && m_pOprNotify)
2048 m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCaret); 2048 m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCaret);
2049 2049
2050 return TRUE; 2050 return true;
2051 } 2051 }
2052 } 2052 }
2053 2053
2054 return FALSE; 2054 return false;
2055 } 2055 }
2056 2056
2057 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, 2057 bool CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps,
2058 const CPVT_WordProps* pWordProps, 2058 const CPVT_WordProps* pWordProps,
2059 FX_BOOL bAddUndo, 2059 bool bAddUndo,
2060 FX_BOOL bPaint) { 2060 bool bPaint) {
2061 if (IsTextOverflow()) 2061 if (IsTextOverflow())
2062 return FALSE; 2062 return false;
2063 2063
2064 if (m_pVT->IsValid()) { 2064 if (m_pVT->IsValid()) {
2065 m_pVT->UpdateWordPlace(m_wpCaret); 2065 m_pVT->UpdateWordPlace(m_wpCaret);
2066 SetCaret(m_pVT->InsertSection(m_wpCaret, pSecProps, pWordProps)); 2066 SetCaret(m_pVT->InsertSection(m_wpCaret, pSecProps, pWordProps));
2067 m_SelState.Set(m_wpCaret, m_wpCaret); 2067 m_SelState.Set(m_wpCaret, m_wpCaret);
2068 2068
2069 if (m_wpCaret != m_wpOldCaret) { 2069 if (m_wpCaret != m_wpOldCaret) {
2070 if (bAddUndo && m_bEnableUndo) { 2070 if (bAddUndo && m_bEnableUndo) {
2071 AddEditUndoItem(new CFXEU_InsertReturn(this, m_wpOldCaret, m_wpCaret, 2071 AddEditUndoItem(new CFXEU_InsertReturn(this, m_wpOldCaret, m_wpCaret,
2072 pSecProps, pWordProps)); 2072 pSecProps, pWordProps));
2073 } 2073 }
2074 2074
2075 if (bPaint) { 2075 if (bPaint) {
2076 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret)); 2076 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret));
2077 ScrollToCaret(); 2077 ScrollToCaret();
2078 Refresh(); 2078 Refresh();
2079 SetCaretOrigin(); 2079 SetCaretOrigin();
2080 SetCaretInfo(); 2080 SetCaretInfo();
2081 } 2081 }
2082 2082
2083 if (m_bOprNotify && m_pOprNotify) 2083 if (m_bOprNotify && m_pOprNotify)
2084 m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret); 2084 m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret);
2085 2085
2086 return TRUE; 2086 return true;
2087 } 2087 }
2088 } 2088 }
2089 2089
2090 return FALSE; 2090 return false;
2091 } 2091 }
2092 2092
2093 FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { 2093 bool CFX_Edit::Backspace(bool bAddUndo, bool bPaint) {
2094 if (m_pVT->IsValid()) { 2094 if (m_pVT->IsValid()) {
2095 if (m_wpCaret == m_pVT->GetBeginWordPlace()) 2095 if (m_wpCaret == m_pVT->GetBeginWordPlace())
2096 return FALSE; 2096 return false;
2097 2097
2098 CPVT_Section section; 2098 CPVT_Section section;
2099 CPVT_Word word; 2099 CPVT_Word word;
2100 2100
2101 if (bAddUndo) { 2101 if (bAddUndo) {
2102 CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); 2102 CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator();
2103 pIterator->SetAt(m_wpCaret); 2103 pIterator->SetAt(m_wpCaret);
2104 pIterator->GetSection(section); 2104 pIterator->GetSection(section);
2105 pIterator->GetWord(word); 2105 pIterator->GetWord(word);
2106 } 2106 }
(...skipping 18 matching lines...) Expand all
2125 RearrangePart(CPVT_WordRange(m_wpCaret, m_wpOldCaret)); 2125 RearrangePart(CPVT_WordRange(m_wpCaret, m_wpOldCaret));
2126 ScrollToCaret(); 2126 ScrollToCaret();
2127 Refresh(); 2127 Refresh();
2128 SetCaretOrigin(); 2128 SetCaretOrigin();
2129 SetCaretInfo(); 2129 SetCaretInfo();
2130 } 2130 }
2131 2131
2132 if (m_bOprNotify && m_pOprNotify) 2132 if (m_bOprNotify && m_pOprNotify)
2133 m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCaret); 2133 m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCaret);
2134 2134
2135 return TRUE; 2135 return true;
2136 } 2136 }
2137 } 2137 }
2138 2138
2139 return FALSE; 2139 return false;
2140 } 2140 }
2141 2141
2142 FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { 2142 bool CFX_Edit::Delete(bool bAddUndo, bool bPaint) {
2143 if (m_pVT->IsValid()) { 2143 if (m_pVT->IsValid()) {
2144 if (m_wpCaret == m_pVT->GetEndWordPlace()) 2144 if (m_wpCaret == m_pVT->GetEndWordPlace())
2145 return FALSE; 2145 return false;
2146 2146
2147 CPVT_Section section; 2147 CPVT_Section section;
2148 CPVT_Word word; 2148 CPVT_Word word;
2149 2149
2150 if (bAddUndo) { 2150 if (bAddUndo) {
2151 CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); 2151 CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator();
2152 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); 2152 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret));
2153 pIterator->GetSection(section); 2153 pIterator->GetSection(section);
2154 pIterator->GetWord(word); 2154 pIterator->GetWord(word);
2155 } 2155 }
2156 2156
2157 m_pVT->UpdateWordPlace(m_wpCaret); 2157 m_pVT->UpdateWordPlace(m_wpCaret);
2158 FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); 2158 bool bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret));
2159 2159
2160 SetCaret(m_pVT->DeleteWord(m_wpCaret)); 2160 SetCaret(m_pVT->DeleteWord(m_wpCaret));
2161 m_SelState.Set(m_wpCaret, m_wpCaret); 2161 m_SelState.Set(m_wpCaret, m_wpCaret);
2162 2162
2163 if (bAddUndo && m_bEnableUndo) { 2163 if (bAddUndo && m_bEnableUndo) {
2164 if (bSecEnd) 2164 if (bSecEnd)
2165 AddEditUndoItem(new CFXEU_Delete( 2165 AddEditUndoItem(new CFXEU_Delete(
2166 this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset, 2166 this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset,
2167 section.SecProps, section.WordProps, bSecEnd)); 2167 section.SecProps, section.WordProps, bSecEnd));
2168 else 2168 else
2169 AddEditUndoItem(new CFXEU_Delete( 2169 AddEditUndoItem(new CFXEU_Delete(
2170 this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset, 2170 this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset,
2171 section.SecProps, word.WordProps, bSecEnd)); 2171 section.SecProps, word.WordProps, bSecEnd));
2172 } 2172 }
2173 2173
2174 if (bPaint) { 2174 if (bPaint) {
2175 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret)); 2175 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret));
2176 ScrollToCaret(); 2176 ScrollToCaret();
2177 Refresh(); 2177 Refresh();
2178 SetCaretOrigin(); 2178 SetCaretOrigin();
2179 SetCaretInfo(); 2179 SetCaretInfo();
2180 } 2180 }
2181 2181
2182 if (m_bOprNotify && m_pOprNotify) 2182 if (m_bOprNotify && m_pOprNotify)
2183 m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); 2183 m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret);
2184 2184
2185 return TRUE; 2185 return true;
2186 } 2186 }
2187 2187
2188 return FALSE; 2188 return false;
2189 } 2189 }
2190 2190
2191 FX_BOOL CFX_Edit::Empty() { 2191 bool CFX_Edit::Empty() {
2192 if (m_pVT->IsValid()) { 2192 if (m_pVT->IsValid()) {
2193 m_pVT->DeleteWords(GetWholeWordRange()); 2193 m_pVT->DeleteWords(GetWholeWordRange());
2194 SetCaret(m_pVT->GetBeginWordPlace()); 2194 SetCaret(m_pVT->GetBeginWordPlace());
2195 2195
2196 return TRUE; 2196 return true;
2197 } 2197 }
2198 2198
2199 return FALSE; 2199 return false;
2200 } 2200 }
2201 2201
2202 FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { 2202 bool CFX_Edit::Clear(bool bAddUndo, bool bPaint) {
2203 if (!m_pVT->IsValid()) 2203 if (!m_pVT->IsValid())
2204 return FALSE; 2204 return false;
2205 2205
2206 if (!m_SelState.IsExist()) 2206 if (!m_SelState.IsExist())
2207 return FALSE; 2207 return false;
2208 2208
2209 CPVT_WordRange range = m_SelState.ConvertToWordRange(); 2209 CPVT_WordRange range = m_SelState.ConvertToWordRange();
2210 2210
2211 if (bAddUndo && m_bEnableUndo) 2211 if (bAddUndo && m_bEnableUndo)
2212 AddEditUndoItem(new CFXEU_Clear(this, range, GetSelText())); 2212 AddEditUndoItem(new CFXEU_Clear(this, range, GetSelText()));
2213 2213
2214 SelectNone(); 2214 SelectNone();
2215 SetCaret(m_pVT->DeleteWords(range)); 2215 SetCaret(m_pVT->DeleteWords(range));
2216 m_SelState.Set(m_wpCaret, m_wpCaret); 2216 m_SelState.Set(m_wpCaret, m_wpCaret);
2217 2217
2218 if (bPaint) { 2218 if (bPaint) {
2219 RearrangePart(range); 2219 RearrangePart(range);
2220 ScrollToCaret(); 2220 ScrollToCaret();
2221 Refresh(); 2221 Refresh();
2222 SetCaretOrigin(); 2222 SetCaretOrigin();
2223 SetCaretInfo(); 2223 SetCaretInfo();
2224 } 2224 }
2225 2225
2226 if (m_bOprNotify && m_pOprNotify) 2226 if (m_bOprNotify && m_pOprNotify)
2227 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); 2227 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret);
2228 2228
2229 return TRUE; 2229 return true;
2230 } 2230 }
2231 2231
2232 FX_BOOL CFX_Edit::InsertText(const CFX_WideString& sText, 2232 bool CFX_Edit::InsertText(const CFX_WideString& sText,
2233 int32_t charset, 2233 int32_t charset,
2234 FX_BOOL bAddUndo, 2234 bool bAddUndo,
2235 FX_BOOL bPaint) { 2235 bool bPaint) {
2236 if (IsTextOverflow()) 2236 if (IsTextOverflow())
2237 return FALSE; 2237 return false;
2238 2238
2239 m_pVT->UpdateWordPlace(m_wpCaret); 2239 m_pVT->UpdateWordPlace(m_wpCaret);
2240 SetCaret(DoInsertText(m_wpCaret, sText, charset)); 2240 SetCaret(DoInsertText(m_wpCaret, sText, charset));
2241 m_SelState.Set(m_wpCaret, m_wpCaret); 2241 m_SelState.Set(m_wpCaret, m_wpCaret);
2242 if (m_wpCaret == m_wpOldCaret) 2242 if (m_wpCaret == m_wpOldCaret)
2243 return FALSE; 2243 return false;
2244 2244
2245 if (bAddUndo && m_bEnableUndo) { 2245 if (bAddUndo && m_bEnableUndo) {
2246 AddEditUndoItem( 2246 AddEditUndoItem(
2247 new CFXEU_InsertText(this, m_wpOldCaret, m_wpCaret, sText, charset)); 2247 new CFXEU_InsertText(this, m_wpOldCaret, m_wpCaret, sText, charset));
2248 } 2248 }
2249 2249
2250 if (bPaint) 2250 if (bPaint)
2251 PaintInsertText(m_wpOldCaret, m_wpCaret); 2251 PaintInsertText(m_wpOldCaret, m_wpCaret);
2252 2252
2253 if (m_bOprNotify && m_pOprNotify) 2253 if (m_bOprNotify && m_pOprNotify)
2254 m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); 2254 m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret);
2255 2255
2256 return TRUE; 2256 return true;
2257 } 2257 }
2258 2258
2259 void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld, 2259 void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld,
2260 const CPVT_WordPlace& wpNew) { 2260 const CPVT_WordPlace& wpNew) {
2261 if (m_pVT->IsValid()) { 2261 if (m_pVT->IsValid()) {
2262 RearrangePart(CPVT_WordRange(wpOld, wpNew)); 2262 RearrangePart(CPVT_WordRange(wpOld, wpNew));
2263 ScrollToCaret(); 2263 ScrollToCaret();
2264 Refresh(); 2264 Refresh();
2265 SetCaretOrigin(); 2265 SetCaretOrigin();
2266 SetCaretInfo(); 2266 SetCaretInfo();
2267 } 2267 }
2268 } 2268 }
2269 2269
2270 FX_BOOL CFX_Edit::Redo() { 2270 bool CFX_Edit::Redo() {
2271 if (m_bEnableUndo) { 2271 if (m_bEnableUndo) {
2272 if (m_Undo.CanRedo()) { 2272 if (m_Undo.CanRedo()) {
2273 m_Undo.Redo(); 2273 m_Undo.Redo();
2274 return TRUE; 2274 return true;
2275 } 2275 }
2276 } 2276 }
2277 2277
2278 return FALSE; 2278 return false;
2279 } 2279 }
2280 2280
2281 FX_BOOL CFX_Edit::Undo() { 2281 bool CFX_Edit::Undo() {
2282 if (m_bEnableUndo) { 2282 if (m_bEnableUndo) {
2283 if (m_Undo.CanUndo()) { 2283 if (m_Undo.CanUndo()) {
2284 m_Undo.Undo(); 2284 m_Undo.Undo();
2285 return TRUE; 2285 return true;
2286 } 2286 }
2287 } 2287 }
2288 2288
2289 return FALSE; 2289 return false;
2290 } 2290 }
2291 2291
2292 void CFX_Edit::SetCaretOrigin() { 2292 void CFX_Edit::SetCaretOrigin() {
2293 if (!m_pVT->IsValid()) 2293 if (!m_pVT->IsValid())
2294 return; 2294 return;
2295 2295
2296 CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); 2296 CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator();
2297 pIterator->SetAt(m_wpCaret); 2297 pIterator->SetAt(m_wpCaret);
2298 CPVT_Word word; 2298 CPVT_Word word;
2299 CPVT_Line line; 2299 CPVT_Line line;
(...skipping 13 matching lines...) Expand all
2313 return -1; 2313 return -1;
2314 } 2314 }
2315 2315
2316 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const { 2316 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const {
2317 if (m_pVT->IsValid()) 2317 if (m_pVT->IsValid())
2318 return m_pVT->WordIndexToWordPlace(index); 2318 return m_pVT->WordIndexToWordPlace(index);
2319 2319
2320 return CPVT_WordPlace(); 2320 return CPVT_WordPlace();
2321 } 2321 }
2322 2322
2323 FX_BOOL CFX_Edit::IsTextFull() const { 2323 bool CFX_Edit::IsTextFull() const {
2324 int32_t nTotalWords = m_pVT->GetTotalWords(); 2324 int32_t nTotalWords = m_pVT->GetTotalWords();
2325 int32_t nLimitChar = m_pVT->GetLimitChar(); 2325 int32_t nLimitChar = m_pVT->GetLimitChar();
2326 int32_t nCharArray = m_pVT->GetCharArray(); 2326 int32_t nCharArray = m_pVT->GetCharArray();
2327 2327
2328 return IsTextOverflow() || (nLimitChar > 0 && nTotalWords >= nLimitChar) || 2328 return IsTextOverflow() || (nLimitChar > 0 && nTotalWords >= nLimitChar) ||
2329 (nCharArray > 0 && nTotalWords >= nCharArray); 2329 (nCharArray > 0 && nTotalWords >= nCharArray);
2330 } 2330 }
2331 2331
2332 FX_BOOL CFX_Edit::IsTextOverflow() const { 2332 bool CFX_Edit::IsTextOverflow() const {
2333 if (!m_bEnableScroll && !m_bEnableOverflow) { 2333 if (!m_bEnableScroll && !m_bEnableOverflow) {
2334 CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); 2334 CFX_FloatRect rcPlate = m_pVT->GetPlateRect();
2335 CFX_FloatRect rcContent = m_pVT->GetContentRect(); 2335 CFX_FloatRect rcContent = m_pVT->GetContentRect();
2336 2336
2337 if (m_pVT->IsMultiLine() && GetTotalLines() > 1 && 2337 if (m_pVT->IsMultiLine() && GetTotalLines() > 1 &&
2338 IsFloatBigger(rcContent.Height(), rcPlate.Height())) { 2338 IsFloatBigger(rcContent.Height(), rcPlate.Height())) {
2339 return TRUE; 2339 return true;
2340 } 2340 }
2341 2341
2342 if (IsFloatBigger(rcContent.Width(), rcPlate.Width())) 2342 if (IsFloatBigger(rcContent.Width(), rcPlate.Width()))
2343 return TRUE; 2343 return true;
2344 } 2344 }
2345 2345
2346 return FALSE; 2346 return false;
2347 } 2347 }
2348 2348
2349 FX_BOOL CFX_Edit::CanUndo() const { 2349 bool CFX_Edit::CanUndo() const {
2350 if (m_bEnableUndo) { 2350 if (m_bEnableUndo) {
2351 return m_Undo.CanUndo(); 2351 return m_Undo.CanUndo();
2352 } 2352 }
2353 2353
2354 return FALSE; 2354 return false;
2355 } 2355 }
2356 2356
2357 FX_BOOL CFX_Edit::CanRedo() const { 2357 bool CFX_Edit::CanRedo() const {
2358 if (m_bEnableUndo) { 2358 if (m_bEnableUndo) {
2359 return m_Undo.CanRedo(); 2359 return m_Undo.CanRedo();
2360 } 2360 }
2361 2361
2362 return FALSE; 2362 return false;
2363 } 2363 }
2364 2364
2365 void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) { 2365 void CFX_Edit::EnableRefresh(bool bRefresh) {
2366 m_bEnableRefresh = bRefresh; 2366 m_bEnableRefresh = bRefresh;
2367 } 2367 }
2368 2368
2369 void CFX_Edit::EnableUndo(FX_BOOL bUndo) { 2369 void CFX_Edit::EnableUndo(bool bUndo) {
2370 m_bEnableUndo = bUndo; 2370 m_bEnableUndo = bUndo;
2371 } 2371 }
2372 2372
2373 void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) { 2373 void CFX_Edit::EnableOprNotify(bool bNotify) {
2374 m_bOprNotify = bNotify; 2374 m_bOprNotify = bNotify;
2375 } 2375 }
2376 2376
2377 CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, 2377 CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place,
2378 const CFX_WideString& sText, 2378 const CFX_WideString& sText,
2379 int32_t charset) { 2379 int32_t charset) {
2380 CPVT_WordPlace wp = place; 2380 CPVT_WordPlace wp = place;
2381 2381
2382 if (m_pVT->IsValid()) { 2382 if (m_pVT->IsValid()) {
2383 for (int32_t i = 0, sz = sText.GetLength(); i < sz; i++) { 2383 for (int32_t i = 0, sz = sText.GetLength(); i < sz; i++) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 } 2488 }
2489 2489
2490 void CFX_Edit_Select::SetBeginPos(const CPVT_WordPlace& begin) { 2490 void CFX_Edit_Select::SetBeginPos(const CPVT_WordPlace& begin) {
2491 BeginPos = begin; 2491 BeginPos = begin;
2492 } 2492 }
2493 2493
2494 void CFX_Edit_Select::SetEndPos(const CPVT_WordPlace& end) { 2494 void CFX_Edit_Select::SetEndPos(const CPVT_WordPlace& end) {
2495 EndPos = end; 2495 EndPos = end;
2496 } 2496 }
2497 2497
2498 FX_BOOL CFX_Edit_Select::IsExist() const { 2498 bool CFX_Edit_Select::IsExist() const {
2499 return BeginPos != EndPos; 2499 return BeginPos != EndPos;
2500 } 2500 }
2501 2501
2502 CFX_Edit_RectArray::CFX_Edit_RectArray() {} 2502 CFX_Edit_RectArray::CFX_Edit_RectArray() {}
2503 2503
2504 CFX_Edit_RectArray::~CFX_Edit_RectArray() { 2504 CFX_Edit_RectArray::~CFX_Edit_RectArray() {
2505 Empty(); 2505 Empty();
2506 } 2506 }
2507 2507
2508 void CFX_Edit_RectArray::Empty() { 2508 void CFX_Edit_RectArray::Empty() {
(...skipping 17 matching lines...) Expand all
2526 int32_t CFX_Edit_RectArray::GetSize() const { 2526 int32_t CFX_Edit_RectArray::GetSize() const {
2527 return m_Rects.GetSize(); 2527 return m_Rects.GetSize();
2528 } 2528 }
2529 2529
2530 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { 2530 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const {
2531 if (nIndex < 0 || nIndex >= m_Rects.GetSize()) 2531 if (nIndex < 0 || nIndex >= m_Rects.GetSize())
2532 return nullptr; 2532 return nullptr;
2533 2533
2534 return m_Rects.GetAt(nIndex); 2534 return m_Rects.GetAt(nIndex);
2535 } 2535 }
OLDNEW
« no previous file with comments | « fpdfsdk/fxedit/fxet_edit.h ('k') | fpdfsdk/fxedit/fxet_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698