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

> Standards:
> - MacOS-X
> - OpenStep
> - GNUstep

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;

Description forthcoming.

### readableTypes

+ (NSArray*) readableTypes;

Description forthcoming.

### writableTypes

+ (NSArray*) writableTypes;

Description forthcoming.

### addWindowController:

- (void) addWindowController: (NSWindowController*)windowController;

Description forthcoming.

### canCloseDocument

- (BOOL) canCloseDocument;

Description forthcoming.

### canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:

- (void) canCloseDocumentWithDelegate: (id)delegate shouldCloseSelector: (SEL)shouldCloseSelector contextInfo: (void*)contextInfo;

Description forthcoming.

### close

- (void) close;

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;

Description forthcoming.

### displayName

- (NSString*) displayName;

Description forthcoming.

### fileAttributesToWriteToFile:ofType:saveOperation:

- (NSDictionary*) fileAttributesToWriteToFile: (NSString*)fullDocumentPath ofType: (NSString*)docType saveOperation: (NSSaveOperationType)saveOperationType;

Description forthcoming.

### fileName

- (NSString*) fileName;

Description forthcoming.

### fileNameFromRunningSavePanelForSaveOperation:

- (NSString*) fileNameFromRunningSavePanelForSaveOperation: (NSSaveOperationType)saveOperation;

Description forthcoming.

### fileType

- (NSString*) fileType;

Description forthcoming.

### fileTypeFromLastRunSavePanel

- (NSString*) fileTypeFromLastRunSavePanel;

Description forthcoming.

### fileWrapperRepresentationOfType:

- (NSFileWrapper*) fileWrapperRepresentationOfType: (NSString*)type;

Description forthcoming.

### hasUndoManager

- (BOOL) hasUndoManager;

Description forthcoming.

### init

- (id) init;

Description forthcoming.

### initWithContentsOfFile:ofType:

- (id) initWithContentsOfFile: (NSString*)fileName ofType: (NSString*)fileType;

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;

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;

Description forthcoming.

### keepBackupFile

- (BOOL) keepBackupFile;

Description forthcoming.

### loadDataRepresentation:ofType:

- (BOOL) loadDataRepresentation: (NSData*)data ofType: (NSString*)type;

Description forthcoming.

### loadFileWrapperRepresentation:ofType:

- (BOOL) loadFileWrapperRepresentation: (NSFileWrapper*)wrapper ofType: (NSString*)type;

Description forthcoming.

### makeWindowControllers

- (void) makeWindowControllers;

Description forthcoming.

### prepareSavePanel:

- (BOOL) prepareSavePanel: (NSSavePanel*)savePanel;

Description forthcoming.

### printDocument:

- (IBAction) printDocument: (id)sender;

Description forthcoming.

### printInfo

- (NSPrintInfo*) printInfo;

Description forthcoming.

### printShowingPrintPanel:

- (void) printShowingPrintPanel: (BOOL)flag;

Description forthcoming.

### readFromFile:ofType:

- (BOOL) readFromFile: (NSString*)fileName ofType: (NSString*)type;

Description forthcoming.

### readFromURL:ofType:

- (BOOL) readFromURL: (NSURL*)url ofType: (NSString*)type;

Description forthcoming.

### removeWindowController:

- (void) removeWindowController: (NSWindowController*)windowController;

Description forthcoming.

### revertDocumentToSaved:

- (IBAction) revertDocumentToSaved: (id)sender;

Description forthcoming.

### revertToSavedFromFile:ofType:

- (BOOL) revertToSavedFromFile: (NSString*)fileName ofType: (NSString*)type;

Description forthcoming.

### revertToSavedFromURL:ofType:

- (BOOL) revertToSavedFromURL: (NSURL*)url ofType: (NSString*)type;

Description forthcoming.

### runModalPageLayoutWithPrintInfo:

- (int) runModalPageLayoutWithPrintInfo: (NSPrintInfo*)printInfo;

Description forthcoming.

### runModalSavePanel:withAccessoryView:

- (int) runModalSavePanel: (NSSavePanel*)savePanel withAccessoryView: (NSView*)accessoryView;

