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/include/fx_basic.h" |
10 #include "core/fxcrt/include/fx_ucd.h" | 11 #include "core/fxcrt/include/fx_ucd.h" |
11 #include "core/fxge/include/fx_ge.h" | 12 #include "core/fxge/include/fx_ge.h" |
12 #include "xfa/fgas/crt/fgas_memory.h" | 13 #include "xfa/fgas/crt/fgas_memory.h" |
13 #include "xfa/fgas/crt/fgas_utils.h" | 14 #include "xfa/fgas/crt/fgas_utils.h" |
14 #include "xfa/fgas/layout/fgas_textbreak.h" | 15 #include "xfa/fgas/layout/fgas_textbreak.h" |
15 #include "xfa/fgas/layout/fgas_unicode.h" | 16 #include "xfa/fgas/layout/fgas_unicode.h" |
16 | 17 |
17 class IFX_Unknown; | |
18 class IFX_Font; | 18 class IFX_Font; |
19 | 19 |
20 #define FX_RTFBREAKPOLICY_None 0x00 | 20 #define FX_RTFBREAKPOLICY_None 0x00 |
21 #define FX_RTFBREAKPOLICY_SpaceBreak 0x01 | 21 #define FX_RTFBREAKPOLICY_SpaceBreak 0x01 |
22 #define FX_RTFBREAKPOLICY_NumberBreak 0x02 | 22 #define FX_RTFBREAKPOLICY_NumberBreak 0x02 |
23 #define FX_RTFBREAKPOLICY_InfixBreak 0x04 | 23 #define FX_RTFBREAKPOLICY_InfixBreak 0x04 |
24 #define FX_RTFBREAKPOLICY_TabBreak 0x08 | 24 #define FX_RTFBREAKPOLICY_TabBreak 0x08 |
25 #define FX_RTFBREAKPOLICY_OrphanPositionedTab 0x10 | 25 #define FX_RTFBREAKPOLICY_OrphanPositionedTab 0x10 |
26 #define FX_RTFBREAK_None 0x00 | 26 #define FX_RTFBREAK_None 0x00 |
27 #define FX_RTFBREAK_PieceBreak 0x01 | 27 #define FX_RTFBREAK_PieceBreak 0x01 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 int32_t m_iChars; | 179 int32_t m_iChars; |
180 int32_t m_iBidiLevel; | 180 int32_t m_iBidiLevel; |
181 int32_t m_iBidiPos; | 181 int32_t m_iBidiPos; |
182 int32_t m_iFontSize; | 182 int32_t m_iFontSize; |
183 int32_t m_iFontHeight; | 183 int32_t m_iFontHeight; |
184 int32_t m_iHorizontalScale; | 184 int32_t m_iHorizontalScale; |
185 int32_t m_iVerticalScale; | 185 int32_t m_iVerticalScale; |
186 uint32_t m_dwLayoutStyles; | 186 uint32_t m_dwLayoutStyles; |
187 uint32_t m_dwIdentity; | 187 uint32_t m_dwIdentity; |
188 CFX_RTFCharArray* m_pChars; | 188 CFX_RTFCharArray* m_pChars; |
189 IFX_Unknown* m_pUserData; | 189 IFX_Retainable* m_pUserData; |
190 }; | 190 }; |
191 typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray; | 191 typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray; |
192 | 192 |
193 class CFX_RTFLine { | 193 class CFX_RTFLine { |
194 public: | 194 public: |
195 CFX_RTFLine() | 195 CFX_RTFLine() |
196 : m_LinePieces(16), | 196 : m_LinePieces(16), |
197 m_iStart(0), | 197 m_iStart(0), |
198 m_iWidth(0), | 198 m_iWidth(0), |
199 m_iArabicChars(0), | 199 m_iArabicChars(0), |
(...skipping 13 matching lines...) Expand all Loading... |
213 ASSERT(index > -1 && index < m_LinePieces.GetSize()); | 213 ASSERT(index > -1 && index < m_LinePieces.GetSize()); |
214 return m_LinePieces.GetAt(index); | 214 return m_LinePieces.GetAt(index); |
215 } | 215 } |
216 CFX_RTFPiece* GetPiecePtr(int32_t index) const { | 216 CFX_RTFPiece* GetPiecePtr(int32_t index) const { |
217 ASSERT(index > -1 && index < m_LinePieces.GetSize()); | 217 ASSERT(index > -1 && index < m_LinePieces.GetSize()); |
218 return m_LinePieces.GetPtrAt(index); | 218 return m_LinePieces.GetPtrAt(index); |
219 } | 219 } |
220 int32_t GetLineEnd() const { return m_iStart + m_iWidth; } | 220 int32_t GetLineEnd() const { return m_iStart + m_iWidth; } |
221 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { | 221 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { |
222 CFX_RTFChar* pChar; | 222 CFX_RTFChar* pChar; |
223 IFX_Unknown* pUnknown; | 223 IFX_Retainable* pUnknown; |
224 int32_t iCount = m_LineChars.GetSize(); | 224 int32_t iCount = m_LineChars.GetSize(); |
225 for (int32_t i = 0; i < iCount; i++) { | 225 for (int32_t i = 0; i < iCount; i++) { |
226 pChar = m_LineChars.GetDataPtr(i); | 226 pChar = m_LineChars.GetDataPtr(i); |
227 if ((pUnknown = pChar->m_pUserData) != NULL) { | 227 if ((pUnknown = pChar->m_pUserData) != NULL) { |
228 pUnknown->Release(); | 228 pUnknown->Release(); |
229 } | 229 } |
230 } | 230 } |
231 m_LineChars.RemoveAll(); | 231 m_LineChars.RemoveAll(); |
232 m_LinePieces.RemoveAll(bLeaveMemory); | 232 m_LinePieces.RemoveAll(bLeaveMemory); |
233 m_iWidth = 0; | 233 m_iWidth = 0; |
(...skipping 26 matching lines...) Expand all Loading... |
260 void SetDefaultChar(FX_WCHAR wch); | 260 void SetDefaultChar(FX_WCHAR wch); |
261 void SetLineBreakChar(FX_WCHAR wch); | 261 void SetLineBreakChar(FX_WCHAR wch); |
262 void SetLineBreakTolerance(FX_FLOAT fTolerance); | 262 void SetLineBreakTolerance(FX_FLOAT fTolerance); |
263 void SetHorizontalScale(int32_t iScale); | 263 void SetHorizontalScale(int32_t iScale); |
264 void SetVerticalScale(int32_t iScale); | 264 void SetVerticalScale(int32_t iScale); |
265 void SetCharRotation(int32_t iCharRotation); | 265 void SetCharRotation(int32_t iCharRotation); |
266 void SetCharSpace(FX_FLOAT fCharSpace); | 266 void SetCharSpace(FX_FLOAT fCharSpace); |
267 void SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace); | 267 void SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace); |
268 void SetReadingOrder(FX_BOOL bRTL = FALSE); | 268 void SetReadingOrder(FX_BOOL bRTL = FALSE); |
269 void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left); | 269 void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left); |
270 void SetUserData(IFX_Unknown* pUserData); | 270 void SetUserData(IFX_Retainable* pUserData); |
271 uint32_t AppendChar(FX_WCHAR wch); | 271 uint32_t AppendChar(FX_WCHAR wch); |
272 uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak); | 272 uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak); |
273 int32_t CountBreakPieces() const; | 273 int32_t CountBreakPieces() const; |
274 const CFX_RTFPiece* GetBreakPiece(int32_t index) const; | 274 const CFX_RTFPiece* GetBreakPiece(int32_t index) const; |
275 void GetLineRect(CFX_RectF& rect) const; | 275 void GetLineRect(CFX_RectF& rect) const; |
276 void ClearBreakPieces(); | 276 void ClearBreakPieces(); |
277 void Reset(); | 277 void Reset(); |
278 int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText, | 278 int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText, |
279 FXTEXT_CHARPOS* pCharPos, | 279 FXTEXT_CHARPOS* pCharPos, |
280 FX_BOOL bCharCode = FALSE, | 280 FX_BOOL bCharCode = FALSE, |
(...skipping 30 matching lines...) Expand all Loading... |
311 int32_t m_iHorizontalScale; | 311 int32_t m_iHorizontalScale; |
312 int32_t m_iVerticalScale; | 312 int32_t m_iVerticalScale; |
313 int32_t m_iLineRotation; | 313 int32_t m_iLineRotation; |
314 int32_t m_iCharRotation; | 314 int32_t m_iCharRotation; |
315 int32_t m_iRotation; | 315 int32_t m_iRotation; |
316 int32_t m_iCharSpace; | 316 int32_t m_iCharSpace; |
317 FX_BOOL m_bWordSpace; | 317 FX_BOOL m_bWordSpace; |
318 int32_t m_iWordSpace; | 318 int32_t m_iWordSpace; |
319 FX_BOOL m_bRTL; | 319 FX_BOOL m_bRTL; |
320 int32_t m_iAlignment; | 320 int32_t m_iAlignment; |
321 IFX_Unknown* m_pUserData; | 321 IFX_Retainable* m_pUserData; |
322 FX_CHARTYPE m_eCharType; | 322 FX_CHARTYPE m_eCharType; |
323 uint32_t m_dwIdentity; | 323 uint32_t m_dwIdentity; |
324 CFX_RTFLine m_RTFLine1; | 324 CFX_RTFLine m_RTFLine1; |
325 CFX_RTFLine m_RTFLine2; | 325 CFX_RTFLine m_RTFLine2; |
326 CFX_RTFLine* m_pCurLine; | 326 CFX_RTFLine* 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 GetLineRotation(uint32_t dwStyles) const; | 329 int32_t GetLineRotation(uint32_t dwStyles) const; |
330 void SetBreakStatus(); | 330 void SetBreakStatus(); |
331 CFX_RTFChar* GetLastChar(int32_t index) const; | 331 CFX_RTFChar* GetLastChar(int32_t index) const; |
(...skipping 12 matching lines...) Expand all Loading... |
344 FX_BOOL EndBreak_SplitLine(CFX_RTFLine* pNextLine, | 344 FX_BOOL EndBreak_SplitLine(CFX_RTFLine* pNextLine, |
345 FX_BOOL bAllChars, | 345 FX_BOOL bAllChars, |
346 uint32_t dwStatus); | 346 uint32_t dwStatus); |
347 void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus); | 347 void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus); |
348 void EndBreak_Alignment(CFX_TPOArray& tpos, | 348 void EndBreak_Alignment(CFX_TPOArray& tpos, |
349 FX_BOOL bAllChars, | 349 FX_BOOL bAllChars, |
350 uint32_t dwStatus); | 350 uint32_t dwStatus); |
351 }; | 351 }; |
352 | 352 |
353 #endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ | 353 #endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ |
OLD | NEW |