PoDoFo 1.0.0-dev
Loading...
Searching...
No Matches
PdfAnnotation_Types.h
1
7#ifndef PDF_ANNOTATION_TYPES_H
8#define PDF_ANNOTATION_TYPES_H
9
10#include "PdfAnnotationActionBase.h"
11#include "PdfFileSpec.h"
12#include "PdfDestination.h"
13#include "PdfDictionary.h"
14
15namespace PoDoFo {
16
17 template <typename T>
18 class PdfQuadPointsProvider
19 {
20 friend class PdfAnnotationLink;
21 friend class PdfAnnotationTextMarkupBase;
22 friend class PdfAnnotationRedact;
23
24 public:
35 nullable<const PdfArray&> GetQuadPoints() const
36 {
37 auto& dict = static_cast<const T&>(*this).GetDictionary();
38 const PdfArray* arr;
39 auto obj = dict.FindKey("QuadPoints");
40 if (obj == nullptr || !obj->TryGetArray(arr))
41 return { };
42
43 return *arr;
44 }
45
55 void SetQuadPoints(nullable<const PdfArray&> quadPoints)
56 {
57 auto& dict = static_cast<T&>(*this).GetDictionary();
58 if (quadPoints == nullptr)
59 dict.RemoveKey("QuadPoints");
60 else
61 dict.AddKey("QuadPoints"_n, *quadPoints);
62 }
63 };
64
65 class PODOFO_API PdfAnnotationTextMarkupBase : public PdfAnnotation, public PdfQuadPointsProvider<PdfAnnotationTextMarkupBase>
66 {
67 friend class PdfAnnotationSquiggly;
68 friend class PdfAnnotationHighlight;
69 friend class PdfAnnotationStrikeOut;
70 friend class PdfAnnotationUnderline;
71 private:
72 PdfAnnotationTextMarkupBase(PdfPage& page, PdfAnnotationType annotType, const Rect& rect);
73 PdfAnnotationTextMarkupBase(PdfObject& obj, PdfAnnotationType annotType);
74
75 };
76
77 class PODOFO_API PdfAnnotationCaret final : public PdfAnnotation
78 {
79 friend class PdfAnnotation;
80 private:
81 PdfAnnotationCaret(PdfPage& page, const Rect& rect);
82 PdfAnnotationCaret(PdfObject& obj);
83 };
84
85
86 class PODOFO_API PdfAnnotationFileAttachment final : public PdfAnnotation
87 {
88 friend class PdfAnnotation;
89 private:
90 PdfAnnotationFileAttachment(PdfPage& page, const Rect& rect);
91 PdfAnnotationFileAttachment(PdfObject& obj);
92
93 public:
101 void SetFileAttachment(const nullable<PdfFileSpec&>& fileSpec);
102
109 nullable<PdfFileSpec&> GetFileAttachment();
110 nullable<const PdfFileSpec&> GetFileAttachment() const;
111
112 private:
113 nullable<PdfFileSpec&> getFileAttachment();
114
115 private:
116 nullable<std::unique_ptr<PdfFileSpec>> m_FileSpec;
117 };
118
119 class PODOFO_API PdfAnnotationFreeText final : public PdfAnnotation
120 {
121 friend class PdfAnnotation;
122 private:
123 PdfAnnotationFreeText(PdfPage& page, const Rect& rect);
124 PdfAnnotationFreeText(PdfObject& obj);
125 };
126
127 class PODOFO_API PdfAnnotationHighlight final : public PdfAnnotationTextMarkupBase
128 {
129 friend class PdfAnnotation;
130 private:
131 PdfAnnotationHighlight(PdfPage& page, const Rect& rect);
132 PdfAnnotationHighlight(PdfObject& obj);
133 };
134
135 class PODOFO_API PdfAnnotationInk final : public PdfAnnotation
136 {
137 friend class PdfAnnotation;
138 private:
139 PdfAnnotationInk(PdfPage& page, const Rect& rect);
140 PdfAnnotationInk(PdfObject& obj);
141 };
142
143 class PODOFO_API PdfAnnotationLine final : public PdfAnnotation
144 {
145 friend class PdfAnnotation;
146 private:
147 PdfAnnotationLine(PdfPage& page, const Rect& rect);
148 PdfAnnotationLine(PdfObject& obj);
149 };
150
151 class PODOFO_API PdfAnnotationLink final : public PdfAnnotationActionBase, public PdfQuadPointsProvider<PdfAnnotationLink>
152 {
153 friend class PdfAnnotation;
154 private:
155 PdfAnnotationLink(PdfPage& page, const Rect& rect);
156 PdfAnnotationLink(PdfObject& obj);
157 public:
163 void SetDestination(nullable<const PdfDestination&> destination);
164
170 nullable<PdfDestination&> GetDestination();
171 nullable<const PdfDestination&> GetDestination() const;
172
173 private:
174 nullable<PdfDestination&> getDestination();
175 void onActionSet() override;
176
177 private:
178 nullable<std::unique_ptr<PdfDestination>> m_Destination;
179 };
180
181 class PODOFO_API PdfAnnotationModel3D final : public PdfAnnotation
182 {
183 friend class PdfAnnotation;
184 private:
185 PdfAnnotationModel3D(PdfPage& page, const Rect& rect);
186 PdfAnnotationModel3D(PdfObject& obj);
187 };
188
189 class PODOFO_API PdfAnnotationMovie final : public PdfAnnotation
190 {
191 friend class PdfAnnotation;
192 private:
193 PdfAnnotationMovie(PdfPage& page, const Rect& rect);
194 PdfAnnotationMovie(PdfObject& obj);
195 };
196
197 class PODOFO_API PdfAnnotationPolygon final : public PdfAnnotation
198 {
199 friend class PdfAnnotation;
200 private:
201 PdfAnnotationPolygon(PdfPage& page, const Rect& rect);
202 PdfAnnotationPolygon(PdfObject& obj);
203 };
204
205 class PODOFO_API PdfAnnotationPolyLine final : public PdfAnnotation
206 {
207 friend class PdfAnnotation;
208 private:
209 PdfAnnotationPolyLine(PdfPage& page, const Rect& rect);
210 PdfAnnotationPolyLine(PdfObject& obj);
211 };
212
213 class PODOFO_API PdfAnnotationPopup final : public PdfAnnotation
214 {
215 friend class PdfAnnotation;
216 private:
217 PdfAnnotationPopup(PdfPage& page, const Rect& rect);
218 PdfAnnotationPopup(PdfObject& obj);
219 public:
224 void SetOpen(const nullable<bool>& value);
225
230 bool GetOpen() const;
231 };
232
233 class PODOFO_API PdfAnnotationPrinterMark final : public PdfAnnotation
234 {
235 friend class PdfAnnotation;
236 private:
237 PdfAnnotationPrinterMark(PdfPage& page, const Rect& rect);
238 PdfAnnotationPrinterMark(PdfObject& obj);
239 };
240
241 class PODOFO_API PdfAnnotationScreen final :
242 public PdfAnnotationActionBase,
243 public PdfAppearanceCharacteristicsProvider<PdfAnnotationScreen>
244 {
245 friend class PdfAnnotation;
246 private:
247 PdfAnnotationScreen(PdfPage& page, const Rect& rect);
248 PdfAnnotationScreen(PdfObject& obj);
249 };
250
251 class PODOFO_API PdfAnnotationSquiggly final : public PdfAnnotationTextMarkupBase
252 {
253 friend class PdfAnnotation;
254 private:
255 PdfAnnotationSquiggly(PdfPage& page, const Rect& rect);
256 PdfAnnotationSquiggly(PdfObject& obj);
257
258 };
259
260 class PODOFO_API PdfAnnotationStrikeOut final : public PdfAnnotationTextMarkupBase
261 {
262 friend class PdfAnnotation;
263 private:
264 PdfAnnotationStrikeOut(PdfPage& page, const Rect& rect);
265 PdfAnnotationStrikeOut(PdfObject& obj);
266 };
267
268 class PODOFO_API PdfAnnotationSound final : public PdfAnnotation
269 {
270 friend class PdfAnnotation;
271 private:
272 PdfAnnotationSound(PdfPage& page, const Rect& rect);
273 PdfAnnotationSound(PdfObject& obj);
274 };
275
276 class PODOFO_API PdfAnnotationSquare final : public PdfAnnotation
277 {
278 friend class PdfAnnotation;
279 private:
280 PdfAnnotationSquare(PdfPage& page, const Rect& rect);
281 PdfAnnotationSquare(PdfObject& obj);
282 };
283
284 class PODOFO_API PdfAnnotationCircle final : public PdfAnnotation
285 {
286 friend class PdfAnnotation;
287 private:
288 PdfAnnotationCircle(PdfPage& page, const Rect& rect);
289 PdfAnnotationCircle(PdfObject& obj);
290 };
291
292 class PODOFO_API PdfAnnotationStamp final : public PdfAnnotation
293 {
294 friend class PdfAnnotation;
295 private:
296 PdfAnnotationStamp(PdfPage& page, const Rect& rect);
297 PdfAnnotationStamp(PdfObject& obj);
298 };
299
300 class PODOFO_API PdfAnnotationText final : public PdfAnnotation
301 {
302 friend class PdfAnnotation;
303 private:
304 PdfAnnotationText(PdfPage& page, const Rect& rect);
305 PdfAnnotationText(PdfObject& obj);
306 public:
311 void SetOpen(const nullable<bool>& value);
312
317 bool GetOpen() const;
318 };
319
320 class PODOFO_API PdfAnnotationTrapNet final : public PdfAnnotation
321 {
322 friend class PdfAnnotation;
323 private:
324 PdfAnnotationTrapNet(PdfPage& page, const Rect& rect);
325 PdfAnnotationTrapNet(PdfObject& obj);
326 };
327
328 class PODOFO_API PdfAnnotationUnderline final : public PdfAnnotationTextMarkupBase
329 {
330 friend class PdfAnnotation;
331 private:
332 PdfAnnotationUnderline(PdfPage& page, const Rect& rect);
333 PdfAnnotationUnderline(PdfObject& obj);
334
335 };
336
337 class PODOFO_API PdfAnnotationWatermark final : public PdfAnnotation
338 {
339 friend class PdfAnnotation;
340 private:
341 PdfAnnotationWatermark(PdfPage& page, const Rect& rect);
342 PdfAnnotationWatermark(PdfObject& obj);
343 };
344
345 class PODOFO_API PdfAnnotationWebMedia final : public PdfAnnotation
346 {
347 friend class PdfAnnotation;
348 private:
349 PdfAnnotationWebMedia(PdfPage& page, const Rect& rect);
350 PdfAnnotationWebMedia(PdfObject& obj);
351 };
352
353 class PODOFO_API PdfAnnotationRedact final : public PdfAnnotation, public PdfQuadPointsProvider<PdfAnnotationRedact>
354 {
355 friend class PdfAnnotation;
356 private:
357 PdfAnnotationRedact(PdfPage& page, const Rect& rect);
358 PdfAnnotationRedact(PdfObject& obj);
359 };
360
361 class PODOFO_API PdfAnnotationProjection final : public PdfAnnotation
362 {
363 friend class PdfAnnotation;
364 private:
365 PdfAnnotationProjection(PdfPage& page, const Rect& rect);
366 PdfAnnotationProjection(PdfObject& obj);
367 };
368
369 class PODOFO_API PdfAnnotationRichMedia final : public PdfAnnotation
370 {
371 friend class PdfAnnotation;
372 private:
373 PdfAnnotationRichMedia(PdfPage& page, const Rect& rect);
374 PdfAnnotationRichMedia(PdfObject& obj);
375 };
376}
377
378#endif // PDF_ANNOTATION_TYPES_H
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition basetypes.h:16