pdfium_render/pdf/document/page/annotation/
unsupported.rs1use crate::bindgen::{FPDF_ANNOTATION, FPDF_DOCUMENT, FPDF_PAGE};
5use crate::bindings::PdfiumLibraryBindings;
6use crate::pdf::document::page::annotation::attachment_points::PdfPageAnnotationAttachmentPoints;
7use crate::pdf::document::page::annotation::objects::PdfPageAnnotationObjects;
8use crate::pdf::document::page::annotation::private::internal::PdfPageAnnotationPrivate;
9use crate::pdf::document::page::annotation::PdfPageAnnotationType;
10use crate::pdf::document::page::object::ownership::PdfPageObjectOwnership;
11use crate::pdf::document::page::objects::private::internal::PdfPageObjectsPrivate;
12
13#[cfg(doc)]
14use crate::pdf::document::page::annotation::PdfPageAnnotation;
15
16pub struct PdfPageUnsupportedAnnotation<'a> {
18 annotation_type: PdfPageAnnotationType,
19 handle: FPDF_ANNOTATION,
20 objects: PdfPageAnnotationObjects<'a>,
21 attachment_points: PdfPageAnnotationAttachmentPoints<'a>,
22 bindings: &'a dyn PdfiumLibraryBindings,
23}
24
25impl<'a> PdfPageUnsupportedAnnotation<'a> {
26 pub(crate) fn from_pdfium(
27 document_handle: FPDF_DOCUMENT,
28 page_handle: FPDF_PAGE,
29 annotation_handle: FPDF_ANNOTATION,
30 annotation_type: PdfPageAnnotationType,
31 bindings: &'a dyn PdfiumLibraryBindings,
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 bindings,
41 ),
42 attachment_points: PdfPageAnnotationAttachmentPoints::from_pdfium(
43 annotation_handle,
44 bindings,
45 ),
46 bindings,
47 }
48 }
49
50 #[inline]
53 pub fn get_type(&self) -> PdfPageAnnotationType {
54 self.annotation_type
55 }
56}
57
58impl<'a> PdfPageAnnotationPrivate<'a> for PdfPageUnsupportedAnnotation<'a> {
59 #[inline]
60 fn handle(&self) -> FPDF_ANNOTATION {
61 self.handle
62 }
63
64 #[inline]
65 fn ownership(&self) -> &PdfPageObjectOwnership {
66 self.objects_impl().ownership()
67 }
68
69 #[inline]
70 fn bindings(&self) -> &dyn PdfiumLibraryBindings {
71 self.bindings
72 }
73
74 #[inline]
75 fn objects_impl(&self) -> &PdfPageAnnotationObjects {
76 &self.objects
77 }
78
79 #[inline]
80 fn attachment_points_impl(&self) -> &PdfPageAnnotationAttachmentPoints {
81 &self.attachment_points
82 }
83}