• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 _FPDF_TAGGED_H_
8 #define _FPDF_TAGGED_H_
9 class CPDF_StructTree;
10 class CPDF_StructElement;
11 struct CPDF_StructKid;
12 class CPDF_Document;
13 class CPDF_Page;
14 class IPDF_ReflowEngine;
15 class IPDF_ReflowedPage;
16 class CPDF_StructTree : public CFX_Object
17 {
18 public:
19 
20     static CPDF_StructTree* LoadDoc(const CPDF_Document* pDoc);
21 
22     static CPDF_StructTree* LoadPage(const CPDF_Document* pDoc, const CPDF_Dictionary* pPageDict);
23 
~CPDF_StructTree()24     virtual ~CPDF_StructTree() {}
25 
26     virtual int			CountTopElements() const = 0;
27 
28     virtual CPDF_StructElement*	GetTopElement(int i) const = 0;
29 };
30 struct CPDF_StructKid {
31     enum {
32         Invalid,
33         Element,
34         PageContent,
35         StreamContent,
36         Object
37     } m_Type;
38 
39     union {
40         struct {
41 
42             CPDF_StructElement*	m_pElement;
43 
44             CPDF_Dictionary*	m_pDict;
45         } m_Element;
46         struct {
47 
48             FX_DWORD			m_PageObjNum;
49 
50             FX_DWORD			m_ContentId;
51         } m_PageContent;
52         struct {
53 
54             FX_DWORD			m_PageObjNum;
55 
56             FX_DWORD			m_ContentId;
57 
58             FX_DWORD			m_RefObjNum;
59         } m_StreamContent;
60         struct {
61 
62             FX_DWORD			m_PageObjNum;
63 
64             FX_DWORD			m_RefObjNum;
65         } m_Object;
66     };
67 };
68 class CPDF_StructElement : public CFX_Object
69 {
70 public:
71 
72     virtual CPDF_StructTree*	GetTree() const = 0;
73 
74     virtual const CFX_ByteString&	GetType() const = 0;
75 
76     virtual CPDF_StructElement*	GetParent() const = 0;
77 
78     virtual CPDF_Dictionary *	GetDict() const = 0;
79 
80     virtual int					CountKids() const = 0;
81 
82     virtual const CPDF_StructKid&	GetKid(int index) const = 0;
83 
84     virtual CFX_PtrArray*		GetObjectArray() = 0;
85 
86     virtual CPDF_Object*		GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable = FALSE, FX_FLOAT fLevel = 0.0F) = 0;
87 
88 
89 
90     virtual CFX_ByteString		GetName(FX_BSTR owner, FX_BSTR name, FX_BSTR default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0;
91 
92     virtual FX_ARGB				GetColor(FX_BSTR owner, FX_BSTR name, FX_ARGB default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0;
93 
94     virtual FX_FLOAT			GetNumber(FX_BSTR owner, FX_BSTR name, FX_FLOAT default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0;
95 
96     virtual int					GetInteger(FX_BSTR owner, FX_BSTR name, int default_value, FX_BOOL bInheritable = FALSE, int subindex = -1) = 0;
97 
98 };
99 #endif
100