| 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> |
| 11 |
| 10 #include "xfa/fde/css/fde_css.h" | 12 #include "xfa/fde/css/fde_css.h" |
| 11 #include "xfa/fde/fde_gedevice.h" | 13 #include "xfa/fde/fde_gedevice.h" |
| 12 #include "xfa/fgas/layout/fgas_rtfbreak.h" | 14 #include "xfa/fgas/layout/fgas_rtfbreak.h" |
| 13 #include "xfa/fxfa/include/xfa_ffdoc.h" | 15 #include "xfa/fxfa/include/xfa_ffdoc.h" |
| 14 #include "xfa/fxfa/parser/xfa_object.h" | 16 #include "xfa/fxfa/parser/xfa_object.h" |
| 15 | 17 |
| 16 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 | 18 #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 |
| 17 | 19 |
| 18 class CXFA_Para; | 20 class CXFA_Para; |
| 19 class CXFA_Font; | 21 class CXFA_Font; |
| 20 class CXFA_TextProvider; | 22 class CXFA_TextProvider; |
| 21 class CXFA_TextTabstopsContext; | 23 class CXFA_TextTabstopsContext; |
| 22 | 24 |
| 23 class CXFA_CSSTagProvider : public IFDE_CSSTagProvider { | 25 class CXFA_CSSTagProvider { |
| 24 public: | 26 public: |
| 25 CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} | 27 CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} |
| 26 virtual ~CXFA_CSSTagProvider(); | 28 ~CXFA_CSSTagProvider() {} |
| 27 | 29 |
| 28 // Note: |this| must outlive the use of GetTagName()'s result. | 30 CFX_WideString GetTagName() { return m_wsTagName; } |
| 29 virtual CFX_WideStringC GetTagName() { return m_wsTagName.AsStringC(); } | 31 |
| 30 virtual FX_POSITION GetFirstAttribute() { | 32 using AttributeMap = std::map<CFX_WideString, CFX_WideString>; |
| 31 return m_Attributes.GetStartPosition(); | 33 AttributeMap::iterator begin() { return m_Attributes.begin(); } |
| 32 } | 34 AttributeMap::iterator end() { return m_Attributes.end(); } |
| 33 virtual void GetNextAttribute(FX_POSITION& pos, | 35 |
| 34 CFX_WideStringC& wsAttr, | 36 bool empty() const { return m_Attributes.empty(); } |
| 35 CFX_WideStringC& wsValue); | 37 |
| 36 void SetTagNameObj(const CFX_WideString& wsName) { m_wsTagName = wsName; } | 38 void SetTagNameObj(const CFX_WideString& wsName) { m_wsTagName = wsName; } |
| 37 void SetAttribute(const CFX_WideString& wsAttr, | 39 void SetAttribute(const CFX_WideString& wsAttr, |
| 38 const CFX_WideString& wsValue); | 40 const CFX_WideString& wsValue) { |
| 41 m_Attributes.insert({wsAttr, wsValue}); |
| 42 } |
| 43 |
| 39 FX_BOOL m_bTagAviliable; | 44 FX_BOOL m_bTagAviliable; |
| 40 FX_BOOL m_bContent; | 45 FX_BOOL m_bContent; |
| 41 | 46 |
| 42 protected: | 47 protected: |
| 43 CFX_WideString m_wsTagName; | 48 CFX_WideString m_wsTagName; |
| 44 CFX_MapPtrToPtr m_Attributes; | 49 AttributeMap m_Attributes; |
| 45 }; | 50 }; |
| 46 | 51 |
| 47 class CXFA_TextParseContext : public CFX_Target { | 52 class CXFA_TextParseContext : public CFX_Target { |
| 48 public: | 53 public: |
| 49 CXFA_TextParseContext() | 54 CXFA_TextParseContext() |
| 50 : m_pParentStyle(nullptr), | 55 : m_pParentStyle(nullptr), |
| 51 m_ppMatchedDecls(nullptr), | 56 m_ppMatchedDecls(nullptr), |
| 52 m_dwMatchedDecls(0), | 57 m_dwMatchedDecls(0), |
| 53 m_eDisplay(FDE_CSSDISPLAY_None) {} | 58 m_eDisplay(FDE_CSSDISPLAY_None) {} |
| 54 ~CXFA_TextParseContext() { | 59 ~CXFA_TextParseContext() { |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 CXFA_LoaderContext* m_pLoader; | 408 CXFA_LoaderContext* m_pLoader; |
| 404 int32_t m_iLines; | 409 int32_t m_iLines; |
| 405 FX_FLOAT m_fMaxWidth; | 410 FX_FLOAT m_fMaxWidth; |
| 406 CXFA_TextParser m_textParser; | 411 CXFA_TextParser m_textParser; |
| 407 CXFA_PieceLineArray m_pieceLines; | 412 CXFA_PieceLineArray m_pieceLines; |
| 408 CXFA_TextTabstopsContext* m_pTabstopContext; | 413 CXFA_TextTabstopsContext* m_pTabstopContext; |
| 409 FX_BOOL m_bBlockContinue; | 414 FX_BOOL m_bBlockContinue; |
| 410 }; | 415 }; |
| 411 | 416 |
| 412 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ | 417 #endif // XFA_FXFA_APP_XFA_TEXTLAYOUT_H_ |
| OLD | NEW |