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_RTFBREAK_H_ | 7 #ifndef XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ |
8 #define XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ | 8 #define XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ |
9 | 9 |
10 #include "core/fxcrt/fx_basic.h" | 10 #include "core/fxcrt/fx_basic.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 int32_t CountPieces() const { return m_LinePieces.GetSize(); } | 181 int32_t CountPieces() const { return m_LinePieces.GetSize(); } |
182 CFX_RTFPiece& GetPiece(int32_t index) const { | 182 CFX_RTFPiece& GetPiece(int32_t index) const { |
183 ASSERT(index > -1 && index < m_LinePieces.GetSize()); | 183 ASSERT(index > -1 && index < m_LinePieces.GetSize()); |
184 return m_LinePieces.GetAt(index); | 184 return m_LinePieces.GetAt(index); |
185 } | 185 } |
186 CFX_RTFPiece* GetPiecePtr(int32_t index) const { | 186 CFX_RTFPiece* GetPiecePtr(int32_t index) const { |
187 ASSERT(index > -1 && index < m_LinePieces.GetSize()); | 187 ASSERT(index > -1 && index < m_LinePieces.GetSize()); |
188 return m_LinePieces.GetPtrAt(index); | 188 return m_LinePieces.GetPtrAt(index); |
189 } | 189 } |
190 int32_t GetLineEnd() const { return m_iStart + m_iWidth; } | 190 int32_t GetLineEnd() const { return m_iStart + m_iWidth; } |
191 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { | 191 void RemoveAll(bool bLeaveMemory = false) { |
192 CFX_RTFChar* pChar; | 192 CFX_RTFChar* pChar; |
193 int32_t iCount = m_LineChars.GetSize(); | 193 int32_t iCount = m_LineChars.GetSize(); |
194 for (int32_t i = 0; i < iCount; i++) { | 194 for (int32_t i = 0; i < iCount; i++) { |
195 pChar = m_LineChars.GetDataPtr(i); | 195 pChar = m_LineChars.GetDataPtr(i); |
196 if (pChar->m_pUserData) | 196 if (pChar->m_pUserData) |
197 pChar->m_pUserData->Release(); | 197 pChar->m_pUserData->Release(); |
198 } | 198 } |
199 m_LineChars.RemoveAll(); | 199 m_LineChars.RemoveAll(); |
200 m_LinePieces.RemoveAll(bLeaveMemory); | 200 m_LinePieces.RemoveAll(bLeaveMemory); |
201 m_iWidth = 0; | 201 m_iWidth = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
226 void AddPositionedTab(FX_FLOAT fTabPos); | 226 void AddPositionedTab(FX_FLOAT fTabPos); |
227 void SetPositionedTabs(const CFX_FloatArray& tabs); | 227 void SetPositionedTabs(const CFX_FloatArray& tabs); |
228 void ClearPositionedTabs(); | 228 void ClearPositionedTabs(); |
229 void SetDefaultChar(FX_WCHAR wch); | 229 void SetDefaultChar(FX_WCHAR wch); |
230 void SetLineBreakChar(FX_WCHAR wch); | 230 void SetLineBreakChar(FX_WCHAR wch); |
231 void SetLineBreakTolerance(FX_FLOAT fTolerance); | 231 void SetLineBreakTolerance(FX_FLOAT fTolerance); |
232 void SetHorizontalScale(int32_t iScale); | 232 void SetHorizontalScale(int32_t iScale); |
233 void SetVerticalScale(int32_t iScale); | 233 void SetVerticalScale(int32_t iScale); |
234 void SetCharRotation(int32_t iCharRotation); | 234 void SetCharRotation(int32_t iCharRotation); |
235 void SetCharSpace(FX_FLOAT fCharSpace); | 235 void SetCharSpace(FX_FLOAT fCharSpace); |
236 void SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace); | 236 void SetWordSpace(bool bDefault, FX_FLOAT fWordSpace); |
237 void SetReadingOrder(FX_BOOL bRTL = FALSE); | 237 void SetReadingOrder(bool bRTL = false); |
238 void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left); | 238 void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left); |
239 void SetUserData(IFX_Retainable* pUserData); | 239 void SetUserData(IFX_Retainable* pUserData); |
240 uint32_t AppendChar(FX_WCHAR wch); | 240 uint32_t AppendChar(FX_WCHAR wch); |
241 uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak); | 241 uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak); |
242 int32_t CountBreakPieces() const; | 242 int32_t CountBreakPieces() const; |
243 const CFX_RTFPiece* GetBreakPiece(int32_t index) const; | 243 const CFX_RTFPiece* GetBreakPiece(int32_t index) const; |
244 void GetLineRect(CFX_RectF& rect) const; | 244 void GetLineRect(CFX_RectF& rect) const; |
245 void ClearBreakPieces(); | 245 void ClearBreakPieces(); |
246 void Reset(); | 246 void Reset(); |
247 int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText, | 247 int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText, |
248 FXTEXT_CHARPOS* pCharPos, | 248 FXTEXT_CHARPOS* pCharPos, |
249 FX_BOOL bCharCode = FALSE, | 249 bool bCharCode = false, |
250 CFX_WideString* pWSForms = nullptr, | 250 CFX_WideString* pWSForms = nullptr, |
251 FX_AdjustCharDisplayPos pAdjustPos = nullptr) const; | 251 FX_AdjustCharDisplayPos pAdjustPos = nullptr) const; |
252 int32_t GetCharRects(const FX_RTFTEXTOBJ* pText, | 252 int32_t GetCharRects(const FX_RTFTEXTOBJ* pText, |
253 CFX_RectFArray& rtArray, | 253 CFX_RectFArray& rtArray, |
254 FX_BOOL bCharBBox = FALSE) const; | 254 bool bCharBBox = false) const; |
255 uint32_t AppendChar_CharCode(FX_WCHAR wch); | 255 uint32_t AppendChar_CharCode(FX_WCHAR wch); |
256 uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar, int32_t iRotation); | 256 uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar, int32_t iRotation); |
257 uint32_t AppendChar_Tab(CFX_RTFChar* pCurChar, int32_t iRotation); | 257 uint32_t AppendChar_Tab(CFX_RTFChar* pCurChar, int32_t iRotation); |
258 uint32_t AppendChar_Control(CFX_RTFChar* pCurChar, int32_t iRotation); | 258 uint32_t AppendChar_Control(CFX_RTFChar* pCurChar, int32_t iRotation); |
259 uint32_t AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t iRotation); | 259 uint32_t AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t iRotation); |
260 uint32_t AppendChar_Others(CFX_RTFChar* pCurChar, int32_t iRotation); | 260 uint32_t AppendChar_Others(CFX_RTFChar* pCurChar, int32_t iRotation); |
261 | 261 |
262 protected: | 262 protected: |
263 int32_t GetLineRotation(uint32_t dwStyles) const; | 263 int32_t GetLineRotation(uint32_t dwStyles) const; |
264 void SetBreakStatus(); | 264 void SetBreakStatus(); |
265 CFX_RTFChar* GetLastChar(int32_t index) const; | 265 CFX_RTFChar* GetLastChar(int32_t index) const; |
266 CFX_RTFLine* GetRTFLine(FX_BOOL bReady) const; | 266 CFX_RTFLine* GetRTFLine(bool bReady) const; |
267 CFX_RTFPieceArray* GetRTFPieces(FX_BOOL bReady) const; | 267 CFX_RTFPieceArray* GetRTFPieces(bool bReady) const; |
268 FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const; | 268 FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const; |
269 int32_t GetLastPositionedTab() const; | 269 int32_t GetLastPositionedTab() const; |
270 FX_BOOL GetPositionedTab(int32_t& iTabPos) const; | 270 bool GetPositionedTab(int32_t& iTabPos) const; |
271 | 271 |
272 int32_t GetBreakPos(CFX_RTFCharArray& tca, | 272 int32_t GetBreakPos(CFX_RTFCharArray& tca, |
273 int32_t& iEndPos, | 273 int32_t& iEndPos, |
274 FX_BOOL bAllChars = FALSE, | 274 bool bAllChars = false, |
275 FX_BOOL bOnlyBrk = FALSE); | 275 bool bOnlyBrk = false); |
276 void SplitTextLine(CFX_RTFLine* pCurLine, | 276 void SplitTextLine(CFX_RTFLine* pCurLine, |
277 CFX_RTFLine* pNextLine, | 277 CFX_RTFLine* pNextLine, |
278 FX_BOOL bAllChars = FALSE); | 278 bool bAllChars = false); |
279 FX_BOOL EndBreak_SplitLine(CFX_RTFLine* pNextLine, | 279 bool EndBreak_SplitLine(CFX_RTFLine* pNextLine, |
280 FX_BOOL bAllChars, | 280 bool bAllChars, |
281 uint32_t dwStatus); | 281 uint32_t dwStatus); |
282 void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus); | 282 void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus); |
283 void EndBreak_Alignment(CFX_TPOArray& tpos, | 283 void EndBreak_Alignment(CFX_TPOArray& tpos, |
284 FX_BOOL bAllChars, | 284 bool bAllChars, |
285 uint32_t dwStatus); | 285 uint32_t dwStatus); |
286 | 286 |
287 uint32_t m_dwPolicies; | 287 uint32_t m_dwPolicies; |
288 int32_t m_iBoundaryStart; | 288 int32_t m_iBoundaryStart; |
289 int32_t m_iBoundaryEnd; | 289 int32_t m_iBoundaryEnd; |
290 uint32_t m_dwLayoutStyles; | 290 uint32_t m_dwLayoutStyles; |
291 bool m_bPagination; | 291 bool m_bPagination; |
292 bool m_bVertical; | 292 bool m_bVertical; |
293 bool m_bSingleLine; | 293 bool m_bSingleLine; |
294 bool m_bCharCode; | 294 bool m_bCharCode; |
295 CFGAS_GEFont* m_pFont; | 295 CFGAS_GEFont* m_pFont; |
296 int32_t m_iFontHeight; | 296 int32_t m_iFontHeight; |
297 int32_t m_iFontSize; | 297 int32_t m_iFontSize; |
298 int32_t m_iTabWidth; | 298 int32_t m_iTabWidth; |
299 CFX_Int32Array m_PositionedTabs; | 299 CFX_Int32Array m_PositionedTabs; |
300 FX_BOOL m_bOrphanLine; | 300 bool m_bOrphanLine; |
301 FX_WCHAR m_wDefChar; | 301 FX_WCHAR m_wDefChar; |
302 int32_t m_iDefChar; | 302 int32_t m_iDefChar; |
303 FX_WCHAR m_wLineBreakChar; | 303 FX_WCHAR m_wLineBreakChar; |
304 int32_t m_iHorizontalScale; | 304 int32_t m_iHorizontalScale; |
305 int32_t m_iVerticalScale; | 305 int32_t m_iVerticalScale; |
306 int32_t m_iLineRotation; | 306 int32_t m_iLineRotation; |
307 int32_t m_iCharRotation; | 307 int32_t m_iCharRotation; |
308 int32_t m_iRotation; | 308 int32_t m_iRotation; |
309 int32_t m_iCharSpace; | 309 int32_t m_iCharSpace; |
310 FX_BOOL m_bWordSpace; | 310 bool m_bWordSpace; |
311 int32_t m_iWordSpace; | 311 int32_t m_iWordSpace; |
312 FX_BOOL m_bRTL; | 312 bool m_bRTL; |
313 int32_t m_iAlignment; | 313 int32_t m_iAlignment; |
314 IFX_Retainable* m_pUserData; | 314 IFX_Retainable* m_pUserData; |
315 FX_CHARTYPE m_eCharType; | 315 FX_CHARTYPE m_eCharType; |
316 uint32_t m_dwIdentity; | 316 uint32_t m_dwIdentity; |
317 CFX_RTFLine m_RTFLine1; | 317 CFX_RTFLine m_RTFLine1; |
318 CFX_RTFLine m_RTFLine2; | 318 CFX_RTFLine m_RTFLine2; |
319 CFX_RTFLine* m_pCurLine; | 319 CFX_RTFLine* m_pCurLine; |
320 int32_t m_iReady; | 320 int32_t m_iReady; |
321 int32_t m_iTolerance; | 321 int32_t m_iTolerance; |
322 }; | 322 }; |
323 | 323 |
324 #endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ | 324 #endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ |
OLD | NEW |