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_SRC_FXFA_SRC_APP_XFA_TEXTLAYOUT_H_ | 7 #ifndef XFA_SRC_FXFA_SRC_APP_XFA_TEXTLAYOUT_H_ |
8 #define XFA_SRC_FXFA_SRC_APP_XFA_TEXTLAYOUT_H_ | 8 #define XFA_SRC_FXFA_SRC_APP_XFA_TEXTLAYOUT_H_ |
9 | 9 |
10 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 | 10 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 } | 218 } |
219 virtual FX_DWORD AddRef() { return ++m_dwRefCount; } | 219 virtual FX_DWORD AddRef() { return ++m_dwRefCount; } |
220 | 220 |
221 IFDE_CSSComputedStyle* m_pStyle; | 221 IFDE_CSSComputedStyle* m_pStyle; |
222 CXFA_LinkUserData* m_pLinkData; | 222 CXFA_LinkUserData* m_pLinkData; |
223 | 223 |
224 protected: | 224 protected: |
225 IFX_MEMAllocator* m_pAllocator; | 225 IFX_MEMAllocator* m_pAllocator; |
226 FX_DWORD m_dwRefCount; | 226 FX_DWORD m_dwRefCount; |
227 }; | 227 }; |
228 typedef struct _XFA_TEXTPIECE : public CFX_Target { | 228 |
229 struct XFA_TEXTPIECE : public CFX_Target { | |
230 XFA_TEXTPIECE() : pszText(NULL), pFont(NULL), pLinkData(NULL) {} | |
Lei Zhang
2016/02/23 20:42:05
nullptr
| |
231 ~XFA_TEXTPIECE() { | |
232 if (pLinkData) | |
233 pLinkData->Release(); | |
234 } | |
235 | |
229 FX_WCHAR* pszText; | 236 FX_WCHAR* pszText; |
230 int32_t iChars; | 237 int32_t iChars; |
231 int32_t* pWidths; | 238 int32_t* pWidths; |
232 int32_t iHorScale; | 239 int32_t iHorScale; |
233 int32_t iVerScale; | 240 int32_t iVerScale; |
234 int32_t iBidiLevel; | 241 int32_t iBidiLevel; |
235 int32_t iUnderline; | 242 int32_t iUnderline; |
236 int32_t iPeriod; | 243 int32_t iPeriod; |
237 int32_t iLineThrough; | 244 int32_t iLineThrough; |
238 IFX_Font* pFont; | 245 IFX_Font* pFont; |
239 FX_ARGB dwColor; | 246 FX_ARGB dwColor; |
240 FX_FLOAT fFontSize; | 247 FX_FLOAT fFontSize; |
241 CFX_RectF rtPiece; | 248 CFX_RectF rtPiece; |
242 CXFA_LinkUserData* pLinkData; | 249 CXFA_LinkUserData* pLinkData; |
250 }; | |
251 typedef CFX_ArrayTemplate<XFA_TEXTPIECE*> CXFA_PieceArray; | |
243 | 252 |
244 _XFA_TEXTPIECE() : pszText(NULL), pFont(NULL), pLinkData(NULL) { | |
245 pszText = NULL; | |
246 } | |
247 ~_XFA_TEXTPIECE() { | |
248 pszText = NULL; | |
249 if (NULL != pLinkData) { | |
250 pLinkData->Release(); | |
251 pLinkData = NULL; | |
252 } | |
253 } | |
254 } XFA_TEXTPIECE, *XFA_LPTEXTPIECE; | |
255 typedef XFA_TEXTPIECE const* XFA_LPCTEXTPIECE; | |
256 typedef CFX_ArrayTemplate<XFA_LPTEXTPIECE> CXFA_PieceArray; | |
257 class CXFA_PieceLine : public CFX_Target { | 253 class CXFA_PieceLine : public CFX_Target { |
258 public: | 254 public: |
259 CXFA_PieceLine() {} | 255 CXFA_PieceLine() {} |
260 CXFA_PieceArray m_textPieces; | 256 CXFA_PieceArray m_textPieces; |
261 CFX_Int32Array m_charCounts; | 257 CFX_Int32Array m_charCounts; |
262 }; | 258 }; |
263 typedef CFX_ArrayTemplate<CXFA_PieceLine*> CXFA_PieceLineArray; | 259 typedef CFX_ArrayTemplate<CXFA_PieceLine*> CXFA_PieceLineArray; |
264 struct XFA_TABSTOPS { | 260 struct XFA_TABSTOPS { |
265 FX_DWORD dwAlign; | 261 FX_DWORD dwAlign; |
266 FX_FLOAT fTabstops; | 262 FX_FLOAT fTabstops; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 CXFA_PieceLine* pPieceLine, | 372 CXFA_PieceLine* pPieceLine, |
377 int32_t iPiece, | 373 int32_t iPiece, |
378 FXTEXT_CHARPOS* pCharPos, | 374 FXTEXT_CHARPOS* pCharPos, |
379 const CFX_Matrix& tmDoc2Device); | 375 const CFX_Matrix& tmDoc2Device); |
380 void RenderPath(IFDE_RenderDevice* pDevice, | 376 void RenderPath(IFDE_RenderDevice* pDevice, |
381 IFDE_Pen* pPen, | 377 IFDE_Pen* pPen, |
382 CXFA_PieceLine* pPieceLine, | 378 CXFA_PieceLine* pPieceLine, |
383 int32_t iPiece, | 379 int32_t iPiece, |
384 FXTEXT_CHARPOS* pCharPos, | 380 FXTEXT_CHARPOS* pCharPos, |
385 const CFX_Matrix& tmDoc2Device); | 381 const CFX_Matrix& tmDoc2Device); |
386 int32_t GetDisplayPos(XFA_LPCTEXTPIECE pPiece, | 382 int32_t GetDisplayPos(const XFA_TEXTPIECE* pPiece, |
387 FXTEXT_CHARPOS* pCharPos, | 383 FXTEXT_CHARPOS* pCharPos, |
388 FX_BOOL bCharCode = FALSE); | 384 FX_BOOL bCharCode = FALSE); |
389 FX_BOOL ToRun(XFA_LPCTEXTPIECE pPiece, FX_RTFTEXTOBJ& tr); | 385 FX_BOOL ToRun(const XFA_TEXTPIECE* pPiece, FX_RTFTEXTOBJ& tr); |
390 void DoTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine); | 386 void DoTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine); |
391 FX_BOOL Layout(int32_t iBlock); | 387 FX_BOOL Layout(int32_t iBlock); |
392 int32_t CountBlocks() const; | 388 int32_t CountBlocks() const; |
393 | 389 |
394 IXFA_TextProvider* m_pTextProvider; | 390 IXFA_TextProvider* m_pTextProvider; |
395 CXFA_Node* m_pTextDataNode; | 391 CXFA_Node* m_pTextDataNode; |
396 FX_BOOL m_bRichText; | 392 FX_BOOL m_bRichText; |
397 IFX_MEMAllocator* m_pAllocator; | 393 IFX_MEMAllocator* m_pAllocator; |
398 IFX_RTFBreak* m_pBreak; | 394 IFX_RTFBreak* m_pBreak; |
399 CXFA_LoaderContext* m_pLoader; | 395 CXFA_LoaderContext* m_pLoader; |
400 int32_t m_iLines; | 396 int32_t m_iLines; |
401 FX_FLOAT m_fMaxWidth; | 397 FX_FLOAT m_fMaxWidth; |
402 CXFA_TextParser m_textParser; | 398 CXFA_TextParser m_textParser; |
403 CXFA_PieceLineArray m_pieceLines; | 399 CXFA_PieceLineArray m_pieceLines; |
404 CXFA_TextTabstopsContext* m_pTabstopContext; | 400 CXFA_TextTabstopsContext* m_pTabstopContext; |
405 FX_BOOL m_bBlockContinue; | 401 FX_BOOL m_bBlockContinue; |
406 }; | 402 }; |
407 | 403 |
408 #endif // XFA_SRC_FXFA_SRC_APP_XFA_TEXTLAYOUT_H_ | 404 #endif // XFA_SRC_FXFA_SRC_APP_XFA_TEXTLAYOUT_H_ |
OLD | NEW |