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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 break; | 416 break; |
417 } | 417 } |
418 } | 418 } |
419 int32_t nDestLen = bsReplace.GetLength(); | 419 int32_t nDestLen = bsReplace.GetLength(); |
420 CFX_WideString wsDest; | 420 CFX_WideString wsDest; |
421 FX_WCHAR* pBuffer = wsDest.GetBuffer(nDestLen); | 421 FX_WCHAR* pBuffer = wsDest.GetBuffer(nDestLen); |
422 for (int32_t i = 0; i < nDestLen; i++) { | 422 for (int32_t i = 0; i < nDestLen; i++) { |
423 pBuffer[i] = bsReplace[i]; | 423 pBuffer[i] = bsReplace[i]; |
424 } | 424 } |
425 wsDest.ReleaseBuffer(nDestLen); | 425 wsDest.ReleaseBuffer(nDestLen); |
426 Replace(nWordStart, nWordCount, wsDest.AsWideStringC()); | 426 Replace(nWordStart, nWordCount, wsDest.AsStringC()); |
427 return TRUE; | 427 return TRUE; |
428 } | 428 } |
429 void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics, | 429 void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics, |
430 const CFX_Matrix* pMatrix) { | 430 const CFX_Matrix* pMatrix) { |
431 pGraphics->SaveGraphState(); | 431 pGraphics->SaveGraphState(); |
432 if (pMatrix) { | 432 if (pMatrix) { |
433 pGraphics->ConcatMatrix(const_cast<CFX_Matrix*>(pMatrix)); | 433 pGraphics->ConcatMatrix(const_cast<CFX_Matrix*>(pMatrix)); |
434 } | 434 } |
435 FX_ARGB cr = 0xFFFF0000; | 435 FX_ARGB cr = 0xFFFF0000; |
436 CFX_Color crLine(cr); | 436 CFX_Color crLine(cr); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) { | 727 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) { |
728 return TRUE; | 728 return TRUE; |
729 } | 729 } |
730 return m_pEdtEngine->Undo(bsRecord); | 730 return m_pEdtEngine->Undo(bsRecord); |
731 } | 731 } |
732 FX_BOOL CFWL_EditImp::Undo() { | 732 FX_BOOL CFWL_EditImp::Undo() { |
733 if (!CanUndo()) { | 733 if (!CanUndo()) { |
734 return FALSE; | 734 return FALSE; |
735 } | 735 } |
736 CFX_ByteString bsRecord = m_RecordArr[m_iCurRecord--]; | 736 CFX_ByteString bsRecord = m_RecordArr[m_iCurRecord--]; |
737 return Undo(bsRecord.AsByteStringC()); | 737 return Undo(bsRecord.AsStringC()); |
738 } | 738 } |
739 FX_BOOL CFWL_EditImp::Redo() { | 739 FX_BOOL CFWL_EditImp::Redo() { |
740 if (!CanRedo()) { | 740 if (!CanRedo()) { |
741 return FALSE; | 741 return FALSE; |
742 } | 742 } |
743 CFX_ByteString bsRecord = m_RecordArr[++m_iCurRecord]; | 743 CFX_ByteString bsRecord = m_RecordArr[++m_iCurRecord]; |
744 return Redo(bsRecord.AsByteStringC()); | 744 return Redo(bsRecord.AsStringC()); |
745 } | 745 } |
746 FX_BOOL CFWL_EditImp::CanUndo() { | 746 FX_BOOL CFWL_EditImp::CanUndo() { |
747 return m_iCurRecord >= 0; | 747 return m_iCurRecord >= 0; |
748 } | 748 } |
749 FX_BOOL CFWL_EditImp::CanRedo() { | 749 FX_BOOL CFWL_EditImp::CanRedo() { |
750 return m_iCurRecord < m_RecordArr.GetSize() - 1; | 750 return m_iCurRecord < m_RecordArr.GetSize() - 1; |
751 } | 751 } |
752 FWL_ERR CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { | 752 FWL_ERR CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { |
753 if (!m_pEdtEngine) | 753 if (!m_pEdtEngine) |
754 return FWL_ERR_Succeeded; | 754 return FWL_ERR_Succeeded; |
(...skipping 1415 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 |