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

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 _;
    }
}

#[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]
    #[doc(alias = "poppler_annot_flag_get_type")]
    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 {
        Self::ParamSpec::builder
    }
}

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 {
        unsafe { 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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerFindFlags")]
    pub struct FindFlags: u32 {
        #[doc(alias = "POPPLER_FIND_DEFAULT")]
        const DEFAULT = ffi::POPPLER_FIND_DEFAULT as _;
        #[doc(alias = "POPPLER_FIND_CASE_SENSITIVE")]
        const CASE_SENSITIVE = ffi::POPPLER_FIND_CASE_SENSITIVE as _;
        #[doc(alias = "POPPLER_FIND_BACKWARDS")]
        const BACKWARDS = ffi::POPPLER_FIND_BACKWARDS as _;
        #[doc(alias = "POPPLER_FIND_WHOLE_WORDS_ONLY")]
        const WHOLE_WORDS_ONLY = ffi::POPPLER_FIND_WHOLE_WORDS_ONLY as _;
        #[doc(alias = "POPPLER_FIND_IGNORE_DIACRITICS")]
        const IGNORE_DIACRITICS = ffi::POPPLER_FIND_IGNORE_DIACRITICS as _;
        #[doc(alias = "POPPLER_FIND_MULTILINE")]
        const MULTILINE = ffi::POPPLER_FIND_MULTILINE as _;
    }
}

#[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]
    #[doc(alias = "poppler_find_flags_get_type")]
    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 {
        Self::ParamSpec::builder
    }
}

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 {
        unsafe { 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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerPermissions")]
    pub struct Permissions: u32 {
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_PRINT")]
        const OK_TO_PRINT = ffi::POPPLER_PERMISSIONS_OK_TO_PRINT as _;
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_MODIFY")]
        const OK_TO_MODIFY = ffi::POPPLER_PERMISSIONS_OK_TO_MODIFY as _;
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_COPY")]
        const OK_TO_COPY = ffi::POPPLER_PERMISSIONS_OK_TO_COPY as _;
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_ADD_NOTES")]
        const OK_TO_ADD_NOTES = ffi::POPPLER_PERMISSIONS_OK_TO_ADD_NOTES as _;
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_FILL_FORM")]
        const OK_TO_FILL_FORM = ffi::POPPLER_PERMISSIONS_OK_TO_FILL_FORM as _;
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS")]
        const OK_TO_EXTRACT_CONTENTS = ffi::POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS as _;
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_ASSEMBLE")]
        const OK_TO_ASSEMBLE = ffi::POPPLER_PERMISSIONS_OK_TO_ASSEMBLE as _;
        #[doc(alias = "POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION")]
        const OK_TO_PRINT_HIGH_RESOLUTION = ffi::POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION as _;
        #[doc(alias = "POPPLER_PERMISSIONS_FULL")]
        const FULL = ffi::POPPLER_PERMISSIONS_FULL as _;
    }
}

#[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]
    #[doc(alias = "poppler_permissions_get_type")]
    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 {
        Self::ParamSpec::builder
    }
}

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 {
        unsafe { 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! {
    #[cfg_attr(feature = "v25_2", deprecated = "Since 25.2")]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerPrintFlags")]
    pub struct PrintFlags: u32 {
        #[doc(alias = "POPPLER_PRINT_DOCUMENT")]
        const DOCUMENT = ffi::POPPLER_PRINT_DOCUMENT as _;
        #[doc(alias = "POPPLER_PRINT_MARKUP_ANNOTS")]
        const MARKUP_ANNOTS = ffi::POPPLER_PRINT_MARKUP_ANNOTS as _;
        #[doc(alias = "POPPLER_PRINT_STAMP_ANNOTS_ONLY")]
        const STAMP_ANNOTS_ONLY = ffi::POPPLER_PRINT_STAMP_ANNOTS_ONLY as _;
        #[doc(alias = "POPPLER_PRINT_ALL")]
        const ALL = ffi::POPPLER_PRINT_ALL as _;
    }
}

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

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

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

#[allow(deprecated)]
impl StaticType for PrintFlags {
    #[inline]
    #[doc(alias = "poppler_print_flags_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::poppler_print_flags_get_type()) }
    }
}

#[allow(deprecated)]
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 {
        Self::ParamSpec::builder
    }
}

