pdfium_render/pdf/document/page/annotation/
unsupported.rs1use crate::bindgen::{FPDF_ANNOTATION, FPDF_DOCUMENT, FPDF_PAGE};
5use crate::pdf::document::page::annotation::attachment_points::PdfPageAnnotationAttachmentPoints;
6use crate::pdf::document::page::annotation::objects::PdfPageAnnotationObjects;
7use crate::pdf::document::page::annotation::private::internal::PdfPageAnnotationPrivate;
8use crate::pdf::document::page::annotation::PdfPageAnnotationType;
9use crate::pdf::document::page::object::ownership::PdfPageObjectOwnership;
10use crate::pdf::document::page::objects::private::internal::PdfPageObjectsPrivate;
11use crate::pdfium::PdfiumLibraryBindingsAccessor;
12use std::marker::PhantomData;
13
14#[cfg(doc)]
15use crate::pdf::document::page::annotation::PdfPageAnnotation;
16
17pub struct PdfPageUnsupportedAnnotation<'a> {
19 annotation_type: PdfPageAnnotationType,
20 handle: FPDF_ANNOTATION,
21 objects: PdfPageAnnotationObjects<'a>,
22 attachment_points: PdfPageAnnotationAttachmentPoints<'a>,
23 lifetime: PhantomData<&'a FPDF_ANNOTATION>,
24}
25
26impl<'a> PdfPageUnsupportedAnnotation<'a> {
27 pub(crate) fn from_pdfium(
28 document_handle: FPDF_DOCUMENT,
29 page_handle: FPDF_PAGE,
30 annotation_handle: FPDF_ANNOTATION,
31 annotation_type: PdfPageAnnotationType,
32 ) -> Self {
33 PdfPageUnsupportedAnnotation {
34 annotation_type,
35 handle: annotation_handle,
36 objects: PdfPageAnnotationObjects::from_pdfium(
37 document_handle,
38 page_handle,
39 annotation_handle,
40 ),
41 attachment_points: PdfPageAnnotationAttachmentPoints::from_pdfium(annotation_handle),
42 lifetime: PhantomData,
43 }
44 }
45
46 #[inline]
49 pub fn get_type(&self) -> PdfPageAnnotationType {
50 self.annotation_type
51 }
52}
53
54impl<'a> PdfPageAnnotationPrivate<'a> for PdfPageUnsupportedAnnotation<'a> {
55 #[inline]
56 fn handle(&self) -> FPDF_ANNOTATION {
57 self.handle
58 }
59
60 #[inline]
61 fn ownership(&self) -> &PdfPageObjectOwnership {
62 self.objects_impl().ownership()
63 }
64
65 #[inline]
66 fn objects_impl(&self) -> &PdfPageAnnotationObjects<'_> {
67 &self.objects
68 }
69
70 #[inline]
71 fn attachment_points_impl(&self) -> &PdfPageAnnotationAttachmentPoints<'_> {
72 &self.attachment_points
73 }
74}
75
76impl<'a> PdfiumLibraryBindingsAccessor<'a> for PdfPageUnsupportedAnnotation<'a> {}
77
78#[cfg(feature = "thread_safe")]
79unsafe impl<'a> Send for PdfPageUnsupportedAnnotation<'a> {}
80
81#[cfg(feature = "thread_safe")]
82unsafe impl<'a> Sync for PdfPageUnsupportedAnnotation<'a> {}