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(document_handle, page_handle, annotation_handle, bindings),
33 attachment_points: PdfPageAnnotationAttachmentPoints::from_pdfium(annotation_handle, bindings),
34 bindings,
35 }
36 }
37}
38
39impl<'a> PdfPageAnnotationPrivate<'a> for PdfPageTextAnnotation<'a> {
40 #[inline]
41 fn handle(&self) -> FPDF_ANNOTATION {
42 self.handle
43 }
44
45 #[inline]
46 fn ownership(&self) -> &PdfPageObjectOwnership {
47 self.objects_impl().ownership()
48 }
49
50 #[inline]
51 fn bindings(&self) -> &dyn PdfiumLibraryBindings {
52 self.bindings
53 }
54
55 #[inline]
56 fn objects_impl(&self) -> &PdfPageAnnotationObjects<'_> {
57 &self.objects
58 }
59
60 #[inline]
61 fn attachment_points_impl(&self) -> &PdfPageAnnotationAttachmentPoints<'_> {
62 &self.attachment_points
63 }
64}