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> |
| 11 #include <memory> |
11 | 12 |
12 #include "xfa/fde/css/fde_css.h" | 13 #include "xfa/fde/css/fde_css.h" |
13 #include "xfa/fde/fde_gedevice.h" | 14 #include "xfa/fde/fde_gedevice.h" |
14 #include "xfa/fgas/layout/fgas_rtfbreak.h" | 15 #include "xfa/fgas/layout/fgas_rtfbreak.h" |
15 #include "xfa/fxfa/include/xfa_ffdoc.h" | 16 #include "xfa/fxfa/include/xfa_ffdoc.h" |
16 #include "xfa/fxfa/parser/xfa_object.h" | 17 #include "xfa/fxfa/parser/xfa_object.h" |
17 | 18 |
18 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 | 19 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 |
19 | 20 |
20 class CFDE_CSSStyleSelector; | 21 class CFDE_CSSStyleSelector; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 IFDE_CSSComputedStyle* m_pParentStyle; | 73 IFDE_CSSComputedStyle* m_pParentStyle; |
73 | 74 |
74 protected: | 75 protected: |
75 CFDE_CSSDeclaration** m_ppMatchedDecls; | 76 CFDE_CSSDeclaration** m_ppMatchedDecls; |
76 uint32_t m_dwMatchedDecls; | 77 uint32_t m_dwMatchedDecls; |
77 FDE_CSSDISPLAY m_eDisplay; | 78 FDE_CSSDISPLAY m_eDisplay; |
78 }; | 79 }; |
79 | 80 |
80 class CXFA_TextParser { | 81 class CXFA_TextParser { |
81 public: | 82 public: |
82 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} | 83 CXFA_TextParser(); |
83 virtual ~CXFA_TextParser(); | 84 virtual ~CXFA_TextParser(); |
84 void Reset(); | 85 void Reset(); |
85 void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); | 86 void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); |
86 IFDE_CSSComputedStyle* CreateRootStyle(CXFA_TextProvider* pTextProvider); | 87 IFDE_CSSComputedStyle* CreateRootStyle(CXFA_TextProvider* pTextProvider); |
87 IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode, | 88 IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode, |
88 IFDE_CSSComputedStyle* pParentStyle); | 89 IFDE_CSSComputedStyle* pParentStyle); |
89 FX_BOOL IsParsed() const { return m_pAllocator != NULL; } | 90 FX_BOOL IsParsed() const { return m_pAllocator != NULL; } |
90 | 91 |
91 int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const; | 92 int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const; |
92 FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const; | 93 FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); | 125 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); |
125 | 126 |
126 private: | 127 private: |
127 void InitCSSData(CXFA_TextProvider* pTextProvider); | 128 void InitCSSData(CXFA_TextProvider* pTextProvider); |
128 void ParseRichText(CFDE_XMLNode* pXMLNode, | 129 void ParseRichText(CFDE_XMLNode* pXMLNode, |
129 IFDE_CSSComputedStyle* pParentStyle); | 130 IFDE_CSSComputedStyle* pParentStyle); |
130 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); | 131 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); |
131 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); | 132 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); |
132 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); | 133 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); |
133 IFX_MemoryAllocator* m_pAllocator; | 134 IFX_MemoryAllocator* m_pAllocator; |
134 CFDE_CSSStyleSelector* m_pSelector; | 135 std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector; |
135 IFDE_CSSStyleSheet* m_pUASheet; | 136 IFDE_CSSStyleSheet* m_pUASheet; |
136 CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*> | 137 CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*> |
137 m_mapXMLNodeToParseContext; | 138 m_mapXMLNodeToParseContext; |
138 }; | 139 }; |
139 | 140 |
140 class CXFA_LoaderContext { | 141 class CXFA_LoaderContext { |
141 public: | 142 public: |
142 CXFA_LoaderContext() | 143 CXFA_LoaderContext() |
143 : m_bSaveLineHeight(FALSE), | 144 : m_bSaveLineHeight(FALSE), |
144 m_fWidth(0), | 145 m_fWidth(0), |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 CXFA_LoaderContext* m_pLoader; | 411 CXFA_LoaderContext* m_pLoader; |
411 int32_t m_iLines; | 412 int32_t m_iLines; |
412 FX_FLOAT m_fMaxWidth; | 413 FX_FLOAT m_fMaxWidth; |
413 CXFA_TextParser m_textParser; | 414 CXFA_TextParser m_textParser; |
414 CXFA_PieceLineArray m_pieceLines; | 415 CXFA_PieceLineArray m_pieceLines; |
415 CXFA_TextTabstopsContext* m_pTabstopContext; | 416 CXFA_TextTabstopsContext* m_pTabstopContext; |
416 FX_BOOL m_bBlockContinue; | 417 FX_BOOL m_bBlockContinue; |
417 }; | 418 }; |
418 | 419 |
419 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 420 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
OLD | NEW |