#[allow(deprecated)]
impl glib::value::ValueType for PrintFlags {
    type Type = Self;
}

#[allow(deprecated)]
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 {
        unsafe { from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) }
    }
}

#[allow(deprecated)]
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()
    }
}

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

#[cfg(feature = "v25_2")]
bitflags! {
    #[cfg_attr(docsrs, doc(cfg(feature = "v25_2")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerRenderAnnotsFlags")]
    pub struct RenderAnnotsFlags: u32 {
        #[doc(alias = "POPPLER_RENDER_ANNOTS_NONE")]
        const NONE = ffi::POPPLER_RENDER_ANNOTS_NONE as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_TEXT")]
        const TEXT = ffi::POPPLER_RENDER_ANNOTS_TEXT as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_LINK")]
        const LINK = ffi::POPPLER_RENDER_ANNOTS_LINK as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_FREETEXT")]
        const FREETEXT = ffi::POPPLER_RENDER_ANNOTS_FREETEXT as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_LINE")]
        const LINE = ffi::POPPLER_RENDER_ANNOTS_LINE as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_SQUARE")]
        const SQUARE = ffi::POPPLER_RENDER_ANNOTS_SQUARE as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_CIRCLE")]
        const CIRCLE = ffi::POPPLER_RENDER_ANNOTS_CIRCLE as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_POLYGON")]
        const POLYGON = ffi::POPPLER_RENDER_ANNOTS_POLYGON as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_POLYLINE")]
        const POLYLINE = ffi::POPPLER_RENDER_ANNOTS_POLYLINE as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_HIGHLIGHT")]
        const HIGHLIGHT = ffi::POPPLER_RENDER_ANNOTS_HIGHLIGHT as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_UNDERLINE")]
        const UNDERLINE = ffi::POPPLER_RENDER_ANNOTS_UNDERLINE as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_SQUIGGLY")]
        const SQUIGGLY = ffi::POPPLER_RENDER_ANNOTS_SQUIGGLY as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_STRIKEOUT")]
        const STRIKEOUT = ffi::POPPLER_RENDER_ANNOTS_STRIKEOUT as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_STAMP")]
        const STAMP = ffi::POPPLER_RENDER_ANNOTS_STAMP as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_CARET")]
        const CARET = ffi::POPPLER_RENDER_ANNOTS_CARET as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_INK")]
        const INK = ffi::POPPLER_RENDER_ANNOTS_INK as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_POPUP")]
        const POPUP = ffi::POPPLER_RENDER_ANNOTS_POPUP as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_FILEATTACHMENT")]
        const FILEATTACHMENT = ffi::POPPLER_RENDER_ANNOTS_FILEATTACHMENT as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_SOUND")]
        const SOUND = ffi::POPPLER_RENDER_ANNOTS_SOUND as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_MOVIE")]
        const MOVIE = ffi::POPPLER_RENDER_ANNOTS_MOVIE as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_WIDGET")]
        const WIDGET = ffi::POPPLER_RENDER_ANNOTS_WIDGET as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_SCREEN")]
        const SCREEN = ffi::POPPLER_RENDER_ANNOTS_SCREEN as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_PRINTERMARK")]
        const PRINTERMARK = ffi::POPPLER_RENDER_ANNOTS_PRINTERMARK as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_TRAPNET")]
        const TRAPNET = ffi::POPPLER_RENDER_ANNOTS_TRAPNET as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_WATERMARK")]
        const WATERMARK = ffi::POPPLER_RENDER_ANNOTS_WATERMARK as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_3D")]
        const _3D = ffi::POPPLER_RENDER_ANNOTS_3D as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_RICHMEDIA")]
        const RICHMEDIA = ffi::POPPLER_RENDER_ANNOTS_RICHMEDIA as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_PRINT_DOCUMENT")]
        const PRINT_DOCUMENT = ffi::POPPLER_RENDER_ANNOTS_PRINT_DOCUMENT as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_PRINT_MARKUP")]
        const PRINT_MARKUP = ffi::POPPLER_RENDER_ANNOTS_PRINT_MARKUP as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_PRINT_STAMP")]
        const PRINT_STAMP = ffi::POPPLER_RENDER_ANNOTS_PRINT_STAMP as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_PRINT_ALL")]
        const PRINT_ALL = ffi::POPPLER_RENDER_ANNOTS_PRINT_ALL as _;
        #[doc(alias = "POPPLER_RENDER_ANNOTS_ALL")]
        const ALL = ffi::POPPLER_RENDER_ANNOTS_ALL as _;
    }
}

