A method identified as deprecated has been superseded and may become unsupported in the future.
Returns the document object for the file in which the document data is stored. (Deprecated in Mac OS X v10.4. Use documentForURL:
instead.)
- (id)documentForFileName:(NSString *)fileName
The fileName argument is a fully qualified path in the file system. Returns nil
if no document can be found.
NSDocumentController.h
Returns a selection of files chosen by the user in the Open panel. (Deprecated in Mac OS X v10.4. Use URLsFromRunningOpenPanel
instead.)
- (NSArray *)fileNamesFromRunningOpenPanel
Each file in the returned NSArray
is a fully qualified path to the file’s location in the file system. This method is invoked by openDocument:
, and it invokes runModalOpenPanel:forTypes:
after initializing the Open panel (which includes getting the starting directory with currentDirectory
). Returns nil
if the user cancels the Open panel or makes no selection.
NSDocumentController.h
Creates and returns a document object of a given document type from the contents of a file. (Deprecated in Mac OS X v10.4. Use makeDocumentWithContentsOfURL:ofType:error:
instead.)
- (id)makeDocumentWithContentsOfFile:(NSString *)fileName ofType:(NSString *)docType
Creates and returns an NSDocument
object for document type docType from the contents of the file fileName, which must be a fully qualified path. The returned object is not retained. Returns nil
if the NSDocument
subclass for docType couldn’t be determined or if the object couldn’t be created. This method invokes the NSDocument
method initWithContentsOfFile:ofType:
and is invoked by openDocumentWithContentsOfFile:display:
.
NSDocumentController.h
Creates and returns a ocument object for the given document type from the contents of a given URL. (Deprecated in Mac OS X v10.4. Use makeDocumentWithContentsOfURL:ofType:error:
instead.)
- (id)makeDocumentWithContentsOfURL:(NSURL *)aURL ofType:(NSString *)docType
Creates and returns an NSDocument
object for document type docType from the contents of aURL. The returned object is not retained. Returns nil
if the NSDocument
subclass for docType couldn’t be determined or if the object couldn’t be created. This method invokes the NSDocument
method initWithContentsOfURL:ofType:
and is invoked by openDocumentWithContentsOfURL:display:
.
NSDocumentController.h
Creates and returns a document object for document type. (Deprecated in Mac OS X v10.4. Use makeUntitledDocumentOfType:error:
instead.)
- (id)makeUntitledDocumentOfType:(NSString *)type
Creates and returns an NSDocument
object for document type type. The returned object is not retained. Returns nil
if the NSDocument
subclass for type couldn’t be determined or if the object couldn’t be created. This method invokes the NSDocument
init
method and is invoked by openUntitledDocumentOfType:display:
.
NSDocumentController.h
Returns a document object created from the contents of a given file and optionally displays it. (Deprecated in Mac OS X v10.4. Use openDocumentWithContentsOfURL:display:error:
instead.)
- (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)flag
Returns an NSDocument
object created from the contents of the file fileName (an absolute path) and displays it if flag is YES
. The returned object is not retained, but is added to the receiver’s list of managed documents. Returns nil
if the object could not be created, typically because fileName does not point to a valid file or because there is no NSDocument
subclass for the document type (as indicated by the file extension or HFS file type). Even if flag is YES
, the document is not displayed if shouldCreateUI
returns NO
. This method invokes makeDocumentWithContentsOfFile:ofType:
to obtain the created NSDocument object. If you override this method, your implementation should be prepared to handle either YES
or NO
.
To handle an Open Documents Apple event, the Application Kit’s built-in Apple event handling automatically invokes this method with the path to the file to open and a display argument.
Invoked with a display argument of YES
instead of NO
when a Print Documents Apple event is handled. This may have been handled differently in versions of Mac OS X prior to version 10.3.
NSDocumentController.h
Returns a document object created from the contents of a given URL and optionally displays it. (Deprecated in Mac OS X v10.4. Use openDocumentWithContentsOfURL:display:error:
instead.)
- (id)openDocumentWithContentsOfURL:(NSURL *)aURL display:(BOOL)flag
Returns an NSDocument
object created from the contents of aURL and displays it if flag is YES
. The returned object is not retained, but is added to the receiver’s list of managed documents. Returns nil
if the object could not be created, typically because aURL does not point to a valid location or because there is no NSDocument
subclass for the document type. Even if flag is YES
, the document is not displayed if shouldCreateUI
returns NO
. This method invokes makeDocumentWithContentsOfURL:ofType:
to obtain the created NSDocument
object.
NSDocumentController.h
Returns a document object instantiated from the subclass of the given document type and optionally displays it. (Deprecated in Mac OS X v10.4. Use openUntitledDocumentAndDisplay:error:
with defaultType
instead.)
- (id)openUntitledDocumentOfType:(NSString *)docType display:(BOOL)display
Returns an NSDocument
object instantiated from the NSDocument
subclass required by document type docType and displays it if flag is YES
. The returned object is not retained, but is added to the receiver’s list of managed documents. Returns nil
if the object could not be created, typically because no NSDocument
subclass could be found for docType. Even if flag is YES
, the document is not displayed if shouldCreateUI
returns NO
. This method invokes makeUntitledDocumentOfType:
to obtain the created NSDocument
object.
NSDocumentController.h
Sets whether the window controllers of a document should be created when the document is created. (Deprecated in Mac OS X v10.4. Use the display parameter of openUntitledDocumentAndDisplay:error:
or openDocumentWithContentsOfURL:display:error:
instead.)
- (void)setShouldCreateUI:(BOOL)flag
Sets whether the window controllers (NSWindowController
instances) of a document should be created when the document is created. When a window controller is created, it loads the nib file containing the window it manages. Often flag is set to NO
for scripting or searching operations involving the document’s data.
NSDocumentController.h
Returns a Boolean value that indicates whether the window controllers of a document should be created when the document is created. (Deprecated in Mac OS X v10.4. Use the display parameter of openUntitledDocumentAndDisplay:error:
or openDocumentWithContentsOfURL:display:error:
instead.)
- (BOOL)shouldCreateUI
A Boolean value that indicates whether the window controllers (NSWindowController
instances) of a document should be created when the document is created.
NSDocumentController.h
Returns the allowable file extensions for the given document type. (Deprecated in Mac OS X v10.5.)
- (NSArray *)fileExtensionsFromType:(NSString *)documentTypeName
The name of a document type, specified by CFBundleTypeName
in the application’s Info.plist
file.
The allowable file extensions (as NSString
objects) for documentTypeName.
Type extensions are specified by the CFBundleTypeExtensions
array for the given type in the Info.plist
file.
The first string in the returned array is typically the most common extension. The array may also contain encoded HFS file types as will as filename extensions.
NSDocumentController.h
Returns the document type associated with files having extension fileExtensionOrHFSFileType. (Deprecated in Mac OS X v10.5.)
- (NSString *)typeFromFileExtension:(NSString *)fileExtensionOrHFSFileType
fileExtensionOrHFSFileType may also be an encoded HFS file type, as well as a filename extension.
NSDocumentController.h
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)