| 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 "xfa/fwl/basewidget/fwl_editimp.h" | 7 #include "xfa/fwl/basewidget/fwl_editimp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 } | 452 } |
| 453 sLatinWord += (FX_CHAR)wsSpell[i]; | 453 sLatinWord += (FX_CHAR)wsSpell[i]; |
| 454 } else { | 454 } else { |
| 455 checkWordEvent.bsWord = sLatinWord; | 455 checkWordEvent.bsWord = sLatinWord; |
| 456 checkWordEvent.bCheckWord = TRUE; | 456 checkWordEvent.bCheckWord = TRUE; |
| 457 DispatchEvent(&checkWordEvent); | 457 DispatchEvent(&checkWordEvent); |
| 458 if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) { | 458 if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) { |
| 459 AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX, | 459 AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX, |
| 460 fOffSetY); | 460 fOffSetY); |
| 461 } | 461 } |
| 462 sLatinWord.Empty(); | 462 sLatinWord.clear(); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 checkWordEvent.bsWord = sLatinWord; | 465 checkWordEvent.bsWord = sLatinWord; |
| 466 checkWordEvent.bCheckWord = TRUE; | 466 checkWordEvent.bCheckWord = TRUE; |
| 467 DispatchEvent(&checkWordEvent); | 467 DispatchEvent(&checkWordEvent); |
| 468 if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) { | 468 if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) { |
| 469 AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX, | 469 AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX, |
| 470 fOffSetY); | 470 fOffSetY); |
| 471 } | 471 } |
| 472 if (!pathSpell.IsEmpty()) { | 472 if (!pathSpell.IsEmpty()) { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 } | 654 } |
| 655 return FWL_ERR_Indefinite; | 655 return FWL_ERR_Indefinite; |
| 656 } | 656 } |
| 657 FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { | 657 FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { |
| 658 if (!m_pEdtEngine) | 658 if (!m_pEdtEngine) |
| 659 return FALSE; | 659 return FALSE; |
| 660 int32_t nCount = m_pEdtEngine->CountSelRanges(); | 660 int32_t nCount = m_pEdtEngine->CountSelRanges(); |
| 661 if (nCount == 0) { | 661 if (nCount == 0) { |
| 662 return FALSE; | 662 return FALSE; |
| 663 } | 663 } |
| 664 wsCopy.Empty(); | 664 wsCopy.clear(); |
| 665 CFX_WideString wsTemp; | 665 CFX_WideString wsTemp; |
| 666 int32_t nStart, nLength; | 666 int32_t nStart, nLength; |
| 667 for (int32_t i = 0; i < nCount; i++) { | 667 for (int32_t i = 0; i < nCount; i++) { |
| 668 nLength = m_pEdtEngine->GetSelRange(i, nStart); | 668 nLength = m_pEdtEngine->GetSelRange(i, nStart); |
| 669 m_pEdtEngine->GetText(wsTemp, nStart, nLength); | 669 m_pEdtEngine->GetText(wsTemp, nStart, nLength); |
| 670 wsCopy += wsTemp; | 670 wsCopy += wsTemp; |
| 671 wsTemp.Empty(); | 671 wsTemp.clear(); |
| 672 } | 672 } |
| 673 return TRUE; | 673 return TRUE; |
| 674 } | 674 } |
| 675 FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) { | 675 FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) { |
| 676 if (!m_pEdtEngine) | 676 if (!m_pEdtEngine) |
| 677 return FALSE; | 677 return FALSE; |
| 678 int32_t nCount = m_pEdtEngine->CountSelRanges(); | 678 int32_t nCount = m_pEdtEngine->CountSelRanges(); |
| 679 if (nCount == 0) { | 679 if (nCount == 0) { |
| 680 return FALSE; | 680 return FALSE; |
| 681 } | 681 } |
| 682 wsCut.Empty(); | 682 wsCut.clear(); |
| 683 CFX_WideString wsTemp; | 683 CFX_WideString wsTemp; |
| 684 int32_t nStart, nLength; | 684 int32_t nStart, nLength; |
| 685 for (int32_t i = 0; i < nCount; i++) { | 685 for (int32_t i = 0; i < nCount; i++) { |
| 686 nLength = m_pEdtEngine->GetSelRange(i, nStart); | 686 nLength = m_pEdtEngine->GetSelRange(i, nStart); |
| 687 m_pEdtEngine->GetText(wsTemp, nStart, nLength); | 687 m_pEdtEngine->GetText(wsTemp, nStart, nLength); |
| 688 wsCut += wsTemp; | 688 wsCut += wsTemp; |
| 689 wsTemp.Empty(); | 689 wsTemp.clear(); |
| 690 } | 690 } |
| 691 m_pEdtEngine->Delete(0); | 691 m_pEdtEngine->Delete(0); |
| 692 return TRUE; | 692 return TRUE; |
| 693 } | 693 } |
| 694 FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) { | 694 FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) { |
| 695 if (!m_pEdtEngine) | 695 if (!m_pEdtEngine) |
| 696 return FALSE; | 696 return FALSE; |
| 697 int32_t nCaret = m_pEdtEngine->GetCaretPos(); | 697 int32_t nCaret = m_pEdtEngine->GetCaretPos(); |
| 698 int32_t iError = | 698 int32_t iError = |
| 699 m_pEdtEngine->Insert(nCaret, wsPaste.c_str(), wsPaste.GetLength()); | 699 m_pEdtEngine->Insert(nCaret, wsPaste.c_str(), wsPaste.GetLength()); |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 } | 2170 } |
| 2171 CFX_RectF rect; | 2171 CFX_RectF rect; |
| 2172 m_pOwner->GetWidgetRect(rect); | 2172 m_pOwner->GetWidgetRect(rect); |
| 2173 CFX_RectF rtInvalidate; | 2173 CFX_RectF rtInvalidate; |
| 2174 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 2174 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
| 2175 m_pOwner->Repaint(&rtInvalidate); | 2175 m_pOwner->Repaint(&rtInvalidate); |
| 2176 } | 2176 } |
| 2177 return TRUE; | 2177 return TRUE; |
| 2178 } | 2178 } |
| 2179 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} | 2179 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} |
| OLD | NEW |