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
// 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 glib::{bitflags::bitflags, prelude::*, translate::*};
use std::fmt;

bitflags! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerAnnotFlag")]
    pub struct AnnotFlag: u32 {
        #[doc(alias = "POPPLER_ANNOT_FLAG_UNKNOWN")]
        const UNKNOWN = ffi::POPPLER_ANNOT_FLAG_UNKNOWN as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_INVISIBLE")]
        const INVISIBLE = ffi::POPPLER_ANNOT_FLAG_INVISIBLE as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_HIDDEN")]
        const HIDDEN = ffi::POPPLER_ANNOT_FLAG_HIDDEN as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_PRINT")]
        const PRINT = ffi::POPPLER_ANNOT_FLAG_PRINT as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_NO_ZOOM")]
        const NO_ZOOM = ffi::POPPLER_ANNOT_FLAG_NO_ZOOM as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_NO_ROTATE")]
        const NO_ROTATE = ffi::POPPLER_ANNOT_FLAG_NO_ROTATE as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_NO_VIEW")]
        const NO_VIEW = ffi::POPPLER_ANNOT_FLAG_NO_VIEW as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_READ_ONLY")]
        const READ_ONLY = ffi::POPPLER_ANNOT_FLAG_READ_ONLY as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_LOCKED")]
        const LOCKED = ffi::POPPLER_ANNOT_FLAG_LOCKED as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_TOGGLE_NO_VIEW")]
        const TOGGLE_NO_VIEW = ffi::POPPLER_ANNOT_FLAG_TOGGLE_NO_VIEW as _;
        #[doc(alias = "POPPLER_ANNOT_FLAG_LOCKED_CONTENTS")]
        const LOCKED_CONTENTS = ffi::POPPLER_ANNOT_FLAG_LOCKED_CONTENTS as _;
    }
}

impl fmt::Display for AnnotFlag {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for AnnotFlag {
    type GlibType = ffi::PopplerAnnotFlag;

    #[inline]
    fn into_glib(self) -> ffi::PopplerAnnotFlag {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::PopplerAnnotFlag> for AnnotFlag {
    #[inline]
    unsafe fn from_glib(value: ffi::PopplerAnnotFlag) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for AnnotFlag {
    #[inline]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::poppler_annot_flag_get_type()) }
    }
}

impl glib::HasParamSpec for AnnotFlag {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        |name| Self::ParamSpec::builder(name)
    }
}

impl glib::value::ValueType for AnnotFlag {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AnnotFlag {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for AnnotFlag {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<AnnotFlag> for glib::Value {
    #[inline]
    fn from(v: AnnotFlag) -> Self {
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// Flags using while searching text in a page
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerFindFlags")]
    pub struct FindFlags: u32 {
        /// use default search settings
        #[doc(alias = "POPPLER_FIND_DEFAULT")]
        const DEFAULT = ffi::POPPLER_FIND_DEFAULT as _;
        /// do case sensitive search
        #[doc(alias = "POPPLER_FIND_CASE_SENSITIVE")]
        const CASE_SENSITIVE = ffi::POPPLER_FIND_CASE_SENSITIVE as _;
        /// search backwards
        #[doc(alias = "POPPLER_FIND_BACKWARDS")]
        const BACKWARDS = ffi::POPPLER_FIND_BACKWARDS as _;
        /// search only whole words
        #[doc(alias = "POPPLER_FIND_WHOLE_WORDS_ONLY")]
        const WHOLE_WORDS_ONLY = ffi::POPPLER_FIND_WHOLE_WORDS_ONLY as _;
        /// do diacritics insensitive search,
        /// i.e. ignore accents, umlauts, diaeresis,etc. while matching. This
        /// option will be ignored if the search term is not pure ascii. Since 0.73.
        #[doc(alias = "POPPLER_FIND_IGNORE_DIACRITICS")]
        const IGNORE_DIACRITICS = ffi::POPPLER_FIND_IGNORE_DIACRITICS as _;
        /// allows to match on text spanning from
        /// end of a line to the next line. (Currently it won't match on text spanning
        /// more than two lines.) Automatically ignores hyphen at end of line, and
        /// allows whitespace in search term to match on newline char. Since: 21.05.0.
        #[doc(alias = "POPPLER_FIND_MULTILINE")]
        const MULTILINE = ffi::POPPLER_FIND_MULTILINE as _;
    }
}

impl fmt::Display for FindFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FindFlags {
    type GlibType = ffi::PopplerFindFlags;

