node-poppler 5.1.4 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/README.md +2 -0
  2. package/package.json +13 -13
  3. package/src/index.js +20 -8
  4. package/API.md +0 -465
  5. package/CHANGELOG.md +0 -976
  6. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Annot.h +0 -1783
  7. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/AnnotStampImageHelper.h +0 -68
  8. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Array.h +0 -92
  9. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/BBoxOutputDev.h +0 -54
  10. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CMap.h +0 -128
  11. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CachedFile.h +0 -149
  12. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoFontEngine.h +0 -122
  13. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoOutputDev.h +0 -468
  14. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CairoRescaleBox.h +0 -60
  15. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Catalog.h +0 -318
  16. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CertificateInfo.h +0 -129
  17. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CharCodeToUnicode.h +0 -143
  18. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CharTypes.h +0 -24
  19. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CurlCachedFile.h +0 -37
  20. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/CurlPDFDocBuilder.h +0 -32
  21. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/DateInfo.h +0 -44
  22. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Decrypt.h +0 -147
  23. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Dict.h +0 -126
  24. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Error.h +0 -59
  25. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ErrorCodes.h +0 -54
  26. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FDPDFDocBuilder.h +0 -36
  27. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FILECacheLoader.h +0 -34
  28. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FileSpec.h +0 -85
  29. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FontEncodingTables.h +0 -20
  30. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/FontInfo.h +0 -109
  31. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Form.h +0 -734
  32. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Function.h +0 -251
  33. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Gfx.h +0 -373
  34. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxFont.h +0 -466
  35. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxState.h +0 -1759
  36. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GfxState_helpers.h +0 -90
  37. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/GlobalParams.h +0 -221
  38. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Hints.h +0 -91
  39. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JArithmeticDecoder.h +0 -131
  40. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JBIG2Stream.h +0 -130
  41. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JPEG2000Stream.h +0 -54
  42. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/JSInfo.h +0 -65
  43. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Lexer.h +0 -113
  44. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Linearization.h +0 -43
  45. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Link.h +0 -566
  46. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/LocalPDFDocBuilder.h +0 -32
  47. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/MarkedContentOutputDev.h +0 -132
  48. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Movie.h +0 -123
  49. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/NameToCharCode.h +0 -52
  50. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/NameToUnicodeTable.h +0 -4300
  51. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Object.h +0 -678
  52. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/OptionalContent.h +0 -117
  53. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Outline.h +0 -122
  54. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/OutputDev.h +0 -379
  55. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDoc.h +0 -419
  56. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocBuilder.h +0 -47
  57. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocEncoding.h +0 -43
  58. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PDFDocFactory.h +0 -58
  59. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PSOutputDev.h +0 -549
  60. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PSTokenizer.h +0 -47
  61. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Page.h +0 -273
  62. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PageTransition.h +0 -105
  63. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Parser.h +0 -76
  64. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PopplerCache.h +0 -65
  65. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/PreScanOutputDev.h +0 -148
  66. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ProfileData.h +0 -35
  67. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Rendition.h +0 -164
  68. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/SecurityHandler.h +0 -131
  69. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Sound.h +0 -82
  70. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/SplashOutputDev.h +0 -413
  71. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Stream-CCITT.h +0 -334
  72. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/Stream.h +0 -1504
  73. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/StructElement.h +0 -406
  74. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/StructTreeRoot.h +0 -89
  75. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/TextOutputDev.h +0 -918
  76. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UTF.h +0 -112
  77. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeCClassTables.h +0 -983
  78. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeCompTables.h +0 -328
  79. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeDecompTables.h +0 -7181
  80. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMap.h +0 -128
  81. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMapFuncs.h +0 -35
  82. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeMapTables.h +0 -84
  83. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/UnicodeTypeTable.h +0 -49
  84. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/ViewerPreferences.h +0 -87
  85. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/XRef.h +0 -325
  86. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-destination.h +0 -69
  87. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-document.h +0 -135
  88. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-embedded-file.h +0 -55
  89. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-font-private.h +0 -68
  90. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-font.h +0 -95
  91. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-global.h +0 -132
  92. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-image.h +0 -74
  93. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page-renderer.h +0 -77
  94. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page-transition.h +0 -85
  95. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-page.h +0 -225
  96. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-rectangle.h +0 -66
  97. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-toc.h +0 -72
  98. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler-version.h +0 -39
  99. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/cpp/poppler_cpp_export.h +0 -42
  100. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiBase.h +0 -66
  101. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiEncodings.h +0 -43
  102. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiIdentifier.h +0 -52
  103. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiTrueType.h +0 -190
  104. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiType1.h +0 -70
  105. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/fofi/FoFiType1C.h +0 -263
  106. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-action.h +0 -454
  107. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-annot.h +0 -333
  108. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-attachment.h +0 -123
  109. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-date.h +0 -32
  110. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-document.h +0 -541
  111. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-enums.h +0 -191
  112. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-features.h +0 -88
  113. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-form-field.h +0 -254
  114. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-layer.h +0 -50
  115. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-macros.h +0 -42
  116. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-media.h +0 -80
  117. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-movie.h +0 -81
  118. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-page.h +0 -424
  119. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler-structure-element.h +0 -425
  120. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/glib/poppler.h +0 -259
  121. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooCheckedOps.h +0 -116
  122. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooLikely.h +0 -22
  123. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooString.h +0 -262
  124. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/GooTimer.h +0 -59
  125. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/ImgWriter.h +0 -39
  126. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/JpegWriter.h +0 -69
  127. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/PNGWriter.h +0 -68
  128. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/TiffWriter.h +0 -70
  129. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gdir.h +0 -96
  130. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gfile.h +0 -156
  131. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gmem.h +0 -201
  132. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/grandom.h +0 -21
  133. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/goo/gstrtod.h +0 -45
  134. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/poppler-config.h +0 -155
  135. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/poppler_private_export.h +0 -42
  136. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/Splash.h +0 -336
  137. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashBitmap.h +0 -127
  138. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashClip.h +0 -131
  139. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashErrorCodes.h +0 -50
  140. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFont.h +0 -71
  141. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFontEngine.h +0 -72
  142. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFTFontFile.h +0 -64
  143. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFont.h +0 -116
  144. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontEngine.h +0 -89
  145. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontFile.h +0 -98
  146. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashFontFileID.h +0 -40
  147. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashGlyphBitmap.h +0 -23
  148. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashMath.h +0 -215
  149. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashPath.h +0 -138
  150. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashPattern.h +0 -107
  151. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashScreen.h +0 -87
  152. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashState.h +0 -132
  153. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashTypes.h +0 -248
  154. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashXPath.h +0 -95
  155. package/src/lib/win32/poppler-22.04.0/Library/include/poppler/splash/SplashXPathScanner.h +0 -136
  156. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler-cpp.pc +0 -12
  157. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler-glib.pc +0 -12
  158. package/src/lib/win32/poppler-22.04.0/Library/lib/pkgconfig/poppler.pc +0 -10
  159. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler-cpp.lib +0 -0
  160. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler-glib.lib +0 -0
  161. package/src/lib/win32/poppler-22.04.0/Library/lib/poppler.lib +0 -0
  162. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfattach.1 +0 -60
  163. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfdetach.1 +0 -94
  164. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdffonts.1 +0 -128
  165. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfimages.1 +0 -265
  166. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfinfo.1 +0 -198
  167. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfseparate.1 +0 -60
  168. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftocairo.1 +0 -346
  169. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftohtml.1 +0 -118
  170. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftoppm.1 +0 -230
  171. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftops.1 +0 -267
  172. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdftotext.1 +0 -157
  173. package/src/lib/win32/poppler-22.04.0/Library/share/man/man1/pdfunite.1 +0 -43
  174. package/src/lib/win32/poppler-22.04.0/share/poppler/CMakeLists.txt +0 -309
  175. package/src/lib/win32/poppler-22.04.0/share/poppler/Makefile +0 -333
  176. package/tsconfig.json +0 -9
