| 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 | 11 |
| 12 #include "xfa/fde/css/fde_css.h" | 12 #include "xfa/fde/css/fde_css.h" |
| 13 #include "xfa/fde/fde_gedevice.h" | 13 #include "xfa/fde/fde_gedevice.h" |
| 14 #include "xfa/fgas/layout/fgas_rtfbreak.h" | 14 #include "xfa/fgas/layout/fgas_rtfbreak.h" |
| 15 #include "xfa/fxfa/include/xfa_ffdoc.h" | 15 #include "xfa/fxfa/include/xfa_ffdoc.h" |
| 16 #include "xfa/fxfa/parser/xfa_object.h" | 16 #include "xfa/fxfa/parser/xfa_object.h" |
| 17 | 17 |
| 18 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 | 18 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 |
| 19 | 19 |
| 20 class CFDE_CSSStyleSelector; |
| 20 class CXFA_Para; | 21 class CXFA_Para; |
| 21 class CXFA_Font; | 22 class CXFA_Font; |
| 22 class CXFA_TextProvider; | 23 class CXFA_TextProvider; |
| 23 class CXFA_TextTabstopsContext; | 24 class CXFA_TextTabstopsContext; |
| 24 | 25 |
| 25 class CXFA_CSSTagProvider { | 26 class CXFA_CSSTagProvider { |
| 26 public: | 27 public: |
| 27 CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} | 28 CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} |
| 28 ~CXFA_CSSTagProvider() {} | 29 ~CXFA_CSSTagProvider() {} |
| 29 | 30 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 56 m_ppMatchedDecls(nullptr), | 57 m_ppMatchedDecls(nullptr), |
| 57 m_dwMatchedDecls(0), | 58 m_dwMatchedDecls(0), |
| 58 m_eDisplay(FDE_CSSDISPLAY_None) {} | 59 m_eDisplay(FDE_CSSDISPLAY_None) {} |
| 59 ~CXFA_TextParseContext() { | 60 ~CXFA_TextParseContext() { |
| 60 if (m_pParentStyle) | 61 if (m_pParentStyle) |
| 61 m_pParentStyle->Release(); | 62 m_pParentStyle->Release(); |
| 62 FX_Free(m_ppMatchedDecls); | 63 FX_Free(m_ppMatchedDecls); |
| 63 } | 64 } |
| 64 void SetDisplay(FDE_CSSDISPLAY eDisplay) { m_eDisplay = eDisplay; } | 65 void SetDisplay(FDE_CSSDISPLAY eDisplay) { m_eDisplay = eDisplay; } |
| 65 FDE_CSSDISPLAY GetDisplay() const { return m_eDisplay; } | 66 FDE_CSSDISPLAY GetDisplay() const { return m_eDisplay; } |
| 66 void SetDecls(const IFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount); | 67 void SetDecls(const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount); |
| 67 const IFDE_CSSDeclaration** GetDecls() { | 68 const CFDE_CSSDeclaration** GetDecls() { |
| 68 return (const IFDE_CSSDeclaration**)m_ppMatchedDecls; | 69 return const_cast<const CFDE_CSSDeclaration**>(m_ppMatchedDecls); |
| 69 } | 70 } |
| 70 uint32_t CountDecls() const { return m_dwMatchedDecls; } | 71 uint32_t CountDecls() const { return m_dwMatchedDecls; } |
| 71 IFDE_CSSComputedStyle* m_pParentStyle; | 72 IFDE_CSSComputedStyle* m_pParentStyle; |
| 72 | 73 |
| 73 protected: | 74 protected: |
| 74 IFDE_CSSDeclaration** m_ppMatchedDecls; | 75 CFDE_CSSDeclaration** m_ppMatchedDecls; |
| 75 uint32_t m_dwMatchedDecls; | 76 uint32_t m_dwMatchedDecls; |
| 76 FDE_CSSDISPLAY m_eDisplay; | 77 FDE_CSSDISPLAY m_eDisplay; |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 class CXFA_TextParser { | 80 class CXFA_TextParser { |
| 80 public: | 81 public: |
| 81 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} | 82 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} |
| 82 virtual ~CXFA_TextParser(); | 83 virtual ~CXFA_TextParser(); |
| 83 void Reset(); | 84 void Reset(); |
| 84 void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); | 85 void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); | 124 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); |
| 124 | 125 |
| 125 private: | 126 private: |
| 126 void InitCSSData(CXFA_TextProvider* pTextProvider); | 127 void InitCSSData(CXFA_TextProvider* pTextProvider); |
| 127 void ParseRichText(CFDE_XMLNode* pXMLNode, | 128 void ParseRichText(CFDE_XMLNode* pXMLNode, |
| 128 IFDE_CSSComputedStyle* pParentStyle); | 129 IFDE_CSSComputedStyle* pParentStyle); |
| 129 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); | 130 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); |
| 130 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); | 131 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); |
| 131 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); | 132 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); |
| 132 IFX_MEMAllocator* m_pAllocator; | 133 IFX_MEMAllocator* m_pAllocator; |
| 133 IFDE_CSSStyleSelector* m_pSelector; | 134 CFDE_CSSStyleSelector* m_pSelector; |
| 134 IFDE_CSSStyleSheet* m_pUASheet; | 135 IFDE_CSSStyleSheet* m_pUASheet; |
| 135 CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*> | 136 CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*> |
| 136 m_mapXMLNodeToParseContext; | 137 m_mapXMLNodeToParseContext; |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 class CXFA_LoaderContext { | 140 class CXFA_LoaderContext { |
| 140 public: | 141 public: |
| 141 CXFA_LoaderContext() | 142 CXFA_LoaderContext() |
| 142 : m_bSaveLineHeight(FALSE), | 143 : m_bSaveLineHeight(FALSE), |
| 143 m_fWidth(0), | 144 m_fWidth(0), |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 CXFA_LoaderContext* m_pLoader; | 409 CXFA_LoaderContext* m_pLoader; |
| 409 int32_t m_iLines; | 410 int32_t m_iLines; |
| 410 FX_FLOAT m_fMaxWidth; | 411 FX_FLOAT m_fMaxWidth; |
| 411 CXFA_TextParser m_textParser; | 412 CXFA_TextParser m_textParser; |
| 412 CXFA_PieceLineArray m_pieceLines; | 413 CXFA_PieceLineArray m_pieceLines; |
| 413 CXFA_TextTabstopsContext* m_pTabstopContext; | 414 CXFA_TextTabstopsContext* m_pTabstopContext; |
| 414 FX_BOOL m_bBlockContinue; | 415 FX_BOOL m_bBlockContinue; |
| 415 }; | 416 }; |
| 416 | 417 |
| 417 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 418 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
| OLD | NEW |