pdfium_render/pdf/document/page/annotation/
text.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::object::ownership::PdfPageObjectOwnership;
10use crate::pdf::document::page::objects::private::internal::PdfPageObjectsPrivate;
11
12#[cfg(doc)]
13use crate::pdf::document::page::annotation::{PdfPageAnnotation, PdfPageAnnotationType};
14
15pub struct PdfPageTextAnnotation<'a> {
17 handle: FPDF_ANNOTATION,
18 objects: PdfPageAnnotationObjects<'a>,
19 attachment_points: PdfPageAnnotationAttachmentPoints<'a>,
20 bindings: &'a dyn PdfiumLibraryBindings,
21}
22
23impl<'a> PdfPageTextAnnotation<'a> {
24 pub(crate) fn from_pdfium(
25 document_handle: FPDF_DOCUMENT,
26 page_handle: FPDF_PAGE,
27 annotation_handle: FPDF_ANNOTATION,
28 bindings: &'a dyn PdfiumLibraryBindings,
29 ) -> Self {
30 PdfPageTextAnnotation {
31 handle: annotation_handle,
32 objects: PdfPageAnnotationObjects::from_pdfium(
33 document_handle,
34 page_handle,
35 annotation_handle,
36 bindings,
37 ),
38 attachment_points: PdfPageAnnotationAttachmentPoints::from_pdfium(
39 annotation_handle,
40 bindings,
41 ),
42 bindings,
43 }
44 }
45}
46
47impl<'a> PdfPageAnnotationPrivate<'a> for PdfPageTextAnnotation<'a> {
48 #[inline]
49 fn handle(&self) -> FPDF_ANNOTATION {
50 self.handle
51 }
52
53 #[inline]
54 fn ownership(&self) -> &PdfPageObjectOwnership {
55 self.objects_impl().ownership()
56 }
57
58 #[inline]
59 fn bindings(&self) -> &dyn PdfiumLibraryBindings {
60 self.bindings
61 }
62
63 #[inline]
64 fn objects_impl(&self) -> &PdfPageAnnotationObjects {
65 &self.objects
66 }
67
68 #[inline]
69 fn attachment_points_impl(&self) -> &PdfPageAnnotationAttachmentPoints {
70 &self.attachment_points
71 }
72}