//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern "C" {
    pub static NSFontAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSParagraphStyleAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSForegroundColorAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSBackgroundColorAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSLigatureAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSKernAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSTrackingAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSStrikethroughStyleAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSUnderlineStyleAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSStrokeColorAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSStrokeWidthAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSShadowAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSTextEffectAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSAttachmentAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSLinkAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSBaselineOffsetAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSUnderlineColorAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSStrikethroughColorAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSWritingDirectionAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSCursorAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSToolTipAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSMarkedClauseSegmentAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSTextAlternativesAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSSpellingStateAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSSuperscriptAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSGlyphInfoAttributeName: &'static NSAttributedStringKey;
}

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSUnderlineStyle(pub NSInteger);
bitflags::bitflags! {
    impl NSUnderlineStyle: NSInteger {
        #[doc(alias = "NSUnderlineStyleNone")]
        const None = 0x00;
        #[doc(alias = "NSUnderlineStyleSingle")]
        const Single = 0x01;
        #[doc(alias = "NSUnderlineStyleThick")]
        const Thick = 0x02;
        #[doc(alias = "NSUnderlineStyleDouble")]
        const Double = 0x09;
        #[doc(alias = "NSUnderlineStylePatternSolid")]
        const PatternSolid = 0x0000;
        #[doc(alias = "NSUnderlineStylePatternDot")]
        const PatternDot = 0x0100;
        #[doc(alias = "NSUnderlineStylePatternDash")]
        const PatternDash = 0x0200;
        #[doc(alias = "NSUnderlineStylePatternDashDot")]
        const PatternDashDot = 0x0300;
        #[doc(alias = "NSUnderlineStylePatternDashDotDot")]
        const PatternDashDotDot = 0x0400;
        #[doc(alias = "NSUnderlineStyleByWord")]
        const ByWord = 0x8000;
    }
}

