| 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/fee/fde_txtedtbuf.h" | 7 #include "xfa/fee/fde_txtedtbuf.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #define FDE_TXTEDT_ZEROWIDTHSPACE 0x200B | 22 #define FDE_TXTEDT_ZEROWIDTHSPACE 0x200B |
| 23 | 23 |
| 24 CFDE_TxtEdtBufIter::CFDE_TxtEdtBufIter(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias) | 24 CFDE_TxtEdtBufIter::CFDE_TxtEdtBufIter(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias) |
| 25 : m_pBuf(pBuf), | 25 : m_pBuf(pBuf), |
| 26 m_nCurChunk(0), | 26 m_nCurChunk(0), |
| 27 m_nCurIndex(0), | 27 m_nCurIndex(0), |
| 28 m_nIndex(0), | 28 m_nIndex(0), |
| 29 m_Alias(wcAlias) { | 29 m_Alias(wcAlias) { |
| 30 ASSERT(m_pBuf); | 30 ASSERT(m_pBuf); |
| 31 } | 31 } |
| 32 |
| 32 CFDE_TxtEdtBufIter::~CFDE_TxtEdtBufIter() {} | 33 CFDE_TxtEdtBufIter::~CFDE_TxtEdtBufIter() {} |
| 33 void CFDE_TxtEdtBufIter::Release() { | 34 |
| 34 delete this; | |
| 35 } | |
| 36 FX_BOOL CFDE_TxtEdtBufIter::Next(FX_BOOL bPrev) { | 35 FX_BOOL CFDE_TxtEdtBufIter::Next(FX_BOOL bPrev) { |
| 37 if (bPrev) { | 36 if (bPrev) { |
| 38 if (m_nIndex == 0) { | 37 if (m_nIndex == 0) { |
| 39 return FALSE; | 38 return FALSE; |
| 40 } | 39 } |
| 41 ASSERT(m_nCurChunk < m_pBuf->m_Chunks.GetSize()); | 40 ASSERT(m_nCurChunk < m_pBuf->m_Chunks.GetSize()); |
| 42 CFDE_TxtEdtBuf::FDE_CHUNKHEADER* lpChunk = nullptr; | 41 CFDE_TxtEdtBuf::FDE_CHUNKHEADER* lpChunk = nullptr; |
| 43 if (m_nCurIndex > 0) { | 42 if (m_nCurIndex > 0) { |
| 44 m_nCurIndex--; | 43 m_nCurIndex--; |
| 45 } else { | 44 } else { |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 int32_t nCount = m_Chunks.GetSize(); | 396 int32_t nCount = m_Chunks.GetSize(); |
| 398 for (; i < nCount; i++) { | 397 for (; i < nCount; i++) { |
| 399 nTotal += m_Chunks[i]->nUsed; | 398 nTotal += m_Chunks[i]->nUsed; |
| 400 if (nTotal > nIndex) { | 399 if (nTotal > nIndex) { |
| 401 break; | 400 break; |
| 402 } | 401 } |
| 403 } | 402 } |
| 404 cp.nChunkIndex = i; | 403 cp.nChunkIndex = i; |
| 405 cp.nCharIndex = m_Chunks[i]->nUsed - (nTotal - nIndex); | 404 cp.nCharIndex = m_Chunks[i]->nUsed - (nTotal - nIndex); |
| 406 } | 405 } |
| OLD | NEW |