OLD | NEW |
1 // Copyright 2017 PDFium Authors. All rights reserved. | 1 // Copyright 2017 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_CXFA_TEXTLAYOUT_H_ | 7 #ifndef XFA_FXFA_APP_CXFA_TEXTLAYOUT_H_ |
8 #define XFA_FXFA_APP_CXFA_TEXTLAYOUT_H_ | 8 #define XFA_FXFA_APP_CXFA_TEXTLAYOUT_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> |
11 | 12 |
12 #include "core/fxcrt/fx_basic.h" | 13 #include "core/fxcrt/fx_basic.h" |
13 #include "core/fxcrt/fx_coordinates.h" | 14 #include "core/fxcrt/fx_coordinates.h" |
14 #include "core/fxcrt/fx_string.h" | 15 #include "core/fxcrt/fx_string.h" |
15 #include "xfa/fde/css/fde_css.h" | 16 #include "xfa/fde/css/fde_css.h" |
16 #include "xfa/fgas/layout/fgas_rtfbreak.h" | 17 #include "xfa/fgas/layout/fgas_rtfbreak.h" |
17 #include "xfa/fxfa/app/cxfa_textparser.h" | 18 #include "xfa/fxfa/app/cxfa_textparser.h" |
18 | 19 |
19 class CFDE_Brush; | 20 class CFDE_Brush; |
20 class CFDE_CSSComputedStyle; | 21 class CFDE_CSSComputedStyle; |
(...skipping 24 matching lines...) Expand all Loading... |
45 | 46 |
46 bool CalcSize(const CFX_SizeF& minSize, | 47 bool CalcSize(const CFX_SizeF& minSize, |
47 const CFX_SizeF& maxSize, | 48 const CFX_SizeF& maxSize, |
48 CFX_SizeF& defaultSize); | 49 CFX_SizeF& defaultSize); |
49 bool Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = nullptr); | 50 bool Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = nullptr); |
50 void ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex); | 51 void ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex); |
51 bool DrawString(CFX_RenderDevice* pFxDevice, | 52 bool DrawString(CFX_RenderDevice* pFxDevice, |
52 const CFX_Matrix& tmDoc2Device, | 53 const CFX_Matrix& tmDoc2Device, |
53 const CFX_RectF& rtClip, | 54 const CFX_RectF& rtClip, |
54 int32_t iBlock = 0); | 55 int32_t iBlock = 0); |
55 bool IsLoaded() const { return m_pieceLines.GetSize() > 0; } | 56 bool IsLoaded() const { return !m_pieceLines.empty(); } |
56 void Unload(); | 57 void Unload(); |
57 const CFX_ArrayTemplate<CXFA_PieceLine*>* GetPieceLines(); | 58 const std::vector<std::unique_ptr<CXFA_PieceLine>>* GetPieceLines() const { |
| 59 return &m_pieceLines; |
| 60 } |
58 | 61 |
59 bool m_bHasBlock; | 62 bool m_bHasBlock; |
60 CFX_Int32Array m_Blocks; | 63 CFX_Int32Array m_Blocks; |
61 | 64 |
62 private: | 65 private: |
63 void GetTextDataNode(); | 66 void GetTextDataNode(); |
64 CFDE_XMLNode* GetXMLContainerNode(); | 67 CFDE_XMLNode* GetXMLContainerNode(); |
65 CFX_RTFBreak* CreateBreak(bool bDefault); | 68 CFX_RTFBreak* CreateBreak(bool bDefault); |
66 void InitBreak(FX_FLOAT fLineWidth); | 69 void InitBreak(FX_FLOAT fLineWidth); |
67 void InitBreak(CFDE_CSSComputedStyle* pStyle, | 70 void InitBreak(CFDE_CSSComputedStyle* pStyle, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const CFX_Matrix& tmDoc2Device); | 108 const CFX_Matrix& tmDoc2Device); |
106 void RenderPath(CFDE_RenderDevice* pDevice, | 109 void RenderPath(CFDE_RenderDevice* pDevice, |
107 CFDE_Pen* pPen, | 110 CFDE_Pen* pPen, |
108 CXFA_PieceLine* pPieceLine, | 111 CXFA_PieceLine* pPieceLine, |
109 int32_t iPiece, | 112 int32_t iPiece, |
110 FXTEXT_CHARPOS* pCharPos, | 113 FXTEXT_CHARPOS* pCharPos, |
111 const CFX_Matrix& tmDoc2Device); | 114 const CFX_Matrix& tmDoc2Device); |
112 int32_t GetDisplayPos(const XFA_TextPiece* pPiece, | 115 int32_t GetDisplayPos(const XFA_TextPiece* pPiece, |
113 FXTEXT_CHARPOS* pCharPos, | 116 FXTEXT_CHARPOS* pCharPos, |
114 bool bCharCode = false); | 117 bool bCharCode = false); |
115 bool ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ& tr); | 118 bool ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ* tr); |
116 void DoTabstops(CFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine); | 119 void DoTabstops(CFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine); |
117 bool Layout(int32_t iBlock); | 120 bool Layout(int32_t iBlock); |
118 int32_t CountBlocks() const; | 121 int32_t CountBlocks() const; |
119 | 122 |
120 CXFA_TextProvider* m_pTextProvider; | 123 CXFA_TextProvider* m_pTextProvider; |
121 CXFA_Node* m_pTextDataNode; | 124 CXFA_Node* m_pTextDataNode; |
122 bool m_bRichText; | 125 bool m_bRichText; |
123 std::unique_ptr<CFX_RTFBreak> m_pBreak; | 126 std::unique_ptr<CFX_RTFBreak> m_pBreak; |
124 std::unique_ptr<CXFA_LoaderContext> m_pLoader; | 127 std::unique_ptr<CXFA_LoaderContext> m_pLoader; |
125 int32_t m_iLines; | 128 int32_t m_iLines; |
126 FX_FLOAT m_fMaxWidth; | 129 FX_FLOAT m_fMaxWidth; |
127 CXFA_TextParser m_textParser; | 130 CXFA_TextParser m_textParser; |
128 CFX_ArrayTemplate<CXFA_PieceLine*> m_pieceLines; | 131 std::vector<std::unique_ptr<CXFA_PieceLine>> m_pieceLines; |
129 std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext; | 132 std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext; |
130 bool m_bBlockContinue; | 133 bool m_bBlockContinue; |
131 }; | 134 }; |
132 | 135 |
133 #endif // XFA_FXFA_APP_CXFA_TEXTLAYOUT_H_ | 136 #endif // XFA_FXFA_APP_CXFA_TEXTLAYOUT_H_ |
OLD | NEW |