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