    #[inline]
    fn into_glib(self) -> ffi::PopplerFindFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::PopplerFindFlags> for FindFlags {
    #[inline]
    unsafe fn from_glib(value: ffi::PopplerFindFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FindFlags {
    #[inline]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::poppler_find_flags_get_type()) }
    }
}

impl glib::HasParamSpec for FindFlags {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        |name| Self::ParamSpec::builder(name)
    }
}

impl glib::value::ValueType for FindFlags {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for FindFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FindFlags {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<FindFlags> for glib::Value {
    #[inline]
    fn from(v: FindFlags) -> Self {
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// Permissions
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerPermissions")]
    pub struct Permissions: u32 {
        /// document can be printer
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_PRINT")]
        const OK_TO_PRINT = ffi::POPPLER_PERMISSIONS_OK_TO_PRINT as _;
        /// document contents can be modified
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_MODIFY")]
        const OK_TO_MODIFY = ffi::POPPLER_PERMISSIONS_OK_TO_MODIFY as _;
        /// document can be copied
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_COPY")]
        const OK_TO_COPY = ffi::POPPLER_PERMISSIONS_OK_TO_COPY as _;
        /// annotations can added to the document
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_ADD_NOTES")]
        const OK_TO_ADD_NOTES = ffi::POPPLER_PERMISSIONS_OK_TO_ADD_NOTES as _;
        /// interactive form fields can be filled in
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_FILL_FORM")]
        const OK_TO_FILL_FORM = ffi::POPPLER_PERMISSIONS_OK_TO_FILL_FORM as _;
        /// extract text and graphics
        /// (in support of accessibility to users with disabilities or for other purposes). Since 0.18
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS")]
        const OK_TO_EXTRACT_CONTENTS = ffi::POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS as _;
        /// assemble the document (insert, rotate, or delete pages and create
        /// bookmarks or thumbnail images). Since 0.18
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_ASSEMBLE")]
        const OK_TO_ASSEMBLE = ffi::POPPLER_PERMISSIONS_OK_TO_ASSEMBLE as _;
        /// document can be printer at high resolution. Since 0.18
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION")]
        const OK_TO_PRINT_HIGH_RESOLUTION = ffi::POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION as _;
        /// document permits all operations
        #[doc(alias = "POPPLER_PERMISSIONS_FULL")]
        const FULL = ffi::POPPLER_PERMISSIONS_FULL as _;
    }
}

impl fmt::Display for Permissions {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for Permissions {
    type GlibType = ffi::PopplerPermissions;

    #[inline]
    fn into_glib(self) -> ffi::PopplerPermissions {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::PopplerPermissions> for Permissions {
    #[inline]
    unsafe fn from_glib(value: ffi::PopplerPermissions) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for Permissions {
    #[inline]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::poppler_permissions_get_type()) }
    }
}

impl glib::HasParamSpec for Permissions {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        |name| Self::ParamSpec::builder(name)
    }
}

impl glib::value::ValueType for Permissions {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for Permissions {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for Permissions {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<Permissions> for glib::Value {
    #[inline]
    fn from(v: Permissions) -> Self {
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// Printing flags
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerPrintFlags")]
    pub struct PrintFlags: u32 {
        /// print main document contents
        #[doc(alias = "POPPLER_PRINT_DOCUMENT")]
        const DOCUMENT = ffi::POPPLER_PRINT_DOCUMENT as _;
        /// print document and markup annotations
        #[doc(alias = "POPPLER_PRINT_MARKUP_ANNOTS")]
        const MARKUP_ANNOTS = ffi::POPPLER_PRINT_MARKUP_ANNOTS as _;
        /// print document and only stamp annotations
        #[doc(alias = "POPPLER_PRINT_STAMP_ANNOTS_ONLY")]
        const STAMP_ANNOTS_ONLY = ffi::POPPLER_PRINT_STAMP_ANNOTS_ONLY as _;
        /// print main document contents and all markup annotations
        #[doc(alias = "POPPLER_PRINT_ALL")]
        const ALL = ffi::POPPLER_PRINT_ALL as _;
    }
}

impl fmt::Display for PrintFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for PrintFlags {
    type GlibType = ffi::PopplerPrintFlags;

