summaryrefslogtreecommitdiff
path: root/core/include/fpdfdoc/fpdf_tagged.h
blob: 28fe84b41ab214d3f94f5e3acc86defa4801b4e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_
#define CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_

#include "core/include/fxge/fx_dib.h"

class CPDF_Document;
class CPDF_StructElement;
class CPDF_StructTree;
struct CPDF_StructKid;

class CPDF_StructTree {
 public:
  static CPDF_StructTree* LoadDoc(const CPDF_Document* pDoc);

  static CPDF_StructTree* LoadPage(const CPDF_Document* pDoc,
                                   const CPDF_Dictionary* pPageDict);

  virtual ~CPDF_StructTree() {}

  virtual int CountTopElements() const = 0;

  virtual CPDF_StructElement* GetTopElement(int i) const = 0;
};
struct CPDF_StructKid {
  enum { Invalid, Element, PageContent, StreamContent, Object } m_Type;

  union {
    struct {
      CPDF_StructElement* m_pElement;

      CPDF_Dictionary* m_pDict;
    } m_Element;
    struct {
      FX_DWORD m_PageObjNum;

      FX_DWORD m_ContentId;
    } m_PageContent;
    struct {
      FX_DWORD m_PageObjNum;

      FX_DWORD m_ContentId;

      FX_DWORD m_RefObjNum;
    } m_StreamContent;
    struct {
      FX_DWORD m_PageObjNum;

      FX_DWORD m_RefObjNum;
    } m_Object;
  };
};
class CPDF_StructElement {
 public:
  virtual ~CPDF_StructElement() {}

  virtual CPDF_StructTree* GetTree() const = 0;

  virtual const CFX_ByteString& GetType() const = 0;

  virtual CPDF_StructElement* GetParent() const = 0;

  virtual CPDF_Dictionary* GetDict() const = 0;

  virtual int CountKids() const = 0;

  virtual const CPDF_StructKid& GetKid(int index) const = 0;

  virtual CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
                               const CFX_ByteStringC& name,
                               FX_BOOL bInheritable = FALSE,
                               FX_FLOAT fLevel = 0.0F) = 0;

  virtual CFX_ByteString GetName(const CFX_ByteStringC& owner,
                                 const CFX_ByteStringC& name,
                                 const CFX_ByteStringC& default_value,
                                 FX_BOOL bInheritable = FALSE,
                                 int subindex = -1) = 0;

  virtual FX_ARGB GetColor(const CFX_ByteStringC& owner,
                           const CFX_ByteStringC& name,
                           FX_ARGB default_value,
                           FX_BOOL bInheritable = FALSE,
                           int subindex = -1) = 0;

  virtual FX_FLOAT GetNumber(const CFX_ByteStringC& owner,
                             const CFX_ByteStringC& name,
                             FX_FLOAT default_value,
                             FX_BOOL bInheritable = FALSE,
                             int subindex = -1) = 0;

  virtual int GetInteger(const CFX_ByteStringC& owner,
                         const CFX_ByteStringC& name,
                         int default_value,
                         FX_BOOL bInheritable = FALSE,
                         int subindex = -1) = 0;
};

#endif  // CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_