NSAttributedString.inc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. { Parsed from Appkit.framework NSAttributedString.h }
  2. { Version FrameworkParser: 1.3. PasCocoa 0.3, Objective-P 0.4 - Thu Oct 1 18:54:06 ICT 2009 }
  3. {$ifdef TYPES}
  4. {$ifndef NSATTRIBUTEDSTRING_PAS_T}
  5. {$define NSATTRIBUTEDSTRING_PAS_T}
  6. { Constants }
  7. const
  8. NSUnderlineStyleNone = $00;
  9. NSUnderlineStyleSingle = $01;
  10. NSUnderlineStyleThick = $02;
  11. NSUnderlineStyleDouble = $09;
  12. const
  13. NSUnderlinePatternSolid = $0000;
  14. NSUnderlinePatternDot = $0100;
  15. NSUnderlinePatternDash = $0200;
  16. NSUnderlinePatternDashDot = $0300;
  17. NSUnderlinePatternDashDotDot = $0400;
  18. const
  19. NSSpellingStateSpellingFlag = 1 shl 0;
  20. NSSpellingStateGrammarFlag = 1 shl 1;
  21. const
  22. NSNoUnderlineStyle = 0;
  23. NSSingleUnderlineStyle = 0;
  24. {$endif}
  25. {$endif}
  26. {$ifdef RECORDS}
  27. {$ifndef NSATTRIBUTEDSTRING_PAS_R}
  28. {$define NSATTRIBUTEDSTRING_PAS_R}
  29. {$endif}
  30. {$endif}
  31. {$ifdef FUNCTIONS}
  32. {$ifndef NSATTRIBUTEDSTRING_PAS_F}
  33. {$define NSATTRIBUTEDSTRING_PAS_F}
  34. {$endif}
  35. {$endif}
  36. {$ifdef EXTERNAL_SYMBOLS}
  37. {$ifndef NSATTRIBUTEDSTRING_PAS_S}
  38. {$define NSATTRIBUTEDSTRING_PAS_S}
  39. { External string constants }
  40. var
  41. NSFontAttributeName: NSString; external name '_NSFontAttributeName';
  42. NSParagraphStyleAttributeName: NSString; external name '_NSParagraphStyleAttributeName';
  43. NSForegroundColorAttributeName: NSString; external name '_NSForegroundColorAttributeName';
  44. NSUnderlineStyleAttributeName: NSString; external name '_NSUnderlineStyleAttributeName';
  45. NSSuperscriptAttributeName: NSString; external name '_NSSuperscriptAttributeName';
  46. NSBackgroundColorAttributeName: NSString; external name '_NSBackgroundColorAttributeName';
  47. NSAttachmentAttributeName: NSString; external name '_NSAttachmentAttributeName';
  48. NSLigatureAttributeName: NSString; external name '_NSLigatureAttributeName';
  49. NSBaselineOffsetAttributeName: NSString; external name '_NSBaselineOffsetAttributeName';
  50. NSKernAttributeName: NSString; external name '_NSKernAttributeName';
  51. NSLinkAttributeName: NSString; external name '_NSLinkAttributeName';
  52. NSStrokeWidthAttributeName: NSString; external name '_NSStrokeWidthAttributeName';
  53. NSStrokeColorAttributeName: NSString; external name '_NSStrokeColorAttributeName';
  54. NSUnderlineColorAttributeName: NSString; external name '_NSUnderlineColorAttributeName';
  55. NSStrikethroughStyleAttributeName: NSString; external name '_NSStrikethroughStyleAttributeName';
  56. NSStrikethroughColorAttributeName: NSString; external name '_NSStrikethroughColorAttributeName';
  57. NSShadowAttributeName: NSString; external name '_NSShadowAttributeName';
  58. NSObliquenessAttributeName: NSString; external name '_NSObliquenessAttributeName';
  59. NSExpansionAttributeName: NSString; external name '_NSExpansionAttributeName';
  60. NSCursorAttributeName: NSString; external name '_NSCursorAttributeName';
  61. NSToolTipAttributeName: NSString; external name '_NSToolTipAttributeName';
  62. NSCharacterShapeAttributeName: NSString; external name '_NSCharacterShapeAttributeName';
  63. NSGlyphInfoAttributeName: NSString; external name '_NSGlyphInfoAttributeName';
  64. NSMarkedClauseSegmentAttributeName: NSString; external name '_NSMarkedClauseSegmentAttributeName';
  65. NSSpellingStateAttributeName: NSString; external name '_NSSpellingStateAttributeName';
  66. NSPlainTextDocumentType: NSString; external name '_NSPlainTextDocumentType';
  67. NSRTFTextDocumentType: NSString; external name '_NSRTFTextDocumentType';
  68. NSRTFDTextDocumentType: NSString; external name '_NSRTFDTextDocumentType';
  69. NSMacSimpleTextDocumentType: NSString; external name '_NSMacSimpleTextDocumentType';
  70. NSHTMLTextDocumentType: NSString; external name '_NSHTMLTextDocumentType';
  71. NSDocFormatTextDocumentType: NSString; external name '_NSDocFormatTextDocumentType';
  72. NSWordMLTextDocumentType: NSString; external name '_NSWordMLTextDocumentType';
  73. NSWebArchiveTextDocumentType: NSString; external name '_NSWebArchiveTextDocumentType';
  74. NSOfficeOpenXMLTextDocumentType: NSString; external name '_NSOfficeOpenXMLTextDocumentType';
  75. NSOpenDocumentTextDocumentType: NSString; external name '_NSOpenDocumentTextDocumentType';
  76. NSPaperSizeDocumentAttribute: NSString; external name '_NSPaperSizeDocumentAttribute';
  77. NSLeftMarginDocumentAttribute: NSString; external name '_NSLeftMarginDocumentAttribute';
  78. NSRightMarginDocumentAttribute: NSString; external name '_NSRightMarginDocumentAttribute';
  79. NSTopMarginDocumentAttribute: NSString; external name '_NSTopMarginDocumentAttribute';
  80. NSBottomMarginDocumentAttribute: NSString; external name '_NSBottomMarginDocumentAttribute';
  81. NSViewSizeDocumentAttribute: NSString; external name '_NSViewSizeDocumentAttribute';
  82. NSViewZoomDocumentAttribute: NSString; external name '_NSViewZoomDocumentAttribute';
  83. NSViewModeDocumentAttribute: NSString; external name '_NSViewModeDocumentAttribute';
  84. NSDocumentTypeDocumentAttribute: NSString; external name '_NSDocumentTypeDocumentAttribute';
  85. NSReadOnlyDocumentAttribute: NSString; external name '_NSReadOnlyDocumentAttribute';
  86. NSConvertedDocumentAttribute: NSString; external name '_NSConvertedDocumentAttribute';
  87. NSCocoaVersionDocumentAttribute: NSString; external name '_NSCocoaVersionDocumentAttribute';
  88. NSBackgroundColorDocumentAttribute: NSString; external name '_NSBackgroundColorDocumentAttribute';
  89. NSHyphenationFactorDocumentAttribute: NSString; external name '_NSHyphenationFactorDocumentAttribute';
  90. NSDefaultTabIntervalDocumentAttribute: NSString; external name '_NSDefaultTabIntervalDocumentAttribute';
  91. NSCharacterEncodingDocumentAttribute: NSString; external name '_NSCharacterEncodingDocumentAttribute';
  92. NSTitleDocumentAttribute: NSString; external name '_NSTitleDocumentAttribute';
  93. NSCompanyDocumentAttribute: NSString; external name '_NSCompanyDocumentAttribute';
  94. NSCopyrightDocumentAttribute: NSString; external name '_NSCopyrightDocumentAttribute';
  95. NSSubjectDocumentAttribute: NSString; external name '_NSSubjectDocumentAttribute';
  96. NSAuthorDocumentAttribute: NSString; external name '_NSAuthorDocumentAttribute';
  97. NSKeywordsDocumentAttribute: NSString; external name '_NSKeywordsDocumentAttribute';
  98. NSCommentDocumentAttribute: NSString; external name '_NSCommentDocumentAttribute';
  99. NSEditorDocumentAttribute: NSString; external name '_NSEditorDocumentAttribute';
  100. NSCreationTimeDocumentAttribute: NSString; external name '_NSCreationTimeDocumentAttribute';
  101. NSModificationTimeDocumentAttribute: NSString; external name '_NSModificationTimeDocumentAttribute';
  102. NSExcludedElementsDocumentAttribute: NSString; external name '_NSExcludedElementsDocumentAttribute';
  103. NSTextEncodingNameDocumentAttribute: NSString; external name '_NSTextEncodingNameDocumentAttribute';
  104. NSPrefixSpacesDocumentAttribute: NSString; external name '_NSPrefixSpacesDocumentAttribute';
  105. NSDocumentTypeDocumentOption: NSString; external name '_NSDocumentTypeDocumentOption';
  106. NSDefaultAttributesDocumentOption: NSString; external name '_NSDefaultAttributesDocumentOption';
  107. NSCharacterEncodingDocumentOption: NSString; external name '_NSCharacterEncodingDocumentOption';
  108. NSTextEncodingNameDocumentOption: NSString; external name '_NSTextEncodingNameDocumentOption';
  109. NSBaseURLDocumentOption: NSString; external name '_NSBaseURLDocumentOption';
  110. NSTimeoutDocumentOption: NSString; external name '_NSTimeoutDocumentOption';
  111. NSWebPreferencesDocumentOption: NSString; external name '_NSWebPreferencesDocumentOption';
  112. NSWebResourceLoadDelegateDocumentOption: NSString; external name '_NSWebResourceLoadDelegateDocumentOption';
  113. NSTextSizeMultiplierDocumentOption: NSString; external name '_NSTextSizeMultiplierDocumentOption';
  114. { External symbols }
  115. var
  116. NSUnderlineByWordMask: NSUInteger; external name '_NSUnderlineByWordMask';
  117. NSUnderlineStrikethroughMask: NSUInteger; external name '_NSUnderlineStrikethroughMask';
  118. {$endif}
  119. {$endif}
  120. {$ifdef FORWARD}
  121. NSAttributedString = objcclass;
  122. NSAttributedStringPointer = ^NSAttributedString;
  123. NSMutableAttributedString = objcclass;
  124. NSMutableAttributedStringPointer = ^NSMutableAttributedString;
  125. {$endif}
  126. {$ifdef CLASSES}
  127. {$ifndef NSATTRIBUTEDSTRING_PAS_C}
  128. {$define NSATTRIBUTEDSTRING_PAS_C}
  129. { NSAttributedString }
  130. NSAttributedString = objcclass(NSObject, NSCopyingProtocol, NSMutableCopyingProtocol, NSCodingProtocol)
  131. public
  132. class function alloc: NSAttributedString; message 'alloc';
  133. function string_: NSString; message 'string';
  134. function attributesAtIndex_effectiveRange(location: NSUInteger; range: NSRangePointer): NSDictionary; message 'attributesAtIndex:effectiveRange:';
  135. { Category: NSExtendedAttributedString }
  136. function length: NSUInteger; message 'length';
  137. function attribute_atIndex_effectiveRange(attrName: NSString; location: NSUInteger; range: NSRangePointer): id; message 'attribute:atIndex:effectiveRange:';
  138. function attributedSubstringFromRange(range: NSRange): NSAttributedString; message 'attributedSubstringFromRange:';
  139. function attributesAtIndex_longestEffectiveRange_inRange(location: NSUInteger; range: NSRangePointer; rangeLimit: NSRange): NSDictionary; message 'attributesAtIndex:longestEffectiveRange:inRange:';
  140. function attribute_atIndex_longestEffectiveRange_inRange(attrName: NSString; location: NSUInteger; range: NSRangePointer; rangeLimit: NSRange): id; message 'attribute:atIndex:longestEffectiveRange:inRange:';
  141. function isEqualToAttributedString(other: NSAttributedString): Boolean; message 'isEqualToAttributedString:';
  142. function initWithString(str: NSString): id; message 'initWithString:';
  143. function initWithString_attributes(str: NSString; attrs: NSDictionary): id; message 'initWithString:attributes:';
  144. function initWithAttributedString(attrStr: NSAttributedString): id; message 'initWithAttributedString:';
  145. { Category: NSAttributedStringKitAdditions }
  146. function fontAttributesInRange(range: NSRange): NSDictionary; message 'fontAttributesInRange:';
  147. function rulerAttributesInRange(range: NSRange): NSDictionary; message 'rulerAttributesInRange:';
  148. function containsAttachments: Boolean; message 'containsAttachments';
  149. function lineBreakBeforeIndex_withinRange(location: NSUInteger; aRange: NSRange): NSUInteger; message 'lineBreakBeforeIndex:withinRange:';
  150. function lineBreakByHyphenatingBeforeIndex_withinRange(location: NSUInteger; aRange: NSRange): NSUInteger; message 'lineBreakByHyphenatingBeforeIndex:withinRange:';
  151. function doubleClickAtIndex(location: NSUInteger): NSRange; message 'doubleClickAtIndex:';
  152. function nextWordFromIndex_forward(location: NSUInteger; isForward: Boolean): NSUInteger; message 'nextWordFromIndex:forward:';
  153. function URLAtIndex_effectiveRange(location: NSUInteger; effectiveRange: NSRangePointer): NSURL; message 'URLAtIndex:effectiveRange:';
  154. class function textTypes: NSArray; message 'textTypes';
  155. class function textUnfilteredTypes: NSArray; message 'textUnfilteredTypes';
  156. function rangeOfTextBlock_atIndex(block: NSTextBlock; location: NSUInteger): NSRange; message 'rangeOfTextBlock:atIndex:';
  157. function rangeOfTextTable_atIndex(table: NSTextTable; location: NSUInteger): NSRange; message 'rangeOfTextTable:atIndex:';
  158. function rangeOfTextList_atIndex(list: NSTextList; location: NSUInteger): NSRange; message 'rangeOfTextList:atIndex:';
  159. function itemNumberInTextList_atIndex(list: NSTextList; location: NSUInteger): NSInteger; message 'itemNumberInTextList:atIndex:';
  160. function initWithURL_options_documentAttributes_error(url: NSURL; options: NSDictionary; dict: NSDictionaryPointer; error: NSErrorPointer): id; message 'initWithURL:options:documentAttributes:error:';
  161. function initWithData_options_documentAttributes_error(data: NSData; options: NSDictionary; dict: NSDictionaryPointer; error: NSErrorPointer): id; message 'initWithData:options:documentAttributes:error:';
  162. function initWithPath_documentAttributes(path: NSString; dict: NSDictionaryPointer): id; message 'initWithPath:documentAttributes:';
  163. function initWithURL_documentAttributes(url: NSURL; dict: NSDictionaryPointer): id; message 'initWithURL:documentAttributes:';
  164. function initWithRTF_documentAttributes(data: NSData; dict: NSDictionaryPointer): id; message 'initWithRTF:documentAttributes:';
  165. function initWithRTFD_documentAttributes(data: NSData; dict: NSDictionaryPointer): id; message 'initWithRTFD:documentAttributes:';
  166. function initWithHTML_documentAttributes(data: NSData; dict: NSDictionaryPointer): id; message 'initWithHTML:documentAttributes:';
  167. function initWithHTML_baseURL_documentAttributes(data: NSData; base: NSURL; dict: NSDictionaryPointer): id; message 'initWithHTML:baseURL:documentAttributes:';
  168. function initWithDocFormat_documentAttributes(data: NSData; dict: NSDictionaryPointer): id; message 'initWithDocFormat:documentAttributes:';
  169. function initWithHTML_options_documentAttributes(data: NSData; options: NSDictionary; dict: NSDictionaryPointer): id; message 'initWithHTML:options:documentAttributes:';
  170. function initWithRTFDFileWrapper_documentAttributes(wrapper: NSFileWrapper; dict: NSDictionaryPointer): id; message 'initWithRTFDFileWrapper:documentAttributes:';
  171. function dataFromRange_documentAttributes_error(range: NSRange; dict: NSDictionary; error: NSErrorPointer): NSData; message 'dataFromRange:documentAttributes:error:';
  172. function fileWrapperFromRange_documentAttributes_error(range: NSRange; dict: NSDictionary; error: NSErrorPointer): NSFileWrapper; message 'fileWrapperFromRange:documentAttributes:error:';
  173. function RTFFromRange_documentAttributes(range: NSRange; dict: NSDictionary): NSData; message 'RTFFromRange:documentAttributes:';
  174. function RTFDFromRange_documentAttributes(range: NSRange; dict: NSDictionary): NSData; message 'RTFDFromRange:documentAttributes:';
  175. function RTFDFileWrapperFromRange_documentAttributes(range: NSRange; dict: NSDictionary): NSFileWrapper; message 'RTFDFileWrapperFromRange:documentAttributes:';
  176. function docFormatFromRange_documentAttributes(range: NSRange; dict: NSDictionary): NSData; message 'docFormatFromRange:documentAttributes:';
  177. { Category: NSDeprecatedKitAdditions }
  178. class function textFileTypes: NSArray; message 'textFileTypes';
  179. class function textPasteboardTypes: NSArray; message 'textPasteboardTypes';
  180. class function textUnfilteredFileTypes: NSArray; message 'textUnfilteredFileTypes';
  181. class function textUnfilteredPasteboardTypes: NSArray; message 'textUnfilteredPasteboardTypes';
  182. { Category: NSAttributedStringAttachmentConveniences }
  183. class function attributedStringWithAttachment(attachment: NSTextAttachment): NSAttributedString; message 'attributedStringWithAttachment:';
  184. { Category: NSStringDrawing }
  185. function size: NSSize; message 'size';
  186. procedure drawAtPoint(point: NSPoint); message 'drawAtPoint:';
  187. procedure drawInRect(rect: NSRect); message 'drawInRect:';
  188. { Category: NSExtendedStringDrawing }
  189. procedure drawWithRect_options(rect: NSRect; options: NSStringDrawingOptions); message 'drawWithRect:options:';
  190. function boundingRectWithSize_options(size_: NSSize; options: NSStringDrawingOptions): NSRect; message 'boundingRectWithSize:options:';
  191. end; external;
  192. { NSMutableAttributedString }
  193. NSMutableAttributedString = objcclass(NSAttributedString)
  194. public
  195. class function alloc: NSMutableAttributedString; message 'alloc';
  196. procedure replaceCharactersInRange_withString(range: NSRange; str: NSString); message 'replaceCharactersInRange:withString:';
  197. procedure setAttributes_range(attrs: NSDictionary; range: NSRange); message 'setAttributes:range:';
  198. { Category: NSExtendedMutableAttributedString }
  199. function mutableString: NSMutableString; message 'mutableString';
  200. procedure addAttribute_value_range(name: NSString; value: id; range: NSRange); message 'addAttribute:value:range:';
  201. procedure addAttributes_range(attrs: NSDictionary; range: NSRange); message 'addAttributes:range:';
  202. procedure removeAttribute_range(name: NSString; range: NSRange); message 'removeAttribute:range:';
  203. procedure replaceCharactersInRange_withAttributedString(range: NSRange; attrString: NSAttributedString); message 'replaceCharactersInRange:withAttributedString:';
  204. procedure insertAttributedString_atIndex(attrString: NSAttributedString; loc: NSUInteger); message 'insertAttributedString:atIndex:';
  205. procedure appendAttributedString(attrString: NSAttributedString); message 'appendAttributedString:';
  206. procedure deleteCharactersInRange(range: NSRange); message 'deleteCharactersInRange:';
  207. procedure setAttributedString(attrString: NSAttributedString); message 'setAttributedString:';
  208. procedure beginEditing; message 'beginEditing';
  209. procedure endEditing; message 'endEditing';
  210. { Category: NSMutableAttributedStringKitAdditions }
  211. function readFromURL_options_documentAttributes_error(url: NSURL; opts: NSDictionary; dict: NSDictionaryPointer; error: NSErrorPointer): Boolean; message 'readFromURL:options:documentAttributes:error:';
  212. function readFromData_options_documentAttributes_error(data: NSData; opts: NSDictionary; dict: NSDictionaryPointer; error: NSErrorPointer): Boolean; message 'readFromData:options:documentAttributes:error:';
  213. function readFromURL_options_documentAttributes(url: NSURL; options: NSDictionary; dict: NSDictionaryPointer): Boolean; message 'readFromURL:options:documentAttributes:';
  214. function readFromData_options_documentAttributes(data: NSData; options: NSDictionary; dict: NSDictionaryPointer): Boolean; message 'readFromData:options:documentAttributes:';
  215. procedure superscriptRange(range: NSRange); message 'superscriptRange:';
  216. procedure subscriptRange(range: NSRange); message 'subscriptRange:';
  217. procedure unscriptRange(range: NSRange); message 'unscriptRange:';
  218. procedure applyFontTraits_range(traitMask: NSFontTraitMask; range: NSRange); message 'applyFontTraits:range:';
  219. procedure setAlignment_range(alignment: NSTextAlignment; range: NSRange); message 'setAlignment:range:';
  220. procedure setBaseWritingDirection_range(writingDirection: NSWritingDirection; range: NSRange); message 'setBaseWritingDirection:range:';
  221. procedure fixAttributesInRange(range: NSRange); message 'fixAttributesInRange:';
  222. procedure fixFontAttributeInRange(range: NSRange); message 'fixFontAttributeInRange:';
  223. procedure fixParagraphStyleAttributeInRange(range: NSRange); message 'fixParagraphStyleAttributeInRange:';
  224. procedure fixAttachmentAttributeInRange(range: NSRange); message 'fixAttachmentAttributeInRange:';
  225. { Category: NSMutableAttributedStringAttachmentConveniences }
  226. procedure updateAttachmentsFromPath(path: NSString); message 'updateAttachmentsFromPath:';
  227. end; external;
  228. {$endif}
  229. {$endif}