Description forthcoming.

### runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:

- (void) runModalSavePanelForSaveOperation: (NSSaveOperationType)saveOperation delegate: (id)delegate didSaveSelector: (SEL)didSaveSelector contextInfo: (void*)contextInfo;

Description forthcoming.

### runPageLayout:

- (IBAction) runPageLayout: (id)sender;

Description forthcoming.

### saveDocument:

- (IBAction) saveDocument: (id)sender;

Description forthcoming.

### saveDocumentAs:

- (IBAction) saveDocumentAs: (id)sender;

Description forthcoming.

### saveDocumentTo:

- (IBAction) saveDocumentTo: (id)sender;

Description forthcoming.

### saveDocumentWithDelegate:didSaveSelector:contextInfo:

- (void) saveDocumentWithDelegate: (id)delegate didSaveSelector: (SEL)didSaveSelector contextInfo: (void*)contextInfo;

Description forthcoming.

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

- (void) saveToFile: (NSString*)fileName saveOperation: (NSSaveOperationType)saveOperation delegate: (id)delegate didSaveSelector: (SEL)didSaveSelector contextInfo: (void*)contextInfo;

Description forthcoming.

### setFileName:

- (void) setFileName: (NSString*)fileName;

Description forthcoming.

### setFileType:

- (void) setFileType: (NSString*)type;

Description forthcoming.

### setHasUndoManager:

- (void) setHasUndoManager: (BOOL)flag;

Description forthcoming.

### setPrintInfo:

- (void) setPrintInfo: (NSPrintInfo*)printInfo;

Description forthcoming.

### setUndoManager:

- (void) setUndoManager: (NSUndoManager*)undoManager;

Description forthcoming.

### setWindow:

- (void) setWindow: (NSWindow*)aWindow;

Description forthcoming.

### shouldChangePrintInfo:

- (BOOL) shouldChangePrintInfo: (NSPrintInfo*)newPrintInfo;

Description forthcoming.

### shouldCloseWindowController:

- (BOOL) shouldCloseWindowController: (NSWindowController*)windowController;

Description forthcoming.

### shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:

- (void) shouldCloseWindowController: (NSWindowController*)windowController delegate: (id)delegate shouldCloseSelector: (SEL)callback contextInfo: (void*)contextInfo;

Description forthcoming.

### shouldRunSavePanelWithAccessoryView

- (BOOL) shouldRunSavePanelWithAccessoryView;

Description forthcoming.

### showWindows

- (void) showWindows;

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;

Description forthcoming.

### updateChangeCount:

- (void) updateChangeCount: (NSDocumentChangeType)change;

Description forthcoming.

### validateMenuItem:

- (BOOL) validateMenuItem: (NSMenuItem*)anItem;

Description forthcoming.

### validateUserInterfaceItem:

- (BOOL) validateUserInterfaceItem: (id<NSValidatedUserInterfaceItem>)anItem;

Description forthcoming.

### windowControllerDidLoadNib:

- (void) windowControllerDidLoadNib: (NSWindowController*)windowController;

Description forthcoming.

### windowControllerWillLoadNib:

- (void) windowControllerWillLoadNib: (NSWindowController*)windowController;

Description forthcoming.

### windowControllers

- (NSArray*) windowControllers;

Description forthcoming.

### windowNibName

- (NSString*) windowNibName;

Description forthcoming.

### writeToFile:ofType:

- (BOOL) writeToFile: (NSString*)fileName ofType: (NSString*)type;

Description forthcoming.

### writeToFile:ofType:originalFile:saveOperation:

- (BOOL) writeToFile: (NSString*)fileName ofType: (NSString*)type originalFile: (NSString*)origFileName saveOperation: (NSSaveOperationType)saveOp;

Description forthcoming.

### writeToURL:ofType:

- (BOOL) writeToURL: (NSURL*)url ofType: (NSString*)type;

Description forthcoming.

### writeWithBackupToFile:ofType:saveOperation:

- (BOOL) writeWithBackupToFile: (NSString*)fileName ofType: (NSString*)fileType saveOperation: (NSSaveOperationType)saveOp;

Description forthcoming.

Up