| 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 #include <memory> |
| 12 | 12 |
| 13 #include "xfa/fde/css/fde_css.h" | 13 #include "xfa/fde/css/fde_css.h" |
| 14 #include "xfa/fde/fde_gedevice.h" | 14 #include "xfa/fde/fde_gedevice.h" |
| 15 #include "xfa/fgas/layout/fgas_rtfbreak.h" | 15 #include "xfa/fgas/layout/fgas_rtfbreak.h" |
| 16 #include "xfa/fxfa/include/xfa_ffdoc.h" | 16 #include "xfa/fxfa/include/xfa_ffdoc.h" |
| 17 #include "xfa/fxfa/parser/xfa_object.h" | 17 #include "xfa/fxfa/parser/xfa_object.h" |
| 18 | 18 |
| 19 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 | 19 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 |
| 20 | 20 |
| 21 class CFDE_CSSStyleSelector; | 21 class CFDE_CSSStyleSelector; |
| 22 class CXFA_Para; | 22 class CXFA_Para; |
| 23 class CXFA_Font; | 23 class CXFA_Font; |
| 24 class CXFA_TextProvider; | 24 class CXFA_TextProvider; |
| 25 class CXFA_TextTabstopsContext; | 25 class CXFA_TextTabstopsContext; |
| 26 | 26 |
| 27 class CXFA_CSSTagProvider { | 27 class CXFA_CSSTagProvider { |
| 28 public: | 28 public: |
| 29 CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} | 29 CXFA_CSSTagProvider() : m_bTagAvailable(FALSE), m_bContent(FALSE) {} |
| 30 ~CXFA_CSSTagProvider() {} | 30 ~CXFA_CSSTagProvider() {} |
| 31 | 31 |
| 32 CFX_WideString GetTagName() { return m_wsTagName; } | 32 CFX_WideString GetTagName() { return m_wsTagName; } |
| 33 | 33 |
| 34 using AttributeMap = std::map<CFX_WideString, CFX_WideString>; | 34 using AttributeMap = std::map<CFX_WideString, CFX_WideString>; |
| 35 AttributeMap::iterator begin() { return m_Attributes.begin(); } | 35 AttributeMap::iterator begin() { return m_Attributes.begin(); } |
| 36 AttributeMap::iterator end() { return m_Attributes.end(); } | 36 AttributeMap::iterator end() { return m_Attributes.end(); } |
| 37 | 37 |
| 38 bool empty() const { return m_Attributes.empty(); } | 38 bool empty() const { return m_Attributes.empty(); } |
| 39 | 39 |
| 40 void SetTagNameObj(const CFX_WideString& wsName) { m_wsTagName = wsName; } | 40 void SetTagNameObj(const CFX_WideString& wsName) { m_wsTagName = wsName; } |
| 41 void SetAttribute(const CFX_WideString& wsAttr, | 41 void SetAttribute(const CFX_WideString& wsAttr, |
| 42 const CFX_WideString& wsValue) { | 42 const CFX_WideString& wsValue) { |
| 43 m_Attributes.insert({wsAttr, wsValue}); | 43 m_Attributes.insert({wsAttr, wsValue}); |
| 44 } | 44 } |
| 45 | 45 |
| 46 FX_BOOL m_bTagAviliable; | 46 FX_BOOL m_bTagAvailable; |
| 47 FX_BOOL m_bContent; | 47 FX_BOOL m_bContent; |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 CFX_WideString m_wsTagName; | 50 CFX_WideString m_wsTagName; |
| 51 AttributeMap m_Attributes; | 51 AttributeMap m_Attributes; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class CXFA_TextParseContext : public CFX_Target { | 54 class CXFA_TextParseContext : public CFX_Target { |
| 55 public: | 55 public: |
| 56 CXFA_TextParseContext() | 56 CXFA_TextParseContext() |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 IFDE_CSSComputedStyle* pStyle) const; | 117 IFDE_CSSComputedStyle* pStyle) const; |
| 118 FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider, | 118 FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider, |
| 119 IFDE_CSSComputedStyle* pStyle, | 119 IFDE_CSSComputedStyle* pStyle, |
| 120 FX_BOOL bFirst, | 120 FX_BOOL bFirst, |
| 121 FX_FLOAT fVerScale) const; | 121 FX_FLOAT fVerScale) const; |
| 122 FX_BOOL GetEmbbedObj(CXFA_TextProvider* pTextProvider, | 122 FX_BOOL GetEmbbedObj(CXFA_TextProvider* pTextProvider, |
| 123 CFDE_XMLNode* pXMLNode, | 123 CFDE_XMLNode* pXMLNode, |
| 124 CFX_WideString& wsValue); | 124 CFX_WideString& wsValue); |
| 125 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); | 125 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); |
| 126 | 126 |
| 127 protected: |
| 128 bool TagValidate(const CFX_WideString& str) const; |
| 129 |
| 127 private: | 130 private: |
| 128 void InitCSSData(CXFA_TextProvider* pTextProvider); | 131 void InitCSSData(CXFA_TextProvider* pTextProvider); |
| 129 void ParseRichText(CFDE_XMLNode* pXMLNode, | 132 void ParseRichText(CFDE_XMLNode* pXMLNode, |
| 130 IFDE_CSSComputedStyle* pParentStyle); | 133 IFDE_CSSComputedStyle* pParentStyle); |
| 131 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); | 134 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); |
| 132 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); | 135 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); |
| 133 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); | 136 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); |
| 134 IFX_MemoryAllocator* m_pAllocator; | 137 IFX_MemoryAllocator* m_pAllocator; |
| 135 std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector; | 138 std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector; |
| 136 IFDE_CSSStyleSheet* m_pUASheet; | 139 IFDE_CSSStyleSheet* m_pUASheet; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 CXFA_LoaderContext* m_pLoader; | 414 CXFA_LoaderContext* m_pLoader; |
| 412 int32_t m_iLines; | 415 int32_t m_iLines; |
| 413 FX_FLOAT m_fMaxWidth; | 416 FX_FLOAT m_fMaxWidth; |
| 414 CXFA_TextParser m_textParser; | 417 CXFA_TextParser m_textParser; |
| 415 CXFA_PieceLineArray m_pieceLines; | 418 CXFA_PieceLineArray m_pieceLines; |
| 416 CXFA_TextTabstopsContext* m_pTabstopContext; | 419 CXFA_TextTabstopsContext* m_pTabstopContext; |
| 417 FX_BOOL m_bBlockContinue; | 420 FX_BOOL m_bBlockContinue; |
| 418 }; | 421 }; |
| 419 | 422 |
| 420 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 423 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
| OLD | NEW |