unsafe impl Encode for NSUnderlineStyle {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSUnderlineStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWritingDirectionFormatType(pub NSInteger);
impl NSWritingDirectionFormatType {
    pub const NSWritingDirectionEmbedding: Self = Self(0 << 1);
    pub const NSWritingDirectionOverride: Self = Self(1 << 1);
}

unsafe impl Encode for NSWritingDirectionFormatType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSWritingDirectionFormatType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_TYPED_ENUM
pub type NSTextEffectStyle = NSString;

extern "C" {
    pub static NSTextEffectLetterpressStyle: &'static NSTextEffectStyle;
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSpellingState(pub NSInteger);
impl NSSpellingState {
    #[doc(alias = "NSSpellingStateSpellingFlag")]
    pub const SpellingFlag: Self = Self(1 << 0);
    #[doc(alias = "NSSpellingStateGrammarFlag")]
    pub const GrammarFlag: Self = Self(1 << 1);
}

unsafe impl Encode for NSSpellingState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSSpellingState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_category!(
    /// Category on [`NSMutableAttributedString`].
    pub unsafe trait NSAttributedStringAttributeFixing {
        #[method(fixAttributesInRange:)]
        unsafe fn fixAttributesInRange(&self, range: NSRange);

        #[method(fixFontAttributeInRange:)]
        unsafe fn fixFontAttributeInRange(&self, range: NSRange);

        #[method(fixParagraphStyleAttributeInRange:)]
        unsafe fn fixParagraphStyleAttributeInRange(&self, range: NSRange);

        #[method(fixAttachmentAttributeInRange:)]
        unsafe fn fixAttachmentAttributeInRange(&self, range: NSRange);
    }

    unsafe impl NSAttributedStringAttributeFixing for NSMutableAttributedString {}
);

// NS_TYPED_EXTENSIBLE_ENUM
pub type NSAttributedStringDocumentType = NSString;

extern "C" {
    pub static NSPlainTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSRTFTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSRTFDTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSHTMLTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSMacSimpleTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSDocFormatTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSWordMLTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSWebArchiveTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSOfficeOpenXMLTextDocumentType: &'static NSAttributedStringDocumentType;
}

extern "C" {
    pub static NSOpenDocumentTextDocumentType: &'static NSAttributedStringDocumentType;
}

// NS_TYPED_ENUM
pub type NSTextLayoutSectionKey = NSString;

extern "C" {
    pub static NSTextLayoutSectionOrientation: &'static NSTextLayoutSectionKey;
}

extern "C" {
    pub static NSTextLayoutSectionRange: &'static NSTextLayoutSectionKey;
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextScalingType(pub NSInteger);
impl NSTextScalingType {
    pub const NSTextScalingStandard: Self = Self(0);
    pub const NSTextScalingiOS: Self = Self(1);
}

unsafe impl Encode for NSTextScalingType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSTextScalingType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_TYPED_EXTENSIBLE_ENUM
pub type NSAttributedStringDocumentAttributeKey = NSString;

extern "C" {
    pub static NSDocumentTypeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSConvertedDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSCocoaVersionDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSFileTypeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSTitleDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSCompanyDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSCopyrightDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSSubjectDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSAuthorDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSKeywordsDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSCommentDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSEditorDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSCreationTimeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSModificationTimeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSManagerDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSCategoryDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSAppearanceDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSCharacterEncodingDocumentAttribute:
        &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSDefaultAttributesDocumentAttribute:
        &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSPaperSizeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSLeftMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSRightMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSTopMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSBottomMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSViewSizeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSViewZoomDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSViewModeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSReadOnlyDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSBackgroundColorDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSHyphenationFactorDocumentAttribute:
        &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSDefaultTabIntervalDocumentAttribute:
        &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSTextLayoutSectionsAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSExcludedElementsDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSTextEncodingNameDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSPrefixSpacesDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSDefaultFontExcludedDocumentAttribute:
        &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSTextScalingDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}

extern "C" {
    pub static NSSourceTextScalingDocumentAttribute:
        &'static NSAttributedStringDocumentAttributeKey;
}

// NS_TYPED_EXTENSIBLE_ENUM
pub type NSAttributedStringDocumentReadingOptionKey = NSString;

extern "C" {
    pub static NSDocumentTypeDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSDefaultAttributesDocumentOption:
        &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSCharacterEncodingDocumentOption:
        &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSTextEncodingNameDocumentOption:
        &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSBaseURLDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSTimeoutDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSWebPreferencesDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSWebResourceLoadDelegateDocumentOption:
        &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSTextSizeMultiplierDocumentOption:
        &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSFileTypeDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSTargetTextScalingDocumentOption:
        &'static NSAttributedStringDocumentReadingOptionKey;
}

extern "C" {
    pub static NSSourceTextScalingDocumentOption:
        &'static NSAttributedStringDocumentReadingOptionKey;
}

extern_category!(
    /// Category on [`NSAttributedString`].
    pub unsafe trait NSAttributedStringDocumentFormats {
        #[method_id(@__retain_semantics Init initWithURL:options:documentAttributes:error:_)]
        unsafe fn initWithURL_options_documentAttributes_error(
            this: Allocated<Self>,
            url: &NSURL,
            options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[method_id(@__retain_semantics Init initWithData:options:documentAttributes:error:_)]
        unsafe fn initWithData_options_documentAttributes_error(
            this: Allocated<Self>,
            data: &NSData,
            options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[method_id(@__retain_semantics Other dataFromRange:documentAttributes:error:_)]
        unsafe fn dataFromRange_documentAttributes_error(
            &self,
            range: NSRange,
            dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
        ) -> Result<Retained<NSData>, Retained<NSError>>;

        #[method_id(@__retain_semantics Other fileWrapperFromRange:documentAttributes:error:_)]
        unsafe fn fileWrapperFromRange_documentAttributes_error(
            &self,
            range: NSRange,
            dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
        ) -> Result<Retained<NSFileWrapper>, Retained<NSError>>;

        #[method_id(@__retain_semantics Init initWithRTF:documentAttributes:)]
        unsafe fn initWithRTF_documentAttributes(
            this: Allocated<Self>,
            data: &NSData,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Init initWithRTFD:documentAttributes:)]
        unsafe fn initWithRTFD_documentAttributes(
            this: Allocated<Self>,
            data: &NSData,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Init initWithHTML:documentAttributes:)]
        unsafe fn initWithHTML_documentAttributes(
            this: Allocated<Self>,
            data: &NSData,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Init initWithHTML:baseURL:documentAttributes:)]
        unsafe fn initWithHTML_baseURL_documentAttributes(
            this: Allocated<Self>,
            data: &NSData,
            base: &NSURL,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Init initWithDocFormat:documentAttributes:)]
        unsafe fn initWithDocFormat_documentAttributes(
            this: Allocated<Self>,
            data: &NSData,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Init initWithHTML:options:documentAttributes:)]
        unsafe fn initWithHTML_options_documentAttributes(
            this: Allocated<Self>,
            data: &NSData,
            options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Init initWithRTFDFileWrapper:documentAttributes:)]
        unsafe fn initWithRTFDFileWrapper_documentAttributes(
            this: Allocated<Self>,
            wrapper: &NSFileWrapper,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Other RTFFromRange:documentAttributes:)]
        unsafe fn RTFFromRange_documentAttributes(
            &self,
            range: NSRange,
            dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
        ) -> Option<Retained<NSData>>;

        #[method_id(@__retain_semantics Other RTFDFromRange:documentAttributes:)]
        unsafe fn RTFDFromRange_documentAttributes(
            &self,
            range: NSRange,
            dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
        ) -> Option<Retained<NSData>>;

        #[method_id(@__retain_semantics Other RTFDFileWrapperFromRange:documentAttributes:)]
        unsafe fn RTFDFileWrapperFromRange_documentAttributes(
            &self,
            range: NSRange,
            dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
        ) -> Option<Retained<NSFileWrapper>>;

        #[method_id(@__retain_semantics Other docFormatFromRange:documentAttributes:)]
        unsafe fn docFormatFromRange_documentAttributes(
            &self,
            range: NSRange,
            dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
        ) -> Option<Retained<NSData>>;
    }

    unsafe impl NSAttributedStringDocumentFormats for NSAttributedString {}
);

