1 /* 2 * Copyright 2018 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkPDFTag_DEFINED 9 #define SkPDFTag_DEFINED 10 11 #include "include/docs/SkPDFDocument.h" 12 #include "include/private/SkTArray.h" 13 #include "include/private/SkTHash.h" 14 #include "src/core/SkArenaAlloc.h" 15 16 class SkPDFDocument; 17 struct SkPDFIndirectReference; 18 struct SkPDFTagNode; 19 20 class SkPDFTagTree { 21 public: 22 SkPDFTagTree(); 23 ~SkPDFTagTree(); 24 void init(const SkPDF::StructureElementNode*); 25 void reset(); 26 int getMarkIdForNodeId(int nodeId, unsigned pageIndex); 27 SkPDFIndirectReference makeStructTreeRoot(SkPDFDocument* doc); 28 29 private: 30 SkArenaAlloc fArena; 31 SkTHashMap<int, SkPDFTagNode*> fNodeMap; 32 SkPDFTagNode* fRoot = nullptr; 33 SkTArray<SkTArray<SkPDFTagNode*>> fMarksPerPage; 34 35 SkPDFTagTree(const SkPDFTagTree&) = delete; 36 SkPDFTagTree& operator=(const SkPDFTagTree&) = delete; 37 }; 38 39 #endif 40