@@ -1,406 +0,0 @@
1
- //========================================================================
2
- //
3
- // StructElement.h
4
- //
5
- // This file is licensed under the GPLv2 or later
6
- //
7
- // Copyright 2013, 2014 Igalia S.L.
8
- // Copyright 2014 Luigi Scarso <luigi.scarso@gmail.com>
9
- // Copyright 2014, 2018, 2019, 2021 Albert Astals Cid <aacid@kde.org>
10
- // Copyright 2018 Adam Reichold <adam.reichold@t-online.de>
11
- // Copyright 2021 Adrian Johnson <ajohnson@redneon.com>
12
- //
13
- //========================================================================
14
-
15
- #ifndef STRUCTELEMENT_H
16
- #define STRUCTELEMENT_H
17
-
18
- #include "goo/GooString.h"
19
- #include "MarkedContentOutputDev.h"
20
- #include "Object.h"
21
- #include "poppler_private_export.h"
22
- #include <vector>
23
- #include <set>
24
-
25
- class GooString;
26
- class Dict;
27
- class StructElement;
28
- class StructTreeRoot;
29
-
30
- class POPPLER_PRIVATE_EXPORT Attribute
31
- {
32
- public:
33
- enum Type
34
- {
35
- Unknown = 0, // Uninitialized, parsing error, etc.
36
- UserProperty, // User defined attribute (i.e. non-standard)
37
-
38
- // Common standard attributes
39
- Placement,
40
- WritingMode,
41
- BackgroundColor,
42
- BorderColor,
43
- BorderStyle,
44
- BorderThickness,
45
- Color,
46
- Padding,
47
-
48
- // Block element standard attributes
49
- SpaceBefore,
50
- SpaceAfter,
51
- StartIndent,
52
- EndIndent,
53
- TextIndent,
54
- TextAlign,
55
- BBox,
56
- Width,
57
- Height,
58
- BlockAlign,
59
- InlineAlign,
60
- TBorderStyle,
61
- TPadding,
62
-
63
- // Inline element standard attributes
64
- BaselineShift,
65
- LineHeight,
66
- TextDecorationColor,
67
- TextDecorationThickness,
68
- TextDecorationType,
69
- RubyAlign,
70
- RubyPosition,
71
- GlyphOrientationVertical,
72
-
73
- // Column-only standard attributes
74
- ColumnCount,
75
- ColumnGap,
76
- ColumnWidths,
77
-
78
- // List-only standard attributes
79
- ListNumbering,
80
-
81
- // PrintField-only standard attributes
82
- Role,
83
- checked,
84
- Desc,
85
-
86
- // Table-only standard attributes
87
- RowSpan,
88
- ColSpan,
89
- Headers,
90
- Scope,
91
- Summary,
92
- };
93
-
94
- enum Owner
95
- {
96
- UnknownOwner = 0,
97
- // User-defined attributes
98
- UserProperties,
99
- // Standard attributes
100
- Layout,
101
- List,
102
- PrintField,
103
- Table,
104
- // Translation to other formats
105
- XML_1_00,
106
- HTML_3_20,
107
- HTML_4_01,
108
- OEB_1_00,
109
- RTF_1_05,
110
- CSS_1_00,
111
- CSS_2_00,
112
- };
113
-
114
- // Creates a standard attribute. The name is predefined, and the
115
- // value is type-checked to conform to the PDF specification.
116
- Attribute(Type type, Object *value);
117
-
118
- // Creates an UserProperty attribute, with an arbitrary name and value.
119
- Attribute(GooString &&name, Object *value);
120
-
121
- bool isOk() const { return type != Unknown; }
122
-
123
- // Name, type and value can be set only on construction.
124
- Type getType() const { return type; }
125
- Owner getOwner() const { return owner; }
126
- const char *getTypeName() const;
127
- const char *getOwnerName() const;
128
- const Object *getValue() const { return &value; }
129
- static Object *getDefaultValue(Type type);
130
-
131
- // The caller gets the ownership of the return GooString and is responsible of deleting it
132
- std::unique_ptr<GooString> getName() const { return std::make_unique<GooString>(type == UserProperty ? name.c_str() : getTypeName()); }
133
-
134
- // The revision is optional, and defaults to zero.
135
- unsigned int getRevision() const { return revision; }
136
- void setRevision(unsigned int revisionA) { revision = revisionA; }
137
-
138
- // Hidden elements should not be displayed by the user agent
139
- bool isHidden() const { return hidden; }
140
- void setHidden(bool hiddenA) { hidden = hiddenA; }
141
-
142
- // The formatted value may be in the PDF, or be left undefined (nullptr).
143
- // In the later case the user agent should provide a default representation.
144
- const char *getFormattedValue() const { return formatted ? formatted->c_str() : nullptr; }
145
- void setFormattedValue(const char *formattedA);
146
-
147
- ~Attribute();
148
-
149
- private:
150
- Type type;
151
- Owner owner;
152
- unsigned int revision;
153
- GooString name;
154
- Object value;
155
- bool hidden;
156
- GooString *formatted;
157
-
158
- bool checkType(StructElement *element = nullptr);
159
- static Type getTypeForName(const char *name, StructElement *element = nullptr);
160
- static Attribute *parseUserProperty(Dict *property);
161
-
162
- friend class StructElement;
163
- };
164
-
165
- class POPPLER_PRIVATE_EXPORT StructElement
166
- {
167
- public:
168
- enum Type
169
- {
170
- Unknown = 0,
171
- MCID, // MCID reference, used internally
172
- OBJR, // Object reference, used internally
173
-
174
- Document,
175
- Part,
176
- Art,
177
- Sect,
178
- Div, // Structural elements
179
-
180
- Span,
181
- Quote,
182
- Note,
183
- Reference,
184
- BibEntry, // Inline elements
185
- Code,
186
- Link,
187
- Annot,
188
- BlockQuote,
189
- Caption,
190
- NonStruct,
191
- TOC,
192
- TOCI,
193
- Index,
194
- Private,
195
-
196
- P,
197
- H,
198
- H1,
199
- H2,
200
- H3,
201
- H4,
202
- H5,
203
- H6, // Paragraph-like
204
-
205
- L,
206
- LI,
207
- Lbl,
208
- LBody, // List elements
209
-
210
- Table,
211
- TR,
212
- TH,
213
- TD,
214
- THead,
215
- TFoot,
216
- TBody, // Table elements
217
-
218
- Ruby,
219
- RB,
220
- RT,
221
- RP, // Ruby text elements
222
- Warichu,
223
- WT,
224
- WP,
225
-
226
- Figure,
227
- Formula,
228
- Form, // Illustration-like elements
229
- };
230
-
231
- static const Ref InvalidRef;
232
-
233
- const char *getTypeName() const;
234
- Type getType() const { return type; }
235
- bool isOk() const { return type != Unknown; }
236
- bool isBlock() const;
237
- bool isInline() const;
238
- bool isGrouping() const;
239
-
240
- inline bool isContent() const { return (type == MCID) || isObjectRef(); }
241
- inline bool isObjectRef() const { return (type == OBJR && c->ref != Ref::INVALID()); }
242
-
243
- int getMCID() const { return c->mcid; }
244
- Ref getObjectRef() const { return c->ref; }
245
- Ref getParentRef() { return isContent() ? parent->getParentRef() : s->parentRef; }
246
- bool hasPageRef() const;
247
- bool getPageRef(Ref &ref) const;
248
- StructTreeRoot *getStructTreeRoot() { return treeRoot; }
249
-
250
- // Optional element identifier.
251
- const GooString *getID() const { return isContent() ? nullptr : s->id; }
252
- GooString *getID() { return isContent() ? nullptr : s->id; }
253
-
254
- // Optional ISO language name, e.g. en_US
255
- GooString *getLanguage()
256
- {
257
- if (!isContent() && s->language) {
258
- return s->language;
259
- }
260
- return parent ? parent->getLanguage() : nullptr;
261
- }
262
- const GooString *getLanguage() const
263
- {
264
- if (!isContent() && s->language) {
265
- return s->language;
266
- }
267
- return parent ? parent->getLanguage() : nullptr;
268
- }
269
-
270
- // Optional revision number, defaults to zero.
271
- unsigned int getRevision() const { return isContent() ? 0 : s->revision; }
272
- void setRevision(unsigned int revision)
273
- {
274
- if (isContent()) {
275
- s->revision = revision;
276
- }
277
- }
278
-
279
- // Optional element title, in human-readable form.
280
- const GooString *getTitle() const { return isContent() ? nullptr : s->title; }
281
- GooString *getTitle() { return isContent() ? nullptr : s->title; }
282
-
283
- // Optional element expanded abbreviation text.
284
- const GooString *getExpandedAbbr() const { return isContent() ? nullptr : s->expandedAbbr; }
285
- GooString *getExpandedAbbr() { return isContent() ? nullptr : s->expandedAbbr; }
286
-
287
- unsigned getNumChildren() const { return isContent() ? 0 : s->elements.size(); }
288
- const StructElement *getChild(int i) const { return isContent() ? nullptr : s->elements.at(i); }
289
- StructElement *getChild(int i) { return isContent() ? nullptr : s->elements.at(i); }
290
-
291
- void appendChild(StructElement *element)
292
- {
293
- if (!isContent() && element && element->isOk()) {
294
- s->elements.push_back(element);
295
- }
296
- }
297
-
298
- unsigned getNumAttributes() const { return isContent() ? 0 : s->attributes.size(); }
299
- const Attribute *getAttribute(int i) const { return isContent() ? nullptr : s->attributes.at(i); }
300
- Attribute *getAttribute(int i) { return isContent() ? nullptr : s->attributes.at(i); }
301
-
302
- void appendAttribute(Attribute *attribute)
303
- {
304
- if (!isContent() && attribute) {
305
- s->attributes.push_back(attribute);
306
- }
307
- }
308
-
309
- const Attribute *findAttribute(Attribute::Type attributeType, bool inherit = false, Attribute::Owner owner = Attribute::UnknownOwner) const;
310
-
311
- const GooString *getAltText() const { return isContent() ? nullptr : s->altText; }
312
- GooString *getAltText() { return isContent() ? nullptr : s->altText; }
313
-
314
- const GooString *getActualText() const { return isContent() ? nullptr : s->actualText; }
315
- GooString *getActualText() { return isContent() ? nullptr : s->actualText; }
316
-
317
- // Content text referenced by the element:
318
- //
319
- // - For MCID reference elements, this is just the text of the
320
- // corresponding marked content object in the page stream, regardless
321
- // of the setting of the "recursive" flag.
322
- // - For other elements, if the "recursive" flag is set, the text
323
- // enclosed by *all* the child MCID reference elements of the subtree
324
- // is returned. The text is assembled by traversing the leaf MCID
325
- // reference elements in logical order.
326
- // - In any other case, the function returns nullptr.
327
- //
328
- // A new string is returned, and the ownership passed to the caller.
329
- //
330
- GooString *getText(bool recursive = true) const { return appendSubTreeText(nullptr, recursive); }
331
-
332
- const TextSpanArray getTextSpans() const
333
- {
334
- if (!isContent()) {
335
- return TextSpanArray();
336
- }
337
- MarkedContentOutputDev mcdev(getMCID(), stmRef);
338
- return getTextSpansInternal(mcdev);
339
- }
340
-
341
- ~StructElement();
342
-
343
- private:
344
- GooString *appendSubTreeText(GooString *string, bool recursive) const;
345
- const TextSpanArray &getTextSpansInternal(MarkedContentOutputDev &mcdev) const;
346
-
347
- typedef std::vector<Attribute *> AttrPtrArray;
348
- typedef std::vector<StructElement *> ElemPtrArray;
349
-
350
- struct StructData
351
- {
352
- Ref parentRef;
353
- GooString *altText;
354
- GooString *actualText;
355
- GooString *id;
356
- GooString *title;
357
- GooString *expandedAbbr;
358
- GooString *language;
359
- unsigned int revision;
360
- ElemPtrArray elements;
361
- AttrPtrArray attributes;
362
-
363
- StructData();
364
- ~StructData();
365
-
366
- StructData(const StructData &) = delete;
367
- StructData &operator=(const StructData &) = delete;
368
- };
369
-
370
- // Data in content elements (MCID, MCR)
371
- struct ContentData
372
- {
373
- union {
374
- int mcid;
375
- Ref ref;
376
- };
377
-
378
- explicit ContentData(int mcidA) : mcid(mcidA) { }
379
- explicit ContentData(const Ref r) { ref = r; }
380
- };
381
-
382
- // Common data
383
- Type type;
384
- StructTreeRoot *treeRoot;
385
- StructElement *parent;
386
- mutable Object pageRef;
387
- Object stmRef;
388
-
389
- union {
390
- StructData *s;
391
- ContentData *c;
392
- };
393
-
394
- StructElement(Dict *elementDict, StructTreeRoot *treeRootA, StructElement *parentA, std::set<int> &seen);
395
- StructElement(int mcid, StructTreeRoot *treeRootA, StructElement *parentA);
396
- StructElement(const Ref ref, StructTreeRoot *treeRootA, StructElement *parentA);
397
-
398
- void parse(Dict *elementDict);
399
- StructElement *parseChild(const Object *ref, Object *childObj, std::set<int> &seen);
400
- void parseChildren(Dict *element, std::set<int> &seen);
401
- void parseAttributes(Dict *attributes, bool keepExisting = false);
402
-
403
- friend class StructTreeRoot;
404
- };
405
-
406
- #endif
@@ -1,89 +0,0 @@
1
- //========================================================================
2
- //
3
- // StructTreeRoot.h
4
- //
5
- // This file is licensed under the GPLv2 or later
6
- //
7
- // Copyright 2013, 2014 Igalia S.L.
8
- // Copyright 2018, 2019 Albert Astals Cid <aacid@kde.org>
9
- // Copyright 2018 Adrian Johnson <ajohnson@redneon.com>
10
- // Copyright 2018 Adam Reichold <adam.reichold@t-online.de>
11
- //
12
- //========================================================================
13
-
14
- #ifndef STRUCTTREEROOT_H
15
- #define STRUCTTREEROOT_H
16
-
17
- #include "Object.h"
18
- #include "StructElement.h"
19
- #include <map>
20
- #include <vector>
21
-
22
- class Dict;
23
- class PDFDoc;
24
-
25
- class StructTreeRoot
26
- {
27
- public:
28
- StructTreeRoot(PDFDoc *docA, Dict *rootDict);
29
- ~StructTreeRoot();
30
-
31
- StructTreeRoot &operator=(const StructTreeRoot &) = delete;
32
- StructTreeRoot(const StructTreeRoot &) = delete;
33
-
34
- PDFDoc *getDoc() { return doc; }
35
- Dict *getRoleMap() { return roleMap.isDict() ? roleMap.getDict() : nullptr; }
36
- Dict *getClassMap() { return classMap.isDict() ? classMap.getDict() : nullptr; }
37
- unsigned getNumChildren() const { return elements.size(); }
38
- const StructElement *getChild(int i) const { return elements.at(i); }
39
- StructElement *getChild(int i) { return elements.at(i); }
40
-
41
- void appendChild(StructElement *element)
42
- {
43
- if (element && element->isOk()) {
44
- elements.push_back(element);
45
- }
46
- }
47
-
48
- const StructElement *findParentElement(int key, unsigned mcid = 0) const
49
- {
50
- auto it = parentTree.find(key);
51
- if (it != parentTree.end()) {
52
- if (mcid < it->second.size()) {
53
- return it->second[mcid].element;
54
- }
55
- }
56
- return nullptr;
57
- }
58
-
59
- private:
60
- typedef std::vector<StructElement *> ElemPtrArray;
61
-
62
- // Structure for items in /ParentTree, it keeps a mapping of
63
- // object references and pointers to StructElement objects.
64
- struct Parent
65
- {
66
- Ref ref;
67
- StructElement *element;
68
-
69
- Parent() : element(nullptr) { ref = Ref::INVALID(); }
70
- Parent(const Parent &p) = default;
71
- Parent &operator=(const Parent &) = default;
72
- ~Parent() { }
73
- };
74
-
75
- PDFDoc *doc;
76
- Object roleMap;
77
- Object classMap;
78
- ElemPtrArray elements;
79
- std::map<int, std::vector<Parent>> parentTree;
80
- std::multimap<Ref, Parent *> refToParentMap;
81
-
82
- void parse(Dict *rootDict);
83
- void parseNumberTreeNode(Dict *node);
84
- void parentTreeAdd(const Ref objectRef, StructElement *element);
85
-
86
- friend class StructElement;
87
- };
88
-
89
- #endif