Up

# NSDocument

### Authors

Carl Lindberg (`Carl.Lindberg@hbo.com`)

> The abstract document class

Copyright: (C) 1999 Free Software Foundation, Inc.

# Software documentation for the NSDocument class

## NSDocument : NSObject

> Declared in:
>   AppKit/NSDocument.h

Availability: OpenStep
Description forthcoming.
Method summary

- +isNativeType:
- +readableTypes
- +writableTypes
- -addWindowController:
- -canCloseDocument
- -canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
- -close
- -dataRepresentationOfType:
- -displayName
- -fileAttributesToWriteToFile:ofType:saveOperation:
- -fileName
- -fileNameFromRunningSavePanelForSaveOperation:
- -fileType
- -fileTypeFromLastRunSavePanel
- -fileWrapperRepresentationOfType:
- -hasUndoManager
- -init
- -initWithContentsOfFile:ofType:
- -initWithContentsOfURL:ofType:
- -isDocumentEdited
- -keepBackupFile
- -loadDataRepresentation:ofType:
- -loadFileWrapperRepresentation:ofType:
- -makeWindowControllers
- -prepareSavePanel:
- -printDocument:
- -printInfo
- -printShowingPrintPanel:
- -readFromFile:ofType:
- -readFromURL:ofType:
- -removeWindowController:
- -revertDocumentToSaved:
- -revertToSavedFromFile:ofType:
- -revertToSavedFromURL:ofType:
- -runModalPageLayoutWithPrintInfo:
- -runModalSavePanel:withAccessoryView:
- -runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:
- -runPageLayout:
- -saveDocument:
- -saveDocumentAs:
- -saveDocumentTo:
- -saveDocumentWithDelegate:didSaveSelector:contextInfo:
- -saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:
- -setFileName:
- -setFileType:
- -setHasUndoManager:
- -setPrintInfo:
- -setUndoManager:
- -setWindow:
- -shouldChangePrintInfo:
- -shouldCloseWindowController:
- -shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:
- -shouldRunSavePanelWithAccessoryView
- -showWindows
- -undoManager
- -updateChangeCount:
- -validateMenuItem:
- -validateUserInterfaceItem:
- -windowControllerDidLoadNib:
- -windowControllerWillLoadNib:
- -windowControllers
- -windowNibName
- -writeToFile:ofType:
- -writeToFile:ofType:originalFile:saveOperation:
- -writeToURL:ofType:
- -writeWithBackupToFile:ofType:saveOperation:

### isNativeType:

+ (BOOL) isNativeType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### readableTypes

+ (NSArray*) readableTypes;
Availability: OpenStep
Description forthcoming.

### writableTypes

+ (NSArray*) writableTypes;
Availability: OpenStep
Description forthcoming.

### addWindowController:

- (void) addWindowController: (NSWindowController*)windowController;
Availability: OpenStep
Description forthcoming.

### canCloseDocument

- (BOOL) canCloseDocument;
Availability: OpenStep
Description forthcoming.

### canCloseDocumentWithDelegate: shouldCloseSelector: contextInfo:

- (void) canCloseDocumentWithDelegate: (id)delegate shouldCloseSelector: (SEL)shouldCloseSelector contextInfo: (void*)contextInfo;
Availability: OpenStep
Description forthcoming.

### close

- (void) close;
Availability: OpenStep
Closes all the windows owned by the document, then removes itself from the list of documents known by the NSDocumentController. This method does not ask the user if they want to save the document before closing. It is closed without saving any information.

### dataRepresentationOfType:

- (NSData*) dataRepresentationOfType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### displayName

- (NSString*) displayName;
Availability: OpenStep
Description forthcoming.

### fileAttributesToWriteToFile: ofType: saveOperation:

- (NSDictionary*) fileAttributesToWriteToFile: (NSString*)fullDocumentPath ofType: (NSString*)docType saveOperation: (NSSaveOperationType)saveOperationType;
Availability: OpenStep
Description forthcoming.

### fileName

- (NSString*) fileName;
Availability: OpenStep
Description forthcoming.

### fileNameFromRunningSavePanelForSaveOperation:

- (NSString*) fileNameFromRunningSavePanelForSaveOperation: (NSSaveOperationType)saveOperation;
Availability: OpenStep
Description forthcoming.