#[cfg(feature = "v25_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v25_2")))]
#[doc(hidden)]
impl IntoGlib for RenderAnnotsFlags {
    type GlibType = ffi::PopplerRenderAnnotsFlags;

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

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

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

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

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

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

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

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

#[cfg(feature = "v25_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v25_2")))]
impl ToValue for RenderAnnotsFlags {
    #[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 = "v25_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v25_2")))]
impl From<RenderAnnotsFlags> for glib::Value {
    #[inline]
    fn from(v: RenderAnnotsFlags) -> Self {
        ToValue::to_value(&v)
    }
}

#[cfg(feature = "v21_12")]
bitflags! {
    #[cfg_attr(docsrs, doc(cfg(feature = "v21_12")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerSignatureValidationFlags")]
    pub struct SignatureValidationFlags: u32 {
        #[doc(alias = "POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE")]
        const VALIDATE_CERTIFICATE = ffi::POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE as _;
        #[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 _;
        #[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")))]
#[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]
    #[doc(alias = "poppler_signature_validation_flags_get_type")]
    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 {
        Self::ParamSpec::builder
    }
}

#[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 {
        unsafe { 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 {
        #[doc(alias = "POPPLER_STRUCTURE_GET_TEXT_NONE")]
        const NONE = ffi::POPPLER_STRUCTURE_GET_TEXT_NONE as _;
        #[doc(alias = "POPPLER_STRUCTURE_GET_TEXT_RECURSIVE")]
        const RECURSIVE = ffi::POPPLER_STRUCTURE_GET_TEXT_RECURSIVE as _;
    }
}

#[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]
    #[doc(alias = "poppler_structure_get_text_flags_get_type")]
    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 {
        Self::ParamSpec::builder
    }
}

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 {
        unsafe { 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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PopplerViewerPreferences")]
    pub struct ViewerPreferences: u32 {
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_UNSET")]
        const UNSET = ffi::POPPLER_VIEWER_PREFERENCES_UNSET as _;
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR")]
        const HIDE_TOOLBAR = ffi::POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR as _;
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR")]
        const HIDE_MENUBAR = ffi::POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR as _;
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI")]
        const HIDE_WINDOWUI = ffi::POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI as _;
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_FIT_WINDOW")]
        const FIT_WINDOW = ffi::POPPLER_VIEWER_PREFERENCES_FIT_WINDOW as _;
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW")]
        const CENTER_WINDOW = ffi::POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW as _;
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE")]
        const DISPLAY_DOC_TITLE = ffi::POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE as _;
        #[doc(alias = "POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL")]
        const DIRECTION_RTL = ffi::POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL as _;
    }
}

#[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]
    #[doc(alias = "poppler_viewer_preferences_get_type")]
    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 {
        Self::ParamSpec::builder
    }
}

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 {
        unsafe { 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)
    }
}