extern_category!(
    /// Category on [`NSMutableAttributedString`].
    pub unsafe trait NSMutableAttributedStringDocumentFormats {
        #[method(readFromURL:options:documentAttributes:error:_)]
        unsafe fn readFromURL_options_documentAttributes_error(
            &self,
            url: &NSURL,
            opts: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Result<(), Retained<NSError>>;

        #[method(readFromData:options:documentAttributes:error:_)]
        unsafe fn readFromData_options_documentAttributes_error(
            &self,
            data: &NSData,
            opts: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
            dict: Option<
                &mut Option<
                    Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
                >,
            >,
        ) -> Result<(), Retained<NSError>>;
    }

    unsafe impl NSMutableAttributedStringDocumentFormats for NSMutableAttributedString {}
);

extern_category!(
    /// Category on [`NSAttributedString`].
    pub unsafe trait NSAttributedStringKitAdditions {
        #[method_id(@__retain_semantics Other fontAttributesInRange:)]
        unsafe fn fontAttributesInRange(
            &self,
            range: NSRange,
        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;

        #[method_id(@__retain_semantics Other rulerAttributesInRange:)]
        unsafe fn rulerAttributesInRange(
            &self,
            range: NSRange,
        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;

        #[method(containsAttachmentsInRange:)]
        unsafe fn containsAttachmentsInRange(&self, range: NSRange) -> bool;

        #[method(lineBreakBeforeIndex:withinRange:)]
        unsafe fn lineBreakBeforeIndex_withinRange(
            &self,
            location: NSUInteger,
            a_range: NSRange,
        ) -> NSUInteger;

        #[method(lineBreakByHyphenatingBeforeIndex:withinRange:)]
        unsafe fn lineBreakByHyphenatingBeforeIndex_withinRange(
            &self,
            location: NSUInteger,
            a_range: NSRange,
        ) -> NSUInteger;

        #[method(doubleClickAtIndex:)]
        unsafe fn doubleClickAtIndex(&self, location: NSUInteger) -> NSRange;

        #[method(nextWordFromIndex:forward:)]
        unsafe fn nextWordFromIndex_forward(
            &self,
            location: NSUInteger,
            is_forward: bool,
        ) -> NSUInteger;

        #[cfg(feature = "NSTextTable")]
        #[method(rangeOfTextBlock:atIndex:)]
        unsafe fn rangeOfTextBlock_atIndex(
            &self,
            block: &NSTextBlock,
            location: NSUInteger,
        ) -> NSRange;

        #[cfg(feature = "NSTextTable")]
        #[method(rangeOfTextTable:atIndex:)]
        unsafe fn rangeOfTextTable_atIndex(
            &self,
            table: &NSTextTable,
            location: NSUInteger,
        ) -> NSRange;

        #[cfg(feature = "NSTextList")]
        #[method(rangeOfTextList:atIndex:)]
        unsafe fn rangeOfTextList_atIndex(
            &self,
            list: &NSTextList,
            location: NSUInteger,
        ) -> NSRange;

        #[cfg(feature = "NSTextList")]
        #[method(itemNumberInTextList:atIndex:)]
        unsafe fn itemNumberInTextList_atIndex(
            &self,
            list: &NSTextList,
            location: NSUInteger,
        ) -> NSInteger;
    }

    unsafe impl NSAttributedStringKitAdditions for NSAttributedString {}
);

extern_category!(
    /// Category on [`NSAttributedString`].
    pub unsafe trait NSAttributedStringPasteboardAdditions {
        #[method_id(@__retain_semantics Other textTypes)]
        unsafe fn textTypes() -> Retained<NSArray<NSString>>;

        #[method_id(@__retain_semantics Other textUnfilteredTypes)]
        unsafe fn textUnfilteredTypes() -> Retained<NSArray<NSString>>;
    }

    unsafe impl NSAttributedStringPasteboardAdditions for NSAttributedString {}
);

#[cfg(feature = "NSPasteboard")]
unsafe impl NSPasteboardReading for NSAttributedString {}

#[cfg(feature = "NSPasteboard")]
unsafe impl NSPasteboardWriting for NSAttributedString {}

extern_category!(
    /// Category on [`NSMutableAttributedString`].
    pub unsafe trait NSMutableAttributedStringKitAdditions {
        #[method(superscriptRange:)]
        unsafe fn superscriptRange(&self, range: NSRange);

        #[method(subscriptRange:)]
        unsafe fn subscriptRange(&self, range: NSRange);

        #[method(unscriptRange:)]
        unsafe fn unscriptRange(&self, range: NSRange);

        #[cfg(feature = "NSFontManager")]
        #[method(applyFontTraits:range:)]
        unsafe fn applyFontTraits_range(&self, trait_mask: NSFontTraitMask, range: NSRange);

        #[cfg(feature = "NSText")]
        #[method(setAlignment:range:)]
        unsafe fn setAlignment_range(&self, alignment: NSTextAlignment, range: NSRange);

        #[cfg(feature = "NSText")]
        #[method(setBaseWritingDirection:range:)]
        unsafe fn setBaseWritingDirection_range(
            &self,
            writing_direction: NSWritingDirection,
            range: NSRange,
        );
    }

    unsafe impl NSMutableAttributedStringKitAdditions for NSMutableAttributedString {}
);

pub static NSUnderlinePatternSolid: NSUnderlineStyle =
    NSUnderlineStyle(NSUnderlineStyle::PatternSolid.0);

pub static NSUnderlinePatternDot: NSUnderlineStyle =
    NSUnderlineStyle(NSUnderlineStyle::PatternDot.0);

pub static NSUnderlinePatternDash: NSUnderlineStyle =
    NSUnderlineStyle(NSUnderlineStyle::PatternDash.0);

pub static NSUnderlinePatternDashDot: NSUnderlineStyle =
    NSUnderlineStyle(NSUnderlineStyle::PatternDashDot.0);

pub static NSUnderlinePatternDashDotDot: NSUnderlineStyle =
    NSUnderlineStyle(NSUnderlineStyle::PatternDashDotDot.0);

pub static NSUnderlineByWord: NSUnderlineStyle = NSUnderlineStyle(NSUnderlineStyle::ByWord.0);

extern "C" {
    pub static NSCharacterShapeAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSUsesScreenFontsDocumentAttribute: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSObliquenessAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSExpansionAttributeName: &'static NSAttributedStringKey;
}

extern "C" {
    pub static NSVerticalGlyphFormAttributeName: &'static NSAttributedStringKey;
}

#[deprecated = "Use NSUnderlineStyleNone instead"]
pub const NSNoUnderlineStyle: c_uint = 0;
#[deprecated = "Use NSUnderlineStyleSingle instead"]
pub const NSSingleUnderlineStyle: c_uint = 1;

extern "C" {
    pub static NSUnderlineStrikethroughMask: NSUInteger;
}

extern "C" {
    pub static NSUnderlineByWordMask: NSUInteger;
}

extern_category!(
    /// Category "NSDeprecatedKitAdditions" on [`NSAttributedString`].
    #[doc(alias = "NSDeprecatedKitAdditions")]
    pub unsafe trait NSAttributedStringNSDeprecatedKitAdditions {
        #[method(containsAttachments)]
        unsafe fn containsAttachments(&self) -> bool;

        #[deprecated]
        #[method_id(@__retain_semantics Other textFileTypes)]
        unsafe fn textFileTypes() -> Retained<NSArray>;

        #[deprecated]
        #[method_id(@__retain_semantics Other textPasteboardTypes)]
        unsafe fn textPasteboardTypes() -> Retained<NSArray>;

        #[deprecated]
        #[method_id(@__retain_semantics Other textUnfilteredFileTypes)]
        unsafe fn textUnfilteredFileTypes() -> Retained<NSArray>;

        #[deprecated]
        #[method_id(@__retain_semantics Other textUnfilteredPasteboardTypes)]
        unsafe fn textUnfilteredPasteboardTypes() -> Retained<NSArray>;

        #[deprecated = "Use -initWithURL:options:documentAttributes:error: instead"]
        #[method_id(@__retain_semantics Init initWithURL:documentAttributes:)]
        unsafe fn initWithURL_documentAttributes(
            this: Allocated<Self>,
            url: &NSURL,
            dict: Option<&mut Option<Retained<NSDictionary>>>,
        ) -> Option<Retained<Self>>;

        #[deprecated = "Use -initWithURL:options:documentAttributes:error: instead"]
        #[method_id(@__retain_semantics Init initWithPath:documentAttributes:)]
        unsafe fn initWithPath_documentAttributes(
            this: Allocated<Self>,
            path: &NSString,
            dict: Option<&mut Option<Retained<NSDictionary>>>,
        ) -> Option<Retained<Self>>;

        #[deprecated = "Use NSDataDetector instead"]
        #[method_id(@__retain_semantics Other URLAtIndex:effectiveRange:)]
        unsafe fn URLAtIndex_effectiveRange(
            &self,
            location: NSUInteger,
            effective_range: NSRangePointer,
        ) -> Option<Retained<NSURL>>;
    }

    unsafe impl NSAttributedStringNSDeprecatedKitAdditions for NSAttributedString {}
);
