diff --git a/Headers/gnustep/gui/NSDocument.h b/Headers/gnustep/gui/NSDocument.h index 96c1b83a3..e535c3b57 100644 --- a/Headers/gnustep/gui/NSDocument.h +++ b/Headers/gnustep/gui/NSDocument.h @@ -1,134 +1,165 @@ - -#import -#import - -@class NSArray, NSMutableArray, NSData; -@class NSURL, NSUndoManager; - -@class NSWindow, NSView, NSSavePanel, NSMenuItem, NSPrintInfo, NSPopUpButton, NSFileWrapper; -@class NSDocumentController, NSWindowController; - - -typedef enum _NSDocumentChangeType { - NSChangeDone = 0, - NSChangeUndone = 1, - NSChangeCleared = 2 -} NSDocumentChangeType; - -typedef enum _NSSaveOperationType { - NSSaveOperation = 0, - NSSaveAsOperation = 1, - NSSaveToOperation = 2 -} NSSaveOperationType; - -@interface NSDocument : NSObject -{ - @private - NSWindow *_window; // Outlet for the single window case - NSMutableArray *_windowControllers; // WindowControllers for this document - NSString *_fileName; // Save location - NSString *_fileType; // file/document type - NSPrintInfo *_printInfo; // print info record - long _changeCount; // number of time the document has been changed - NSView *savePanelAccessory; // outlet for the accessory save-panel view - NSPopUpButton *spaButton; // outlet for "the File Format:" button in the save panel. - int _documentIndex; // Untitled index - NSUndoManager *_undoManager; // Undo manager for this document - struct __docFlags { - unsigned int inClose:1; - unsigned int hasUndoManager:1; - unsigned int RESERVED:30; - } _docFlags; - void *_reserved1; -} - -/*" Initialization "*/ -- (id)init; -- (id)initWithContentsOfFile:(NSString *)fileName ofType:(NSString *)fileType; -- (id)initWithContentsOfURL:(NSURL *)url ofType:(NSString *)fileType; - -/*" Window management "*/ -- (NSArray *)windowControllers; -- (void)addWindowController:(NSWindowController *)windowController; -- (BOOL)shouldCloseWindowController:(NSWindowController *)windowController; -- (void)showWindows; - -/*" Window controller creation "*/ -- (void)makeWindowControllers; // Manual creation -- (NSString *)windowNibName; // Automatic creation (Document will be the nib owner) - -/*" Window loading notifications "*/ -// Only called if the document is the owner of the nib -- (void)windowControllerWillLoadNib:(NSWindowController *)windowController; -- (void)windowControllerDidLoadNib:(NSWindowController *)windowController; - -/*" Edited flag "*/ -- (BOOL)isDocumentEdited; -- (void)updateChangeCount:(NSDocumentChangeType)change; - -/*" Display Name (window title) "*/ -- (NSString *)displayName; - -/*" Backup file "*/ -- (BOOL)keepBackupFile; - -/*" Closing "*/ -- (void)close; -- (BOOL)canCloseDocument; - -/*" Type and location "*/ -- (NSString *)fileName; -- (void)setFileName:(NSString *)fileName; -- (NSString *)fileType; -- (void)setFileType:(NSString *)type; -+ (NSArray *)readableTypes; -+ (NSArray *)writableTypes; -+ (BOOL)isNativeType:(NSString *)type; - -/*" Read/Write/Revert "*/ - -- (NSData *)dataRepresentationOfType:(NSString *)type; -- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type; - -- (NSFileWrapper *)fileWrapperRepresentationOfType:(NSString *)type; -- (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:(NSString *)type; - -- (BOOL)writeToFile:(NSString *)fileName ofType:(NSString *)type; -- (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)type; -- (BOOL)revertToSavedFromFile:(NSString *)fileName ofType:(NSString *)type; - -- (BOOL)writeToURL:(NSURL *)url ofType:(NSString *)type; -- (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)type; -- (BOOL)revertToSavedFromURL:(NSURL *)url ofType:(NSString *)type; - -/*" Save panel "*/ -- (BOOL)shouldRunSavePanelWithAccessoryView; -- (NSString *)fileNameFromRunningSavePanelForSaveOperation:(NSSaveOperationType)saveOperation; -- (int)runModalSavePanel:(NSSavePanel *)savePanel withAccessoryView:(NSView *)accessoryView; - -/*" Printing "*/ -- (NSPrintInfo *)printInfo; -- (void)setPrintInfo:(NSPrintInfo *)printInfo; -- (BOOL)shouldChangePrintInfo:(NSPrintInfo *)newPrintInfo; -- (IBAction)runPageLayout:(id)sender; -- (int)runModalPageLayoutWithPrintInfo:(NSPrintInfo *)printInfo; -- (IBAction)printDocument:(id)sender; -- (void)printShowingPrintPanel:(BOOL)flag; - -/*" IB Actions "*/ -- (IBAction)saveDocument:(id)sender; -- (IBAction)saveDocumentAs:(id)sender; -- (IBAction)saveDocumentTo:(id)sender; -- (IBAction)revertDocumentToSaved:(id)sender; - -/*" Menus "*/ -- (BOOL)validateMenuItem:(NSMenuItem *)anItem; - -/*" Undo "*/ -- (NSUndoManager *)undoManager; -- (void)setUndoManager:(NSUndoManager *)undoManager; -- (BOOL)hasUndoManager; -- (void)setHasUndoManager:(BOOL)flag; - -@end - +/* + NSDocument.h + + The abstract document class + + Copyright (C) 1999 Free Software Foundation, Inc. + + Author: Carl Lindberg + Date: 1999 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _GNUstep_H_NSDocument +#define _GNUstep_H_NSDocument + +#include +#include + + +@class NSURL, NSUndoManager; +@class NSWindow, NSView, NSSavePanel, NSMenuItem; +@class NSPrintInfo, NSPopUpButton, NSFileWrapper; +@class NSDocumentController, NSWindowController; + + +typedef enum _NSDocumentChangeType { + NSChangeDone = 0, + NSChangeUndone = 1, + NSChangeCleared = 2 +} NSDocumentChangeType; + +typedef enum _NSSaveOperationType { + NSSaveOperation = 0, + NSSaveAsOperation = 1, + NSSaveToOperation = 2 +} NSSaveOperationType; + +@interface NSDocument : NSObject +{ + @private + NSWindow *_window; // Outlet for the single window case + NSMutableArray *_windowControllers; // WindowControllers for this document + NSString *_fileName; // Save location + NSString *_fileType; // file/document type + NSPrintInfo *_printInfo; // print info record + long _changeCount; // number of time the document has been changed + NSView *savePanelAccessory; // outlet for the accessory save-panel view + NSPopUpButton *spaButton; // outlet for "the File Format:" button in the save panel. + int _documentIndex; // Untitled index + NSUndoManager *_undoManager; // Undo manager for this document + struct __docFlags { + unsigned int inClose:1; + unsigned int hasUndoManager:1; + unsigned int RESERVED:30; + } _docFlags; + void *_reserved1; +} + +/*" Initialization "*/ +- (id)init; +- (id)initWithContentsOfFile:(NSString *)fileName ofType:(NSString *)fileType; +- (id)initWithContentsOfURL:(NSURL *)url ofType:(NSString *)fileType; + +/*" Window management "*/ +- (NSArray *)windowControllers; +- (void)addWindowController:(NSWindowController *)windowController; +- (BOOL)shouldCloseWindowController:(NSWindowController *)windowController; +- (void)showWindows; + +/*" Window controller creation "*/ +- (void)makeWindowControllers; // Manual creation +- (NSString *)windowNibName; // Automatic creation (Document will be the nib owner) + +/*" Window loading notifications "*/ +// Only called if the document is the owner of the nib +- (void)windowControllerWillLoadNib:(NSWindowController *)windowController; +- (void)windowControllerDidLoadNib:(NSWindowController *)windowController; + +/*" Edited flag "*/ +- (BOOL)isDocumentEdited; +- (void)updateChangeCount:(NSDocumentChangeType)change; + +/*" Display Name (window title) "*/ +- (NSString *)displayName; + +/*" Backup file "*/ +- (BOOL)keepBackupFile; + +/*" Closing "*/ +- (void)close; +- (BOOL)canCloseDocument; + +/*" Type and location "*/ +- (NSString *)fileName; +- (void)setFileName:(NSString *)fileName; +- (NSString *)fileType; +- (void)setFileType:(NSString *)type; ++ (NSArray *)readableTypes; ++ (NSArray *)writableTypes; ++ (BOOL)isNativeType:(NSString *)type; + +/*" Read/Write/Revert "*/ + +- (NSData *)dataRepresentationOfType:(NSString *)type; +- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type; + +- (NSFileWrapper *)fileWrapperRepresentationOfType:(NSString *)type; +- (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:(NSString *)type; + +- (BOOL)writeToFile:(NSString *)fileName ofType:(NSString *)type; +- (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)type; +- (BOOL)revertToSavedFromFile:(NSString *)fileName ofType:(NSString *)type; + +- (BOOL)writeToURL:(NSURL *)url ofType:(NSString *)type; +- (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)type; +- (BOOL)revertToSavedFromURL:(NSURL *)url ofType:(NSString *)type; + +/*" Save panel "*/ +- (BOOL)shouldRunSavePanelWithAccessoryView; +- (NSString *)fileNameFromRunningSavePanelForSaveOperation:(NSSaveOperationType)saveOperation; +- (int)runModalSavePanel:(NSSavePanel *)savePanel withAccessoryView:(NSView *)accessoryView; + +/*" Printing "*/ +- (NSPrintInfo *)printInfo; +- (void)setPrintInfo:(NSPrintInfo *)printInfo; +- (BOOL)shouldChangePrintInfo:(NSPrintInfo *)newPrintInfo; +- (IBAction)runPageLayout:(id)sender; +- (int)runModalPageLayoutWithPrintInfo:(NSPrintInfo *)printInfo; +- (IBAction)printDocument:(id)sender; +- (void)printShowingPrintPanel:(BOOL)flag; + +/*" IB Actions "*/ +- (IBAction)saveDocument:(id)sender; +- (IBAction)saveDocumentAs:(id)sender; +- (IBAction)saveDocumentTo:(id)sender; +- (IBAction)revertDocumentToSaved:(id)sender; + +/*" Menus "*/ +- (BOOL)validateMenuItem:(NSMenuItem *)anItem; + +/*" Undo "*/ +- (NSUndoManager *)undoManager; +- (void)setUndoManager:(NSUndoManager *)undoManager; +- (BOOL)hasUndoManager; +- (void)setHasUndoManager:(BOOL)flag; + +@end + +#endif // _GNUstep_H_NSDocument diff --git a/Headers/gnustep/gui/NSDocumentController.h b/Headers/gnustep/gui/NSDocumentController.h index fb76dae8b..43b730d00 100644 --- a/Headers/gnustep/gui/NSDocumentController.h +++ b/Headers/gnustep/gui/NSDocumentController.h @@ -1,6 +1,35 @@ +/* + NSDocumentController.h -#import -#import + The document controller class + + Copyright (C) 1999 Free Software Foundation, Inc. + + Author: Carl Lindberg + Date: 1999 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _GNUstep_H_NSDocumentController +#define _GNUstep_H_NSDocumentController + +#include +#include @class NSArray, NSMutableArray; @class NSURL; @@ -11,6 +40,7 @@ { @private NSMutableArray *_documents; + NSMutableArray *_recentDocuments; struct __controllerFlags { unsigned int shouldCreateUI:1; unsigned int RESERVED:31; @@ -30,10 +60,8 @@ - (id)openUntitledDocumentOfType:(NSString*)type display:(BOOL)display; - (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)display; -#if NS_URL -//- (id)makeDocumentWithContentsOfURL:(NSURL *)url ofType:(NSString *)type; -//- (id)openDocumentWithContentsOfURL:(NSURL *)url display:(BOOL)display; -#endif +- (id)makeDocumentWithContentsOfURL:(NSURL *)url ofType:(NSString *)type; +- (id)openDocumentWithContentsOfURL:(NSURL *)url display:(BOOL)display; /*" With or without UI "*/ - (BOOL)shouldCreateUI; @@ -43,15 +71,20 @@ - (IBAction)saveAllDocuments:(id)sender; - (IBAction)openDocument:(id)sender; - (IBAction)newDocument:(id)sender; +- (IBAction)clearRecentDocuments:(id)sender; + +/*" Recent Documents "*/ +- (void)noteNewRecentDocumentURL:(NSURL *)anURL; +- (NSArray *)recentDocumentURLs; /*" Open panel "*/ -#if NS_URL -//- (NSArray *)URLsFromRunningOpenPanel; -#endif +- (NSArray *)URLsFromRunningOpenPanel; - (NSArray *)fileNamesFromRunningOpenPanel; - (int)runModalOpenPanel:(NSOpenPanel *)openPanel forTypes:(NSArray *)openableFileExtensions; /*" Document management "*/ +- (void)addDocument:(NSDocument *)document; +- (void)removeDocument:(NSDocument *)document; - (BOOL)closeAllDocuments; - (BOOL)reviewUnsavedDocumentsWithAlertTitle:(NSString *)title cancellable:(BOOL)cancellable; - (NSArray *)documents; @@ -61,6 +94,7 @@ - (id)documentForWindow:(NSWindow *)window; - (id)documentForFileName:(NSString *)fileName; + /*" Menu validation "*/ - (BOOL)validateMenuItem:(NSMenuItem *)anItem; @@ -72,3 +106,5 @@ @end +#endif // _GNUstep_H_NSDocumentController + diff --git a/Headers/gnustep/gui/NSDocumentFrameworkPrivate.h b/Headers/gnustep/gui/NSDocumentFrameworkPrivate.h index 708bc7f28..603b6bbfd 100644 --- a/Headers/gnustep/gui/NSDocumentFrameworkPrivate.h +++ b/Headers/gnustep/gui/NSDocumentFrameworkPrivate.h @@ -1,26 +1,57 @@ - -#import "NSDocumentController.h" - -@interface NSDocumentController (Private) -- (NSArray *)_editorAndViewerTypesForClass:(Class)documentClass; -- (NSArray *)_editorTypesForClass:(Class)fp12; -- (NSArray *)_exportableTypesForClass:(Class)documentClass; -- (void)_removeDocument:(NSDocument *)document; -@end - - -#import "NSDocument.h" - -@interface NSDocument (Private) -- (void)_removeWindowController:(NSWindowController *)controller; -- (NSWindow *)_transferWindowOwnership; -@end - - -#import "NSWindowController.h" - -@interface NSWindowController (Private) -- (void)_windowDidLoad; -- (void)_synchronizeWindowTitleWithDocumentName; -- (void)setWindow:(NSWindow *)window; -@end +/* + NSDocumentFramworkPrivate.h + + The private methods of all the classes of the document framework + + Copyright (C) 1999 Free Software Foundation, Inc. + + Author: Carl Lindberg + Date: 1999 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _GNUstep_H_NSDocumentFramworkPrivate +#define _GNUstep_H_NSDocumentFramworkPrivate + +#include "NSDocumentController.h" + +@interface NSDocumentController (Private) +- (NSArray *)_editorAndViewerTypesForClass:(Class)documentClass; +- (NSArray *)_editorTypesForClass:(Class)fp12; +- (NSArray *)_exportableTypesForClass:(Class)documentClass; +- (void)_removeDocument:(NSDocument *)document; +@end + + +#include "NSDocument.h" + +@interface NSDocument (Private) +- (void)_removeWindowController:(NSWindowController *)controller; +- (NSWindow *)_transferWindowOwnership; +@end + + +#include "NSWindowController.h" + +@interface NSWindowController (Private) +- (void)_windowDidLoad; +- (void)_synchronizeWindowTitleWithDocumentName; +- (void)setWindow:(NSWindow *)window; +@end + +#endif // _GNUstep_H_NSDocumentFramworkPrivate