Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_structtree.h
Go to the documentation of this file.
1// Copyright 2017 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 CORE_FPDFDOC_CPDF_STRUCTTREE_H_
8#define CORE_FPDFDOC_CPDF_STRUCTTREE_H_
9
10#include <functional>
11#include <map>
12#include <memory>
13#include <vector>
14
15#include "core/fpdfapi/parser/cpdf_dictionary.h"
16#include "core/fxcrt/bytestring.h"
17#include "core/fxcrt/retain_ptr.h"
18
19class CPDF_Document;
20class CPDF_StructElement;
21
23 public:
25 const CPDF_Document* pDoc,
26 RetainPtr<const CPDF_Dictionary> pPageDict);
27
28 explicit CPDF_StructTree(const CPDF_Document* pDoc);
30
31 size_t CountTopElements() const { return m_Kids.size(); }
32 CPDF_StructElement* GetTopElement(size_t i) const { return m_Kids[i].Get(); }
33 uint32_t GetPageObjNum() const { return m_pPage->GetObjNum(); }
34 ByteString GetRoleMapNameFor(const ByteString& type) const;
35
36 private:
39 std::less<>>;
40
41 void LoadPageTree(RetainPtr<const CPDF_Dictionary> pPageDict);
42 RetainPtr<CPDF_StructElement> AddPageNode(
43 RetainPtr<const CPDF_Dictionary> pDict,
44 StructElementMap* map,
45 int nLevel);
46 bool AddTopLevelNode(const CPDF_Dictionary* pDict,
47 const RetainPtr<CPDF_StructElement>& pElement);
48
49 RetainPtr<const CPDF_Dictionary> const m_pTreeRoot;
50 RetainPtr<const CPDF_Dictionary> const m_pRoleMap;
51 RetainPtr<const CPDF_Dictionary> m_pPage;
52 std::vector<RetainPtr<CPDF_StructElement>> m_Kids;
53};
54
55#endif // CORE_FPDFDOC_CPDF_STRUCTTREE_H_
int GetIntegerFor(const ByteString &key) const
ByteString GetNameFor(const ByteString &key) const
uint32_t GetRefObjNum() const
void SetParent(CPDF_StructElement *pParentElement)
int GetKidContentId(size_t index) const
absl::optional< WideString > GetID() const
bool UpdateKidIfElement(const CPDF_Dictionary *pDict, CPDF_StructElement *pElement)
ByteString GetType() const
RetainPtr< const CPDF_Object > GetK() const
WideString GetTitle() const
absl::optional< WideString > GetLang() const
CPDF_StructElement * GetKidIfElement(size_t index) const
WideString GetActualText() const
CPDF_StructElement * GetParent() const
ByteString GetObjType() const
WideString GetAltText() const
RetainPtr< const CPDF_Object > GetA() const
static std::unique_ptr< CPDF_StructTree > LoadPage(const CPDF_Document *pDoc, RetainPtr< const CPDF_Dictionary > pPageDict)
size_t CountTopElements() const
CPDF_StructElement * GetTopElement(size_t i) const
uint32_t GetPageObjNum() const
CPDF_StructTree(const CPDF_Document *pDoc)
ByteString GetRoleMapNameFor(const ByteString &type) const
bool operator==(const char *ptr) const
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:224