pub struct WidgetInfo {
pub id: AnnotId,
pub field: FieldId,
pub field_index: Option<u32>,
pub name: String,
pub kind: Option<FieldKind>,
pub flags: FieldFlags,
pub rotation: Rotation,
pub dict: Dict,
pub valued: Dict,
/* private fields */
}Expand description
One widget annotation, read far enough to build its field’s state.
Fields§
§id: AnnotIdWhich annotation, by raw /Annots index.
field: FieldIdWhich field it is a control of, on this page.
A page-local id. See WidgetInfo::field_index for the document-wide
one, and the module documentation for why both exist.
field_index: Option<u32>Where this widget’s field sits in the document’s flat terminal-field
list — the /AcroForm /Fields walk pdfrum_doc::form::Form::fields
performs, which is the space /CO, Doc.numFields and
Doc.getNthFieldName all count in.
None for a widget whose field the form does not list: an unnamed
widget, or one under an /AcroForm that does not reach it. Such a
field exists for interaction and is invisible to a script, which is
also what the oracle answers — GetFieldByDict returns null and
CountFields never counted it.
name: StringThe field’s fully qualified name, empty when it has none.
kind: Option<FieldKind>What kind of field it is, when the classifier could name one.
flags: FieldFlagsThe inherited /Ff.
rotation: RotationThe widget’s /MK /R, as the quadrant the appearance stream is set
into.
Folded by pdfrum_doc::geom::WidgetRotation::from_degrees, which is
the same call ap::widget::rotated_rect makes — routing and the
generator must agree about which box a click lands in, so there is one
normalization and not two. An angle that is not a multiple of 90 names
no quadrant and is upright.
dict: DictThe widget’s dictionary, for the readers that want the long tail.
valued: DictThe field dictionary the value is read from, when that is not the widget itself.
Implementations§
Source§impl WidgetInfo
impl WidgetInfo
Sourcepub fn options<R: Resolve>(&self, r: &R) -> Vec<ChoiceOption>
pub fn options<R: Resolve>(&self, r: &R) -> Vec<ChoiceOption>
The field’s options, for a choice field.
Sourcepub fn selected<R: Resolve>(&self, r: &R) -> Vec<usize>
pub fn selected<R: Resolve>(&self, r: &R) -> Vec<usize>
Which options the file says are selected, as interaction reads it.
Deliberately not ap::field_body::selected_indices, and the two are
both right — a list box’s selection has two readers that disagree on
purpose:
- the appearance reader takes
/Vfirst and matches it as text. That is what draws a file with no/AP, and it is whatap::field_body::selected_indicesreproduces. - the interaction reader, this one, consults
/Ifirst as integer indices and falls back to/Vonly when/Iis not usable. That is what a session’s state must be seeded from.
They agree except on one shape — /I present, /V absent — where the
first selects nothing and the second selects the rows /I names.
Sourcepub fn text_config<R: Resolve>(&self, r: &R) -> TextConfig
pub fn text_config<R: Resolve>(&self, r: &R) -> TextConfig
The text configuration, read from the flags and /MaxLen.
Sourcepub fn choice_config(&self) -> ChoiceConfig
pub fn choice_config(&self) -> ChoiceConfig
The choice configuration, read from the flags.
Trait Implementations§
Source§impl Clone for WidgetInfo
impl Clone for WidgetInfo
Source§impl Debug for WidgetInfo
impl Debug for WidgetInfo
Source§impl PartialEq for WidgetInfo
impl PartialEq for WidgetInfo
impl StructuralPartialEq for WidgetInfo
Auto Trait Implementations§
impl Freeze for WidgetInfo
impl RefUnwindSafe for WidgetInfo
impl Send for WidgetInfo
impl Sync for WidgetInfo
impl Unpin for WidgetInfo
impl UnsafeUnpin for WidgetInfo
impl UnwindSafe for WidgetInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.