1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef XFA_FXFA_CXFA_TEXTPROVIDER_H_ 8 #define XFA_FXFA_CXFA_TEXTPROVIDER_H_ 9 10 #include "core/fxcrt/fx_string.h" 11 #include "third_party/base/optional.h" 12 #include "xfa/fxfa/cxfa_textlayout.h" 13 14 class CXFA_Font; 15 class CXFA_Node; 16 class CXFA_Para; 17 18 enum XFA_TEXTPROVIDERTYPE { 19 XFA_TEXTPROVIDERTYPE_Text, 20 XFA_TEXTPROVIDERTYPE_Datasets, 21 XFA_TEXTPROVIDERTYPE_Caption, 22 XFA_TEXTPROVIDERTYPE_Rollover, 23 XFA_TEXTPROVIDERTYPE_Down, 24 }; 25 26 class CXFA_TextProvider { 27 public: CXFA_TextProvider(CXFA_Node * pNode,XFA_TEXTPROVIDERTYPE eType)28 CXFA_TextProvider(CXFA_Node* pNode, XFA_TEXTPROVIDERTYPE eType) 29 : m_pNode(pNode), m_eType(eType) { 30 ASSERT(m_pNode); 31 } ~CXFA_TextProvider()32 ~CXFA_TextProvider() {} 33 34 CXFA_Node* GetTextNode(bool* bRichText); 35 CXFA_Para* GetParaIfExists(); 36 CXFA_Font* GetFontIfExists(); 37 bool IsCheckButtonAndAutoWidth() const; 38 Optional<WideString> GetEmbeddedObj(const WideString& wsAttr) const; 39 40 private: 41 CXFA_Node* m_pNode; // Raw, this class owned by tree node. 42 XFA_TEXTPROVIDERTYPE m_eType; 43 }; 44 45 #endif // XFA_FXFA_CXFA_TEXTPROVIDER_H_ 46