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_FXFA_APP_XFA_TEXTLAYOUT_H_ | 7 #ifndef XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
8 #define XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 8 #define XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 class CXFA_LoaderContext { | 144 class CXFA_LoaderContext { |
145 public: | 145 public: |
146 CXFA_LoaderContext() | 146 CXFA_LoaderContext() |
147 : m_bSaveLineHeight(FALSE), | 147 : m_bSaveLineHeight(FALSE), |
148 m_fWidth(0), | 148 m_fWidth(0), |
149 m_fHeight(0), | 149 m_fHeight(0), |
150 m_fLastPos(0), | 150 m_fLastPos(0), |
151 m_fStartLineOffset(0), | 151 m_fStartLineOffset(0), |
152 m_iChar(0), | 152 m_iChar(0), |
153 m_iTotalLines(-1), | 153 m_iTotalLines(-1), |
154 m_pXMLNode(NULL), | 154 m_pXMLNode(nullptr), |
155 m_pNode(NULL), | 155 m_pNode(nullptr), |
156 m_pParentStyle(NULL), | 156 m_pParentStyle(nullptr), |
157 m_dwFlags(0) {} | 157 m_dwFlags(0) {} |
158 FX_BOOL m_bSaveLineHeight; | 158 FX_BOOL m_bSaveLineHeight; |
159 FX_FLOAT m_fWidth; | 159 FX_FLOAT m_fWidth; |
160 FX_FLOAT m_fHeight; | 160 FX_FLOAT m_fHeight; |
161 FX_FLOAT m_fLastPos; | 161 FX_FLOAT m_fLastPos; |
162 FX_FLOAT m_fStartLineOffset; | 162 FX_FLOAT m_fStartLineOffset; |
163 int32_t m_iChar; | 163 int32_t m_iChar; |
164 int32_t m_iLines; | 164 int32_t m_iLines; |
165 int32_t m_iTotalLines; | 165 int32_t m_iTotalLines; |
166 CFDE_XMLNode* m_pXMLNode; | 166 CFDE_XMLNode* m_pXMLNode; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 FX_FLOAT GetLayoutHeight(); | 330 FX_FLOAT GetLayoutHeight(); |
331 FX_FLOAT StartLayout(FX_FLOAT fWidth = -1); | 331 FX_FLOAT StartLayout(FX_FLOAT fWidth = -1); |
332 FX_BOOL DoLayout(int32_t iBlockIndex, | 332 FX_BOOL DoLayout(int32_t iBlockIndex, |
333 FX_FLOAT& fCalcHeight, | 333 FX_FLOAT& fCalcHeight, |
334 FX_FLOAT fContentAreaHeight = -1, | 334 FX_FLOAT fContentAreaHeight = -1, |
335 FX_FLOAT fTextHeight = -1); | 335 FX_FLOAT fTextHeight = -1); |
336 | 336 |
337 FX_BOOL CalcSize(const CFX_SizeF& minSize, | 337 FX_BOOL CalcSize(const CFX_SizeF& minSize, |
338 const CFX_SizeF& maxSize, | 338 const CFX_SizeF& maxSize, |
339 CFX_SizeF& defaultSize); | 339 CFX_SizeF& defaultSize); |
340 FX_BOOL Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = NULL); | 340 FX_BOOL Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = nullptr); |
341 void ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex); | 341 void ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex); |
342 FX_BOOL DrawString(CFX_RenderDevice* pFxDevice, | 342 FX_BOOL DrawString(CFX_RenderDevice* pFxDevice, |
343 const CFX_Matrix& tmDoc2Device, | 343 const CFX_Matrix& tmDoc2Device, |
344 const CFX_RectF& rtClip, | 344 const CFX_RectF& rtClip, |
345 int32_t iBlock = 0); | 345 int32_t iBlock = 0); |
346 FX_BOOL IsLoaded() const { return m_pieceLines.GetSize() > 0; } | 346 FX_BOOL IsLoaded() const { return m_pieceLines.GetSize() > 0; } |
347 void Unload(); | 347 void Unload(); |
348 const CXFA_PieceLineArray* GetPieceLines(); | 348 const CXFA_PieceLineArray* GetPieceLines(); |
349 | 349 |
350 FX_BOOL m_bHasBlock; | 350 FX_BOOL m_bHasBlock; |
351 CFX_Int32Array m_Blocks; | 351 CFX_Int32Array m_Blocks; |
352 | 352 |
353 private: | 353 private: |
354 void GetTextDataNode(); | 354 void GetTextDataNode(); |
355 CFDE_XMLNode* GetXMLContainerNode(); | 355 CFDE_XMLNode* GetXMLContainerNode(); |
356 CFX_RTFBreak* CreateBreak(FX_BOOL bDefault); | 356 CFX_RTFBreak* CreateBreak(FX_BOOL bDefault); |
357 void InitBreak(FX_FLOAT fLineWidth); | 357 void InitBreak(FX_FLOAT fLineWidth); |
358 void InitBreak(IFDE_CSSComputedStyle* pStyle, | 358 void InitBreak(IFDE_CSSComputedStyle* pStyle, |
359 FDE_CSSDISPLAY eDisplay, | 359 FDE_CSSDISPLAY eDisplay, |
360 FX_FLOAT fLineWidth, | 360 FX_FLOAT fLineWidth, |
361 CFDE_XMLNode* pXMLNode, | 361 CFDE_XMLNode* pXMLNode, |
362 IFDE_CSSComputedStyle* pParentStyle = NULL); | 362 IFDE_CSSComputedStyle* pParentStyle = nullptr); |
363 FX_BOOL Loader(const CFX_SizeF& szText, | 363 FX_BOOL Loader(const CFX_SizeF& szText, |
364 FX_FLOAT& fLinePos, | 364 FX_FLOAT& fLinePos, |
365 FX_BOOL bSavePieces = TRUE); | 365 FX_BOOL bSavePieces = TRUE); |
366 void LoadText(CXFA_Node* pNode, | 366 void LoadText(CXFA_Node* pNode, |
367 const CFX_SizeF& szText, | 367 const CFX_SizeF& szText, |
368 FX_FLOAT& fLinePos, | 368 FX_FLOAT& fLinePos, |
369 FX_BOOL bSavePieces); | 369 FX_BOOL bSavePieces); |
370 FX_BOOL LoadRichText(CFDE_XMLNode* pXMLNode, | 370 FX_BOOL LoadRichText(CFDE_XMLNode* pXMLNode, |
371 const CFX_SizeF& szText, | 371 const CFX_SizeF& szText, |
372 FX_FLOAT& fLinePos, | 372 FX_FLOAT& fLinePos, |
373 IFDE_CSSComputedStyle* pParentStyle, | 373 IFDE_CSSComputedStyle* pParentStyle, |
374 FX_BOOL bSavePieces, | 374 FX_BOOL bSavePieces, |
375 CXFA_LinkUserData* pLinkData = NULL, | 375 CXFA_LinkUserData* pLinkData = nullptr, |
376 FX_BOOL bEndBreak = TRUE, | 376 FX_BOOL bEndBreak = TRUE, |
377 FX_BOOL bIsOl = FALSE, | 377 FX_BOOL bIsOl = FALSE, |
378 int32_t iLiCount = 0); | 378 int32_t iLiCount = 0); |
379 FX_BOOL AppendChar(const CFX_WideString& wsText, | 379 FX_BOOL AppendChar(const CFX_WideString& wsText, |
380 FX_FLOAT& fLinePos, | 380 FX_FLOAT& fLinePos, |
381 FX_FLOAT fSpaceAbove, | 381 FX_FLOAT fSpaceAbove, |
382 FX_BOOL bSavePieces); | 382 FX_BOOL bSavePieces); |
383 void AppendTextLine(uint32_t dwStatus, | 383 void AppendTextLine(uint32_t dwStatus, |
384 FX_FLOAT& fLinePos, | 384 FX_FLOAT& fLinePos, |
385 FX_BOOL bSavePieces, | 385 FX_BOOL bSavePieces, |
(...skipping 30 matching lines...) Expand all Loading... |
416 std::unique_ptr<CXFA_LoaderContext> m_pLoader; | 416 std::unique_ptr<CXFA_LoaderContext> m_pLoader; |
417 int32_t m_iLines; | 417 int32_t m_iLines; |
418 FX_FLOAT m_fMaxWidth; | 418 FX_FLOAT m_fMaxWidth; |
419 CXFA_TextParser m_textParser; | 419 CXFA_TextParser m_textParser; |
420 CXFA_PieceLineArray m_pieceLines; | 420 CXFA_PieceLineArray m_pieceLines; |
421 std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext; | 421 std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext; |
422 FX_BOOL m_bBlockContinue; | 422 FX_BOOL m_bBlockContinue; |
423 }; | 423 }; |
424 | 424 |
425 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 425 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
OLD | NEW |