| 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 "xfa/fde/css/fde_css.h" | 10 #include "xfa/fde/css/fde_css.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 IFDE_CSSDeclaration** m_ppMatchedDecls; | 81 IFDE_CSSDeclaration** m_ppMatchedDecls; |
| 82 uint32_t m_dwMatchedDecls; | 82 uint32_t m_dwMatchedDecls; |
| 83 FDE_CSSDISPLAY m_eDisplay; | 83 FDE_CSSDISPLAY m_eDisplay; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 class CXFA_TextParser { | 86 class CXFA_TextParser { |
| 87 public: | 87 public: |
| 88 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} | 88 CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} |
| 89 virtual ~CXFA_TextParser(); | 89 virtual ~CXFA_TextParser(); |
| 90 void Reset(); | 90 void Reset(); |
| 91 void DoParse(IFDE_XMLNode* pXMLContainer, IXFA_TextProvider* pTextProvider); | 91 void DoParse(CFDE_XMLNode* pXMLContainer, IXFA_TextProvider* pTextProvider); |
| 92 IFDE_CSSComputedStyle* CreateRootStyle(IXFA_TextProvider* pTextProvider); | 92 IFDE_CSSComputedStyle* CreateRootStyle(IXFA_TextProvider* pTextProvider); |
| 93 IFDE_CSSComputedStyle* ComputeStyle(IFDE_XMLNode* pXMLNode, | 93 IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode, |
| 94 IFDE_CSSComputedStyle* pParentStyle); | 94 IFDE_CSSComputedStyle* pParentStyle); |
| 95 FX_BOOL IsParsed() const { return m_pAllocator != NULL; } | 95 FX_BOOL IsParsed() const { return m_pAllocator != NULL; } |
| 96 | 96 |
| 97 int32_t GetVAlgin(IXFA_TextProvider* pTextProvider) const; | 97 int32_t GetVAlgin(IXFA_TextProvider* pTextProvider) const; |
| 98 FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const; | 98 FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const; |
| 99 int32_t CountTabs(IFDE_CSSComputedStyle* pStyle) const; | 99 int32_t CountTabs(IFDE_CSSComputedStyle* pStyle) const; |
| 100 FX_BOOL IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const; | 100 FX_BOOL IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const; |
| 101 FX_BOOL GetTabstops(IFDE_CSSComputedStyle* pStyle, | 101 FX_BOOL GetTabstops(IFDE_CSSComputedStyle* pStyle, |
| 102 CXFA_TextTabstopsContext* pTabstopContext); | 102 CXFA_TextTabstopsContext* pTabstopContext); |
| 103 IFX_Font* GetFont(IXFA_TextProvider* pTextProvider, | 103 IFX_Font* GetFont(IXFA_TextProvider* pTextProvider, |
| 104 IFDE_CSSComputedStyle* pStyle) const; | 104 IFDE_CSSComputedStyle* pStyle) const; |
| 105 FX_FLOAT GetFontSize(IXFA_TextProvider* pTextProvider, | 105 FX_FLOAT GetFontSize(IXFA_TextProvider* pTextProvider, |
| 106 IFDE_CSSComputedStyle* pStyle) const; | 106 IFDE_CSSComputedStyle* pStyle) const; |
| 107 int32_t GetHorScale(IXFA_TextProvider* pTextProvider, | 107 int32_t GetHorScale(IXFA_TextProvider* pTextProvider, |
| 108 IFDE_CSSComputedStyle* pStyle, | 108 IFDE_CSSComputedStyle* pStyle, |
| 109 IFDE_XMLNode* pXMLNode) const; | 109 CFDE_XMLNode* pXMLNode) const; |
| 110 int32_t GetVerScale(IXFA_TextProvider* pTextProvider, | 110 int32_t GetVerScale(IXFA_TextProvider* pTextProvider, |
| 111 IFDE_CSSComputedStyle* pStyle) const; | 111 IFDE_CSSComputedStyle* pStyle) const; |
| 112 void GetUnderline(IXFA_TextProvider* pTextProvider, | 112 void GetUnderline(IXFA_TextProvider* pTextProvider, |
| 113 IFDE_CSSComputedStyle* pStyle, | 113 IFDE_CSSComputedStyle* pStyle, |
| 114 int32_t& iUnderline, | 114 int32_t& iUnderline, |
| 115 int32_t& iPeriod) const; | 115 int32_t& iPeriod) const; |
| 116 void GetLinethrough(IXFA_TextProvider* pTextProvider, | 116 void GetLinethrough(IXFA_TextProvider* pTextProvider, |
| 117 IFDE_CSSComputedStyle* pStyle, | 117 IFDE_CSSComputedStyle* pStyle, |
| 118 int32_t& iLinethrough) const; | 118 int32_t& iLinethrough) const; |
| 119 FX_ARGB GetColor(IXFA_TextProvider* pTextProvider, | 119 FX_ARGB GetColor(IXFA_TextProvider* pTextProvider, |
| 120 IFDE_CSSComputedStyle* pStyle) const; | 120 IFDE_CSSComputedStyle* pStyle) const; |
| 121 FX_FLOAT GetBaseline(IXFA_TextProvider* pTextProvider, | 121 FX_FLOAT GetBaseline(IXFA_TextProvider* pTextProvider, |
| 122 IFDE_CSSComputedStyle* pStyle) const; | 122 IFDE_CSSComputedStyle* pStyle) const; |
| 123 FX_FLOAT GetLineHeight(IXFA_TextProvider* pTextProvider, | 123 FX_FLOAT GetLineHeight(IXFA_TextProvider* pTextProvider, |
| 124 IFDE_CSSComputedStyle* pStyle, | 124 IFDE_CSSComputedStyle* pStyle, |
| 125 FX_BOOL bFirst, | 125 FX_BOOL bFirst, |
| 126 FX_FLOAT fVerScale) const; | 126 FX_FLOAT fVerScale) const; |
| 127 FX_BOOL GetEmbbedObj(IXFA_TextProvider* pTextProvider, | 127 FX_BOOL GetEmbbedObj(IXFA_TextProvider* pTextProvider, |
| 128 IFDE_XMLNode* pXMLNode, | 128 CFDE_XMLNode* pXMLNode, |
| 129 CFX_WideString& wsValue); | 129 CFX_WideString& wsValue); |
| 130 CXFA_TextParseContext* GetParseContextFromMap(IFDE_XMLNode* pXMLNode); | 130 CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 void InitCSSData(IXFA_TextProvider* pTextProvider); | 133 void InitCSSData(IXFA_TextProvider* pTextProvider); |
| 134 void ParseRichText(IFDE_XMLNode* pXMLNode, | 134 void ParseRichText(CFDE_XMLNode* pXMLNode, |
| 135 IFDE_CSSComputedStyle* pParentStyle); | 135 IFDE_CSSComputedStyle* pParentStyle); |
| 136 void ParseTagInfo(IFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); | 136 void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); |
| 137 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); | 137 IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); |
| 138 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); | 138 IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); |
| 139 IFX_MEMAllocator* m_pAllocator; | 139 IFX_MEMAllocator* m_pAllocator; |
| 140 IFDE_CSSStyleSelector* m_pSelector; | 140 IFDE_CSSStyleSelector* m_pSelector; |
| 141 IFDE_CSSStyleSheet* m_pUASheet; | 141 IFDE_CSSStyleSheet* m_pUASheet; |
| 142 CFX_MapPtrTemplate<IFDE_XMLNode*, CXFA_TextParseContext*> | 142 CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*> |
| 143 m_mapXMLNodeToParseContext; | 143 m_mapXMLNodeToParseContext; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 class CXFA_LoaderContext { | 146 class CXFA_LoaderContext { |
| 147 public: | 147 public: |
| 148 CXFA_LoaderContext() | 148 CXFA_LoaderContext() |
| 149 : m_bSaveLineHeight(FALSE), | 149 : m_bSaveLineHeight(FALSE), |
| 150 m_fWidth(0), | 150 m_fWidth(0), |
| 151 m_fHeight(0), | 151 m_fHeight(0), |
| 152 m_fLastPos(0), | 152 m_fLastPos(0), |
| 153 m_fStartLineOffset(0), | 153 m_fStartLineOffset(0), |
| 154 m_iChar(0), | 154 m_iChar(0), |
| 155 m_iTotalLines(-1), | 155 m_iTotalLines(-1), |
| 156 m_pXMLNode(NULL), | 156 m_pXMLNode(NULL), |
| 157 m_pNode(NULL), | 157 m_pNode(NULL), |
| 158 m_pParentStyle(NULL), | 158 m_pParentStyle(NULL), |
| 159 m_dwFlags(0) {} | 159 m_dwFlags(0) {} |
| 160 FX_BOOL m_bSaveLineHeight; | 160 FX_BOOL m_bSaveLineHeight; |
| 161 FX_FLOAT m_fWidth; | 161 FX_FLOAT m_fWidth; |
| 162 FX_FLOAT m_fHeight; | 162 FX_FLOAT m_fHeight; |
| 163 FX_FLOAT m_fLastPos; | 163 FX_FLOAT m_fLastPos; |
| 164 FX_FLOAT m_fStartLineOffset; | 164 FX_FLOAT m_fStartLineOffset; |
| 165 int32_t m_iChar; | 165 int32_t m_iChar; |
| 166 int32_t m_iLines; | 166 int32_t m_iLines; |
| 167 int32_t m_iTotalLines; | 167 int32_t m_iTotalLines; |
| 168 IFDE_XMLNode* m_pXMLNode; | 168 CFDE_XMLNode* m_pXMLNode; |
| 169 CXFA_Node* m_pNode; | 169 CXFA_Node* m_pNode; |
| 170 IFDE_CSSComputedStyle* m_pParentStyle; | 170 IFDE_CSSComputedStyle* m_pParentStyle; |
| 171 CFX_ArrayTemplate<FX_FLOAT> m_lineHeights; | 171 CFX_ArrayTemplate<FX_FLOAT> m_lineHeights; |
| 172 uint32_t m_dwFlags; | 172 uint32_t m_dwFlags; |
| 173 CFX_FloatArray m_BlocksHeight; | 173 CFX_FloatArray m_BlocksHeight; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { | 176 class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { |
| 177 public: | 177 public: |
| 178 CXFA_LinkUserData(IFX_MEMAllocator* pAllocator, FX_WCHAR* pszText) | 178 CXFA_LinkUserData(IFX_MEMAllocator* pAllocator, FX_WCHAR* pszText) |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 IFDE_XMLNode* GetXMLContainerNode(); | 355 CFDE_XMLNode* GetXMLContainerNode(); |
| 356 IFX_RTFBreak* CreateBreak(FX_BOOL bDefault); | 356 IFX_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 IFDE_XMLNode* pXMLNode, | 361 CFDE_XMLNode* pXMLNode, |
| 362 IFDE_CSSComputedStyle* pParentStyle = NULL); | 362 IFDE_CSSComputedStyle* pParentStyle = NULL); |
| 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(IFDE_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 = NULL, |
| 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, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 CXFA_LoaderContext* m_pLoader; | 416 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 CXFA_TextTabstopsContext* m_pTabstopContext; | 421 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 |