objc2_app_kit/generated/
NSDocument.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdocumentchangetype?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSDocumentChangeType(pub NSUInteger);
15impl NSDocumentChangeType {
16    #[doc(alias = "NSChangeDone")]
17    pub const ChangeDone: Self = Self(0);
18    #[doc(alias = "NSChangeUndone")]
19    pub const ChangeUndone: Self = Self(1);
20    #[doc(alias = "NSChangeRedone")]
21    pub const ChangeRedone: Self = Self(5);
22    #[doc(alias = "NSChangeCleared")]
23    pub const ChangeCleared: Self = Self(2);
24    #[doc(alias = "NSChangeReadOtherContents")]
25    pub const ChangeReadOtherContents: Self = Self(3);
26    #[doc(alias = "NSChangeAutosaved")]
27    pub const ChangeAutosaved: Self = Self(4);
28    #[doc(alias = "NSChangeDiscardable")]
29    pub const ChangeDiscardable: Self = Self(256);
30}
31
32unsafe impl Encode for NSDocumentChangeType {
33    const ENCODING: Encoding = NSUInteger::ENCODING;
34}
35
36unsafe impl RefEncode for NSDocumentChangeType {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssaveoperationtype?language=objc)
41// NS_ENUM
42#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct NSSaveOperationType(pub NSUInteger);
45impl NSSaveOperationType {
46    #[doc(alias = "NSSaveOperation")]
47    pub const SaveOperation: Self = Self(0);
48    #[doc(alias = "NSSaveAsOperation")]
49    pub const SaveAsOperation: Self = Self(1);
50    #[doc(alias = "NSSaveToOperation")]
51    pub const SaveToOperation: Self = Self(2);
52    #[doc(alias = "NSAutosaveInPlaceOperation")]
53    pub const AutosaveInPlaceOperation: Self = Self(4);
54    #[doc(alias = "NSAutosaveElsewhereOperation")]
55    pub const AutosaveElsewhereOperation: Self = Self(3);
56    #[doc(alias = "NSAutosaveAsOperation")]
57    pub const AutosaveAsOperation: Self = Self(5);
58    #[doc(alias = "NSAutosaveOperation")]
59    #[deprecated = "Use NSAutosaveElsewhereOperation instead"]
60    pub const AutosaveOperation: Self = Self(3);
61}
62
63unsafe impl Encode for NSSaveOperationType {
64    const ENCODING: Encoding = NSUInteger::ENCODING;
65}
66
67unsafe impl RefEncode for NSSaveOperationType {
68    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
69}
70
71extern_class!(
72    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdocument?language=objc)
73    #[unsafe(super(NSObject))]
74    #[thread_kind = MainThreadOnly]
75    #[derive(Debug, PartialEq, Eq, Hash)]
76    pub struct NSDocument;
77);
78
79#[cfg(feature = "NSKeyValueBinding")]
80extern_conformance!(
81    unsafe impl NSEditorRegistration for NSDocument {}
82);
83
84extern_conformance!(
85    unsafe impl NSFilePresenter for NSDocument {}
86);
87
88#[cfg(feature = "NSMenu")]
89extern_conformance!(
90    unsafe impl NSMenuItemValidation for NSDocument {}
91);
92
93extern_conformance!(
94    unsafe impl NSObjectProtocol for NSDocument {}
95);
96
97#[cfg(feature = "NSUserInterfaceValidation")]
98extern_conformance!(
99    unsafe impl NSUserInterfaceValidations for NSDocument {}
100);
101
102impl NSDocument {
103    extern_methods!(
104        #[unsafe(method(init))]
105        #[unsafe(method_family = init)]
106        pub fn init(this: Allocated<Self>) -> Retained<Self>;
107
108        #[unsafe(method(initWithType:error:_))]
109        #[unsafe(method_family = init)]
110        pub fn initWithType_error(
111            this: Allocated<Self>,
112            type_name: &NSString,
113        ) -> Result<Retained<Self>, Retained<NSError>>;
114
115        #[unsafe(method(canConcurrentlyReadDocumentsOfType:))]
116        #[unsafe(method_family = none)]
117        pub fn canConcurrentlyReadDocumentsOfType(
118            type_name: &NSString,
119            mtm: MainThreadMarker,
120        ) -> bool;
121
122        #[unsafe(method(initWithContentsOfURL:ofType:error:_))]
123        #[unsafe(method_family = init)]
124        pub fn initWithContentsOfURL_ofType_error(
125            this: Allocated<Self>,
126            url: &NSURL,
127            type_name: &NSString,
128        ) -> Result<Retained<Self>, Retained<NSError>>;
129
130        #[unsafe(method(initForURL:withContentsOfURL:ofType:error:_))]
131        #[unsafe(method_family = init)]
132        pub fn initForURL_withContentsOfURL_ofType_error(
133            this: Allocated<Self>,
134            url_or_nil: Option<&NSURL>,
135            contents_url: &NSURL,
136            type_name: &NSString,
137        ) -> Result<Retained<Self>, Retained<NSError>>;
138
139        #[unsafe(method(fileType))]
140        #[unsafe(method_family = none)]
141        pub fn fileType(&self) -> Option<Retained<NSString>>;
142
143        /// Setter for [`fileType`][Self::fileType].
144        ///
145        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
146        #[unsafe(method(setFileType:))]
147        #[unsafe(method_family = none)]
148        pub fn setFileType(&self, file_type: Option<&NSString>);
149
150        #[unsafe(method(fileURL))]
151        #[unsafe(method_family = none)]
152        pub fn fileURL(&self) -> Option<Retained<NSURL>>;
153
154        /// Setter for [`fileURL`][Self::fileURL].
155        ///
156        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
157        #[unsafe(method(setFileURL:))]
158        #[unsafe(method_family = none)]
159        pub fn setFileURL(&self, file_url: Option<&NSURL>);
160
161        #[unsafe(method(fileModificationDate))]
162        #[unsafe(method_family = none)]
163        pub fn fileModificationDate(&self) -> Option<Retained<NSDate>>;
164
165        /// Setter for [`fileModificationDate`][Self::fileModificationDate].
166        ///
167        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
168        #[unsafe(method(setFileModificationDate:))]
169        #[unsafe(method_family = none)]
170        pub fn setFileModificationDate(&self, file_modification_date: Option<&NSDate>);
171
172        #[unsafe(method(isDraft))]
173        #[unsafe(method_family = none)]
174        pub fn isDraft(&self) -> bool;
175
176        /// Setter for [`isDraft`][Self::isDraft].
177        #[unsafe(method(setDraft:))]
178        #[unsafe(method_family = none)]
179        pub fn setDraft(&self, draft: bool);
180
181        #[cfg(feature = "block2")]
182        #[unsafe(method(performActivityWithSynchronousWaiting:usingBlock:))]
183        #[unsafe(method_family = none)]
184        pub fn performActivityWithSynchronousWaiting_usingBlock(
185            &self,
186            wait_synchronously: bool,
187            block: &block2::DynBlock<dyn Fn(NonNull<block2::DynBlock<dyn Fn()>>)>,
188        );
189
190        #[cfg(feature = "block2")]
191        #[unsafe(method(continueActivityUsingBlock:))]
192        #[unsafe(method_family = none)]
193        pub fn continueActivityUsingBlock(&self, block: &block2::DynBlock<dyn Fn() + '_>);
194
195        #[cfg(feature = "block2")]
196        #[unsafe(method(continueAsynchronousWorkOnMainThreadUsingBlock:))]
197        #[unsafe(method_family = none)]
198        pub fn continueAsynchronousWorkOnMainThreadUsingBlock(
199            &self,
200            block: &block2::DynBlock<dyn Fn()>,
201        );
202
203        #[cfg(feature = "block2")]
204        #[unsafe(method(performSynchronousFileAccessUsingBlock:))]
205        #[unsafe(method_family = none)]
206        pub fn performSynchronousFileAccessUsingBlock(
207            &self,
208            block: &block2::DynBlock<dyn Fn() + '_>,
209        );
210
211        #[cfg(feature = "block2")]
212        #[unsafe(method(performAsynchronousFileAccessUsingBlock:))]
213        #[unsafe(method_family = none)]
214        pub fn performAsynchronousFileAccessUsingBlock(
215            &self,
216            block: &block2::DynBlock<dyn Fn(NonNull<block2::DynBlock<dyn Fn()>>)>,
217        );
218
219        /// # Safety
220        ///
221        /// `sender` should be of the correct type.
222        #[unsafe(method(revertDocumentToSaved:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn revertDocumentToSaved(&self, sender: Option<&AnyObject>);
225
226        #[unsafe(method(revertToContentsOfURL:ofType:error:_))]
227        #[unsafe(method_family = none)]
228        pub fn revertToContentsOfURL_ofType_error(
229            &self,
230            url: &NSURL,
231            type_name: &NSString,
232        ) -> Result<(), Retained<NSError>>;
233
234        #[unsafe(method(readFromURL:ofType:error:_))]
235        #[unsafe(method_family = none)]
236        pub fn readFromURL_ofType_error(
237            &self,
238            url: &NSURL,
239            type_name: &NSString,
240        ) -> Result<(), Retained<NSError>>;
241
242        #[unsafe(method(readFromFileWrapper:ofType:error:_))]
243        #[unsafe(method_family = none)]
244        pub fn readFromFileWrapper_ofType_error(
245            &self,
246            file_wrapper: &NSFileWrapper,
247            type_name: &NSString,
248        ) -> Result<(), Retained<NSError>>;
249
250        #[unsafe(method(readFromData:ofType:error:_))]
251        #[unsafe(method_family = none)]
252        pub fn readFromData_ofType_error(
253            &self,
254            data: &NSData,
255            type_name: &NSString,
256        ) -> Result<(), Retained<NSError>>;
257
258        #[unsafe(method(isEntireFileLoaded))]
259        #[unsafe(method_family = none)]
260        pub fn isEntireFileLoaded(&self) -> bool;
261
262        #[unsafe(method(writeToURL:ofType:error:_))]
263        #[unsafe(method_family = none)]
264        pub fn writeToURL_ofType_error(
265            &self,
266            url: &NSURL,
267            type_name: &NSString,
268        ) -> Result<(), Retained<NSError>>;
269
270        #[unsafe(method(fileWrapperOfType:error:_))]
271        #[unsafe(method_family = none)]
272        pub fn fileWrapperOfType_error(
273            &self,
274            type_name: &NSString,
275        ) -> Result<Retained<NSFileWrapper>, Retained<NSError>>;
276
277        #[unsafe(method(dataOfType:error:_))]
278        #[unsafe(method_family = none)]
279        pub fn dataOfType_error(
280            &self,
281            type_name: &NSString,
282        ) -> Result<Retained<NSData>, Retained<NSError>>;
283
284        #[unsafe(method(unblockUserInteraction))]
285        #[unsafe(method_family = none)]
286        pub fn unblockUserInteraction(&self);
287
288        #[unsafe(method(autosavingIsImplicitlyCancellable))]
289        #[unsafe(method_family = none)]
290        pub fn autosavingIsImplicitlyCancellable(&self) -> bool;
291
292        #[unsafe(method(writeSafelyToURL:ofType:forSaveOperation:error:_))]
293        #[unsafe(method_family = none)]
294        pub fn writeSafelyToURL_ofType_forSaveOperation_error(
295            &self,
296            url: &NSURL,
297            type_name: &NSString,
298            save_operation: NSSaveOperationType,
299        ) -> Result<(), Retained<NSError>>;
300
301        #[unsafe(method(writeToURL:ofType:forSaveOperation:originalContentsURL:error:_))]
302        #[unsafe(method_family = none)]
303        pub fn writeToURL_ofType_forSaveOperation_originalContentsURL_error(
304            &self,
305            url: &NSURL,
306            type_name: &NSString,
307            save_operation: NSSaveOperationType,
308            absolute_original_contents_url: Option<&NSURL>,
309        ) -> Result<(), Retained<NSError>>;
310
311        #[unsafe(method(fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:_))]
312        #[unsafe(method_family = none)]
313        pub fn fileAttributesToWriteToURL_ofType_forSaveOperation_originalContentsURL_error(
314            &self,
315            url: &NSURL,
316            type_name: &NSString,
317            save_operation: NSSaveOperationType,
318            absolute_original_contents_url: Option<&NSURL>,
319        ) -> Result<Retained<NSDictionary<NSString, AnyObject>>, Retained<NSError>>;
320
321        #[unsafe(method(keepBackupFile))]
322        #[unsafe(method_family = none)]
323        pub fn keepBackupFile(&self) -> bool;
324
325        #[unsafe(method(backupFileURL))]
326        #[unsafe(method_family = none)]
327        pub fn backupFileURL(&self) -> Option<Retained<NSURL>>;
328
329        /// # Safety
330        ///
331        /// `sender` should be of the correct type.
332        #[unsafe(method(saveDocument:))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn saveDocument(&self, sender: Option<&AnyObject>);
335
336        /// # Safety
337        ///
338        /// `sender` should be of the correct type.
339        #[unsafe(method(saveDocumentAs:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn saveDocumentAs(&self, sender: Option<&AnyObject>);
342
343        /// # Safety
344        ///
345        /// `sender` should be of the correct type.
346        #[unsafe(method(saveDocumentTo:))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn saveDocumentTo(&self, sender: Option<&AnyObject>);
349
350        /// # Safety
351        ///
352        /// - `delegate` should be of the correct type.
353        /// - `did_save_selector` must be a valid selector.
354        /// - `context_info` must be a valid pointer or null.
355        #[unsafe(method(saveDocumentWithDelegate:didSaveSelector:contextInfo:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn saveDocumentWithDelegate_didSaveSelector_contextInfo(
358            &self,
359            delegate: Option<&AnyObject>,
360            did_save_selector: Option<Sel>,
361            context_info: *mut c_void,
362        );
363
364        /// # Safety
365        ///
366        /// - `delegate` should be of the correct type.
367        /// - `did_save_selector` must be a valid selector.
368        /// - `context_info` must be a valid pointer or null.
369        #[unsafe(method(runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn runModalSavePanelForSaveOperation_delegate_didSaveSelector_contextInfo(
372            &self,
373            save_operation: NSSaveOperationType,
374            delegate: Option<&AnyObject>,
375            did_save_selector: Option<Sel>,
376            context_info: *mut c_void,
377        );
378
379        #[unsafe(method(savePanelShowsFileFormatsControl))]
380        #[unsafe(method_family = none)]
381        pub fn savePanelShowsFileFormatsControl(&self) -> bool;
382
383        #[cfg(all(
384            feature = "NSPanel",
385            feature = "NSResponder",
386            feature = "NSSavePanel",
387            feature = "NSWindow"
388        ))]
389        #[unsafe(method(prepareSavePanel:))]
390        #[unsafe(method_family = none)]
391        pub fn prepareSavePanel(&self, save_panel: &NSSavePanel) -> bool;
392
393        #[unsafe(method(fileNameExtensionWasHiddenInLastRunSavePanel))]
394        #[unsafe(method_family = none)]
395        pub fn fileNameExtensionWasHiddenInLastRunSavePanel(&self) -> bool;
396
397        #[unsafe(method(fileTypeFromLastRunSavePanel))]
398        #[unsafe(method_family = none)]
399        pub fn fileTypeFromLastRunSavePanel(&self) -> Option<Retained<NSString>>;
400
401        /// # Safety
402        ///
403        /// - `delegate` should be of the correct type.
404        /// - `did_save_selector` must be a valid selector.
405        /// - `context_info` must be a valid pointer or null.
406        #[unsafe(method(saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn saveToURL_ofType_forSaveOperation_delegate_didSaveSelector_contextInfo(
409            &self,
410            url: &NSURL,
411            type_name: &NSString,
412            save_operation: NSSaveOperationType,
413            delegate: Option<&AnyObject>,
414            did_save_selector: Option<Sel>,
415            context_info: *mut c_void,
416        );
417
418        #[cfg(feature = "block2")]
419        #[unsafe(method(saveToURL:ofType:forSaveOperation:completionHandler:))]
420        #[unsafe(method_family = none)]
421        pub fn saveToURL_ofType_forSaveOperation_completionHandler(
422            &self,
423            url: &NSURL,
424            type_name: &NSString,
425            save_operation: NSSaveOperationType,
426            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
427        );
428
429        #[unsafe(method(canAsynchronouslyWriteToURL:ofType:forSaveOperation:))]
430        #[unsafe(method_family = none)]
431        pub fn canAsynchronouslyWriteToURL_ofType_forSaveOperation(
432            &self,
433            url: &NSURL,
434            type_name: &NSString,
435            save_operation: NSSaveOperationType,
436        ) -> bool;
437
438        #[unsafe(method(checkAutosavingSafetyAndReturnError:_))]
439        #[unsafe(method_family = none)]
440        pub fn checkAutosavingSafetyAndReturnError(&self) -> Result<(), Retained<NSError>>;
441
442        #[unsafe(method(scheduleAutosaving))]
443        #[unsafe(method_family = none)]
444        pub fn scheduleAutosaving(&self);
445
446        #[unsafe(method(hasUnautosavedChanges))]
447        #[unsafe(method_family = none)]
448        pub fn hasUnautosavedChanges(&self) -> bool;
449
450        /// # Safety
451        ///
452        /// - `delegate` should be of the correct type.
453        /// - `did_autosave_selector` must be a valid selector.
454        /// - `context_info` must be a valid pointer or null.
455        #[unsafe(method(autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:))]
456        #[unsafe(method_family = none)]
457        pub unsafe fn autosaveDocumentWithDelegate_didAutosaveSelector_contextInfo(
458            &self,
459            delegate: Option<&AnyObject>,
460            did_autosave_selector: Option<Sel>,
461            context_info: *mut c_void,
462        );
463
464        #[cfg(feature = "block2")]
465        #[unsafe(method(autosaveWithImplicitCancellability:completionHandler:))]
466        #[unsafe(method_family = none)]
467        pub fn autosaveWithImplicitCancellability_completionHandler(
468            &self,
469            autosaving_is_implicitly_cancellable: bool,
470            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
471        );
472
473        #[unsafe(method(autosavesInPlace))]
474        #[unsafe(method_family = none)]
475        pub fn autosavesInPlace(mtm: MainThreadMarker) -> bool;
476
477        #[unsafe(method(preservesVersions))]
478        #[unsafe(method_family = none)]
479        pub fn preservesVersions(mtm: MainThreadMarker) -> bool;
480
481        /// # Safety
482        ///
483        /// `sender` should be of the correct type.
484        #[unsafe(method(browseDocumentVersions:))]
485        #[unsafe(method_family = none)]
486        pub unsafe fn browseDocumentVersions(&self, sender: Option<&AnyObject>);
487
488        #[unsafe(method(isBrowsingVersions))]
489        #[unsafe(method_family = none)]
490        pub fn isBrowsingVersions(&self) -> bool;
491
492        #[cfg(feature = "block2")]
493        #[unsafe(method(stopBrowsingVersionsWithCompletionHandler:))]
494        #[unsafe(method_family = none)]
495        pub fn stopBrowsingVersionsWithCompletionHandler(
496            &self,
497            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
498        );
499
500        #[unsafe(method(autosavesDrafts))]
501        #[unsafe(method_family = none)]
502        pub fn autosavesDrafts(mtm: MainThreadMarker) -> bool;
503
504        #[unsafe(method(autosavingFileType))]
505        #[unsafe(method_family = none)]
506        pub fn autosavingFileType(&self) -> Option<Retained<NSString>>;
507
508        #[unsafe(method(autosavedContentsFileURL))]
509        #[unsafe(method_family = none)]
510        pub fn autosavedContentsFileURL(&self) -> Option<Retained<NSURL>>;
511
512        /// Setter for [`autosavedContentsFileURL`][Self::autosavedContentsFileURL].
513        ///
514        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
515        #[unsafe(method(setAutosavedContentsFileURL:))]
516        #[unsafe(method_family = none)]
517        pub fn setAutosavedContentsFileURL(&self, autosaved_contents_file_url: Option<&NSURL>);
518
519        /// # Safety
520        ///
521        /// - `delegate` should be of the correct type.
522        /// - `should_close_selector` must be a valid selector.
523        /// - `context_info` must be a valid pointer or null.
524        #[unsafe(method(canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:))]
525        #[unsafe(method_family = none)]
526        pub unsafe fn canCloseDocumentWithDelegate_shouldCloseSelector_contextInfo(
527            &self,
528            delegate: &AnyObject,
529            should_close_selector: Option<Sel>,
530            context_info: *mut c_void,
531        );
532
533        #[unsafe(method(close))]
534        #[unsafe(method_family = none)]
535        pub fn close(&self);
536
537        /// # Safety
538        ///
539        /// `sender` should be of the correct type.
540        #[unsafe(method(duplicateDocument:))]
541        #[unsafe(method_family = none)]
542        pub unsafe fn duplicateDocument(&self, sender: Option<&AnyObject>);
543
544        /// # Safety
545        ///
546        /// - `delegate` should be of the correct type.
547        /// - `did_duplicate_selector` must be a valid selector.
548        /// - `context_info` must be a valid pointer or null.
549        #[unsafe(method(duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:))]
550        #[unsafe(method_family = none)]
551        pub unsafe fn duplicateDocumentWithDelegate_didDuplicateSelector_contextInfo(
552            &self,
553            delegate: Option<&AnyObject>,
554            did_duplicate_selector: Option<Sel>,
555            context_info: *mut c_void,
556        );
557
558        #[unsafe(method(duplicateAndReturnError:_))]
559        #[unsafe(method_family = none)]
560        pub fn duplicateAndReturnError(&self) -> Result<Retained<NSDocument>, Retained<NSError>>;
561
562        /// # Safety
563        ///
564        /// `sender` should be of the correct type.
565        #[unsafe(method(renameDocument:))]
566        #[unsafe(method_family = none)]
567        pub unsafe fn renameDocument(&self, sender: Option<&AnyObject>);
568
569        /// # Safety
570        ///
571        /// `sender` should be of the correct type.
572        #[unsafe(method(moveDocumentToUbiquityContainer:))]
573        #[unsafe(method_family = none)]
574        pub unsafe fn moveDocumentToUbiquityContainer(&self, sender: Option<&AnyObject>);
575
576        /// # Safety
577        ///
578        /// `sender` should be of the correct type.
579        #[unsafe(method(moveDocument:))]
580        #[unsafe(method_family = none)]
581        pub unsafe fn moveDocument(&self, sender: Option<&AnyObject>);
582
583        #[cfg(feature = "block2")]
584        #[unsafe(method(moveDocumentWithCompletionHandler:))]
585        #[unsafe(method_family = none)]
586        pub fn moveDocumentWithCompletionHandler(
587            &self,
588            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
589        );
590
591        #[cfg(feature = "block2")]
592        #[unsafe(method(moveToURL:completionHandler:))]
593        #[unsafe(method_family = none)]
594        pub fn moveToURL_completionHandler(
595            &self,
596            url: &NSURL,
597            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
598        );
599
600        /// # Safety
601        ///
602        /// `sender` should be of the correct type.
603        #[unsafe(method(lockDocument:))]
604        #[unsafe(method_family = none)]
605        pub unsafe fn lockDocument(&self, sender: Option<&AnyObject>);
606
607        /// # Safety
608        ///
609        /// `sender` should be of the correct type.
610        #[unsafe(method(unlockDocument:))]
611        #[unsafe(method_family = none)]
612        pub unsafe fn unlockDocument(&self, sender: Option<&AnyObject>);
613
614        #[cfg(feature = "block2")]
615        #[unsafe(method(lockDocumentWithCompletionHandler:))]
616        #[unsafe(method_family = none)]
617        pub fn lockDocumentWithCompletionHandler(
618            &self,
619            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
620        );
621
622        #[cfg(feature = "block2")]
623        #[unsafe(method(lockWithCompletionHandler:))]
624        #[unsafe(method_family = none)]
625        pub fn lockWithCompletionHandler(
626            &self,
627            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
628        );
629
630        #[cfg(feature = "block2")]
631        #[unsafe(method(unlockDocumentWithCompletionHandler:))]
632        #[unsafe(method_family = none)]
633        pub fn unlockDocumentWithCompletionHandler(
634            &self,
635            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
636        );
637
638        #[cfg(feature = "block2")]
639        #[unsafe(method(unlockWithCompletionHandler:))]
640        #[unsafe(method_family = none)]
641        pub fn unlockWithCompletionHandler(
642            &self,
643            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
644        );
645
646        #[unsafe(method(isLocked))]
647        #[unsafe(method_family = none)]
648        pub fn isLocked(&self) -> bool;
649
650        /// # Safety
651        ///
652        /// `sender` should be of the correct type.
653        #[unsafe(method(runPageLayout:))]
654        #[unsafe(method_family = none)]
655        pub unsafe fn runPageLayout(&self, sender: Option<&AnyObject>);
656
657        #[cfg(feature = "NSPrintInfo")]
658        /// # Safety
659        ///
660        /// - `delegate` should be of the correct type.
661        /// - `did_run_selector` must be a valid selector.
662        /// - `context_info` must be a valid pointer or null.
663        #[unsafe(method(runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:))]
664        #[unsafe(method_family = none)]
665        pub unsafe fn runModalPageLayoutWithPrintInfo_delegate_didRunSelector_contextInfo(
666            &self,
667            print_info: &NSPrintInfo,
668            delegate: Option<&AnyObject>,
669            did_run_selector: Option<Sel>,
670            context_info: *mut c_void,
671        );
672
673        #[cfg(feature = "NSPageLayout")]
674        #[unsafe(method(preparePageLayout:))]
675        #[unsafe(method_family = none)]
676        pub fn preparePageLayout(&self, page_layout: &NSPageLayout) -> bool;
677
678        #[cfg(feature = "NSPrintInfo")]
679        #[unsafe(method(shouldChangePrintInfo:))]
680        #[unsafe(method_family = none)]
681        pub fn shouldChangePrintInfo(&self, new_print_info: &NSPrintInfo) -> bool;
682
683        #[cfg(feature = "NSPrintInfo")]
684        #[unsafe(method(printInfo))]
685        #[unsafe(method_family = none)]
686        pub fn printInfo(&self) -> Retained<NSPrintInfo>;
687
688        #[cfg(feature = "NSPrintInfo")]
689        /// Setter for [`printInfo`][Self::printInfo].
690        ///
691        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
692        #[unsafe(method(setPrintInfo:))]
693        #[unsafe(method_family = none)]
694        pub fn setPrintInfo(&self, print_info: &NSPrintInfo);
695
696        /// # Safety
697        ///
698        /// `sender` should be of the correct type.
699        #[unsafe(method(printDocument:))]
700        #[unsafe(method_family = none)]
701        pub unsafe fn printDocument(&self, sender: Option<&AnyObject>);
702
703        #[cfg(feature = "NSPrintInfo")]
704        /// # Safety
705        ///
706        /// - `print_settings` generic should be of the correct type.
707        /// - `delegate` should be of the correct type.
708        /// - `did_print_selector` must be a valid selector.
709        /// - `context_info` must be a valid pointer or null.
710        #[unsafe(method(printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:))]
711        #[unsafe(method_family = none)]
712        pub unsafe fn printDocumentWithSettings_showPrintPanel_delegate_didPrintSelector_contextInfo(
713            &self,
714            print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>,
715            show_print_panel: bool,
716            delegate: Option<&AnyObject>,
717            did_print_selector: Option<Sel>,
718            context_info: *mut c_void,
719        );
720
721        #[cfg(all(feature = "NSPrintInfo", feature = "NSPrintOperation"))]
722        /// # Safety
723        ///
724        /// `print_settings` generic should be of the correct type.
725        #[unsafe(method(printOperationWithSettings:error:_))]
726        #[unsafe(method_family = none)]
727        pub unsafe fn printOperationWithSettings_error(
728            &self,
729            print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>,
730        ) -> Result<Retained<NSPrintOperation>, Retained<NSError>>;
731
732        #[cfg(feature = "NSPrintOperation")]
733        /// # Safety
734        ///
735        /// - `delegate` should be of the correct type.
736        /// - `did_run_selector` must be a valid selector.
737        /// - `context_info` must be a valid pointer or null.
738        #[unsafe(method(runModalPrintOperation:delegate:didRunSelector:contextInfo:))]
739        #[unsafe(method_family = none)]
740        pub unsafe fn runModalPrintOperation_delegate_didRunSelector_contextInfo(
741            &self,
742            print_operation: &NSPrintOperation,
743            delegate: Option<&AnyObject>,
744            did_run_selector: Option<Sel>,
745            context_info: *mut c_void,
746        );
747
748        /// # Safety
749        ///
750        /// `sender` should be of the correct type.
751        #[unsafe(method(saveDocumentToPDF:))]
752        #[unsafe(method_family = none)]
753        pub unsafe fn saveDocumentToPDF(&self, sender: Option<&AnyObject>);
754
755        #[cfg(feature = "NSPrintOperation")]
756        #[unsafe(method(PDFPrintOperation))]
757        #[unsafe(method_family = none)]
758        pub fn PDFPrintOperation(&self) -> Retained<NSPrintOperation>;
759
760        #[unsafe(method(allowsDocumentSharing))]
761        #[unsafe(method_family = none)]
762        pub fn allowsDocumentSharing(&self) -> bool;
763
764        #[cfg(all(feature = "NSSharingService", feature = "block2"))]
765        #[unsafe(method(shareDocumentWithSharingService:completionHandler:))]
766        #[unsafe(method_family = none)]
767        pub fn shareDocumentWithSharingService_completionHandler(
768            &self,
769            sharing_service: &NSSharingService,
770            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
771        );
772
773        #[cfg(feature = "NSSharingService")]
774        #[unsafe(method(prepareSharingServicePicker:))]
775        #[unsafe(method_family = none)]
776        pub fn prepareSharingServicePicker(&self, sharing_service_picker: &NSSharingServicePicker);
777
778        #[cfg(feature = "NSPreviewRepresentingActivityItem")]
779        #[unsafe(method(previewRepresentableActivityItems))]
780        #[unsafe(method_family = none)]
781        pub fn previewRepresentableActivityItems(
782            &self,
783        ) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>;
784
785        #[cfg(feature = "NSPreviewRepresentingActivityItem")]
786        /// Setter for [`previewRepresentableActivityItems`][Self::previewRepresentableActivityItems].
787        ///
788        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
789        #[unsafe(method(setPreviewRepresentableActivityItems:))]
790        #[unsafe(method_family = none)]
791        pub fn setPreviewRepresentableActivityItems(
792            &self,
793            preview_representable_activity_items: Option<
794                &NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>,
795            >,
796        );
797
798        #[unsafe(method(isDocumentEdited))]
799        #[unsafe(method_family = none)]
800        pub fn isDocumentEdited(&self) -> bool;
801
802        #[unsafe(method(isInViewingMode))]
803        #[unsafe(method_family = none)]
804        pub fn isInViewingMode(&self) -> bool;
805
806        #[unsafe(method(updateChangeCount:))]
807        #[unsafe(method_family = none)]
808        pub fn updateChangeCount(&self, change: NSDocumentChangeType);
809
810        #[unsafe(method(changeCountTokenForSaveOperation:))]
811        #[unsafe(method_family = none)]
812        pub fn changeCountTokenForSaveOperation(
813            &self,
814            save_operation: NSSaveOperationType,
815        ) -> Retained<AnyObject>;
816
817        /// # Safety
818        ///
819        /// `change_count_token` should be of the correct type.
820        #[unsafe(method(updateChangeCountWithToken:forSaveOperation:))]
821        #[unsafe(method_family = none)]
822        pub unsafe fn updateChangeCountWithToken_forSaveOperation(
823            &self,
824            change_count_token: &AnyObject,
825            save_operation: NSSaveOperationType,
826        );
827
828        #[unsafe(method(undoManager))]
829        #[unsafe(method_family = none)]
830        pub fn undoManager(&self) -> Option<Retained<NSUndoManager>>;
831
832        /// Setter for [`undoManager`][Self::undoManager].
833        #[unsafe(method(setUndoManager:))]
834        #[unsafe(method_family = none)]
835        pub fn setUndoManager(&self, undo_manager: Option<&NSUndoManager>);
836
837        #[unsafe(method(hasUndoManager))]
838        #[unsafe(method_family = none)]
839        pub fn hasUndoManager(&self) -> bool;
840
841        /// Setter for [`hasUndoManager`][Self::hasUndoManager].
842        #[unsafe(method(setHasUndoManager:))]
843        #[unsafe(method_family = none)]
844        pub fn setHasUndoManager(&self, has_undo_manager: bool);
845
846        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
847        /// # Safety
848        ///
849        /// - `delegate` should be of the correct type.
850        /// - `did_present_selector` must be a valid selector.
851        /// - `context_info` must be a valid pointer or null.
852        #[unsafe(method(presentError:modalForWindow:delegate:didPresentSelector:contextInfo:))]
853        #[unsafe(method_family = none)]
854        pub unsafe fn presentError_modalForWindow_delegate_didPresentSelector_contextInfo(
855            &self,
856            error: &NSError,
857            window: &NSWindow,
858            delegate: Option<&AnyObject>,
859            did_present_selector: Option<Sel>,
860            context_info: *mut c_void,
861        );
862
863        #[unsafe(method(presentError:))]
864        #[unsafe(method_family = none)]
865        pub fn presentError(&self, error: &NSError) -> bool;
866
867        #[unsafe(method(willPresentError:))]
868        #[unsafe(method_family = none)]
869        pub fn willPresentError(&self, error: &NSError) -> Retained<NSError>;
870
871        #[unsafe(method(willNotPresentError:))]
872        #[unsafe(method_family = none)]
873        pub fn willNotPresentError(&self, error: &NSError);
874
875        #[unsafe(method(makeWindowControllers))]
876        #[unsafe(method_family = none)]
877        pub fn makeWindowControllers(&self);
878
879        #[cfg(feature = "NSNib")]
880        #[unsafe(method(windowNibName))]
881        #[unsafe(method_family = none)]
882        pub fn windowNibName(&self) -> Option<Retained<NSNibName>>;
883
884        #[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
885        #[unsafe(method(windowControllerWillLoadNib:))]
886        #[unsafe(method_family = none)]
887        pub fn windowControllerWillLoadNib(&self, window_controller: &NSWindowController);
888
889        #[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
890        #[unsafe(method(windowControllerDidLoadNib:))]
891        #[unsafe(method_family = none)]
892        pub fn windowControllerDidLoadNib(&self, window_controller: &NSWindowController);
893
894        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
895        #[unsafe(method(setWindow:))]
896        #[unsafe(method_family = none)]
897        pub fn setWindow(&self, window: Option<&NSWindow>);
898
899        #[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
900        #[unsafe(method(addWindowController:))]
901        #[unsafe(method_family = none)]
902        pub fn addWindowController(&self, window_controller: &NSWindowController);
903
904        #[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
905        #[unsafe(method(removeWindowController:))]
906        #[unsafe(method_family = none)]
907        pub fn removeWindowController(&self, window_controller: &NSWindowController);
908
909        #[unsafe(method(showWindows))]
910        #[unsafe(method_family = none)]
911        pub fn showWindows(&self);
912
913        #[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
914        #[unsafe(method(windowControllers))]
915        #[unsafe(method_family = none)]
916        pub fn windowControllers(&self) -> Retained<NSArray<NSWindowController>>;
917
918        #[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
919        /// # Safety
920        ///
921        /// - `delegate` should be of the correct type.
922        /// - `should_close_selector` must be a valid selector.
923        /// - `context_info` must be a valid pointer or null.
924        #[unsafe(method(shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:))]
925        #[unsafe(method_family = none)]
926        pub unsafe fn shouldCloseWindowController_delegate_shouldCloseSelector_contextInfo(
927            &self,
928            window_controller: &NSWindowController,
929            delegate: Option<&AnyObject>,
930            should_close_selector: Option<Sel>,
931            context_info: *mut c_void,
932        );
933
934        #[unsafe(method(displayName))]
935        #[unsafe(method_family = none)]
936        pub fn displayName(&self) -> Retained<NSString>;
937
938        #[unsafe(method(defaultDraftName))]
939        #[unsafe(method_family = none)]
940        pub fn defaultDraftName(&self) -> Retained<NSString>;
941
942        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
943        #[unsafe(method(windowForSheet))]
944        #[unsafe(method_family = none)]
945        pub fn windowForSheet(&self) -> Option<Retained<NSWindow>>;
946
947        #[unsafe(method(readableTypes))]
948        #[unsafe(method_family = none)]
949        pub fn readableTypes(mtm: MainThreadMarker) -> Retained<NSArray<NSString>>;
950
951        #[unsafe(method(writableTypes))]
952        #[unsafe(method_family = none)]
953        pub fn writableTypes(mtm: MainThreadMarker) -> Retained<NSArray<NSString>>;
954
955        #[unsafe(method(isNativeType:))]
956        #[unsafe(method_family = none)]
957        pub fn isNativeType(r#type: &NSString, mtm: MainThreadMarker) -> bool;
958
959        #[unsafe(method(writableTypesForSaveOperation:))]
960        #[unsafe(method_family = none)]
961        pub fn writableTypesForSaveOperation(
962            &self,
963            save_operation: NSSaveOperationType,
964        ) -> Retained<NSArray<NSString>>;
965
966        #[unsafe(method(fileNameExtensionForType:saveOperation:))]
967        #[unsafe(method_family = none)]
968        pub fn fileNameExtensionForType_saveOperation(
969            &self,
970            type_name: &NSString,
971            save_operation: NSSaveOperationType,
972        ) -> Option<Retained<NSString>>;
973
974        #[cfg(feature = "NSUserInterfaceValidation")]
975        #[unsafe(method(validateUserInterfaceItem:))]
976        #[unsafe(method_family = none)]
977        pub fn validateUserInterfaceItem(
978            &self,
979            item: &ProtocolObject<dyn NSValidatedUserInterfaceItem>,
980        ) -> bool;
981
982        #[unsafe(method(usesUbiquitousStorage))]
983        #[unsafe(method_family = none)]
984        pub fn usesUbiquitousStorage(mtm: MainThreadMarker) -> bool;
985
986        #[unsafe(method(presentedItemURL))]
987        #[unsafe(method_family = none)]
988        pub fn presentedItemURL(&self) -> Option<Retained<NSURL>>;
989
990        #[unsafe(method(observedPresentedItemUbiquityAttributes))]
991        #[unsafe(method_family = none)]
992        pub fn observedPresentedItemUbiquityAttributes(&self) -> Retained<NSSet<NSURLResourceKey>>;
993
994        #[cfg(feature = "block2")]
995        /// # Safety
996        ///
997        /// `reader` block must be sendable.
998        #[unsafe(method(relinquishPresentedItemToReader:))]
999        #[unsafe(method_family = none)]
1000        pub unsafe fn relinquishPresentedItemToReader(
1001            &self,
1002            reader: &block2::DynBlock<dyn Fn(*mut block2::DynBlock<dyn Fn()>)>,
1003        );
1004
1005        #[cfg(feature = "block2")]
1006        /// # Safety
1007        ///
1008        /// `writer` block must be sendable.
1009        #[unsafe(method(relinquishPresentedItemToWriter:))]
1010        #[unsafe(method_family = none)]
1011        pub unsafe fn relinquishPresentedItemToWriter(
1012            &self,
1013            writer: &block2::DynBlock<dyn Fn(*mut block2::DynBlock<dyn Fn()>)>,
1014        );
1015
1016        #[cfg(feature = "block2")]
1017        /// # Safety
1018        ///
1019        /// `completion_handler` block must be sendable.
1020        #[unsafe(method(savePresentedItemChangesWithCompletionHandler:))]
1021        #[unsafe(method_family = none)]
1022        pub unsafe fn savePresentedItemChangesWithCompletionHandler(
1023            &self,
1024            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1025        );
1026
1027        #[cfg(feature = "block2")]
1028        /// # Safety
1029        ///
1030        /// `completion_handler` block must be sendable.
1031        #[unsafe(method(accommodatePresentedItemDeletionWithCompletionHandler:))]
1032        #[unsafe(method_family = none)]
1033        pub unsafe fn accommodatePresentedItemDeletionWithCompletionHandler(
1034            &self,
1035            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1036        );
1037
1038        #[unsafe(method(presentedItemDidMoveToURL:))]
1039        #[unsafe(method_family = none)]
1040        pub fn presentedItemDidMoveToURL(&self, new_url: &NSURL);
1041
1042        #[unsafe(method(presentedItemDidChange))]
1043        #[unsafe(method_family = none)]
1044        pub fn presentedItemDidChange(&self);
1045
1046        #[unsafe(method(presentedItemDidChangeUbiquityAttributes:))]
1047        #[unsafe(method_family = none)]
1048        pub fn presentedItemDidChangeUbiquityAttributes(
1049            &self,
1050            attributes: &NSSet<NSURLResourceKey>,
1051        );
1052
1053        #[unsafe(method(presentedItemDidGainVersion:))]
1054        #[unsafe(method_family = none)]
1055        pub fn presentedItemDidGainVersion(&self, version: &NSFileVersion);
1056
1057        #[unsafe(method(presentedItemDidLoseVersion:))]
1058        #[unsafe(method_family = none)]
1059        pub fn presentedItemDidLoseVersion(&self, version: &NSFileVersion);
1060
1061        #[unsafe(method(presentedItemDidResolveConflictVersion:))]
1062        #[unsafe(method_family = none)]
1063        pub fn presentedItemDidResolveConflictVersion(&self, version: &NSFileVersion);
1064    );
1065}
1066
1067/// Methods declared on superclass `NSObject`.
1068impl NSDocument {
1069    extern_methods!(
1070        #[unsafe(method(new))]
1071        #[unsafe(method_family = new)]
1072        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
1073    );
1074}
1075
1076/// NSDeprecated.
1077impl NSDocument {
1078    extern_methods!(
1079        #[deprecated]
1080        #[unsafe(method(shouldRunSavePanelWithAccessoryView))]
1081        #[unsafe(method_family = none)]
1082        pub fn shouldRunSavePanelWithAccessoryView(&self) -> bool;
1083
1084        #[deprecated = "Use -saveToURL:ofType:forSaveOperation:completionHandler: instead"]
1085        #[unsafe(method(saveToURL:ofType:forSaveOperation:error:_))]
1086        #[unsafe(method_family = none)]
1087        pub fn saveToURL_ofType_forSaveOperation_error(
1088            &self,
1089            url: &NSURL,
1090            type_name: &NSString,
1091            save_operation: NSSaveOperationType,
1092        ) -> Result<(), Retained<NSError>>;
1093
1094        #[deprecated]
1095        #[unsafe(method(dataRepresentationOfType:))]
1096        #[unsafe(method_family = none)]
1097        pub fn dataRepresentationOfType(&self, r#type: &NSString) -> Option<Retained<NSData>>;
1098
1099        #[deprecated]
1100        #[unsafe(method(fileAttributesToWriteToFile:ofType:saveOperation:))]
1101        #[unsafe(method_family = none)]
1102        pub fn fileAttributesToWriteToFile_ofType_saveOperation(
1103            &self,
1104            full_document_path: &NSString,
1105            document_type_name: &NSString,
1106            save_operation_type: NSSaveOperationType,
1107        ) -> Option<Retained<NSDictionary>>;
1108
1109        #[deprecated]
1110        #[unsafe(method(fileName))]
1111        #[unsafe(method_family = none)]
1112        pub fn fileName(&self) -> Option<Retained<NSString>>;
1113
1114        #[deprecated]
1115        #[unsafe(method(fileWrapperRepresentationOfType:))]
1116        #[unsafe(method_family = none)]
1117        pub fn fileWrapperRepresentationOfType(
1118            &self,
1119            r#type: &NSString,
1120        ) -> Option<Retained<NSFileWrapper>>;
1121
1122        #[deprecated]
1123        #[unsafe(method(initWithContentsOfFile:ofType:))]
1124        #[unsafe(method_family = init)]
1125        pub fn initWithContentsOfFile_ofType(
1126            this: Allocated<Self>,
1127            absolute_path: &NSString,
1128            type_name: &NSString,
1129        ) -> Option<Retained<Self>>;
1130
1131        #[deprecated]
1132        #[unsafe(method(initWithContentsOfURL:ofType:))]
1133        #[unsafe(method_family = init)]
1134        pub fn initWithContentsOfURL_ofType(
1135            this: Allocated<Self>,
1136            url: &NSURL,
1137            type_name: &NSString,
1138        ) -> Option<Retained<Self>>;
1139
1140        #[deprecated]
1141        #[unsafe(method(loadDataRepresentation:ofType:))]
1142        #[unsafe(method_family = none)]
1143        pub fn loadDataRepresentation_ofType(&self, data: &NSData, r#type: &NSString) -> bool;
1144
1145        #[deprecated]
1146        #[unsafe(method(loadFileWrapperRepresentation:ofType:))]
1147        #[unsafe(method_family = none)]
1148        pub fn loadFileWrapperRepresentation_ofType(
1149            &self,
1150            wrapper: &NSFileWrapper,
1151            r#type: &NSString,
1152        ) -> bool;
1153
1154        #[deprecated]
1155        #[unsafe(method(printShowingPrintPanel:))]
1156        #[unsafe(method_family = none)]
1157        pub fn printShowingPrintPanel(&self, flag: bool);
1158
1159        #[deprecated]
1160        #[unsafe(method(readFromFile:ofType:))]
1161        #[unsafe(method_family = none)]
1162        pub fn readFromFile_ofType(&self, file_name: &NSString, r#type: &NSString) -> bool;
1163
1164        #[deprecated]
1165        #[unsafe(method(readFromURL:ofType:))]
1166        #[unsafe(method_family = none)]
1167        pub fn readFromURL_ofType(&self, url: &NSURL, r#type: &NSString) -> bool;
1168
1169        #[deprecated]
1170        #[unsafe(method(revertToSavedFromFile:ofType:))]
1171        #[unsafe(method_family = none)]
1172        pub fn revertToSavedFromFile_ofType(&self, file_name: &NSString, r#type: &NSString)
1173            -> bool;
1174
1175        #[deprecated]
1176        #[unsafe(method(revertToSavedFromURL:ofType:))]
1177        #[unsafe(method_family = none)]
1178        pub fn revertToSavedFromURL_ofType(&self, url: &NSURL, r#type: &NSString) -> bool;
1179
1180        #[cfg(feature = "NSPrintInfo")]
1181        #[deprecated]
1182        #[unsafe(method(runModalPageLayoutWithPrintInfo:))]
1183        #[unsafe(method_family = none)]
1184        pub fn runModalPageLayoutWithPrintInfo(&self, print_info: &NSPrintInfo) -> NSInteger;
1185
1186        /// # Safety
1187        ///
1188        /// - `delegate` should be of the correct type.
1189        /// - `did_save_selector` must be a valid selector.
1190        /// - `context_info` must be a valid pointer or null.
1191        #[deprecated]
1192        #[unsafe(method(saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:))]
1193        #[unsafe(method_family = none)]
1194        pub unsafe fn saveToFile_saveOperation_delegate_didSaveSelector_contextInfo(
1195            &self,
1196            file_name: &NSString,
1197            save_operation: NSSaveOperationType,
1198            delegate: Option<&AnyObject>,
1199            did_save_selector: Option<Sel>,
1200            context_info: *mut c_void,
1201        );
1202
1203        #[deprecated]
1204        #[unsafe(method(setFileName:))]
1205        #[unsafe(method_family = none)]
1206        pub fn setFileName(&self, file_name: Option<&NSString>);
1207
1208        #[deprecated]
1209        #[unsafe(method(writeToFile:ofType:))]
1210        #[unsafe(method_family = none)]
1211        pub fn writeToFile_ofType(&self, file_name: &NSString, r#type: &NSString) -> bool;
1212
1213        #[deprecated]
1214        #[unsafe(method(writeToFile:ofType:originalFile:saveOperation:))]
1215        #[unsafe(method_family = none)]
1216        pub fn writeToFile_ofType_originalFile_saveOperation(
1217            &self,
1218            full_document_path: &NSString,
1219            document_type_name: &NSString,
1220            full_original_document_path: Option<&NSString>,
1221            save_operation_type: NSSaveOperationType,
1222        ) -> bool;
1223
1224        #[deprecated]
1225        #[unsafe(method(writeToURL:ofType:))]
1226        #[unsafe(method_family = none)]
1227        pub fn writeToURL_ofType(&self, url: &NSURL, r#type: &NSString) -> bool;
1228
1229        #[deprecated]
1230        #[unsafe(method(writeWithBackupToFile:ofType:saveOperation:))]
1231        #[unsafe(method_family = none)]
1232        pub fn writeWithBackupToFile_ofType_saveOperation(
1233            &self,
1234            full_document_path: &NSString,
1235            document_type_name: &NSString,
1236            save_operation_type: NSSaveOperationType,
1237        ) -> bool;
1238    );
1239}