| 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 "xfa/fde/cfde_txtedtbuf.h" | 9 #include "xfa/fde/cfde_txtedtbuf.h" |
| 10 #include "xfa/fde/cfde_txtedtbufiter.h" | 10 #include "xfa/fde/cfde_txtedtbufiter.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 fPlateHeight(0), | 29 fPlateHeight(0), |
| 30 nLineCount(0), | 30 nLineCount(0), |
| 31 dwLayoutStyles(0), | 31 dwLayoutStyles(0), |
| 32 dwAlignment(0), | 32 dwAlignment(0), |
| 33 dwMode(0), | 33 dwMode(0), |
| 34 pFont(nullptr), | 34 pFont(nullptr), |
| 35 fFontSize(10.0f), | 35 fFontSize(10.0f), |
| 36 dwFontColor(0xff000000), | 36 dwFontColor(0xff000000), |
| 37 fLineSpace(10.0f), | 37 fLineSpace(10.0f), |
| 38 fTabWidth(36), | 38 fTabWidth(36), |
| 39 bTabEquidistant(FALSE), | 39 bTabEquidistant(false), |
| 40 wDefChar(0xFEFF), | 40 wDefChar(0xFEFF), |
| 41 wLineBreakChar('\n'), | 41 wLineBreakChar('\n'), |
| 42 nCharRotation(0), | 42 nCharRotation(0), |
| 43 nLineEnd(0), | 43 nLineEnd(0), |
| 44 nHorzScale(100), | 44 nHorzScale(100), |
| 45 fCharSpace(0), | 45 fCharSpace(0), |
| 46 pEventSink(nullptr) {} | 46 pEventSink(nullptr) {} |
| 47 | 47 |
| 48 FDE_TXTEDT_TEXTCHANGE_INFO::FDE_TXTEDT_TEXTCHANGE_INFO() {} | 48 FDE_TXTEDT_TEXTCHANGE_INFO::FDE_TXTEDT_TEXTCHANGE_INFO() {} |
| 49 | 49 |
| 50 FDE_TXTEDT_TEXTCHANGE_INFO::~FDE_TXTEDT_TEXTCHANGE_INFO() {} | 50 FDE_TXTEDT_TEXTCHANGE_INFO::~FDE_TXTEDT_TEXTCHANGE_INFO() {} |
| 51 | 51 |
| 52 CFDE_TxtEdtEngine::CFDE_TxtEdtEngine() | 52 CFDE_TxtEdtEngine::CFDE_TxtEdtEngine() |
| 53 : m_pTxtBuf(new CFDE_TxtEdtBuf()), | 53 : m_pTxtBuf(new CFDE_TxtEdtBuf()), |
| 54 m_nPageLineCount(20), | 54 m_nPageLineCount(20), |
| 55 m_nLineCount(0), | 55 m_nLineCount(0), |
| 56 m_nAnchorPos(-1), | 56 m_nAnchorPos(-1), |
| 57 m_nLayoutPos(0), | 57 m_nLayoutPos(0), |
| 58 m_fCaretPosReserve(0.0), | 58 m_fCaretPosReserve(0.0), |
| 59 m_nCaret(0), | 59 m_nCaret(0), |
| 60 m_bBefore(TRUE), | 60 m_bBefore(true), |
| 61 m_nCaretPage(0), | 61 m_nCaretPage(0), |
| 62 m_dwFindFlags(0), | 62 m_dwFindFlags(0), |
| 63 m_bLock(FALSE), | 63 m_bLock(false), |
| 64 m_nLimit(0), | 64 m_nLimit(0), |
| 65 m_wcAliasChar(L'*'), | 65 m_wcAliasChar(L'*'), |
| 66 m_nFirstLineEnd(FDE_TXTEDIT_LINEEND_Auto), | 66 m_nFirstLineEnd(FDE_TXTEDIT_LINEEND_Auto), |
| 67 m_bAutoLineEnd(TRUE), | 67 m_bAutoLineEnd(true), |
| 68 m_wLineEnd(kUnicodeParagraphSeparator) { | 68 m_wLineEnd(kUnicodeParagraphSeparator) { |
| 69 FXSYS_memset(&m_rtCaret, 0, sizeof(CFX_RectF)); | 69 FXSYS_memset(&m_rtCaret, 0, sizeof(CFX_RectF)); |
| 70 m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); | 70 m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); |
| 71 } | 71 } |
| 72 | 72 |
| 73 CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() { | 73 CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() { |
| 74 RemoveAllParags(); | 74 RemoveAllParags(); |
| 75 RemoveAllPages(); | 75 RemoveAllPages(); |
| 76 m_Param.pEventSink = nullptr; | 76 m_Param.pEventSink = nullptr; |
| 77 ClearSelection(); | 77 ClearSelection(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 103 return nullptr; | 103 return nullptr; |
| 104 } | 104 } |
| 105 return m_PagePtrArray[nIndex]; | 105 return m_PagePtrArray[nIndex]; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void CFDE_TxtEdtEngine::SetTextByStream(IFX_Stream* pStream) { | 108 void CFDE_TxtEdtEngine::SetTextByStream(IFX_Stream* pStream) { |
| 109 ResetEngine(); | 109 ResetEngine(); |
| 110 int32_t nIndex = 0; | 110 int32_t nIndex = 0; |
| 111 if (pStream && pStream->GetLength()) { | 111 if (pStream && pStream->GetLength()) { |
| 112 int32_t nStreamLength = pStream->GetLength(); | 112 int32_t nStreamLength = pStream->GetLength(); |
| 113 FX_BOOL bValid = TRUE; | 113 bool bValid = true; |
| 114 if (m_nLimit > 0 && nStreamLength > m_nLimit) { | 114 if (m_nLimit > 0 && nStreamLength > m_nLimit) { |
| 115 bValid = FALSE; | 115 bValid = false; |
| 116 } | 116 } |
| 117 FX_BOOL bPreIsCR = FALSE; | 117 bool bPreIsCR = false; |
| 118 if (bValid) { | 118 if (bValid) { |
| 119 uint8_t bom[4]; | 119 uint8_t bom[4]; |
| 120 int32_t nPos = pStream->GetBOM(bom); | 120 int32_t nPos = pStream->GetBOM(bom); |
| 121 pStream->Seek(FX_STREAMSEEK_Begin, nPos); | 121 pStream->Seek(FX_STREAMSEEK_Begin, nPos); |
| 122 int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize()); | 122 int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize()); |
| 123 FX_WCHAR* lpwstr = FX_Alloc(FX_WCHAR, nPlateSize); | 123 FX_WCHAR* lpwstr = FX_Alloc(FX_WCHAR, nPlateSize); |
| 124 FX_BOOL bEos = false; | 124 bool bEos = false; |
| 125 while (!bEos) { | 125 while (!bEos) { |
| 126 int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, bEos); | 126 int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, bEos); |
| 127 bPreIsCR = ReplaceParagEnd(lpwstr, nRead, bPreIsCR); | 127 bPreIsCR = ReplaceParagEnd(lpwstr, nRead, bPreIsCR); |
| 128 m_pTxtBuf->Insert(nIndex, lpwstr, nRead); | 128 m_pTxtBuf->Insert(nIndex, lpwstr, nRead); |
| 129 nIndex += nRead; | 129 nIndex += nRead; |
| 130 } | 130 } |
| 131 FX_Free(lpwstr); | 131 FX_Free(lpwstr); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 m_pTxtBuf->Insert(nIndex, &m_wLineEnd, 1); | 134 m_pTxtBuf->Insert(nIndex, &m_wLineEnd, 1); |
| 135 RebuildParagraphs(); | 135 RebuildParagraphs(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void CFDE_TxtEdtEngine::SetText(const CFX_WideString& wsText) { | 138 void CFDE_TxtEdtEngine::SetText(const CFX_WideString& wsText) { |
| 139 ResetEngine(); | 139 ResetEngine(); |
| 140 int32_t nLength = wsText.GetLength(); | 140 int32_t nLength = wsText.GetLength(); |
| 141 if (nLength > 0) { | 141 if (nLength > 0) { |
| 142 CFX_WideString wsTemp; | 142 CFX_WideString wsTemp; |
| 143 FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); | 143 FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); |
| 144 FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(FX_WCHAR)); | 144 FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(FX_WCHAR)); |
| 145 ReplaceParagEnd(lpBuffer, nLength, FALSE); | 145 ReplaceParagEnd(lpBuffer, nLength, false); |
| 146 wsTemp.ReleaseBuffer(nLength); | 146 wsTemp.ReleaseBuffer(nLength); |
| 147 if (m_nLimit > 0 && nLength > m_nLimit) { | 147 if (m_nLimit > 0 && nLength > m_nLimit) { |
| 148 wsTemp.Delete(m_nLimit, nLength - m_nLimit); | 148 wsTemp.Delete(m_nLimit, nLength - m_nLimit); |
| 149 nLength = m_nLimit; | 149 nLength = m_nLimit; |
| 150 } | 150 } |
| 151 m_pTxtBuf->SetText(wsTemp); | 151 m_pTxtBuf->SetText(wsTemp); |
| 152 } | 152 } |
| 153 m_pTxtBuf->Insert(nLength, &m_wLineEnd, 1); | 153 m_pTxtBuf->Insert(nLength, &m_wLineEnd, 1); |
| 154 RebuildParagraphs(); | 154 RebuildParagraphs(); |
| 155 } | 155 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 178 return m_nCaret; | 178 return m_nCaret; |
| 179 } | 179 } |
| 180 | 180 |
| 181 int32_t CFDE_TxtEdtEngine::GetCaretPos() const { | 181 int32_t CFDE_TxtEdtEngine::GetCaretPos() const { |
| 182 if (IsLocked()) { | 182 if (IsLocked()) { |
| 183 return 0; | 183 return 0; |
| 184 } | 184 } |
| 185 return m_nCaret + (m_bBefore ? 0 : 1); | 185 return m_nCaret + (m_bBefore ? 0 : 1); |
| 186 } | 186 } |
| 187 | 187 |
| 188 int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { | 188 int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, bool bBefore) { |
| 189 if (IsLocked()) { | 189 if (IsLocked()) { |
| 190 return 0; | 190 return 0; |
| 191 } | 191 } |
| 192 ASSERT(nIndex >= 0 && nIndex <= GetTextBufLength()); | 192 ASSERT(nIndex >= 0 && nIndex <= GetTextBufLength()); |
| 193 if (m_PagePtrArray.GetSize() <= m_nCaretPage) { | 193 if (m_PagePtrArray.GetSize() <= m_nCaretPage) { |
| 194 return 0; | 194 return 0; |
| 195 } | 195 } |
| 196 m_bBefore = bBefore; | 196 m_bBefore = bBefore; |
| 197 m_nCaret = nIndex; | 197 m_nCaret = nIndex; |
| 198 MovePage2Char(m_nCaret); | 198 MovePage2Char(m_nCaret); |
| 199 GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore); | 199 GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore); |
| 200 if (!m_bBefore) { | 200 if (!m_bBefore) { |
| 201 m_nCaret++; | 201 m_nCaret++; |
| 202 m_bBefore = TRUE; | 202 m_bBefore = true; |
| 203 } | 203 } |
| 204 m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) | 204 m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) |
| 205 ? m_rtCaret.top | 205 ? m_rtCaret.top |
| 206 : m_rtCaret.left; | 206 : m_rtCaret.left; |
| 207 m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage, 0); | 207 m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage, 0); |
| 208 m_nAnchorPos = -1; | 208 m_nAnchorPos = -1; |
| 209 return m_nCaret; | 209 return m_nCaret; |
| 210 } | 210 } |
| 211 | 211 |
| 212 int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, | 212 int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, |
| 213 FX_BOOL bShift, | 213 bool bShift, |
| 214 FX_BOOL bCtrl) { | 214 bool bCtrl) { |
| 215 if (IsLocked()) { | 215 if (IsLocked()) { |
| 216 return 0; | 216 return 0; |
| 217 } | 217 } |
| 218 if (m_PagePtrArray.GetSize() <= m_nCaretPage) { | 218 if (m_PagePtrArray.GetSize() <= m_nCaretPage) { |
| 219 return 0; | 219 return 0; |
| 220 } | 220 } |
| 221 FX_BOOL bSelChange = FALSE; | 221 bool bSelChange = false; |
| 222 if (IsSelect()) { | 222 if (IsSelect()) { |
| 223 ClearSelection(); | 223 ClearSelection(); |
| 224 bSelChange = TRUE; | 224 bSelChange = true; |
| 225 } | 225 } |
| 226 if (bShift) { | 226 if (bShift) { |
| 227 if (m_nAnchorPos == -1) { | 227 if (m_nAnchorPos == -1) { |
| 228 m_nAnchorPos = m_nCaret; | 228 m_nAnchorPos = m_nCaret; |
| 229 } | 229 } |
| 230 } else { | 230 } else { |
| 231 m_nAnchorPos = -1; | 231 m_nAnchorPos = -1; |
| 232 } | 232 } |
| 233 FX_BOOL bVertical = m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical; | 233 bool bVertical = m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical; |
| 234 switch (eMoveCaret) { | 234 switch (eMoveCaret) { |
| 235 case MC_Left: { | 235 case MC_Left: { |
| 236 if (bVertical) { | 236 if (bVertical) { |
| 237 CFX_PointF ptCaret; | 237 CFX_PointF ptCaret; |
| 238 if (MoveUp(ptCaret)) { | 238 if (MoveUp(ptCaret)) { |
| 239 UpdateCaretIndex(ptCaret); | 239 UpdateCaretIndex(ptCaret); |
| 240 } | 240 } |
| 241 } else { | 241 } else { |
| 242 FX_BOOL bBefore = TRUE; | 242 bool bBefore = true; |
| 243 int32_t nIndex = MoveBackward(bBefore); | 243 int32_t nIndex = MoveBackward(bBefore); |
| 244 if (nIndex >= 0) { | 244 if (nIndex >= 0) { |
| 245 UpdateCaretRect(nIndex, bBefore); | 245 UpdateCaretRect(nIndex, bBefore); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 } break; | 248 } break; |
| 249 case MC_Right: { | 249 case MC_Right: { |
| 250 if (bVertical) { | 250 if (bVertical) { |
| 251 CFX_PointF ptCaret; | 251 CFX_PointF ptCaret; |
| 252 if (MoveDown(ptCaret)) { | 252 if (MoveDown(ptCaret)) { |
| 253 UpdateCaretIndex(ptCaret); | 253 UpdateCaretIndex(ptCaret); |
| 254 } | 254 } |
| 255 } else { | 255 } else { |
| 256 FX_BOOL bBefore = TRUE; | 256 bool bBefore = true; |
| 257 int32_t nIndex = MoveForward(bBefore); | 257 int32_t nIndex = MoveForward(bBefore); |
| 258 if (nIndex >= 0) { | 258 if (nIndex >= 0) { |
| 259 UpdateCaretRect(nIndex, bBefore); | 259 UpdateCaretRect(nIndex, bBefore); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 } break; | 262 } break; |
| 263 case MC_Up: { | 263 case MC_Up: { |
| 264 if (bVertical) { | 264 if (bVertical) { |
| 265 FX_BOOL bBefore = TRUE; | 265 bool bBefore = true; |
| 266 int32_t nIndex = MoveBackward(bBefore); | 266 int32_t nIndex = MoveBackward(bBefore); |
| 267 if (nIndex >= 0) { | 267 if (nIndex >= 0) { |
| 268 UpdateCaretRect(nIndex, bBefore); | 268 UpdateCaretRect(nIndex, bBefore); |
| 269 } | 269 } |
| 270 } else { | 270 } else { |
| 271 CFX_PointF ptCaret; | 271 CFX_PointF ptCaret; |
| 272 if (MoveUp(ptCaret)) { | 272 if (MoveUp(ptCaret)) { |
| 273 UpdateCaretIndex(ptCaret); | 273 UpdateCaretIndex(ptCaret); |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 } break; | 276 } break; |
| 277 case MC_Down: { | 277 case MC_Down: { |
| 278 if (bVertical) { | 278 if (bVertical) { |
| 279 FX_BOOL bBefore = TRUE; | 279 bool bBefore = true; |
| 280 int32_t nIndex = MoveForward(bBefore); | 280 int32_t nIndex = MoveForward(bBefore); |
| 281 if (nIndex >= 0) { | 281 if (nIndex >= 0) { |
| 282 UpdateCaretRect(nIndex, bBefore); | 282 UpdateCaretRect(nIndex, bBefore); |
| 283 } | 283 } |
| 284 } else { | 284 } else { |
| 285 CFX_PointF ptCaret; | 285 CFX_PointF ptCaret; |
| 286 if (MoveDown(ptCaret)) { | 286 if (MoveDown(ptCaret)) { |
| 287 UpdateCaretIndex(ptCaret); | 287 UpdateCaretIndex(ptCaret); |
| 288 } | 288 } |
| 289 } | 289 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 FXSYS_abs(m_nAnchorPos - m_nCaret)); | 322 FXSYS_abs(m_nAnchorPos - m_nCaret)); |
| 323 m_Param.pEventSink->On_SelChanged(this); | 323 m_Param.pEventSink->On_SelChanged(this); |
| 324 } | 324 } |
| 325 if (bSelChange) { | 325 if (bSelChange) { |
| 326 m_Param.pEventSink->On_SelChanged(this); | 326 m_Param.pEventSink->On_SelChanged(this); |
| 327 } | 327 } |
| 328 return m_nCaret; | 328 return m_nCaret; |
| 329 } | 329 } |
| 330 | 330 |
| 331 void CFDE_TxtEdtEngine::Lock() { | 331 void CFDE_TxtEdtEngine::Lock() { |
| 332 m_bLock = TRUE; | 332 m_bLock = true; |
| 333 } | 333 } |
| 334 | 334 |
| 335 void CFDE_TxtEdtEngine::Unlock() { | 335 void CFDE_TxtEdtEngine::Unlock() { |
| 336 m_bLock = FALSE; | 336 m_bLock = false; |
| 337 } | 337 } |
| 338 | 338 |
| 339 FX_BOOL CFDE_TxtEdtEngine::IsLocked() const { | 339 bool CFDE_TxtEdtEngine::IsLocked() const { |
| 340 return m_bLock; | 340 return m_bLock; |
| 341 } | 341 } |
| 342 | 342 |
| 343 int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, | 343 int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, |
| 344 const FX_WCHAR* lpText, | 344 const FX_WCHAR* lpText, |
| 345 int32_t nLength) { | 345 int32_t nLength) { |
| 346 if (IsLocked()) { | 346 if (IsLocked()) { |
| 347 return FDE_TXTEDT_MODIFY_RET_F_Locked; | 347 return FDE_TXTEDT_MODIFY_RET_F_Locked; |
| 348 } | 348 } |
| 349 CFX_WideString wsTemp; | 349 CFX_WideString wsTemp; |
| 350 FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); | 350 FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); |
| 351 FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); | 351 FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); |
| 352 ReplaceParagEnd(lpBuffer, nLength, FALSE); | 352 ReplaceParagEnd(lpBuffer, nLength, false); |
| 353 wsTemp.ReleaseBuffer(nLength); | 353 wsTemp.ReleaseBuffer(nLength); |
| 354 FX_BOOL bPart = FALSE; | 354 bool bPart = false; |
| 355 if (m_nLimit > 0) { | 355 if (m_nLimit > 0) { |
| 356 int32_t nTotalLength = GetTextBufLength(); | 356 int32_t nTotalLength = GetTextBufLength(); |
| 357 int32_t nCount = m_SelRangePtrArr.GetSize(); | 357 int32_t nCount = m_SelRangePtrArr.GetSize(); |
| 358 for (int32_t i = 0; i < nCount; i++) { | 358 for (int32_t i = 0; i < nCount; i++) { |
| 359 FDE_TXTEDTSELRANGE* lpSelRange = m_SelRangePtrArr.GetAt(i); | 359 FDE_TXTEDTSELRANGE* lpSelRange = m_SelRangePtrArr.GetAt(i); |
| 360 nTotalLength -= lpSelRange->nCount; | 360 nTotalLength -= lpSelRange->nCount; |
| 361 } | 361 } |
| 362 int32_t nExpectLength = nTotalLength + nLength; | 362 int32_t nExpectLength = nTotalLength + nLength; |
| 363 if (nTotalLength == m_nLimit) { | 363 if (nTotalLength == m_nLimit) { |
| 364 return FDE_TXTEDT_MODIFY_RET_F_Full; | 364 return FDE_TXTEDT_MODIFY_RET_F_Full; |
| 365 } | 365 } |
| 366 if (nExpectLength > m_nLimit) { | 366 if (nExpectLength > m_nLimit) { |
| 367 nLength -= (nExpectLength - m_nLimit); | 367 nLength -= (nExpectLength - m_nLimit); |
| 368 bPart = TRUE; | 368 bPart = true; |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Vert) || | 371 if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Vert) || |
| 372 (m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Horz)) { | 372 (m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Horz)) { |
| 373 int32_t nTemp = nLength; | 373 int32_t nTemp = nLength; |
| 374 if (m_Param.dwMode & FDE_TEXTEDITMODE_Password) { | 374 if (m_Param.dwMode & FDE_TEXTEDITMODE_Password) { |
| 375 CFX_WideString wsText; | 375 CFX_WideString wsText; |
| 376 while (nLength > 0) { | 376 while (nLength > 0) { |
| 377 GetPreInsertText(wsText, m_nCaret, lpBuffer, nLength); | 377 GetPreInsertText(wsText, m_nCaret, lpBuffer, nLength); |
| 378 int32_t nTotal = wsText.GetLength(); | 378 int32_t nTotal = wsText.GetLength(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 393 if (IsFitArea(wsText)) { | 393 if (IsFitArea(wsText)) { |
| 394 break; | 394 break; |
| 395 } | 395 } |
| 396 nLength--; | 396 nLength--; |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 if (nLength == 0) { | 399 if (nLength == 0) { |
| 400 return FDE_TXTEDT_MODIFY_RET_F_Full; | 400 return FDE_TXTEDT_MODIFY_RET_F_Full; |
| 401 } | 401 } |
| 402 if (nLength < nTemp) { | 402 if (nLength < nTemp) { |
| 403 bPart = TRUE; | 403 bPart = true; |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { | 406 if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { |
| 407 CFX_WideString wsText; | 407 CFX_WideString wsText; |
| 408 GetPreInsertText(wsText, m_nCaret, lpBuffer, nLength); | 408 GetPreInsertText(wsText, m_nCaret, lpBuffer, nLength); |
| 409 if (!m_Param.pEventSink->On_Validate(this, wsText)) { | 409 if (!m_Param.pEventSink->On_Validate(this, wsText)) { |
| 410 return FDE_TXTEDT_MODIFY_RET_F_Invalidate; | 410 return FDE_TXTEDT_MODIFY_RET_F_Invalidate; |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 if (IsSelect()) { | 413 if (IsSelect()) { |
| 414 DeleteSelect(); | 414 DeleteSelect(); |
| 415 } | 415 } |
| 416 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) | 416 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) |
| 417 m_Param.pEventSink->On_AddDoRecord( | 417 m_Param.pEventSink->On_AddDoRecord( |
| 418 this, | 418 this, |
| 419 new CFDE_TxtEdtDoRecord_Insert(this, m_nCaret, lpBuffer, nLength)); | 419 new CFDE_TxtEdtDoRecord_Insert(this, m_nCaret, lpBuffer, nLength)); |
| 420 | 420 |
| 421 GetText(m_ChangeInfo.wsPrevText, 0); | 421 GetText(m_ChangeInfo.wsPrevText, 0); |
| 422 Inner_Insert(m_nCaret, lpBuffer, nLength); | 422 Inner_Insert(m_nCaret, lpBuffer, nLength); |
| 423 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; | 423 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; |
| 424 m_ChangeInfo.wsInsert = CFX_WideString(lpBuffer, nLength); | 424 m_ChangeInfo.wsInsert = CFX_WideString(lpBuffer, nLength); |
| 425 nStart = m_nCaret; | 425 nStart = m_nCaret; |
| 426 nStart += nLength; | 426 nStart += nLength; |
| 427 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); | 427 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); |
| 428 FX_BOOL bBefore = TRUE; | 428 bool bBefore = true; |
| 429 if (wChar != L'\n' && wChar != L'\r') { | 429 if (wChar != L'\n' && wChar != L'\r') { |
| 430 nStart--; | 430 nStart--; |
| 431 bBefore = FALSE; | 431 bBefore = false; |
| 432 } | 432 } |
| 433 SetCaretPos(nStart, bBefore); | 433 SetCaretPos(nStart, bBefore); |
| 434 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); | 434 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); |
| 435 return bPart ? FDE_TXTEDT_MODIFY_RET_S_Part : FDE_TXTEDT_MODIFY_RET_S_Normal; | 435 return bPart ? FDE_TXTEDT_MODIFY_RET_S_Part : FDE_TXTEDT_MODIFY_RET_S_Normal; |
| 436 } | 436 } |
| 437 | 437 |
| 438 int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, FX_BOOL bBackspace) { | 438 int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, bool bBackspace) { |
| 439 if (IsLocked()) { | 439 if (IsLocked()) { |
| 440 return FDE_TXTEDT_MODIFY_RET_F_Locked; | 440 return FDE_TXTEDT_MODIFY_RET_F_Locked; |
| 441 } | 441 } |
| 442 if (IsSelect()) { | 442 if (IsSelect()) { |
| 443 DeleteSelect(); | 443 DeleteSelect(); |
| 444 return FDE_TXTEDT_MODIFY_RET_S_Normal; | 444 return FDE_TXTEDT_MODIFY_RET_S_Normal; |
| 445 } | 445 } |
| 446 | 446 |
| 447 int32_t nCount = 1; | 447 int32_t nCount = 1; |
| 448 if (bBackspace) { | 448 if (bBackspace) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 } | 500 } |
| 501 if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { | 501 if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { |
| 502 CFX_WideString wsText; | 502 CFX_WideString wsText; |
| 503 GetPreDeleteText(wsText, nStart, nCount); | 503 GetPreDeleteText(wsText, nStart, nCount); |
| 504 if (!m_Param.pEventSink->On_Validate(this, wsText)) { | 504 if (!m_Param.pEventSink->On_Validate(this, wsText)) { |
| 505 return FDE_TXTEDT_MODIFY_RET_F_Invalidate; | 505 return FDE_TXTEDT_MODIFY_RET_F_Invalidate; |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 DeleteRange_DoRecord(nStart, nCount); | 508 DeleteRange_DoRecord(nStart, nCount); |
| 509 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); | 509 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); |
| 510 SetCaretPos(nStart, TRUE); | 510 SetCaretPos(nStart, true); |
| 511 return FDE_TXTEDT_MODIFY_RET_S_Normal; | 511 return FDE_TXTEDT_MODIFY_RET_S_Normal; |
| 512 } | 512 } |
| 513 | 513 |
| 514 int32_t CFDE_TxtEdtEngine::Replace(int32_t nStart, | 514 int32_t CFDE_TxtEdtEngine::Replace(int32_t nStart, |
| 515 int32_t nLength, | 515 int32_t nLength, |
| 516 const CFX_WideString& wsReplace) { | 516 const CFX_WideString& wsReplace) { |
| 517 if (IsLocked()) { | 517 if (IsLocked()) { |
| 518 return FDE_TXTEDT_MODIFY_RET_F_Locked; | 518 return FDE_TXTEDT_MODIFY_RET_F_Locked; |
| 519 } | 519 } |
| 520 if (nStart < 0 || (nStart + nLength > GetTextBufLength())) { | 520 if (nStart < 0 || (nStart + nLength > GetTextBufLength())) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 536 if (nLength > 0) { | 536 if (nLength > 0) { |
| 537 Inner_DeleteRange(nStart, nLength); | 537 Inner_DeleteRange(nStart, nLength); |
| 538 } | 538 } |
| 539 int32_t nTextLength = wsReplace.GetLength(); | 539 int32_t nTextLength = wsReplace.GetLength(); |
| 540 if (nTextLength > 0) { | 540 if (nTextLength > 0) { |
| 541 Inner_Insert(nStart, wsReplace.c_str(), nTextLength); | 541 Inner_Insert(nStart, wsReplace.c_str(), nTextLength); |
| 542 } | 542 } |
| 543 m_ChangeInfo.wsInsert = CFX_WideString(wsReplace.c_str(), nTextLength); | 543 m_ChangeInfo.wsInsert = CFX_WideString(wsReplace.c_str(), nTextLength); |
| 544 nStart += nTextLength; | 544 nStart += nTextLength; |
| 545 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); | 545 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); |
| 546 FX_BOOL bBefore = TRUE; | 546 bool bBefore = true; |
| 547 if (wChar != L'\n' && wChar != L'\r') { | 547 if (wChar != L'\n' && wChar != L'\r') { |
| 548 nStart--; | 548 nStart--; |
| 549 bBefore = FALSE; | 549 bBefore = false; |
| 550 } | 550 } |
| 551 SetCaretPos(nStart, bBefore); | 551 SetCaretPos(nStart, bBefore); |
| 552 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); | 552 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); |
| 553 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); | 553 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); |
| 554 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); | 554 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); |
| 555 return FDE_TXTEDT_MODIFY_RET_S_Normal; | 555 return FDE_TXTEDT_MODIFY_RET_S_Normal; |
| 556 } | 556 } |
| 557 | 557 |
| 558 void CFDE_TxtEdtEngine::SetLimit(int32_t nLimit) { | 558 void CFDE_TxtEdtEngine::SetLimit(int32_t nLimit) { |
| 559 m_nLimit = nLimit; | 559 m_nLimit = nLimit; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 lpTemp = m_SelRangePtrArr[nSize - 1]; | 594 lpTemp = m_SelRangePtrArr[nSize - 1]; |
| 595 if (nStart >= lpTemp->nStart + lpTemp->nCount) { | 595 if (nStart >= lpTemp->nStart + lpTemp->nCount) { |
| 596 FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE; | 596 FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE; |
| 597 lpSelRange->nStart = nStart; | 597 lpSelRange->nStart = nStart; |
| 598 lpSelRange->nCount = nCount; | 598 lpSelRange->nCount = nCount; |
| 599 m_SelRangePtrArr.Add(lpSelRange); | 599 m_SelRangePtrArr.Add(lpSelRange); |
| 600 m_Param.pEventSink->On_SelChanged(this); | 600 m_Param.pEventSink->On_SelChanged(this); |
| 601 return; | 601 return; |
| 602 } | 602 } |
| 603 int32_t nEnd = nStart + nCount - 1; | 603 int32_t nEnd = nStart + nCount - 1; |
| 604 FX_BOOL bBegin = FALSE; | 604 bool bBegin = false; |
| 605 int32_t nRangeBgn = 0; | 605 int32_t nRangeBgn = 0; |
| 606 int32_t nRangeCnt = 0; | 606 int32_t nRangeCnt = 0; |
| 607 for (int32_t i = 0; i < nSize; i++) { | 607 for (int32_t i = 0; i < nSize; i++) { |
| 608 lpTemp = m_SelRangePtrArr[i]; | 608 lpTemp = m_SelRangePtrArr[i]; |
| 609 int32_t nTempBgn = lpTemp->nStart; | 609 int32_t nTempBgn = lpTemp->nStart; |
| 610 int32_t nTempEnd = nTempBgn + lpTemp->nCount - 1; | 610 int32_t nTempEnd = nTempBgn + lpTemp->nCount - 1; |
| 611 if (bBegin) { | 611 if (bBegin) { |
| 612 if (nEnd < nTempBgn) { | 612 if (nEnd < nTempBgn) { |
| 613 break; | 613 break; |
| 614 } else if (nStart >= nTempBgn && nStart <= nTempEnd) { | 614 } else if (nStart >= nTempBgn && nStart <= nTempEnd) { |
| 615 nRangeCnt++; | 615 nRangeCnt++; |
| 616 break; | 616 break; |
| 617 } | 617 } |
| 618 nRangeCnt++; | 618 nRangeCnt++; |
| 619 } else { | 619 } else { |
| 620 if (nStart <= nTempEnd) { | 620 if (nStart <= nTempEnd) { |
| 621 nRangeBgn = i; | 621 nRangeBgn = i; |
| 622 if (nEnd < nTempBgn) { | 622 if (nEnd < nTempBgn) { |
| 623 break; | 623 break; |
| 624 } | 624 } |
| 625 nRangeCnt = 1; | 625 nRangeCnt = 1; |
| 626 bBegin = TRUE; | 626 bBegin = true; |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 } | 629 } |
| 630 if (nRangeCnt == 0) { | 630 if (nRangeCnt == 0) { |
| 631 FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE; | 631 FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE; |
| 632 lpSelRange->nStart = nStart; | 632 lpSelRange->nStart = nStart; |
| 633 lpSelRange->nCount = nCount; | 633 lpSelRange->nCount = nCount; |
| 634 m_SelRangePtrArr.InsertAt(nRangeBgn, lpSelRange); | 634 m_SelRangePtrArr.InsertAt(nRangeBgn, lpSelRange); |
| 635 } else { | 635 } else { |
| 636 lpTemp = m_SelRangePtrArr[nRangeBgn]; | 636 lpTemp = m_SelRangePtrArr[nRangeBgn]; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 657 | 657 |
| 658 void CFDE_TxtEdtEngine::ClearSelection() { | 658 void CFDE_TxtEdtEngine::ClearSelection() { |
| 659 int32_t nCount = m_SelRangePtrArr.GetSize(); | 659 int32_t nCount = m_SelRangePtrArr.GetSize(); |
| 660 for (int i = 0; i < nCount; ++i) | 660 for (int i = 0; i < nCount; ++i) |
| 661 delete m_SelRangePtrArr[i]; | 661 delete m_SelRangePtrArr[i]; |
| 662 m_SelRangePtrArr.RemoveAll(); | 662 m_SelRangePtrArr.RemoveAll(); |
| 663 if (nCount && m_Param.pEventSink) | 663 if (nCount && m_Param.pEventSink) |
| 664 m_Param.pEventSink->On_SelChanged(this); | 664 m_Param.pEventSink->On_SelChanged(this); |
| 665 } | 665 } |
| 666 | 666 |
| 667 FX_BOOL CFDE_TxtEdtEngine::Redo(const IFDE_TxtEdtDoRecord* pDoRecord) { | 667 bool CFDE_TxtEdtEngine::Redo(const IFDE_TxtEdtDoRecord* pDoRecord) { |
| 668 if (IsLocked()) | 668 if (IsLocked()) |
| 669 return FALSE; | 669 return false; |
| 670 if (m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo) | 670 if (m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo) |
| 671 return FALSE; | 671 return false; |
| 672 return pDoRecord->Redo(); | 672 return pDoRecord->Redo(); |
| 673 } | 673 } |
| 674 | 674 |
| 675 FX_BOOL CFDE_TxtEdtEngine::Undo(const IFDE_TxtEdtDoRecord* pDoRecord) { | 675 bool CFDE_TxtEdtEngine::Undo(const IFDE_TxtEdtDoRecord* pDoRecord) { |
| 676 if (IsLocked()) | 676 if (IsLocked()) |
| 677 return FALSE; | 677 return false; |
| 678 if (m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo) | 678 if (m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo) |
| 679 return FALSE; | 679 return false; |
| 680 return pDoRecord->Undo(); | 680 return pDoRecord->Undo(); |
| 681 } | 681 } |
| 682 | 682 |
| 683 int32_t CFDE_TxtEdtEngine::StartLayout() { | 683 int32_t CFDE_TxtEdtEngine::StartLayout() { |
| 684 Lock(); | 684 Lock(); |
| 685 RemoveAllPages(); | 685 RemoveAllPages(); |
| 686 m_nLayoutPos = 0; | 686 m_nLayoutPos = 0; |
| 687 m_nLineCount = 0; | 687 m_nLineCount = 0; |
| 688 return 0; | 688 return 0; |
| 689 } | 689 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 712 m_nCaret = nLength; | 712 m_nCaret = nLength; |
| 713 } | 713 } |
| 714 int32_t nIndex = m_nCaret; | 714 int32_t nIndex = m_nCaret; |
| 715 if (!m_bBefore) { | 715 if (!m_bBefore) { |
| 716 nIndex--; | 716 nIndex--; |
| 717 } | 717 } |
| 718 m_rtCaret.Set(0, 0, 1, m_Param.fFontSize); | 718 m_rtCaret.Set(0, 0, 1, m_Param.fFontSize); |
| 719 Unlock(); | 719 Unlock(); |
| 720 } | 720 } |
| 721 | 721 |
| 722 FX_BOOL CFDE_TxtEdtEngine::Optimize(IFX_Pause* pPause) { | 722 bool CFDE_TxtEdtEngine::Optimize(IFX_Pause* pPause) { |
| 723 return m_pTxtBuf->Optimize(pPause); | 723 return m_pTxtBuf->Optimize(pPause); |
| 724 } | 724 } |
| 725 | 725 |
| 726 CFDE_TxtEdtBuf* CFDE_TxtEdtEngine::GetTextBuf() const { | 726 CFDE_TxtEdtBuf* CFDE_TxtEdtEngine::GetTextBuf() const { |
| 727 return m_pTxtBuf.get(); | 727 return m_pTxtBuf.get(); |
| 728 } | 728 } |
| 729 | 729 |
| 730 int32_t CFDE_TxtEdtEngine::GetTextBufLength() const { | 730 int32_t CFDE_TxtEdtEngine::GetTextBufLength() const { |
| 731 return m_pTxtBuf->GetTextLength() - 1; | 731 return m_pTxtBuf->GetTextLength() - 1; |
| 732 } | 732 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 m_ParagPtrArray[i]->IncrementStartIndex(nLength); | 841 m_ParagPtrArray[i]->IncrementStartIndex(nLength); |
| 842 | 842 |
| 843 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 843 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 844 int32_t nReserveLineCount = pParag->GetLineCount(); | 844 int32_t nReserveLineCount = pParag->GetLineCount(); |
| 845 int32_t nReserveCharStart = pParag->GetStartIndex(); | 845 int32_t nReserveCharStart = pParag->GetStartIndex(); |
| 846 int32_t nLeavePart = ParagPos.nCharIndex; | 846 int32_t nLeavePart = ParagPos.nCharIndex; |
| 847 int32_t nCutPart = pParag->GetTextLength() - ParagPos.nCharIndex; | 847 int32_t nCutPart = pParag->GetTextLength() - ParagPos.nCharIndex; |
| 848 int32_t nTextStart = 0; | 848 int32_t nTextStart = 0; |
| 849 FX_WCHAR wCurChar = L' '; | 849 FX_WCHAR wCurChar = L' '; |
| 850 const FX_WCHAR* lpPos = lpText; | 850 const FX_WCHAR* lpPos = lpText; |
| 851 FX_BOOL bFirst = TRUE; | 851 bool bFirst = true; |
| 852 int32_t nParagIndex = ParagPos.nParagIndex; | 852 int32_t nParagIndex = ParagPos.nParagIndex; |
| 853 for (i = 0; i < nLength; i++, lpPos++) { | 853 for (i = 0; i < nLength; i++, lpPos++) { |
| 854 wCurChar = *lpPos; | 854 wCurChar = *lpPos; |
| 855 if (wCurChar == m_wLineEnd) { | 855 if (wCurChar == m_wLineEnd) { |
| 856 if (bFirst) { | 856 if (bFirst) { |
| 857 pParag->SetTextLength(nLeavePart + (i - nTextStart + 1)); | 857 pParag->SetTextLength(nLeavePart + (i - nTextStart + 1)); |
| 858 pParag->SetLineCount(-1); | 858 pParag->SetLineCount(-1); |
| 859 nReserveCharStart += pParag->GetTextLength(); | 859 nReserveCharStart += pParag->GetTextLength(); |
| 860 bFirst = FALSE; | 860 bFirst = false; |
| 861 } else { | 861 } else { |
| 862 pParag = new CFDE_TxtEdtParag(this); | 862 pParag = new CFDE_TxtEdtParag(this); |
| 863 pParag->SetLineCount(-1); | 863 pParag->SetLineCount(-1); |
| 864 pParag->SetTextLength(i - nTextStart + 1); | 864 pParag->SetTextLength(i - nTextStart + 1); |
| 865 pParag->SetStartIndex(nReserveCharStart); | 865 pParag->SetStartIndex(nReserveCharStart); |
| 866 m_ParagPtrArray.InsertAt(++nParagIndex, pParag); | 866 m_ParagPtrArray.InsertAt(++nParagIndex, pParag); |
| 867 nReserveCharStart += pParag->GetTextLength(); | 867 nReserveCharStart += pParag->GetTextLength(); |
| 868 } | 868 } |
| 869 nTextStart = i + 1; | 869 nTextStart = i + 1; |
| 870 } | 870 } |
| 871 } | 871 } |
| 872 if (bFirst) { | 872 if (bFirst) { |
| 873 pParag->IncrementTextLength(nLength); | 873 pParag->IncrementTextLength(nLength); |
| 874 pParag->SetLineCount(-1); | 874 pParag->SetLineCount(-1); |
| 875 bFirst = FALSE; | 875 bFirst = false; |
| 876 } else { | 876 } else { |
| 877 pParag = new CFDE_TxtEdtParag(this); | 877 pParag = new CFDE_TxtEdtParag(this); |
| 878 pParag->SetLineCount(-1); | 878 pParag->SetLineCount(-1); |
| 879 pParag->SetTextLength(nLength - nTextStart + nCutPart); | 879 pParag->SetTextLength(nLength - nTextStart + nCutPart); |
| 880 pParag->SetStartIndex(nReserveCharStart); | 880 pParag->SetStartIndex(nReserveCharStart); |
| 881 m_ParagPtrArray.InsertAt(++nParagIndex, pParag); | 881 m_ParagPtrArray.InsertAt(++nParagIndex, pParag); |
| 882 } | 882 } |
| 883 m_pTxtBuf->Insert(nStart, lpText, nLength); | 883 m_pTxtBuf->Insert(nStart, lpText, nLength); |
| 884 int32_t nTotalLineCount = 0; | 884 int32_t nTotalLineCount = 0; |
| 885 for (i = ParagPos.nParagIndex; i <= nParagIndex; i++) { | 885 for (i = ParagPos.nParagIndex; i <= nParagIndex; i++) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 896 if (nCount == -1) { | 896 if (nCount == -1) { |
| 897 nCount = m_pTxtBuf->GetTextLength() - nStart; | 897 nCount = m_pTxtBuf->GetTextLength() - nStart; |
| 898 } | 898 } |
| 899 int32_t nEnd = nStart + nCount - 1; | 899 int32_t nEnd = nStart + nCount - 1; |
| 900 ASSERT(nStart >= 0 && nEnd < m_pTxtBuf->GetTextLength()); | 900 ASSERT(nStart >= 0 && nEnd < m_pTxtBuf->GetTextLength()); |
| 901 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); | 901 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); |
| 902 FDE_TXTEDTPARAGPOS ParagPosBgn, ParagPosEnd; | 902 FDE_TXTEDTPARAGPOS ParagPosBgn, ParagPosEnd; |
| 903 TextPos2ParagPos(nStart, ParagPosBgn); | 903 TextPos2ParagPos(nStart, ParagPosBgn); |
| 904 TextPos2ParagPos(nEnd, ParagPosEnd); | 904 TextPos2ParagPos(nEnd, ParagPosEnd); |
| 905 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPosEnd.nParagIndex]; | 905 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPosEnd.nParagIndex]; |
| 906 FX_BOOL bLastParag = FALSE; | 906 bool bLastParag = false; |
| 907 if (ParagPosEnd.nCharIndex == pParag->GetTextLength() - 1) { | 907 if (ParagPosEnd.nCharIndex == pParag->GetTextLength() - 1) { |
| 908 if (ParagPosEnd.nParagIndex < m_ParagPtrArray.GetSize() - 1) { | 908 if (ParagPosEnd.nParagIndex < m_ParagPtrArray.GetSize() - 1) { |
| 909 ParagPosEnd.nParagIndex++; | 909 ParagPosEnd.nParagIndex++; |
| 910 } else { | 910 } else { |
| 911 bLastParag = TRUE; | 911 bLastParag = true; |
| 912 } | 912 } |
| 913 } | 913 } |
| 914 int32_t nTotalLineCount = 0; | 914 int32_t nTotalLineCount = 0; |
| 915 int32_t nTotalCharCount = 0; | 915 int32_t nTotalCharCount = 0; |
| 916 int32_t i = 0; | 916 int32_t i = 0; |
| 917 for (i = ParagPosBgn.nParagIndex; i <= ParagPosEnd.nParagIndex; i++) { | 917 for (i = ParagPosBgn.nParagIndex; i <= ParagPosEnd.nParagIndex; i++) { |
| 918 CFDE_TxtEdtParag* pTextParag = m_ParagPtrArray[i]; | 918 CFDE_TxtEdtParag* pTextParag = m_ParagPtrArray[i]; |
| 919 pTextParag->CalcLines(); | 919 pTextParag->CalcLines(); |
| 920 nTotalLineCount += pTextParag->GetLineCount(); | 920 nTotalLineCount += pTextParag->GetLineCount(); |
| 921 nTotalCharCount += pTextParag->GetTextLength(); | 921 nTotalCharCount += pTextParag->GetTextLength(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 942 UpdatePages(); | 942 UpdatePages(); |
| 943 int32_t nPageCount = CountPages(); | 943 int32_t nPageCount = CountPages(); |
| 944 if (m_nCaretPage >= nPageCount) { | 944 if (m_nCaretPage >= nPageCount) { |
| 945 m_nCaretPage = nPageCount - 1; | 945 m_nCaretPage = nPageCount - 1; |
| 946 } | 946 } |
| 947 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); | 947 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); |
| 948 } | 948 } |
| 949 | 949 |
| 950 void CFDE_TxtEdtEngine::DeleteRange_DoRecord(int32_t nStart, | 950 void CFDE_TxtEdtEngine::DeleteRange_DoRecord(int32_t nStart, |
| 951 int32_t nCount, | 951 int32_t nCount, |
| 952 FX_BOOL bSel) { | 952 bool bSel) { |
| 953 ASSERT(nStart >= 0); | 953 ASSERT(nStart >= 0); |
| 954 if (nCount == -1) { | 954 if (nCount == -1) { |
| 955 nCount = GetTextLength() - nStart; | 955 nCount = GetTextLength() - nStart; |
| 956 } | 956 } |
| 957 ASSERT((nStart + nCount) <= m_pTxtBuf->GetTextLength()); | 957 ASSERT((nStart + nCount) <= m_pTxtBuf->GetTextLength()); |
| 958 | 958 |
| 959 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) { | 959 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) { |
| 960 CFX_WideString wsRange; | 960 CFX_WideString wsRange; |
| 961 m_pTxtBuf->GetRange(wsRange, nStart, nCount); | 961 m_pTxtBuf->GetRange(wsRange, nStart, nCount); |
| 962 m_Param.pEventSink->On_AddDoRecord( | 962 m_Param.pEventSink->On_AddDoRecord( |
| 963 this, new CFDE_TxtEdtDoRecord_DeleteRange(this, nStart, m_nCaret, | 963 this, new CFDE_TxtEdtDoRecord_DeleteRange(this, nStart, m_nCaret, |
| 964 wsRange, bSel)); | 964 wsRange, bSel)); |
| 965 } | 965 } |
| 966 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; | 966 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; |
| 967 GetText(m_ChangeInfo.wsDelete, nStart, nCount); | 967 GetText(m_ChangeInfo.wsDelete, nStart, nCount); |
| 968 Inner_DeleteRange(nStart, nCount); | 968 Inner_DeleteRange(nStart, nCount); |
| 969 } | 969 } |
| 970 | 970 |
| 971 void CFDE_TxtEdtEngine::ResetEngine() { | 971 void CFDE_TxtEdtEngine::ResetEngine() { |
| 972 RemoveAllPages(); | 972 RemoveAllPages(); |
| 973 RemoveAllParags(); | 973 RemoveAllParags(); |
| 974 ClearSelection(); | 974 ClearSelection(); |
| 975 m_nCaret = 0; | 975 m_nCaret = 0; |
| 976 m_pTxtBuf->Clear(FALSE); | 976 m_pTxtBuf->Clear(false); |
| 977 m_nCaret = 0; | 977 m_nCaret = 0; |
| 978 } | 978 } |
| 979 | 979 |
| 980 void CFDE_TxtEdtEngine::RebuildParagraphs() { | 980 void CFDE_TxtEdtEngine::RebuildParagraphs() { |
| 981 RemoveAllParags(); | 981 RemoveAllParags(); |
| 982 FX_WCHAR wChar = L' '; | 982 FX_WCHAR wChar = L' '; |
| 983 int32_t nParagStart = 0; | 983 int32_t nParagStart = 0; |
| 984 int32_t nIndex = 0; | 984 int32_t nIndex = 0; |
| 985 std::unique_ptr<IFX_CharIter> pIter(new CFDE_TxtEdtBufIter(m_pTxtBuf.get())); | 985 std::unique_ptr<IFX_CharIter> pIter(new CFDE_TxtEdtBufIter(m_pTxtBuf.get())); |
| 986 pIter->SetAt(0); | 986 pIter->SetAt(0); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 m_pTextBreak->SetFontSize(m_Param.fFontSize); | 1139 m_pTextBreak->SetFontSize(m_Param.fFontSize); |
| 1140 m_pTextBreak->SetTabWidth(m_Param.fTabWidth, m_Param.bTabEquidistant); | 1140 m_pTextBreak->SetTabWidth(m_Param.fTabWidth, m_Param.bTabEquidistant); |
| 1141 m_pTextBreak->SetDefaultChar(m_Param.wDefChar); | 1141 m_pTextBreak->SetDefaultChar(m_Param.wDefChar); |
| 1142 m_pTextBreak->SetParagraphBreakChar(m_Param.wLineBreakChar); | 1142 m_pTextBreak->SetParagraphBreakChar(m_Param.wLineBreakChar); |
| 1143 m_pTextBreak->SetCharRotation(m_Param.nCharRotation); | 1143 m_pTextBreak->SetCharRotation(m_Param.nCharRotation); |
| 1144 m_pTextBreak->SetLineBreakTolerance(m_Param.fFontSize * 0.2f); | 1144 m_pTextBreak->SetLineBreakTolerance(m_Param.fFontSize * 0.2f); |
| 1145 m_pTextBreak->SetHorizontalScale(m_Param.nHorzScale); | 1145 m_pTextBreak->SetHorizontalScale(m_Param.nHorzScale); |
| 1146 m_pTextBreak->SetCharSpace(m_Param.fCharSpace); | 1146 m_pTextBreak->SetCharSpace(m_Param.fCharSpace); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 FX_BOOL CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, | 1149 bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, |
| 1150 int32_t& nLength, | 1150 int32_t& nLength, |
| 1151 FX_BOOL bPreIsCR) { | 1151 bool bPreIsCR) { |
| 1152 for (int32_t i = 0; i < nLength; i++) { | 1152 for (int32_t i = 0; i < nLength; i++) { |
| 1153 FX_WCHAR wc = lpText[i]; | 1153 FX_WCHAR wc = lpText[i]; |
| 1154 switch (wc) { | 1154 switch (wc) { |
| 1155 case L'\r': { | 1155 case L'\r': { |
| 1156 lpText[i] = m_wLineEnd; | 1156 lpText[i] = m_wLineEnd; |
| 1157 bPreIsCR = TRUE; | 1157 bPreIsCR = true; |
| 1158 } break; | 1158 } break; |
| 1159 case L'\n': { | 1159 case L'\n': { |
| 1160 if (bPreIsCR == TRUE) { | 1160 if (bPreIsCR == true) { |
| 1161 int32_t nNext = i + 1; | 1161 int32_t nNext = i + 1; |
| 1162 if (nNext < nLength) { | 1162 if (nNext < nLength) { |
| 1163 FXSYS_memmove(lpText + i, lpText + nNext, | 1163 FXSYS_memmove(lpText + i, lpText + nNext, |
| 1164 (nLength - nNext) * sizeof(FX_WCHAR)); | 1164 (nLength - nNext) * sizeof(FX_WCHAR)); |
| 1165 } | 1165 } |
| 1166 i--; | 1166 i--; |
| 1167 nLength--; | 1167 nLength--; |
| 1168 bPreIsCR = FALSE; | 1168 bPreIsCR = false; |
| 1169 if (m_bAutoLineEnd) { | 1169 if (m_bAutoLineEnd) { |
| 1170 m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_CRLF; | 1170 m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_CRLF; |
| 1171 m_bAutoLineEnd = FALSE; | 1171 m_bAutoLineEnd = false; |
| 1172 } | 1172 } |
| 1173 } else { | 1173 } else { |
| 1174 lpText[i] = m_wLineEnd; | 1174 lpText[i] = m_wLineEnd; |
| 1175 if (m_bAutoLineEnd) { | 1175 if (m_bAutoLineEnd) { |
| 1176 m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_LF; | 1176 m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_LF; |
| 1177 m_bAutoLineEnd = FALSE; | 1177 m_bAutoLineEnd = false; |
| 1178 } | 1178 } |
| 1179 } | 1179 } |
| 1180 } break; | 1180 } break; |
| 1181 default: { | 1181 default: { |
| 1182 if (bPreIsCR && m_bAutoLineEnd) { | 1182 if (bPreIsCR && m_bAutoLineEnd) { |
| 1183 m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_CR; | 1183 m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_CR; |
| 1184 m_bAutoLineEnd = FALSE; | 1184 m_bAutoLineEnd = false; |
| 1185 } | 1185 } |
| 1186 bPreIsCR = FALSE; | 1186 bPreIsCR = false; |
| 1187 } break; | 1187 } break; |
| 1188 } | 1188 } |
| 1189 } | 1189 } |
| 1190 return bPreIsCR; | 1190 return bPreIsCR; |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) { | 1193 void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) { |
| 1194 FX_WCHAR wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r'; | 1194 FX_WCHAR wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r'; |
| 1195 if (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CRLF) { | 1195 if (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CRLF) { |
| 1196 CFX_ArrayTemplate<int32_t> PosArr; | 1196 CFX_ArrayTemplate<int32_t> PosArr; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 if (nBgn == nEnd) | 1296 if (nBgn == nEnd) |
| 1297 nMid = nBgn; | 1297 nMid = nBgn; |
| 1298 | 1298 |
| 1299 ASSERT(nIndex >= m_ParagPtrArray[nMid]->GetStartIndex() && | 1299 ASSERT(nIndex >= m_ParagPtrArray[nMid]->GetStartIndex() && |
| 1300 (nIndex < m_ParagPtrArray[nMid]->GetStartIndex() + | 1300 (nIndex < m_ParagPtrArray[nMid]->GetStartIndex() + |
| 1301 m_ParagPtrArray[nMid]->GetTextLength())); | 1301 m_ParagPtrArray[nMid]->GetTextLength())); |
| 1302 ParagPos.nParagIndex = nMid; | 1302 ParagPos.nParagIndex = nMid; |
| 1303 ParagPos.nCharIndex = nIndex - m_ParagPtrArray[nMid]->GetStartIndex(); | 1303 ParagPos.nCharIndex = nIndex - m_ParagPtrArray[nMid]->GetStartIndex(); |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 int32_t CFDE_TxtEdtEngine::MoveForward(FX_BOOL& bBefore) { | 1306 int32_t CFDE_TxtEdtEngine::MoveForward(bool& bBefore) { |
| 1307 if (m_nCaret == m_pTxtBuf->GetTextLength() - 1) | 1307 if (m_nCaret == m_pTxtBuf->GetTextLength() - 1) |
| 1308 return -1; | 1308 return -1; |
| 1309 | 1309 |
| 1310 int32_t nCaret = m_nCaret; | 1310 int32_t nCaret = m_nCaret; |
| 1311 if ((nCaret + 1 < m_pTxtBuf->GetTextLength()) && | 1311 if ((nCaret + 1 < m_pTxtBuf->GetTextLength()) && |
| 1312 (m_pTxtBuf->GetCharByIndex(nCaret) == L'\r') && | 1312 (m_pTxtBuf->GetCharByIndex(nCaret) == L'\r') && |
| 1313 (m_pTxtBuf->GetCharByIndex(nCaret + 1) == L'\n')) { | 1313 (m_pTxtBuf->GetCharByIndex(nCaret + 1) == L'\n')) { |
| 1314 nCaret++; | 1314 nCaret++; |
| 1315 } | 1315 } |
| 1316 nCaret++; | 1316 nCaret++; |
| 1317 bBefore = TRUE; | 1317 bBefore = true; |
| 1318 return nCaret; | 1318 return nCaret; |
| 1319 } | 1319 } |
| 1320 | 1320 |
| 1321 int32_t CFDE_TxtEdtEngine::MoveBackward(FX_BOOL& bBefore) { | 1321 int32_t CFDE_TxtEdtEngine::MoveBackward(bool& bBefore) { |
| 1322 if (m_nCaret == 0) | 1322 if (m_nCaret == 0) |
| 1323 return FALSE; | 1323 return false; |
| 1324 | 1324 |
| 1325 int32_t nCaret = m_nCaret; | 1325 int32_t nCaret = m_nCaret; |
| 1326 if (nCaret > 2 && m_pTxtBuf->GetCharByIndex(nCaret - 1) == L'\n' && | 1326 if (nCaret > 2 && m_pTxtBuf->GetCharByIndex(nCaret - 1) == L'\n' && |
| 1327 m_pTxtBuf->GetCharByIndex(nCaret - 2) == L'\r') { | 1327 m_pTxtBuf->GetCharByIndex(nCaret - 2) == L'\r') { |
| 1328 nCaret--; | 1328 nCaret--; |
| 1329 } | 1329 } |
| 1330 nCaret--; | 1330 nCaret--; |
| 1331 bBefore = TRUE; | 1331 bBefore = true; |
| 1332 return nCaret; | 1332 return nCaret; |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 FX_BOOL CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { | 1335 bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { |
| 1336 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); | 1336 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); |
| 1337 const CFX_RectF& rtContent = pPage->GetContentsBox(); | 1337 const CFX_RectF& rtContent = pPage->GetContentsBox(); |
| 1338 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { | 1338 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { |
| 1339 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 - m_Param.fLineSpace; | 1339 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 - m_Param.fLineSpace; |
| 1340 ptCaret.y = m_fCaretPosReserve; | 1340 ptCaret.y = m_fCaretPosReserve; |
| 1341 FX_BOOL bLineReserve = | 1341 bool bLineReserve = |
| 1342 !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); | 1342 !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); |
| 1343 if (ptCaret.x < rtContent.left) { | 1343 if (ptCaret.x < rtContent.left) { |
| 1344 if (bLineReserve) { | 1344 if (bLineReserve) { |
| 1345 if (m_nCaretPage == CountPages() - 1) { | 1345 if (m_nCaretPage == CountPages() - 1) { |
| 1346 return FALSE; | 1346 return false; |
| 1347 } | 1347 } |
| 1348 } else { | 1348 } else { |
| 1349 if (m_nCaretPage == 0) { | 1349 if (m_nCaretPage == 0) { |
| 1350 return FALSE; | 1350 return false; |
| 1351 } | 1351 } |
| 1352 } | 1352 } |
| 1353 if (bLineReserve) { | 1353 if (bLineReserve) { |
| 1354 m_nCaretPage++; | 1354 m_nCaretPage++; |
| 1355 } else { | 1355 } else { |
| 1356 m_nCaretPage--; | 1356 m_nCaretPage--; |
| 1357 } | 1357 } |
| 1358 ptCaret.x -= rtContent.left; | 1358 ptCaret.x -= rtContent.left; |
| 1359 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); | 1359 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); |
| 1360 ptCaret.x += pCurPage->GetContentsBox().right(); | 1360 ptCaret.x += pCurPage->GetContentsBox().right(); |
| 1361 } | 1361 } |
| 1362 } else { | 1362 } else { |
| 1363 ptCaret.x = m_fCaretPosReserve; | 1363 ptCaret.x = m_fCaretPosReserve; |
| 1364 ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace; | 1364 ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace; |
| 1365 if (ptCaret.y < rtContent.top) { | 1365 if (ptCaret.y < rtContent.top) { |
| 1366 if (m_nCaretPage == 0) { | 1366 if (m_nCaretPage == 0) { |
| 1367 return FALSE; | 1367 return false; |
| 1368 } | 1368 } |
| 1369 ptCaret.y -= rtContent.top; | 1369 ptCaret.y -= rtContent.top; |
| 1370 m_nCaretPage--; | 1370 m_nCaretPage--; |
| 1371 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); | 1371 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); |
| 1372 ptCaret.y += pCurPage->GetContentsBox().bottom(); | 1372 ptCaret.y += pCurPage->GetContentsBox().bottom(); |
| 1373 } | 1373 } |
| 1374 } | 1374 } |
| 1375 return TRUE; | 1375 return true; |
| 1376 } | 1376 } |
| 1377 | 1377 |
| 1378 FX_BOOL CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { | 1378 bool CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { |
| 1379 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); | 1379 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); |
| 1380 const CFX_RectF& rtContent = pPage->GetContentsBox(); | 1380 const CFX_RectF& rtContent = pPage->GetContentsBox(); |
| 1381 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { | 1381 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { |
| 1382 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 + m_Param.fLineSpace; | 1382 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 + m_Param.fLineSpace; |
| 1383 ptCaret.y = m_fCaretPosReserve; | 1383 ptCaret.y = m_fCaretPosReserve; |
| 1384 if (ptCaret.x >= rtContent.right()) { | 1384 if (ptCaret.x >= rtContent.right()) { |
| 1385 FX_BOOL bLineReserve = | 1385 bool bLineReserve = |
| 1386 !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); | 1386 !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); |
| 1387 if (bLineReserve) { | 1387 if (bLineReserve) { |
| 1388 if (m_nCaretPage == 0) { | 1388 if (m_nCaretPage == 0) { |
| 1389 return FALSE; | 1389 return false; |
| 1390 } | 1390 } |
| 1391 } else { | 1391 } else { |
| 1392 if (m_nCaretPage == CountPages() - 1) { | 1392 if (m_nCaretPage == CountPages() - 1) { |
| 1393 return FALSE; | 1393 return false; |
| 1394 } | 1394 } |
| 1395 } | 1395 } |
| 1396 if (bLineReserve) { | 1396 if (bLineReserve) { |
| 1397 m_nCaretPage--; | 1397 m_nCaretPage--; |
| 1398 } else { | 1398 } else { |
| 1399 m_nCaretPage++; | 1399 m_nCaretPage++; |
| 1400 } | 1400 } |
| 1401 ptCaret.x -= rtContent.right(); | 1401 ptCaret.x -= rtContent.right(); |
| 1402 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); | 1402 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); |
| 1403 ptCaret.x += pCurPage->GetContentsBox().left; | 1403 ptCaret.x += pCurPage->GetContentsBox().left; |
| 1404 } | 1404 } |
| 1405 } else { | 1405 } else { |
| 1406 ptCaret.x = m_fCaretPosReserve; | 1406 ptCaret.x = m_fCaretPosReserve; |
| 1407 ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace; | 1407 ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace; |
| 1408 if (ptCaret.y >= rtContent.bottom()) { | 1408 if (ptCaret.y >= rtContent.bottom()) { |
| 1409 if (m_nCaretPage == CountPages() - 1) { | 1409 if (m_nCaretPage == CountPages() - 1) { |
| 1410 return FALSE; | 1410 return false; |
| 1411 } | 1411 } |
| 1412 ptCaret.y -= rtContent.bottom(); | 1412 ptCaret.y -= rtContent.bottom(); |
| 1413 m_nCaretPage++; | 1413 m_nCaretPage++; |
| 1414 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); | 1414 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); |
| 1415 ptCaret.y += pCurPage->GetContentsBox().top; | 1415 ptCaret.y += pCurPage->GetContentsBox().top; |
| 1416 } | 1416 } |
| 1417 } | 1417 } |
| 1418 return TRUE; | 1418 return true; |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 FX_BOOL CFDE_TxtEdtEngine::MoveLineStart() { | 1421 bool CFDE_TxtEdtEngine::MoveLineStart() { |
| 1422 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; | 1422 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; |
| 1423 FDE_TXTEDTPARAGPOS ParagPos; | 1423 FDE_TXTEDTPARAGPOS ParagPos; |
| 1424 TextPos2ParagPos(nIndex, ParagPos); | 1424 TextPos2ParagPos(nIndex, ParagPos); |
| 1425 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 1425 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 1426 pParag->LoadParag(); | 1426 pParag->LoadParag(); |
| 1427 int32_t nLineCount = pParag->GetLineCount(); | 1427 int32_t nLineCount = pParag->GetLineCount(); |
| 1428 int32_t i = 0; | 1428 int32_t i = 0; |
| 1429 int32_t nStart = 0; | 1429 int32_t nStart = 0; |
| 1430 int32_t nCount = 0; | 1430 int32_t nCount = 0; |
| 1431 for (; i < nLineCount; i++) { | 1431 for (; i < nLineCount; i++) { |
| 1432 pParag->GetLineRange(i, nStart, nCount); | 1432 pParag->GetLineRange(i, nStart, nCount); |
| 1433 if (nIndex >= nStart && nIndex < nStart + nCount) { | 1433 if (nIndex >= nStart && nIndex < nStart + nCount) { |
| 1434 break; | 1434 break; |
| 1435 } | 1435 } |
| 1436 } | 1436 } |
| 1437 UpdateCaretRect(nStart, TRUE); | 1437 UpdateCaretRect(nStart, true); |
| 1438 pParag->UnloadParag(); | 1438 pParag->UnloadParag(); |
| 1439 return TRUE; | 1439 return true; |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 FX_BOOL CFDE_TxtEdtEngine::MoveLineEnd() { | 1442 bool CFDE_TxtEdtEngine::MoveLineEnd() { |
| 1443 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; | 1443 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; |
| 1444 FDE_TXTEDTPARAGPOS ParagPos; | 1444 FDE_TXTEDTPARAGPOS ParagPos; |
| 1445 TextPos2ParagPos(nIndex, ParagPos); | 1445 TextPos2ParagPos(nIndex, ParagPos); |
| 1446 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 1446 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 1447 pParag->LoadParag(); | 1447 pParag->LoadParag(); |
| 1448 int32_t nLineCount = pParag->GetLineCount(); | 1448 int32_t nLineCount = pParag->GetLineCount(); |
| 1449 int32_t i = 0; | 1449 int32_t i = 0; |
| 1450 int32_t nStart = 0; | 1450 int32_t nStart = 0; |
| 1451 int32_t nCount = 0; | 1451 int32_t nCount = 0; |
| 1452 for (; i < nLineCount; i++) { | 1452 for (; i < nLineCount; i++) { |
| 1453 pParag->GetLineRange(i, nStart, nCount); | 1453 pParag->GetLineRange(i, nStart, nCount); |
| 1454 if (nIndex >= nStart && nIndex < nStart + nCount) { | 1454 if (nIndex >= nStart && nIndex < nStart + nCount) { |
| 1455 break; | 1455 break; |
| 1456 } | 1456 } |
| 1457 } | 1457 } |
| 1458 nIndex = nStart + nCount - 1; | 1458 nIndex = nStart + nCount - 1; |
| 1459 ASSERT(nIndex <= GetTextBufLength()); | 1459 ASSERT(nIndex <= GetTextBufLength()); |
| 1460 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); | 1460 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); |
| 1461 FX_BOOL bBefore = FALSE; | 1461 bool bBefore = false; |
| 1462 if (nIndex <= GetTextBufLength()) { | 1462 if (nIndex <= GetTextBufLength()) { |
| 1463 if (wChar == L'\r') { | 1463 if (wChar == L'\r') { |
| 1464 bBefore = TRUE; | 1464 bBefore = true; |
| 1465 } else if (wChar == L'\n' && nIndex > nStart) { | 1465 } else if (wChar == L'\n' && nIndex > nStart) { |
| 1466 bBefore = TRUE; | 1466 bBefore = true; |
| 1467 nIndex--; | 1467 nIndex--; |
| 1468 wChar = m_pTxtBuf->GetCharByIndex(nIndex); | 1468 wChar = m_pTxtBuf->GetCharByIndex(nIndex); |
| 1469 if (wChar != L'\r') { | 1469 if (wChar != L'\r') { |
| 1470 nIndex++; | 1470 nIndex++; |
| 1471 } | 1471 } |
| 1472 } | 1472 } |
| 1473 } | 1473 } |
| 1474 UpdateCaretRect(nIndex, bBefore); | 1474 UpdateCaretRect(nIndex, bBefore); |
| 1475 pParag->UnloadParag(); | 1475 pParag->UnloadParag(); |
| 1476 return TRUE; | 1476 return true; |
| 1477 } | 1477 } |
| 1478 | 1478 |
| 1479 FX_BOOL CFDE_TxtEdtEngine::MoveParagStart() { | 1479 bool CFDE_TxtEdtEngine::MoveParagStart() { |
| 1480 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; | 1480 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; |
| 1481 FDE_TXTEDTPARAGPOS ParagPos; | 1481 FDE_TXTEDTPARAGPOS ParagPos; |
| 1482 TextPos2ParagPos(nIndex, ParagPos); | 1482 TextPos2ParagPos(nIndex, ParagPos); |
| 1483 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 1483 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 1484 UpdateCaretRect(pParag->GetStartIndex(), TRUE); | 1484 UpdateCaretRect(pParag->GetStartIndex(), true); |
| 1485 return TRUE; | 1485 return true; |
| 1486 } | 1486 } |
| 1487 | 1487 |
| 1488 FX_BOOL CFDE_TxtEdtEngine::MoveParagEnd() { | 1488 bool CFDE_TxtEdtEngine::MoveParagEnd() { |
| 1489 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; | 1489 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; |
| 1490 FDE_TXTEDTPARAGPOS ParagPos; | 1490 FDE_TXTEDTPARAGPOS ParagPos; |
| 1491 TextPos2ParagPos(nIndex, ParagPos); | 1491 TextPos2ParagPos(nIndex, ParagPos); |
| 1492 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 1492 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 1493 nIndex = pParag->GetStartIndex() + pParag->GetTextLength() - 1; | 1493 nIndex = pParag->GetStartIndex() + pParag->GetTextLength() - 1; |
| 1494 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); | 1494 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); |
| 1495 if (wChar == L'\n' && nIndex > 0) { | 1495 if (wChar == L'\n' && nIndex > 0) { |
| 1496 nIndex--; | 1496 nIndex--; |
| 1497 wChar = m_pTxtBuf->GetCharByIndex(nIndex); | 1497 wChar = m_pTxtBuf->GetCharByIndex(nIndex); |
| 1498 if (wChar != L'\r') { | 1498 if (wChar != L'\r') { |
| 1499 nIndex++; | 1499 nIndex++; |
| 1500 } | 1500 } |
| 1501 } | 1501 } |
| 1502 UpdateCaretRect(nIndex, TRUE); | 1502 UpdateCaretRect(nIndex, true); |
| 1503 return TRUE; | 1503 return true; |
| 1504 } | 1504 } |
| 1505 | 1505 |
| 1506 FX_BOOL CFDE_TxtEdtEngine::MoveHome() { | 1506 bool CFDE_TxtEdtEngine::MoveHome() { |
| 1507 UpdateCaretRect(0, TRUE); | 1507 UpdateCaretRect(0, true); |
| 1508 return TRUE; | 1508 return true; |
| 1509 } | 1509 } |
| 1510 | 1510 |
| 1511 FX_BOOL CFDE_TxtEdtEngine::MoveEnd() { | 1511 bool CFDE_TxtEdtEngine::MoveEnd() { |
| 1512 UpdateCaretRect(GetTextBufLength(), TRUE); | 1512 UpdateCaretRect(GetTextBufLength(), true); |
| 1513 return TRUE; | 1513 return true; |
| 1514 } | 1514 } |
| 1515 | 1515 |
| 1516 FX_BOOL CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) { | 1516 bool CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) { |
| 1517 std::unique_ptr<CFDE_TextOut> pTextOut(new CFDE_TextOut); | 1517 std::unique_ptr<CFDE_TextOut> pTextOut(new CFDE_TextOut); |
| 1518 pTextOut->SetLineSpace(m_Param.fLineSpace); | 1518 pTextOut->SetLineSpace(m_Param.fLineSpace); |
| 1519 pTextOut->SetFont(m_Param.pFont); | 1519 pTextOut->SetFont(m_Param.pFont); |
| 1520 pTextOut->SetFontSize(m_Param.fFontSize); | 1520 pTextOut->SetFontSize(m_Param.fFontSize); |
| 1521 CFX_RectF rcText; | 1521 CFX_RectF rcText; |
| 1522 FXSYS_memset(&rcText, 0, sizeof(rcText)); | 1522 FXSYS_memset(&rcText, 0, sizeof(rcText)); |
| 1523 uint32_t dwStyle = 0; | 1523 uint32_t dwStyle = 0; |
| 1524 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines)) | 1524 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines)) |
| 1525 dwStyle |= FDE_TTOSTYLE_SingleLine; | 1525 dwStyle |= FDE_TTOSTYLE_SingleLine; |
| 1526 | 1526 |
| 1527 if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap) { | 1527 if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap) { |
| 1528 dwStyle |= FDE_TTOSTYLE_LineWrap; | 1528 dwStyle |= FDE_TTOSTYLE_LineWrap; |
| 1529 rcText.width = m_Param.fPlateWidth; | 1529 rcText.width = m_Param.fPlateWidth; |
| 1530 } else { | 1530 } else { |
| 1531 rcText.width = 65535; | 1531 rcText.width = 65535; |
| 1532 } | 1532 } |
| 1533 pTextOut->SetStyles(dwStyle); | 1533 pTextOut->SetStyles(dwStyle); |
| 1534 wsText += L"\n"; | 1534 wsText += L"\n"; |
| 1535 pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), rcText); | 1535 pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), rcText); |
| 1536 wsText.Delete(wsText.GetLength() - 1); | 1536 wsText.Delete(wsText.GetLength() - 1); |
| 1537 if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Horz) && | 1537 if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Horz) && |
| 1538 (rcText.width > m_Param.fPlateWidth)) { | 1538 (rcText.width > m_Param.fPlateWidth)) { |
| 1539 return FALSE; | 1539 return false; |
| 1540 } | 1540 } |
| 1541 if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Vert) && | 1541 if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Vert) && |
| 1542 (rcText.height > m_Param.fLineSpace * m_Param.nLineCount)) { | 1542 (rcText.height > m_Param.fLineSpace * m_Param.nLineCount)) { |
| 1543 return FALSE; | 1543 return false; |
| 1544 } | 1544 } |
| 1545 return TRUE; | 1545 return true; |
| 1546 } | 1546 } |
| 1547 | 1547 |
| 1548 void CFDE_TxtEdtEngine::UpdateCaretRect(int32_t nIndex, FX_BOOL bBefore) { | 1548 void CFDE_TxtEdtEngine::UpdateCaretRect(int32_t nIndex, bool bBefore) { |
| 1549 MovePage2Char(nIndex); | 1549 MovePage2Char(nIndex); |
| 1550 GetCaretRect(m_rtCaret, m_nCaretPage, nIndex, bBefore); | 1550 GetCaretRect(m_rtCaret, m_nCaretPage, nIndex, bBefore); |
| 1551 m_nCaret = nIndex; | 1551 m_nCaret = nIndex; |
| 1552 m_bBefore = bBefore; | 1552 m_bBefore = bBefore; |
| 1553 if (!m_bBefore) { | 1553 if (!m_bBefore) { |
| 1554 m_nCaret++; | 1554 m_nCaret++; |
| 1555 m_bBefore = TRUE; | 1555 m_bBefore = true; |
| 1556 } | 1556 } |
| 1557 m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) | 1557 m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) |
| 1558 ? m_rtCaret.top | 1558 ? m_rtCaret.top |
| 1559 : m_rtCaret.left; | 1559 : m_rtCaret.left; |
| 1560 m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage, 0); | 1560 m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage, 0); |
| 1561 } | 1561 } |
| 1562 | 1562 |
| 1563 void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret, | 1563 void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret, |
| 1564 int32_t nPageIndex, | 1564 int32_t nPageIndex, |
| 1565 int32_t nCaret, | 1565 int32_t nCaret, |
| 1566 FX_BOOL bBefore) { | 1566 bool bBefore) { |
| 1567 IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; | 1567 IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; |
| 1568 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); | 1568 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); |
| 1569 FX_BOOL bCombText = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText); | 1569 bool bCombText = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText); |
| 1570 int32_t nIndexInpage = nCaret - pPage->GetCharStart(); | 1570 int32_t nIndexInpage = nCaret - pPage->GetCharStart(); |
| 1571 if (bBefore && bCombText && nIndexInpage > 0) { | 1571 if (bBefore && bCombText && nIndexInpage > 0) { |
| 1572 nIndexInpage--; | 1572 nIndexInpage--; |
| 1573 bBefore = FALSE; | 1573 bBefore = false; |
| 1574 } | 1574 } |
| 1575 int32_t nBIDILevel = pPage->GetCharRect(nIndexInpage, rtCaret, bCombText); | 1575 int32_t nBIDILevel = pPage->GetCharRect(nIndexInpage, rtCaret, bCombText); |
| 1576 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { | 1576 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { |
| 1577 if ((!FX_IsOdd(nBIDILevel) && !bBefore) || | 1577 if ((!FX_IsOdd(nBIDILevel) && !bBefore) || |
| 1578 (FX_IsOdd(nBIDILevel) && bBefore)) { | 1578 (FX_IsOdd(nBIDILevel) && bBefore)) { |
| 1579 rtCaret.Offset(0, rtCaret.height - 1.0f); | 1579 rtCaret.Offset(0, rtCaret.height - 1.0f); |
| 1580 } | 1580 } |
| 1581 if (rtCaret.height == 0 && rtCaret.top > 1.0f) | 1581 if (rtCaret.height == 0 && rtCaret.top > 1.0f) |
| 1582 rtCaret.top -= 1.0f; | 1582 rtCaret.top -= 1.0f; |
| 1583 | 1583 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1595 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); | 1595 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); |
| 1596 } | 1596 } |
| 1597 | 1597 |
| 1598 void CFDE_TxtEdtEngine::UpdateCaretIndex(const CFX_PointF& ptCaret) { | 1598 void CFDE_TxtEdtEngine::UpdateCaretIndex(const CFX_PointF& ptCaret) { |
| 1599 IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; | 1599 IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; |
| 1600 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); | 1600 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); |
| 1601 m_nCaret = pPage->GetCharIndex(ptCaret, m_bBefore); | 1601 m_nCaret = pPage->GetCharIndex(ptCaret, m_bBefore); |
| 1602 GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore); | 1602 GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore); |
| 1603 if (!m_bBefore) { | 1603 if (!m_bBefore) { |
| 1604 m_nCaret++; | 1604 m_nCaret++; |
| 1605 m_bBefore = TRUE; | 1605 m_bBefore = true; |
| 1606 } | 1606 } |
| 1607 m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage); | 1607 m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage); |
| 1608 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); | 1608 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); |
| 1609 } | 1609 } |
| 1610 | 1610 |
| 1611 FX_BOOL CFDE_TxtEdtEngine::IsSelect() { | 1611 bool CFDE_TxtEdtEngine::IsSelect() { |
| 1612 return m_SelRangePtrArr.GetSize() > 0; | 1612 return m_SelRangePtrArr.GetSize() > 0; |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 void CFDE_TxtEdtEngine::DeleteSelect() { | 1615 void CFDE_TxtEdtEngine::DeleteSelect() { |
| 1616 int32_t nCountRange = CountSelRanges(); | 1616 int32_t nCountRange = CountSelRanges(); |
| 1617 if (nCountRange > 0) { | 1617 if (nCountRange > 0) { |
| 1618 int32_t nSelStart = 0; | 1618 int32_t nSelStart = 0; |
| 1619 while (nCountRange > 0) { | 1619 while (nCountRange > 0) { |
| 1620 int32_t nSelCount = GetSelRange(--nCountRange, nSelStart); | 1620 int32_t nSelCount = GetSelRange(--nCountRange, nSelStart); |
| 1621 delete m_SelRangePtrArr[nCountRange]; | 1621 delete m_SelRangePtrArr[nCountRange]; |
| 1622 m_SelRangePtrArr.RemoveAt(nCountRange); | 1622 m_SelRangePtrArr.RemoveAt(nCountRange); |
| 1623 DeleteRange_DoRecord(nSelStart, nSelCount, TRUE); | 1623 DeleteRange_DoRecord(nSelStart, nSelCount, true); |
| 1624 } | 1624 } |
| 1625 ClearSelection(); | 1625 ClearSelection(); |
| 1626 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); | 1626 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); |
| 1627 m_Param.pEventSink->On_SelChanged(this); | 1627 m_Param.pEventSink->On_SelChanged(this); |
| 1628 SetCaretPos(nSelStart, TRUE); | 1628 SetCaretPos(nSelStart, true); |
| 1629 return; | 1629 return; |
| 1630 } | 1630 } |
| 1631 } | 1631 } |
| OLD | NEW |