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_txtedtparag.h" | 7 #include "xfa/fee/fde_txtedtparag.h" |
8 | 8 |
9 #include "xfa/fee/fde_txtedtbuf.h" | 9 #include "xfa/fee/fde_txtedtbuf.h" |
10 #include "xfa/fee/fde_txtedtengine.h" | 10 #include "xfa/fee/fde_txtedtengine.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 CFDE_TxtEdtParag::~CFDE_TxtEdtParag() { | 24 CFDE_TxtEdtParag::~CFDE_TxtEdtParag() { |
25 if (m_lpData != NULL) { | 25 if (m_lpData != NULL) { |
26 FX_Free(m_lpData); | 26 FX_Free(m_lpData); |
27 } | 27 } |
28 } | 28 } |
29 void CFDE_TxtEdtParag::LoadParag() { | 29 void CFDE_TxtEdtParag::LoadParag() { |
30 if (m_lpData != NULL) { | 30 if (m_lpData != NULL) { |
31 ((int32_t*)m_lpData)[0]++; | 31 ((int32_t*)m_lpData)[0]++; |
32 return; | 32 return; |
33 } | 33 } |
34 IFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak(); | 34 CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak(); |
35 IFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf(); | 35 IFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf(); |
36 const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams(); | 36 const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams(); |
37 FX_WCHAR wcAlias = 0; | 37 FX_WCHAR wcAlias = 0; |
38 if (pParam->dwMode & FDE_TEXTEDITMODE_Password) { | 38 if (pParam->dwMode & FDE_TEXTEDITMODE_Password) { |
39 wcAlias = m_pEngine->GetAliasChar(); | 39 wcAlias = m_pEngine->GetAliasChar(); |
40 } | 40 } |
41 IFX_CharIter* pIter = | 41 IFX_CharIter* pIter = |
42 new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pTxtBuf, wcAlias); | 42 new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pTxtBuf, wcAlias); |
43 pIter->SetAt(m_nCharStart); | 43 pIter->SetAt(m_nCharStart); |
44 int32_t nEndIndex = m_nCharStart + m_nCharCount; | 44 int32_t nEndIndex = m_nCharStart + m_nCharCount; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void CFDE_TxtEdtParag::UnloadParag() { | 94 void CFDE_TxtEdtParag::UnloadParag() { |
95 FXSYS_assert(m_lpData != NULL); | 95 FXSYS_assert(m_lpData != NULL); |
96 ((int32_t*)m_lpData)[0]--; | 96 ((int32_t*)m_lpData)[0]--; |
97 FXSYS_assert(((int32_t*)m_lpData)[0] >= 0); | 97 FXSYS_assert(((int32_t*)m_lpData)[0] >= 0); |
98 if (((int32_t*)m_lpData)[0] == 0) { | 98 if (((int32_t*)m_lpData)[0] == 0) { |
99 FX_Free(m_lpData); | 99 FX_Free(m_lpData); |
100 m_lpData = NULL; | 100 m_lpData = NULL; |
101 } | 101 } |
102 } | 102 } |
103 void CFDE_TxtEdtParag::CalcLines() { | 103 void CFDE_TxtEdtParag::CalcLines() { |
104 IFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak(); | 104 CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak(); |
105 IFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf(); | 105 IFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf(); |
106 IFX_CharIter* pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pTxtBuf); | 106 IFX_CharIter* pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pTxtBuf); |
107 int32_t nCount = 0; | 107 int32_t nCount = 0; |
108 uint32_t dwBreakStatus = FX_TXTBREAK_None; | 108 uint32_t dwBreakStatus = FX_TXTBREAK_None; |
109 int32_t nEndIndex = m_nCharStart + m_nCharCount; | 109 int32_t nEndIndex = m_nCharStart + m_nCharCount; |
110 pIter->SetAt(m_nCharStart); | 110 pIter->SetAt(m_nCharStart); |
111 FX_BOOL bReload = FALSE; | 111 FX_BOOL bReload = FALSE; |
112 do { | 112 do { |
113 if (bReload) { | 113 if (bReload) { |
114 dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); | 114 dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); |
(...skipping 26 matching lines...) Expand all Loading... |
141 int32_t* pLineBaseArr = (int32_t*)m_lpData; | 141 int32_t* pLineBaseArr = (int32_t*)m_lpData; |
142 FXSYS_assert(nLineIndex < m_nLineCount); | 142 FXSYS_assert(nLineIndex < m_nLineCount); |
143 nStart = m_nCharStart; | 143 nStart = m_nCharStart; |
144 pLineBaseArr++; | 144 pLineBaseArr++; |
145 for (int32_t i = 0; i < nLineIndex; i++) { | 145 for (int32_t i = 0; i < nLineIndex; i++) { |
146 nStart += *pLineBaseArr; | 146 nStart += *pLineBaseArr; |
147 pLineBaseArr++; | 147 pLineBaseArr++; |
148 } | 148 } |
149 nCount = *pLineBaseArr; | 149 nCount = *pLineBaseArr; |
150 } | 150 } |
OLD | NEW |