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 #ifndef XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ | 7 #ifndef XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ |
8 #define XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ | 8 #define XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_ucd.h" | 10 #include "core/fxcrt/include/fx_ucd.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 : m_dwStatus(FX_TXTBREAK_PieceBreak), | 117 : m_dwStatus(FX_TXTBREAK_PieceBreak), |
118 m_iStartPos(0), | 118 m_iStartPos(0), |
119 m_iWidth(-1), | 119 m_iWidth(-1), |
120 m_iStartChar(0), | 120 m_iStartChar(0), |
121 m_iChars(0), | 121 m_iChars(0), |
122 m_iBidiLevel(0), | 122 m_iBidiLevel(0), |
123 m_iBidiPos(0), | 123 m_iBidiPos(0), |
124 m_iHorizontalScale(100), | 124 m_iHorizontalScale(100), |
125 m_iVerticalScale(100), | 125 m_iVerticalScale(100), |
126 m_dwCharStyles(0), | 126 m_dwCharStyles(0), |
127 m_pChars(NULL), | 127 m_pChars(nullptr), |
128 m_pUserData(NULL) {} | 128 m_pUserData(nullptr) {} |
129 int32_t GetEndPos() const { | 129 int32_t GetEndPos() const { |
130 return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth; | 130 return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth; |
131 } | 131 } |
132 int32_t GetLength() const { return m_iChars; } | 132 int32_t GetLength() const { return m_iChars; } |
133 int32_t GetEndChar() const { return m_iStartChar + m_iChars; } | 133 int32_t GetEndChar() const { return m_iStartChar + m_iChars; } |
134 CFX_TxtChar* GetCharPtr(int32_t index) const { | 134 CFX_TxtChar* GetCharPtr(int32_t index) const { |
135 ASSERT(index > -1 && index < m_iChars && m_pChars != NULL); | 135 ASSERT(index > -1 && index < m_iChars); |
136 return m_pChars->GetDataPtr(m_iStartChar + index); | 136 return m_pChars->GetDataPtr(m_iStartChar + index); |
137 } | 137 } |
138 void GetString(FX_WCHAR* pText) const { | 138 void GetString(FX_WCHAR* pText) const { |
139 ASSERT(pText != NULL); | 139 ASSERT(pText); |
140 int32_t iEndChar = m_iStartChar + m_iChars; | 140 int32_t iEndChar = m_iStartChar + m_iChars; |
141 CFX_Char* pChar; | 141 CFX_Char* pChar; |
142 for (int32_t i = m_iStartChar; i < iEndChar; i++) { | 142 for (int32_t i = m_iStartChar; i < iEndChar; i++) { |
143 pChar = m_pChars->GetDataPtr(i); | 143 pChar = m_pChars->GetDataPtr(i); |
144 *pText++ = (FX_WCHAR)pChar->m_wCharCode; | 144 *pText++ = (FX_WCHAR)pChar->m_wCharCode; |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 void GetString(CFX_WideString& wsText) const { | 148 void GetString(CFX_WideString& wsText) const { |
149 FX_WCHAR* pText = wsText.GetBuffer(m_iChars); | 149 FX_WCHAR* pText = wsText.GetBuffer(m_iChars); |
150 GetString(pText); | 150 GetString(pText); |
151 wsText.ReleaseBuffer(m_iChars); | 151 wsText.ReleaseBuffer(m_iChars); |
152 } | 152 } |
153 void GetWidths(int32_t* pWidths) const { | 153 void GetWidths(int32_t* pWidths) const { |
154 ASSERT(pWidths != NULL); | 154 ASSERT(pWidths); |
155 int32_t iEndChar = m_iStartChar + m_iChars; | 155 int32_t iEndChar = m_iStartChar + m_iChars; |
156 CFX_Char* pChar; | 156 CFX_Char* pChar; |
157 for (int32_t i = m_iStartChar; i < iEndChar; i++) { | 157 for (int32_t i = m_iStartChar; i < iEndChar; i++) { |
158 pChar = m_pChars->GetDataPtr(i); | 158 pChar = m_pChars->GetDataPtr(i); |
159 *pWidths++ = pChar->m_iCharWidth; | 159 *pWidths++ = pChar->m_iCharWidth; |
160 } | 160 } |
161 } | 161 } |
162 uint32_t m_dwStatus; | 162 uint32_t m_dwStatus; |
163 int32_t m_iStartPos; | 163 int32_t m_iStartPos; |
164 int32_t m_iWidth; | 164 int32_t m_iWidth; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 uint32_t AppendChar(FX_WCHAR wch); | 246 uint32_t AppendChar(FX_WCHAR wch); |
247 uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak); | 247 uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak); |
248 int32_t CountBreakChars() const; | 248 int32_t CountBreakChars() const; |
249 int32_t CountBreakPieces() const; | 249 int32_t CountBreakPieces() const; |
250 const CFX_TxtPiece* GetBreakPiece(int32_t index) const; | 250 const CFX_TxtPiece* GetBreakPiece(int32_t index) const; |
251 void ClearBreakPieces(); | 251 void ClearBreakPieces(); |
252 void Reset(); | 252 void Reset(); |
253 int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun, | 253 int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun, |
254 FXTEXT_CHARPOS* pCharPos, | 254 FXTEXT_CHARPOS* pCharPos, |
255 FX_BOOL bCharCode = FALSE, | 255 FX_BOOL bCharCode = FALSE, |
256 CFX_WideString* pWSForms = NULL, | 256 CFX_WideString* pWSForms = nullptr, |
257 FX_AdjustCharDisplayPos pAdjustPos = NULL) const; | 257 FX_AdjustCharDisplayPos pAdjustPos = nullptr) const; |
258 int32_t GetCharRects(const FX_TXTRUN* pTxtRun, | 258 int32_t GetCharRects(const FX_TXTRUN* pTxtRun, |
259 CFX_RectFArray& rtArray, | 259 CFX_RectFArray& rtArray, |
260 FX_BOOL bCharBBox = FALSE) const; | 260 FX_BOOL bCharBBox = FALSE) const; |
261 void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps); | 261 void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps); |
262 uint32_t AppendChar_Combination(CFX_Char* pCurChar, int32_t iRotation); | 262 uint32_t AppendChar_Combination(CFX_Char* pCurChar, int32_t iRotation); |
263 uint32_t AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation); | 263 uint32_t AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation); |
264 uint32_t AppendChar_Control(CFX_Char* pCurChar, int32_t iRotation); | 264 uint32_t AppendChar_Control(CFX_Char* pCurChar, int32_t iRotation); |
265 uint32_t AppendChar_Arabic(CFX_Char* pCurChar, int32_t iRotation); | 265 uint32_t AppendChar_Arabic(CFX_Char* pCurChar, int32_t iRotation); |
266 uint32_t AppendChar_Others(CFX_Char* pCurChar, int32_t iRotation); | 266 uint32_t AppendChar_Others(CFX_Char* pCurChar, int32_t iRotation); |
267 | 267 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 CFX_TxtLine* m_pTxtLine2; | 325 CFX_TxtLine* m_pTxtLine2; |
326 CFX_TxtLine* m_pCurLine; | 326 CFX_TxtLine* m_pCurLine; |
327 int32_t m_iReady; | 327 int32_t m_iReady; |
328 int32_t m_iTolerance; | 328 int32_t m_iTolerance; |
329 int32_t m_iHorScale; | 329 int32_t m_iHorScale; |
330 int32_t m_iVerScale; | 330 int32_t m_iVerScale; |
331 int32_t m_iCharSpace; | 331 int32_t m_iCharSpace; |
332 }; | 332 }; |
333 | 333 |
334 #endif // XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ | 334 #endif // XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ |
OLD | NEW |