• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The PDFium Authors
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 <optional>
11 
12 #include "core/fxcrt/widestring.h"
13 #include "fxjs/gc/heap.h"
14 #include "v8/include/cppgc/garbage-collected.h"
15 #include "v8/include/cppgc/member.h"
16 #include "v8/include/cppgc/visitor.h"
17 #include "xfa/fxfa/cxfa_textlayout.h"
18 
19 class CXFA_Font;
20 class CXFA_Node;
21 class CXFA_Para;
22 
23 class CXFA_TextProvider : public cppgc::GarbageCollected<CXFA_TextProvider> {
24  public:
25   enum class Type : uint8_t {
26     kText,
27     kCaption,
28     kRollover,
29     kDown,
30   };
31 
32   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
33   ~CXFA_TextProvider();
34 
35   void Trace(cppgc::Visitor* visitor) const;
36 
37   CXFA_Node* GetTextNode(bool* bRichText);
38   CXFA_Para* GetParaIfExists();
39   CXFA_Font* GetFontIfExists();
40   bool IsCheckButtonAndAutoWidth() const;
41   std::optional<WideString> GetEmbeddedObj(const WideString& wsAttr) const;
42 
43  private:
44   CXFA_TextProvider(CXFA_Node* pNode, Type eType);
45 
46   cppgc::Member<CXFA_Node> m_pNode;
47   const Type m_eType;
48 };
49 
50 #endif  // XFA_FXFA_CXFA_TEXTPROVIDER_H_
51