| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "xfa/src/foxitlib.h" | 9 #include "xfa/src/foxitlib.h" |
| 10 #include "xfa/src/fwl/src/core/include/fwl_threadimp.h" | 10 #include "xfa/src/fwl/src/core/include/fwl_threadimp.h" |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 m_pEdtEngine->Replace(nStart, nLen, wsReplace); | 641 m_pEdtEngine->Replace(nStart, nLen, wsReplace); |
| 642 return FWL_ERR_Succeeded; | 642 return FWL_ERR_Succeeded; |
| 643 } | 643 } |
| 644 FWL_ERR CFWL_EditImp::DoClipboard(int32_t iCmd) { | 644 FWL_ERR CFWL_EditImp::DoClipboard(int32_t iCmd) { |
| 645 if (!m_pEdtEngine) | 645 if (!m_pEdtEngine) |
| 646 return FWL_ERR_Succeeded; | 646 return FWL_ERR_Succeeded; |
| 647 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) || | 647 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) || |
| 648 (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { | 648 (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { |
| 649 return FWL_ERR_Succeeded; | 649 return FWL_ERR_Succeeded; |
| 650 } | 650 } |
| 651 IFWL_AdapterNative* pNative = FWL_GetAdapterNative(); | 651 return FWL_ERR_Indefinite; |
| 652 if (!pNative) | |
| 653 return FWL_ERR_Indefinite; | |
| 654 IFWL_AdapterClipboardMgr* pClipBorder = pNative->GetClipboardMgr(); | |
| 655 if (!pClipBorder) | |
| 656 return FWL_ERR_Indefinite; | |
| 657 CFX_WideString wsText; | |
| 658 switch (iCmd) { | |
| 659 case 1: { | |
| 660 int32_t nStart; | |
| 661 int32_t nCount = m_pEdtEngine->GetSelRange(0, nStart); | |
| 662 if (nCount < 1) { | |
| 663 break; | |
| 664 } | |
| 665 m_pEdtEngine->GetText(wsText, nStart, nCount); | |
| 666 pClipBorder->SetStringData(wsText); | |
| 667 break; | |
| 668 } | |
| 669 case 2: { | |
| 670 int32_t nStart; | |
| 671 int32_t nCount = m_pEdtEngine->GetSelRange(0, nStart); | |
| 672 if (nCount < 1) { | |
| 673 break; | |
| 674 } | |
| 675 m_pEdtEngine->GetText(wsText, nStart, nCount); | |
| 676 m_pEdtEngine->DeleteRange(nStart, nCount); | |
| 677 m_pEdtEngine->ClearSelection(); | |
| 678 pClipBorder->SetStringData(wsText); | |
| 679 break; | |
| 680 } | |
| 681 case 3: { | |
| 682 pClipBorder->GetStringData(wsText); | |
| 683 int32_t iLen = wsText.GetLength(); | |
| 684 if (iLen < 0) { | |
| 685 break; | |
| 686 } | |
| 687 if (wsText[iLen] == L'\0') { | |
| 688 if (iLen == 1) { | |
| 689 break; | |
| 690 } | |
| 691 iLen--; | |
| 692 wsText = wsText.Left(iLen); | |
| 693 } | |
| 694 int32_t nPos = m_pEdtEngine->GetCaretPos(); | |
| 695 m_pEdtEngine->Insert(nPos, wsText, iLen); | |
| 696 break; | |
| 697 } | |
| 698 default: {} | |
| 699 } | |
| 700 return FWL_ERR_Succeeded; | |
| 701 } | 652 } |
| 702 FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { | 653 FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { |
| 703 if (!m_pEdtEngine) | 654 if (!m_pEdtEngine) |
| 704 return FALSE; | 655 return FALSE; |
| 705 int32_t nCount = m_pEdtEngine->CountSelRanges(); | 656 int32_t nCount = m_pEdtEngine->CountSelRanges(); |
| 706 if (nCount == 0) { | 657 if (nCount == 0) { |
| 707 return FALSE; | 658 return FALSE; |
| 708 } | 659 } |
| 709 wsCopy.Empty(); | 660 wsCopy.Empty(); |
| 710 CFX_WideString wsTemp; | 661 CFX_WideString wsTemp; |
| (...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2198 } | 2149 } |
| 2199 CFX_RectF rect; | 2150 CFX_RectF rect; |
| 2200 m_pOwner->GetWidgetRect(rect); | 2151 m_pOwner->GetWidgetRect(rect); |
| 2201 CFX_RectF rtInvalidate; | 2152 CFX_RectF rtInvalidate; |
| 2202 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 2153 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
| 2203 m_pOwner->Repaint(&rtInvalidate); | 2154 m_pOwner->Repaint(&rtInvalidate); |
| 2204 } | 2155 } |
| 2205 return TRUE; | 2156 return TRUE; |
| 2206 } | 2157 } |
| 2207 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) { | 2158 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) { |
| 2208 if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { | |
| 2209 IFWL_AdapterNative* pNative = FWL_GetAdapterNative(); | |
| 2210 IFWL_AdapterCursorMgr* pCursorMgr = pNative->GetCursorMgr(); | |
| 2211 if (NULL != pCursorMgr) { | |
| 2212 FWL_HCURSOR hCursor = | |
| 2213 pCursorMgr->GetSystemCursor(FWL_CURSORTYPE_InputBeam); | |
| 2214 pCursorMgr->SetCursor(hCursor); | |
| 2215 pCursorMgr->ShowCursor(TRUE); | |
| 2216 } | |
| 2217 } | |
| 2218 } | 2159 } |
| OLD | NEW |