### fileType

- (NSString*) fileType;
Availability: OpenStep
Description forthcoming.

### fileTypeFromLastRunSavePanel

- (NSString*) fileTypeFromLastRunSavePanel;
Availability: OpenStep
Description forthcoming.

### fileWrapperRepresentationOfType:

- (NSFileWrapper*) fileWrapperRepresentationOfType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### hasUndoManager

- (BOOL) hasUndoManager;
Availability: OpenStep
Description forthcoming.

### init

- (id) init;
Availability: OpenStep
Description forthcoming.

### initWithContentsOfFile: ofType:

- (id) initWithContentsOfFile: (NSString*)fileName ofType: (NSString*)fileType;
Availability: OpenStep
Initialises the receiver with the contents of the document at fileName assuming that the type of data is as specified by fileType.
Destroys the receiver and returns `nil` on failure.

### initWithContentsOfURL: ofType:

- (id) initWithContentsOfURL: (NSURL*)url ofType: (NSString*)fileType;
Availability: OpenStep
Initialises the receiver with the contents of the document at url assuming that the type of data is as specified by fileType.
Destroys the receiver and returns `nil` on failure.

### isDocumentEdited

- (BOOL) isDocumentEdited;
Availability: OpenStep
Description forthcoming.

### keepBackupFile

- (BOOL) keepBackupFile;
Availability: OpenStep
Description forthcoming.

### loadDataRepresentation: ofType:

- (BOOL) loadDataRepresentation: (NSData*)data ofType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### loadFileWrapperRepresentation: ofType:

- (BOOL) loadFileWrapperRepresentation: (NSFileWrapper*)wrapper ofType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### makeWindowControllers

- (void) makeWindowControllers;
Availability: OpenStep
Creates the window controllers for the current document. Calls addWindowController: on the receiver to add them to the controller array.

### prepareSavePanel:

- (BOOL) prepareSavePanel: (NSSavePanel*)savePanel;
Availability: OpenStep
Description forthcoming.

### printDocument:

- (IBAction) printDocument: (id)sender;
Availability: OpenStep
Description forthcoming.

### printInfo

- (NSPrintInfo*) printInfo;
Availability: OpenStep
Description forthcoming.

### printShowingPrintPanel:

- (void) printShowingPrintPanel: (BOOL)flag;
Availability: OpenStep
Description forthcoming.

### readFromFile: ofType:

- (BOOL) readFromFile: (NSString*)fileName ofType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### readFromURL: ofType:

- (BOOL) readFromURL: (NSURL*)url ofType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### removeWindowController:

- (void) removeWindowController: (NSWindowController*)windowController;
Availability: OpenStep
Description forthcoming.

### revertDocumentToSaved:

- (IBAction) revertDocumentToSaved: (id)sender;
Availability: OpenStep
Description forthcoming.

### revertToSavedFromFile: ofType:

- (BOOL) revertToSavedFromFile: (NSString*)fileName ofType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### revertToSavedFromURL: ofType:

- (BOOL) revertToSavedFromURL: (NSURL*)url ofType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### runModalPageLayoutWithPrintInfo:

- (int) runModalPageLayoutWithPrintInfo: (NSPrintInfo*)printInfo;
Availability: OpenStep
Description forthcoming.

### runModalSavePanel: withAccessoryView:

- (int) runModalSavePanel: (NSSavePanel*)savePanel withAccessoryView: (NSView*)accessoryView;
Availability: OpenStep
Description forthcoming.

### runModalSavePanelForSaveOperation: delegate: didSaveSelector: contextInfo:

- (void) runModalSavePanelForSaveOperation: (NSSaveOperationType)saveOperation delegate: (id)delegate didSaveSelector: (SEL)didSaveSelector contextInfo: (void*)contextInfo;
Availability: OpenStep
Description forthcoming.

### runPageLayout:

- (IBAction) runPageLayout: (id)sender;
Availability: OpenStep
Description forthcoming.

### saveDocument:

- (IBAction) saveDocument: (id)sender;
Availability: OpenStep
Description forthcoming.

### saveDocumentAs:

- (IBAction) saveDocumentAs: (id)sender;
Availability: OpenStep
Description forthcoming.

### saveDocumentTo:

