// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{
    Color, Rectangle, StructureBlockAlign, StructureElementKind, StructureFormRole,
    StructureFormState, StructureGetTextFlags, StructureGlyphOrientation, StructureInlineAlign,
    StructureListNumbering, StructurePlacement, StructureRubyAlign, StructureRubyPosition,
    StructureTableScope, StructureTextAlign, StructureTextDecoration, StructureWritingMode,
    TextSpan, ffi,
};
use glib::translate::*;

glib::wrapper! {
    #[doc(alias = "PopplerStructureElement")]
    pub struct StructureElement(Object<ffi::PopplerStructureElement>);

    match fn {
        type_ => || ffi::poppler_structure_element_get_type(),
    }
}

impl StructureElement {
    #[doc(alias = "poppler_structure_element_get_abbreviation")]
    #[doc(alias = "get_abbreviation")]
    pub fn abbreviation(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_structure_element_get_abbreviation(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_actual_text")]
    #[doc(alias = "get_actual_text")]
    pub fn actual_text(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_structure_element_get_actual_text(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_alt_text")]
    #[doc(alias = "get_alt_text")]
    pub fn alt_text(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_structure_element_get_alt_text(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_background_color")]
    #[doc(alias = "get_background_color")]
    pub fn background_color(&self) -> Option<Color> {
        unsafe {
            let mut color = Color::uninitialized();
            let ret = from_glib(ffi::poppler_structure_element_get_background_color(
                self.to_glib_none().0,
                color.to_glib_none_mut().0,
            ));
            if ret { Some(color) } else { None }
        }
    }

    #[doc(alias = "poppler_structure_element_get_baseline_shift")]
    #[doc(alias = "get_baseline_shift")]
    pub fn baseline_shift(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_baseline_shift(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_block_align")]
    #[doc(alias = "get_block_align")]
    pub fn block_align(&self) -> StructureBlockAlign {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_block_align(
                self.to_glib_none().0,
            ))
        }
    }

    //#[doc(alias = "poppler_structure_element_get_border_color")]
    //#[doc(alias = "get_border_color")]
    //pub fn border_color(&self, colors: /*Unimplemented*/FixedArray TypeId { ns_id: 1, id: 23 }; 4) -> bool {
    //    unsafe { TODO: call ffi:poppler_structure_element_get_border_color() }
    //}

    //#[doc(alias = "poppler_structure_element_get_border_style")]
    //#[doc(alias = "get_border_style")]
    //pub fn border_style(&self, border_styles: /*Unimplemented*/FixedArray TypeId { ns_id: 1, id: 103 }; 4) {
    //    unsafe { TODO: call ffi:poppler_structure_element_get_border_style() }
    //}

    //#[doc(alias = "poppler_structure_element_get_border_thickness")]
    //#[doc(alias = "get_border_thickness")]
    //pub fn border_thickness(&self, border_thicknesses: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 21 }; 4) -> bool {
    //    unsafe { TODO: call ffi:poppler_structure_element_get_border_thickness() }
    //}

    #[doc(alias = "poppler_structure_element_get_bounding_box")]
    #[doc(alias = "get_bounding_box")]
    pub fn bounding_box(&self) -> Option<Rectangle> {
        unsafe {
            let mut bounding_box = Rectangle::uninitialized();
            let ret = from_glib(ffi::poppler_structure_element_get_bounding_box(
                self.to_glib_none().0,
                bounding_box.to_glib_none_mut().0,
            ));
            if ret { Some(bounding_box) } else { None }
        }
    }

    #[doc(alias = "poppler_structure_element_get_color")]
    #[doc(alias = "get_color")]
    pub fn color(&self) -> Option<Color> {
        unsafe {
            let mut color = Color::uninitialized();
            let ret = from_glib(ffi::poppler_structure_element_get_color(
                self.to_glib_none().0,
                color.to_glib_none_mut().0,
            ));
            if ret { Some(color) } else { None }
        }
    }

    #[doc(alias = "poppler_structure_element_get_column_count")]
    #[doc(alias = "get_column_count")]
    pub fn column_count(&self) -> u32 {
        unsafe { ffi::poppler_structure_element_get_column_count(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_column_gaps")]
    #[doc(alias = "get_column_gaps")]
    pub fn column_gaps(&self) -> Vec<f64> {
        unsafe {
            let mut n_values = std::mem::MaybeUninit::uninit();
            let ret = FromGlibContainer::from_glib_full_num(
                ffi::poppler_structure_element_get_column_gaps(
                    self.to_glib_none().0,
                    n_values.as_mut_ptr(),
                ),
                n_values.assume_init() as _,
            );
            ret
        }
    }

    #[doc(alias = "poppler_structure_element_get_column_widths")]
    #[doc(alias = "get_column_widths")]
    pub fn column_widths(&self) -> Vec<f64> {
        unsafe {
            let mut n_values = std::mem::MaybeUninit::uninit();
            let ret = FromGlibContainer::from_glib_full_num(
                ffi::poppler_structure_element_get_column_widths(
                    self.to_glib_none().0,
                    n_values.as_mut_ptr(),
                ),
                n_values.assume_init() as _,
            );
            ret
        }
    }

    #[doc(alias = "poppler_structure_element_get_end_indent")]
    #[doc(alias = "get_end_indent")]
    pub fn end_indent(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_end_indent(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_form_description")]
    #[doc(alias = "get_form_description")]
    pub fn form_description(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_structure_element_get_form_description(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_form_role")]
    #[doc(alias = "get_form_role")]
    pub fn form_role(&self) -> StructureFormRole {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_form_role(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_form_state")]
    #[doc(alias = "get_form_state")]
    pub fn form_state(&self) -> StructureFormState {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_form_state(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_glyph_orientation")]
    #[doc(alias = "get_glyph_orientation")]
    pub fn glyph_orientation(&self) -> StructureGlyphOrientation {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_glyph_orientation(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_height")]
    #[doc(alias = "get_height")]
    pub fn height(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_height(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_id")]
    #[doc(alias = "get_id")]
    pub fn id(&self) -> Option<glib::GString> {
        unsafe { from_glib_full(ffi::poppler_structure_element_get_id(self.to_glib_none().0)) }
    }

    #[doc(alias = "poppler_structure_element_get_inline_align")]
    #[doc(alias = "get_inline_align")]
    pub fn inline_align(&self) -> StructureInlineAlign {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_inline_align(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_kind")]
    #[doc(alias = "get_kind")]
    pub fn kind(&self) -> StructureElementKind {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_kind(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_language")]
    #[doc(alias = "get_language")]
    pub fn language(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_structure_element_get_language(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_line_height")]
    #[doc(alias = "get_line_height")]
    pub fn line_height(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_line_height(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_list_numbering")]
    #[doc(alias = "get_list_numbering")]
    pub fn list_numbering(&self) -> StructureListNumbering {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_list_numbering(
                self.to_glib_none().0,
            ))
        }
    }

    //#[doc(alias = "poppler_structure_element_get_padding")]
    //#[doc(alias = "get_padding")]
    //pub fn padding(&self, paddings: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 21 }; 4) {
    //    unsafe { TODO: call ffi:poppler_structure_element_get_padding() }
    //}

    #[doc(alias = "poppler_structure_element_get_page")]
    #[doc(alias = "get_page")]
    pub fn page(&self) -> i32 {
        unsafe { ffi::poppler_structure_element_get_page(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_placement")]
    #[doc(alias = "get_placement")]
    pub fn placement(&self) -> StructurePlacement {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_placement(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_ruby_align")]
    #[doc(alias = "get_ruby_align")]
    pub fn ruby_align(&self) -> StructureRubyAlign {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_ruby_align(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_ruby_position")]
    #[doc(alias = "get_ruby_position")]
    pub fn ruby_position(&self) -> StructureRubyPosition {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_ruby_position(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_space_after")]
    #[doc(alias = "get_space_after")]
    pub fn space_after(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_space_after(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_space_before")]
    #[doc(alias = "get_space_before")]
    pub fn space_before(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_space_before(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_start_indent")]
    #[doc(alias = "get_start_indent")]
    pub fn start_indent(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_start_indent(self.to_glib_none().0) }
    }

    //#[doc(alias = "poppler_structure_element_get_table_border_style")]
    //#[doc(alias = "get_table_border_style")]
    //pub fn table_border_style(&self, border_styles: /*Unimplemented*/FixedArray TypeId { ns_id: 1, id: 103 }; 4) {
    //    unsafe { TODO: call ffi:poppler_structure_element_get_table_border_style() }
    //}

    #[doc(alias = "poppler_structure_element_get_table_column_span")]
    #[doc(alias = "get_table_column_span")]
    pub fn table_column_span(&self) -> u32 {
        unsafe { ffi::poppler_structure_element_get_table_column_span(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_table_headers")]
    #[doc(alias = "get_table_headers")]
    pub fn table_headers(&self) -> Vec<glib::GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::poppler_structure_element_get_table_headers(
                self.to_glib_none().0,
            ))
        }
    }

    //#[doc(alias = "poppler_structure_element_get_table_padding")]
    //#[doc(alias = "get_table_padding")]
    //pub fn table_padding(&self, paddings: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 21 }; 4) {
    //    unsafe { TODO: call ffi:poppler_structure_element_get_table_padding() }
    //}

    #[doc(alias = "poppler_structure_element_get_table_row_span")]
    #[doc(alias = "get_table_row_span")]
    pub fn table_row_span(&self) -> u32 {
        unsafe { ffi::poppler_structure_element_get_table_row_span(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_table_scope")]
    #[doc(alias = "get_table_scope")]
    pub fn table_scope(&self) -> StructureTableScope {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_table_scope(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_table_summary")]
    #[doc(alias = "get_table_summary")]
    pub fn table_summary(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_structure_element_get_table_summary(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_text")]
    #[doc(alias = "get_text")]
    pub fn text(&self, flags: StructureGetTextFlags) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_structure_element_get_text(
                self.to_glib_none().0,
                flags.into_glib(),
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_text_align")]
    #[doc(alias = "get_text_align")]
    pub fn text_align(&self) -> StructureTextAlign {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_text_align(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_text_decoration_color")]
    #[doc(alias = "get_text_decoration_color")]
    pub fn text_decoration_color(&self) -> Option<Color> {
        unsafe {
            let mut color = Color::uninitialized();
            let ret = from_glib(ffi::poppler_structure_element_get_text_decoration_color(
                self.to_glib_none().0,
                color.to_glib_none_mut().0,
            ));
            if ret { Some(color) } else { None }
        }
    }

    #[doc(alias = "poppler_structure_element_get_text_decoration_thickness")]
    #[doc(alias = "get_text_decoration_thickness")]
    pub fn text_decoration_thickness(&self) -> f64 {
        unsafe {
            ffi::poppler_structure_element_get_text_decoration_thickness(self.to_glib_none().0)
        }
    }

    #[doc(alias = "poppler_structure_element_get_text_decoration_type")]
    #[doc(alias = "get_text_decoration_type")]
    pub fn text_decoration_type(&self) -> StructureTextDecoration {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_text_decoration_type(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_text_indent")]
    #[doc(alias = "get_text_indent")]
    pub fn text_indent(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_text_indent(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_text_spans")]
    #[doc(alias = "get_text_spans")]
    pub fn text_spans(&self) -> Vec<TextSpan> {
        unsafe {
            let mut n_text_spans = std::mem::MaybeUninit::uninit();
            let ret = FromGlibContainer::from_glib_full_num(
                ffi::poppler_structure_element_get_text_spans(
                    self.to_glib_none().0,
                    n_text_spans.as_mut_ptr(),
                ),
                n_text_spans.assume_init() as _,
            );
            ret
        }
    }

    #[doc(alias = "poppler_structure_element_get_title")]
    #[doc(alias = "get_title")]
    pub fn title(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_structure_element_get_title(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_get_width")]
    #[doc(alias = "get_width")]
    pub fn width(&self) -> f64 {
        unsafe { ffi::poppler_structure_element_get_width(self.to_glib_none().0) }
    }

    #[doc(alias = "poppler_structure_element_get_writing_mode")]
    #[doc(alias = "get_writing_mode")]
    pub fn writing_mode(&self) -> StructureWritingMode {
        unsafe {
            from_glib(ffi::poppler_structure_element_get_writing_mode(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_is_block")]
    pub fn is_block(&self) -> bool {
        unsafe {
            from_glib(ffi::poppler_structure_element_is_block(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_is_content")]
    pub fn is_content(&self) -> bool {
        unsafe {
            from_glib(ffi::poppler_structure_element_is_content(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_is_grouping")]
    pub fn is_grouping(&self) -> bool {
        unsafe {
            from_glib(ffi::poppler_structure_element_is_grouping(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_structure_element_is_inline")]
    pub fn is_inline(&self) -> bool {
        unsafe {
            from_glib(ffi::poppler_structure_element_is_inline(
                self.to_glib_none().0,
            ))
        }
    }
}
