1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905
// 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::{
ffi, Color, Rectangle, StructureBlockAlign, StructureElementKind, StructureFormRole,
StructureFormState, StructureGetTextFlags, StructureGlyphOrientation, StructureInlineAlign,
StructureListNumbering, StructurePlacement, StructureRubyAlign, StructureRubyPosition,
StructureTableScope, StructureTextAlign, StructureTextDecoration, StructureWritingMode,
TextSpan,
};
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 {
/// Acronyms and abbreviations contained in elements of type
/// [`StructureElementKind::Span`][crate::StructureElementKind::Span] may have an associated expanded
/// text form, which can be retrieved using this function.
///
/// # Returns
///
/// Text of the expanded abbreviation if the
/// element text is an abbreviation or acrony, [`None`] if not.
#[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,
))
}
}
/// Obtains the actual text enclosed by the element (and its child elements).
/// The actual text is mostly used for non-text elements like images and
/// figures which `<emphasis>`do`</emphasis>` have the graphical appearance of text, like
/// a logo. For those the actual text is the equivalent text to those
/// graphical elements which look like text when rendered.
///
/// Note that for elements containing proper text, the function
/// [`text()`][Self::text()] must be used instead.
///
/// # Returns
///
/// The actual text for the element, or [`None`]
/// if not defined.
#[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,
))
}
}
/// Obtains the “alternate” text representation of the element (and its child
/// elements). This is mostly used for non-text elements like images and
/// figures, to specify a textual description of the element.
///
/// Note that for elements containing proper text, the function
/// [`text()`][Self::text()] must be used instead.
///
/// # Returns
///
/// The alternate text representation for the
/// element, or [`None`] if not defined.
#[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,
))
}
}
/// Obtains the background color of the element. If this attribute is
/// not specified, the element shall be treated as if it were transparent.
///
/// # Returns
///
/// [`true`] if a color is defined for the element,
/// [`false`] otherwise.
///
/// ## `color`
/// A [`Color`][crate::Color].
#[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
}
}
}
/// Obtains how much the text contained in the inline-level structure element should be shifted,
/// measuring from the baseline of the glyphs.
///
/// # Returns
///
/// A numeric value.
#[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) }
}
/// Obtains the block-alignment mode of the block-level structure element.
///
/// # Returns
///
/// A [`StructureBlockAlign`][crate::StructureBlockAlign] value.
#[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: 96 }; 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() }
//}
/// Obtains the size of the bounding box of a block-level structure element.
///
/// # Returns
///
/// [`true`] if a bounding box is defined for the element,
/// [`false`] otherwise.
///
/// ## `bounding_box`
/// A [`Rectangle`][crate::Rectangle].
#[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
}
}
}
/// Obtains the color of the content contained in the element.
/// If this attribute is not specified, the color for this element shall
/// be the current text fill color in effect at the start of its associated content.
///
/// # Returns
///
/// [`true`] if a color is defined for the element,
/// [`false`] otherwise.
///
/// ## `color`
/// A [`Color`][crate::Color].
#[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
}
}
}
/// Obtains the number of columns used to lay out the content contained
/// in the grouping element.
///
/// # Returns
///
/// Number of columns.
#[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) }
}
/// Obtains the size of the gaps in between adjacent columns. Returns an
/// array of elements: the first one is the size of the gap in between
/// columns 1 and 2, second is the size between columns 2 and 3, and so on.
///
/// For elements which use a single column, [`None`] is returned and `n_values`
/// is set to zero.
///
/// If the attribute is undefined, [`None`] is returned and `n_values` is set
/// to a non-zero value.
///
/// The array with the results is allocated by the function. When it is
/// not needed anymore, be sure to call `g_free()` on it.
///
/// # Returns
///
///
/// Array containing the values for the column gaps, or [`None`] if the
/// array is empty or the attribute is not defined.
#[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
}
}
/// Obtains an array with the widths of the columns.
///
/// The array with the results is allocated by the function. When it is
/// not needed anymore, be sure to call `g_free()` on it.
///
/// # Returns
///
///
/// Array containing widths of the columns, or [`None`] if the attribute
/// is not defined.
#[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
}
}
/// Obtains the amount of indentation at the end of the block-level structure element.
///
/// # Returns
///
/// A numeric value.
#[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) }
}
/// Obtains the textual description of the form element. Note that the
/// description is for informative purposes, and it is not intended
/// to be rendered. For example, assistive technologies may use the
/// description field to provide an alternate way of presenting an
/// element to the user.
///
/// The returned string is allocated by the function. When it is
/// not needed anymore, be sure to call `g_free()` on it.
///
/// # Returns
///
/// A string, or [`None`] if the attribute
/// is not defined.
#[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,
))
}
}
/// Obtains the role of a form structure element that is part of a form, or is
/// a form field. This hints how the control for the element is intended
/// to be rendered.
///
/// # Returns
///
/// A [`StructureFormRole`][crate::StructureFormRole] value.
#[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,
))
}
}
/// For a structure element that is a form field, obtains in which state
/// the associated control is expected to be rendered.
///
/// # Returns
///
/// A [`StructureFormState`][crate::StructureFormState] value.
#[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,
))
}
}
/// Obtains the glyph orientation for the text contained in a
/// inline-level structure element.
///
/// # Returns
///
/// A [`StructureGlyphOrientation`][crate::StructureGlyphOrientation] value.
#[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,
))
}
}
/// Obtains the height of the block-level structure element. Note that for elements which do
/// not specify a height, it has to be calculated, and in this case -1 is returned.
///
/// # Returns
///
/// A positive value if a width is defined, or -1
/// if the height is to be calculated automatically.
#[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) }
}
/// Obtains the identifier of an element.
///
/// # Returns
///
/// The identifier of the element (if
/// defined), or [`None`].
#[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)) }
}
/// Obtains the inline-alignment mode of the block-level structure element.
///
/// # Returns
///
/// A [`StructureInlineAlign`][crate::StructureInlineAlign] value.
#[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,
))
}
}
///
/// # Returns
///
/// A [`StructureElementKind`][crate::StructureElementKind] value.
#[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,
))
}
}
/// Obtains the language and country code for the content in an element,
/// in two-letter ISO format, e.g. `<code>`en_ES`</code>`, or [`None`] if not
/// defined.
///
/// # Returns
///
/// language and country code, or [`None`].
#[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,
))
}
}
/// Obtains the line height for the text contained in the inline-level structure element.
/// Note that for elements which do not specify a line height, it has to be calculated,
/// and in this case -1 is returned.
///
/// # Returns
///
/// A positive value if a line height is defined, or -1
/// if the height is to be calculated automatically.
#[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) }
}
/// Obtains the list numbering style for list items.
///
/// # Returns
///
/// A [`StructureListNumbering`][crate::StructureListNumbering] value.
#[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() }
//}
/// Obtains the page number in which the element is contained.
///
/// # Returns
///
/// Number of the page that contains the element, of
/// `<code>`-1`</code>` if not defined.
#[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) }
}
/// Obtains the placement type of the structure element.
///
/// # Returns
///
/// A [`StructurePlacement`][crate::StructurePlacement] value.
#[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,
))
}
}
/// Obtains the alignment for the ruby text contained in a
/// inline-level structure element.
///
/// # Returns
///
/// A [`StructureRubyAlign`][crate::StructureRubyAlign] value.
#[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,
))
}
}
/// Obtains the position for the ruby text contained in a
/// inline-level structure element.
///
/// # Returns
///
/// A [`StructureRubyPosition`][crate::StructureRubyPosition] value.
#[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,
))
}
}
/// Obtains the amount of empty space after the block-level structure element.
///
/// # Returns
///
/// A positive value.
#[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) }
}
/// Obtains the amount of empty space before the block-level structure element.
///
/// # Returns
///
/// A positive value.
#[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) }
}
/// Obtains the amount of indentation at the beginning of the block-level structure element.
///
/// # Returns
///
/// A numeric value.
#[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: 96 }; 4) {
// unsafe { TODO: call ffi:poppler_structure_element_get_table_border_style() }
//}
/// Obtains the number of columns the table element spans to.
///
/// # Returns
///
/// A positive, non-zero value.
#[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) }
}
/// Obtains an array with the names of the table column headers. This is only
/// useful for table header row elements.
///
/// The array with the results is allocated by the function. The number
/// of items in the returned array can be obtained with `g_strv_length()`.
/// The returned value must be freed using `g_strfreev()`.
///
/// # Returns
///
///
/// Zero-terminated array of strings with the table header names,
/// or [`None`] if the attribute is not defined.
#[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() }
//}
/// Obtains the number of rows the table element spans to.
///
/// # Returns
///
/// A positive, non-zero value.
#[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) }
}
/// Obtains the scope of a table structure element.
///
/// # Returns
///
/// A [`StructureTableScope`][crate::StructureTableScope] value.
#[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,
))
}
}
/// Obtains the textual summary of the contents of the table element. Note that
/// the summary is meant for informative purposes, and it is not intended
/// to be rendered. For example, assistive technologies may use the
/// description field to provide an alternate way of presenting an element
/// to the user, or a document indexer may want to scan it for additional
/// keywords.
///
/// The returned string is allocated by the function. When it is
/// not needed anymore, be sure to call `g_free()` on it.
///
/// # Returns
///
/// A string, or [`None`] if the attribute
/// is not defined.
#[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,
))
}
}
/// Obtains the text enclosed by an element, or the text enclosed by the
/// elements in the subtree (including the element itself).
/// ## `flags`
/// A [`StructureGetTextFlags`][crate::StructureGetTextFlags] value, or
/// [`StructureGetTextFlags::NONE`][crate::StructureGetTextFlags::NONE] to disable all the flags.
///
/// # Returns
///
/// A string.
#[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(),
))
}
}
/// Obtains the text alignment mode of the text contained into a
/// block-level structure element.
///
/// # Returns
///
/// A [`StructureTextAlign`][crate::StructureTextAlign] value.
#[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,
))
}
}
/// Obtains the color of the text decoration for the text contained
/// in the inline-level structure element.
/// If this attribute is not specified, the color for this element shall be the current fill
/// color in effect at the start of its associated content.
///
/// # Returns
///
/// [`true`] if a color is defined for the element,
/// [`false`] otherwise.
///
/// ## `color`
/// A [`Color`][crate::Color].
#[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
}
}
}
/// Obtains the thickness of the text decoration for the text contained
/// in the inline-level structure element.
/// If this attribute is not specified, it shall be derived from the current
/// stroke thickness in effect at the start of the element’s associated content.
///
/// # Returns
///
/// Thickness of the text decoration, or NAN if not defined.
#[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)
}
}
/// Obtains the text decoration type of the text contained in the
/// inline-level structure element.
///
/// # Returns
///
/// A [`StructureTextDecoration`][crate::StructureTextDecoration] value.
#[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,
))
}
}
/// Obtains the amount of indentation of the text contained in the block-level structure element.
///
/// # Returns
///
/// A numeric value.
#[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) }
}
/// Obtains the text enclosed by an element, as an array of [`TextSpan`][crate::TextSpan]
/// structures. Each item in the list is a piece of text which share the same
/// attributes, plus its attributes. The following example shows how to
/// obtain and free the text spans of an element:
///
/// `<informalexample>``<programlisting>`
/// guint i, n_spans;
/// PopplerTextSpan **text_spans =
/// poppler_structure_element_get_text_spans (element, &n_spans);
/// /<!-- -->* Use the text spans *<!-- -->/
/// for (i = 0; i < n_spans; i++)
/// poppler_text_span_free (text_spans[i]);
/// g_free (text_spans);
/// `</programlisting>``</informalexample>`
///
/// # Returns
///
///
/// An array of [`TextSpan`][crate::TextSpan] elements.
#[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
}
}
/// Obtains the title of an element.
///
/// # Returns
///
/// The title of the element, or [`None`].
#[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,
))
}
}
/// Obtains the width of the block-level structure element. Note that for elements which do
/// not specify a width, it has to be calculated, and in this case -1 is returned.
///
/// # Returns
///
/// A positive value if a width is defined, or -1
/// if the width is to be calculated automatically.
#[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) }
}
/// Obtains the writing mode (writing direction) of the content associated
/// with a structure element.
///
/// # Returns
///
/// A [`StructureWritingMode`][crate::StructureWritingMode] value.
#[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,
))
}
}
/// Checks whether an element is a block element.
///
/// # Returns
///
/// [`true`] if the element is a block element, or [`false`] otherwise.
#[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,
))
}
}
/// Checks whether an element is actual document content.
///
/// # Returns
///
/// [`true`] if the element is content, or [`false`] otherwise.
#[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,
))
}
}
/// Checks whether an element is a grouping element.
///
/// # Returns
///
/// [`true`] if the element is a grouping element, [`false`]
/// otherwise.
#[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,
))
}
}
/// Checks whether an element is an inline element.
///
/// # Returns
///
/// [`true`] if the element is an inline element, or [`false`] otherwise.
#[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,
))
}
}
}