- (IBAction) saveDocumentTo: (id)sender;
Availability: OpenStep
Description forthcoming.

### saveDocumentWithDelegate: didSaveSelector: contextInfo:

- (void) saveDocumentWithDelegate: (id)delegate didSaveSelector: (SEL)didSaveSelector contextInfo: (void*)contextInfo;
Availability: OpenStep
Description forthcoming.

### saveToFile: saveOperation: delegate: didSaveSelector: contextInfo:

- (void) saveToFile: (NSString*)fileName saveOperation: (NSSaveOperationType)saveOperation delegate: (id)delegate didSaveSelector: (SEL)didSaveSelector contextInfo: (void*)contextInfo;
Availability: OpenStep
Description forthcoming.

### setFileName:

- (void) setFileName: (NSString*)fileName;
Availability: OpenStep
Description forthcoming.

### setFileType:

- (void) setFileType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### setHasUndoManager:

- (void) setHasUndoManager: (BOOL)flag;
Availability: OpenStep
Description forthcoming.

### setPrintInfo:

- (void) setPrintInfo: (NSPrintInfo*)printInfo;
Availability: OpenStep
Description forthcoming.

### setUndoManager:

- (void) setUndoManager: (NSUndoManager*)undoManager;
Availability: OpenStep
Description forthcoming.

### setWindow:

- (void) setWindow: (NSWindow*)aWindow;
Availability: OpenStep
Description forthcoming.

### shouldChangePrintInfo:

- (BOOL) shouldChangePrintInfo: (NSPrintInfo*)newPrintInfo;
Availability: OpenStep
Description forthcoming.

### shouldCloseWindowController:

- (BOOL) shouldCloseWindowController: (NSWindowController*)windowController;
Availability: OpenStep
Description forthcoming.

### shouldCloseWindowController: delegate: shouldCloseSelector: contextInfo:

- (void) shouldCloseWindowController: (NSWindowController*)windowController delegate: (id)delegate shouldCloseSelector: (SEL)callback contextInfo: (void*)contextInfo;
Availability: OpenStep
Description forthcoming.

### shouldRunSavePanelWithAccessoryView

- (BOOL) shouldRunSavePanelWithAccessoryView;
Availability: OpenStep
Description forthcoming.

### showWindows

- (void) showWindows;
Availability: OpenStep
Makes all the documents windows visible by ordering them to the front and making them main or key.
If the document has no windows, this method has no effect.

### undoManager

- (NSUndoManager*) undoManager;
Availability: OpenStep
Description forthcoming.

### updateChangeCount:

- (void) updateChangeCount: (NSDocumentChangeType)change;
Availability: OpenStep
Description forthcoming.

### validateMenuItem:

- (BOOL) validateMenuItem: (NSMenuItem*)anItem;
Availability: OpenStep
Description forthcoming.

### validateUserInterfaceItem:

- (BOOL) validateUserInterfaceItem: (id)anItem;
Availability: OpenStep
Description forthcoming.

### windowControllerDidLoadNib:

- (void) windowControllerDidLoadNib: (NSWindowController*)windowController;
Availability: OpenStep
Description forthcoming.

### windowControllerWillLoadNib:

- (void) windowControllerWillLoadNib: (NSWindowController*)windowController;
Availability: OpenStep
Description forthcoming.

### windowControllers

- (NSArray*) windowControllers;
Availability: OpenStep
Description forthcoming.

### windowNibName

- (NSString*) windowNibName;
Availability: OpenStep
Description forthcoming.

### writeToFile: ofType:

- (BOOL) writeToFile: (NSString*)fileName ofType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### writeToFile: ofType: originalFile: saveOperation:

- (BOOL) writeToFile: (NSString*)fileName ofType: (NSString*)type originalFile: (NSString*)origFileName saveOperation: (NSSaveOperationType)saveOp;
Availability: OpenStep
Description forthcoming.

### writeToURL: ofType:

- (BOOL) writeToURL: (NSURL*)url ofType: (NSString*)type;
Availability: OpenStep
Description forthcoming.

### writeWithBackupToFile: ofType: saveOperation:

- (BOOL) writeWithBackupToFile: (NSString*)fileName ofType: (NSString*)fileType saveOperation: (NSSaveOperationType)saveOp;
Availability: OpenStep
Description forthcoming.

Up