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 <memory> | 10 #include <memory> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const FX_WCHAR* lpText, | 120 const FX_WCHAR* lpText, |
121 int32_t nLen) { | 121 int32_t nLen) { |
122 return static_cast<CFWL_EditImp*>(GetImpl())->Insert(nStart, lpText, nLen); | 122 return static_cast<CFWL_EditImp*>(GetImpl())->Insert(nStart, lpText, nLen); |
123 } | 123 } |
124 FWL_Error IFWL_Edit::DeleteSelections() { | 124 FWL_Error IFWL_Edit::DeleteSelections() { |
125 return static_cast<CFWL_EditImp*>(GetImpl())->DeleteSelections(); | 125 return static_cast<CFWL_EditImp*>(GetImpl())->DeleteSelections(); |
126 } | 126 } |
127 FWL_Error IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { | 127 FWL_Error IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { |
128 return static_cast<CFWL_EditImp*>(GetImpl())->DeleteRange(nStart, nCount); | 128 return static_cast<CFWL_EditImp*>(GetImpl())->DeleteRange(nStart, nCount); |
129 } | 129 } |
130 FWL_Error IFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) { | |
131 return static_cast<CFWL_EditImp*>(GetImpl())->ReplaceSelections(wsReplace); | |
132 } | |
133 FWL_Error IFWL_Edit::Replace(int32_t nStart, | 130 FWL_Error IFWL_Edit::Replace(int32_t nStart, |
134 int32_t nLen, | 131 int32_t nLen, |
135 const CFX_WideStringC& wsReplace) { | 132 const CFX_WideStringC& wsReplace) { |
136 return static_cast<CFWL_EditImp*>(GetImpl()) | 133 return static_cast<CFWL_EditImp*>(GetImpl()) |
137 ->Replace(nStart, nLen, wsReplace); | 134 ->Replace(nStart, nLen, wsReplace); |
138 } | 135 } |
139 FWL_Error IFWL_Edit::DoClipboard(int32_t iCmd) { | 136 FWL_Error IFWL_Edit::DoClipboard(int32_t iCmd) { |
140 return static_cast<CFWL_EditImp*>(GetImpl())->DoClipboard(iCmd); | 137 return static_cast<CFWL_EditImp*>(GetImpl())->DoClipboard(iCmd); |
141 } | 138 } |
142 FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) { | 139 FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 } | 654 } |
658 | 655 |
659 FWL_Error CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) { | 656 FWL_Error CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) { |
660 if (!m_pEdtEngine) | 657 if (!m_pEdtEngine) |
661 return FWL_Error::Indefinite; | 658 return FWL_Error::Indefinite; |
662 | 659 |
663 m_pEdtEngine->DeleteRange(nStart, nCount); | 660 m_pEdtEngine->DeleteRange(nStart, nCount); |
664 return FWL_Error::Succeeded; | 661 return FWL_Error::Succeeded; |
665 } | 662 } |
666 | 663 |
667 FWL_Error CFWL_EditImp::ReplaceSelections(const CFX_WideStringC& wsReplace) { | |
668 if (!m_pEdtEngine) | |
669 return FWL_Error::Indefinite; | |
670 | |
671 int32_t iCount = m_pEdtEngine->CountSelRanges(); | |
672 for (int i = 0; i < iCount; i++) { | |
673 int32_t nStart; | |
674 int32_t nCount = m_pEdtEngine->GetSelRange(i, nStart); | |
675 m_pEdtEngine->Replace(nStart, nCount, wsReplace); | |
676 } | |
677 return FWL_Error::Succeeded; | |
678 } | |
679 | |
680 FWL_Error CFWL_EditImp::Replace(int32_t nStart, | 664 FWL_Error CFWL_EditImp::Replace(int32_t nStart, |
681 int32_t nLen, | 665 int32_t nLen, |
682 const CFX_WideStringC& wsReplace) { | 666 const CFX_WideStringC& wsReplace) { |
683 if (!m_pEdtEngine) | 667 if (!m_pEdtEngine) |
684 return FWL_Error::Indefinite; | 668 return FWL_Error::Indefinite; |
685 | 669 |
686 m_pEdtEngine->Replace(nStart, nLen, wsReplace); | 670 m_pEdtEngine->Replace(nStart, nLen, wsReplace); |
687 return FWL_Error::Succeeded; | 671 return FWL_Error::Succeeded; |
688 } | 672 } |
689 | 673 |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 } | 2190 } |
2207 CFX_RectF rect; | 2191 CFX_RectF rect; |
2208 m_pOwner->GetWidgetRect(rect); | 2192 m_pOwner->GetWidgetRect(rect); |
2209 CFX_RectF rtInvalidate; | 2193 CFX_RectF rtInvalidate; |
2210 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 2194 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
2211 m_pOwner->Repaint(&rtInvalidate); | 2195 m_pOwner->Repaint(&rtInvalidate); |
2212 } | 2196 } |
2213 return TRUE; | 2197 return TRUE; |
2214 } | 2198 } |
2215 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} | 2199 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} |
OLD | NEW |