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/fde/cfde_txtedtengine.h" | 7 #include "xfa/fde/cfde_txtedtengine.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return ((m_nLineCount - 1) / m_nPageLineCount) + 1; | 100 return ((m_nLineCount - 1) / m_nPageLineCount) + 1; |
101 } | 101 } |
102 | 102 |
103 IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) { | 103 IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) { |
104 if (m_PagePtrArray.GetSize() <= nIndex) { | 104 if (m_PagePtrArray.GetSize() <= nIndex) { |
105 return nullptr; | 105 return nullptr; |
106 } | 106 } |
107 return m_PagePtrArray[nIndex]; | 107 return m_PagePtrArray[nIndex]; |
108 } | 108 } |
109 | 109 |
110 void CFDE_TxtEdtEngine::SetTextByStream(IFGAS_Stream* pStream) { | 110 void CFDE_TxtEdtEngine::SetTextByStream( |
| 111 const CFX_RetainPtr<IFGAS_Stream>& pStream) { |
111 ResetEngine(); | 112 ResetEngine(); |
112 int32_t nIndex = 0; | 113 int32_t nIndex = 0; |
113 if (pStream && pStream->GetLength()) { | 114 if (pStream && pStream->GetLength()) { |
114 int32_t nStreamLength = pStream->GetLength(); | 115 int32_t nStreamLength = pStream->GetLength(); |
115 bool bValid = true; | 116 bool bValid = true; |
116 if (m_nLimit > 0 && nStreamLength > m_nLimit) { | 117 if (m_nLimit > 0 && nStreamLength > m_nLimit) { |
117 bValid = false; | 118 bValid = false; |
118 } | 119 } |
119 bool bPreIsCR = false; | 120 bool bPreIsCR = false; |
120 if (bValid) { | 121 if (bValid) { |
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 m_SelRangePtrArr.RemoveAt(nCountRange); | 1617 m_SelRangePtrArr.RemoveAt(nCountRange); |
1617 DeleteRange_DoRecord(nSelStart, nSelCount, true); | 1618 DeleteRange_DoRecord(nSelStart, nSelCount, true); |
1618 } | 1619 } |
1619 ClearSelection(); | 1620 ClearSelection(); |
1620 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); | 1621 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); |
1621 m_Param.pEventSink->On_SelChanged(this); | 1622 m_Param.pEventSink->On_SelChanged(this); |
1622 SetCaretPos(nSelStart, true); | 1623 SetCaretPos(nSelStart, true); |
1623 return; | 1624 return; |
1624 } | 1625 } |
1625 } | 1626 } |
OLD | NEW |