    #[inline]
    fn into_glib(self) -> ffi::PopplerPrintFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::PopplerPrintFlags> for PrintFlags {
    #[inline]
    unsafe fn from_glib(value: ffi::PopplerPrintFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for PrintFlags {
    #[inline]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::poppler_print_flags_get_type()) }
    }
}

impl glib::HasParamSpec for PrintFlags {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        |name| Self::ParamSpec::builder(name)
    }
}

impl glib::value::ValueType for PrintFlags {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for PrintFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for PrintFlags {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<PrintFlags> for glib::Value {
    #[inline]
    fn from(v: PrintFlags) -> Self {
        ToValue::to_value(&v)
    }
}

#[cfg(feature = "v21_12")]
bitflags! {
    /// Signature validation flags
    #[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerSignatureValidationFlags")]
    pub struct SignatureValidationFlags: u32 {
        /// Whether to validate also the certificate of the signature
        #[doc(alias = "POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE")]
        const VALIDATE_CERTIFICATE = ffi::POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE as _;
        /// Whether to not do OCSP (Online Certificate Status Protocol) revocation check
        #[doc(alias = "POPPLER_SIGNATURE_VALIDATION_FLAG_WITHOUT_OCSP_REVOCATION_CHECK")]
        const WITHOUT_OCSP_REVOCATION_CHECK = ffi::POPPLER_SIGNATURE_VALIDATION_FLAG_WITHOUT_OCSP_REVOCATION_CHECK as _;
        /// Whether to use AIA (Authority Information Access) extension for certificate fetching
        #[doc(alias = "POPPLER_SIGNATURE_VALIDATION_FLAG_USE_AIA_CERTIFICATE_FETCH")]
        const USE_AIA_CERTIFICATE_FETCH = ffi::POPPLER_SIGNATURE_VALIDATION_FLAG_USE_AIA_CERTIFICATE_FETCH as _;
    }
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
impl fmt::Display for SignatureValidationFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
#[doc(hidden)]
impl IntoGlib for SignatureValidationFlags {
    type GlibType = ffi::PopplerSignatureValidationFlags;

    #[inline]
    fn into_glib(self) -> ffi::PopplerSignatureValidationFlags {
        self.bits()
    }
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
#[doc(hidden)]
impl FromGlib<ffi::PopplerSignatureValidationFlags> for SignatureValidationFlags {
    #[inline]
    unsafe fn from_glib(value: ffi::PopplerSignatureValidationFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
impl StaticType for SignatureValidationFlags {
    #[inline]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::poppler_signature_validation_flags_get_type()) }
    }
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
impl glib::HasParamSpec for SignatureValidationFlags {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        |name| Self::ParamSpec::builder(name)
    }
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
impl glib::value::ValueType for SignatureValidationFlags {
    type Type = Self;
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
unsafe impl<'a> glib::value::FromValue<'a> for SignatureValidationFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
impl ToValue for SignatureValidationFlags {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

#[cfg(feature = "v21_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
impl From<SignatureValidationFlags> for glib::Value {
    #[inline]
    fn from(v: SignatureValidationFlags) -> Self {
        ToValue::to_value(&v)
    }
}

bitflags! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerStructureGetTextFlags")]
    pub struct StructureGetTextFlags: u32 {
        /// No flags.
        #[doc(alias = "POPPLER_STRUCTURE_GET_TEXT_NONE")]
        const NONE = ffi::POPPLER_STRUCTURE_GET_TEXT_NONE as _;
        /// For non-leaf, non-content
        ///  elements, recursively obtain the text from all the elements
        ///  enclosed in the subtree.
        #[doc(alias = "POPPLER_STRUCTURE_GET_TEXT_RECURSIVE")]
        const RECURSIVE = ffi::POPPLER_STRUCTURE_GET_TEXT_RECURSIVE as _;
    }
}

impl fmt::Display for StructureGetTextFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for StructureGetTextFlags {
    type GlibType = ffi::PopplerStructureGetTextFlags;

    #[inline]
    fn into_glib(self) -> ffi::PopplerStructureGetTextFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::PopplerStructureGetTextFlags> for StructureGetTextFlags {
    #[inline]
    unsafe fn from_glib(value: ffi::PopplerStructureGetTextFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for StructureGetTextFlags {
    #[inline]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::poppler_structure_get_text_flags_get_type()) }
    }
}

impl glib::HasParamSpec for StructureGetTextFlags {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        |name| Self::ParamSpec::builder(name)
    }
}

impl glib::value::ValueType for StructureGetTextFlags {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for StructureGetTextFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for StructureGetTextFlags {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<StructureGetTextFlags> for glib::Value {
    #[inline]
    fn from(v: StructureGetTextFlags) -> Self {
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// Viewer preferences
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerViewerPreferences")]
    pub struct ViewerPreferences: u32 {
        /// no preferences set
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_UNSET")]
        const UNSET = ffi::POPPLER_VIEWER_PREFERENCES_UNSET as _;
        /// hider toolbars when document is active
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR")]
        const HIDE_TOOLBAR = ffi::POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR as _;
        /// hide menu bar when document is active
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR")]
        const HIDE_MENUBAR = ffi::POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR as _;
        /// hide UI elements in document's window
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI")]
        const HIDE_WINDOWUI = ffi::POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI as _;
        /// resize document's window to fit the size of the first displayed page
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_FIT_WINDOW")]
        const FIT_WINDOW = ffi::POPPLER_VIEWER_PREFERENCES_FIT_WINDOW as _;
        /// position the document's window in the center of the screen
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW")]
        const CENTER_WINDOW = ffi::POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW as _;
        /// display document title in window's title bar
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE")]
        const DISPLAY_DOC_TITLE = ffi::POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE as _;
        /// the predominant reading order for text is right to left
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL")]
        const DIRECTION_RTL = ffi::POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL as _;
    }
}

impl fmt::Display for ViewerPreferences {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for ViewerPreferences {
    type GlibType = ffi::PopplerViewerPreferences;

    #[inline]
    fn into_glib(self) -> ffi::PopplerViewerPreferences {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::PopplerViewerPreferences> for ViewerPreferences {
    #[inline]
    unsafe fn from_glib(value: ffi::PopplerViewerPreferences) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for ViewerPreferences {
    #[inline]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::poppler_viewer_preferences_get_type()) }
    }
}

impl glib::HasParamSpec for ViewerPreferences {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        |name| Self::ParamSpec::builder(name)
    }
}

impl glib::value::ValueType for ViewerPreferences {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for ViewerPreferences {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for ViewerPreferences {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<ViewerPreferences> for glib::Value {
    #[inline]
    fn from(v: ViewerPreferences) -> Self {
        ToValue::to_value(&v)
    }
}