/* Document.h
 * Cenon document class
 *
 * Copyright (C) 1996-2006 by vhf interservice GmbH
 * Author: Georg Fleischmann
 *
 * Created:  1996-02-09
 * Modified: 2006-02-06
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the vhf Public License as
 * published by vhf interservice GmbH. Among other things, the
 * License requires that the copyright notices and this notice
 * be preserved on all copies.
 *
 * This program 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 vhf Public License for more details.
 *
 * You should have received a copy of the vhf Public License along
 * with this program; see the file LICENSE. If not, write to vhf.
 *
 * vhf interservice GmbH, Im Marxle 3, 72119 Altingen, Germany
 * eMail: info@vhf.de
 * http://www.vhf.de
 */

#ifndef VHF_H_DOCUMENT
#define VHF_H_DOCUMENT

#include <AppKit/AppKit.h>
#include "TileScrollView.h"
#include "DocWindow.h"
#include "DocView.h"
#include "undo.subproj/undochange.h"
#include "Type1Font.h"
#include "functions.h"	// CenonUnits

/* notifications */
#define DocumentHasBeenSaved		@"DocumentHasBeenSaved"		// objects should save their stuff
#define DocumentDidOpen			@"DocumentDidOpen"		// all additional init should be done

@interface Document:ChangeManager
{
    TileScrollView	*scrollView;		// the scroll view inside the window
    DocWindow		*window;		// the window
    int			magazineIndex;		// the index of the magazine we use

    id			printInfo;
    NSString		*name;			// the name of the document
    NSString		*directory;		// the directory it is in
    BOOL		dirty;
    BOOL		haveSavedDocument;	// whether document has associated disk file

    Type1Font		*fontObject;		// to allow editing Fonts

    /* project settings */
    //CenonUnits	baseUnit;		// document unit (mm, inch, point)
    //int		unitNum, unitDen;	// factor of base unit num/den

    /* project info */
    NSString		*docVersion;
    NSString		*docAuthor;
    NSString		*docCopyright;
    NSString		*docComment;
}


/* class methods */

+ new;
+ newFromFile:(NSString *)fileName;
+ (NSMutableArray*)listFromFile:(NSString*)fileName;
+ newFromList:(NSMutableArray*)list;

//- (void)sizeWindow:(NSSize)size;
- (void)scale:(float)x :(float)y withCenter:(NSPoint)center;

- window;
- (void)resetScrollers;
- (TileScrollView*)scrollView;	// returns the scroll view
- (DocView*)documentView;	// returns the docView of the scroll view

- (void)setDirty:(BOOL)flag;
- (BOOL)dirty;

/* Services menu methods */
- (void)registerForServicesMenu;
- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType;
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types;

/* Document info */
- (void)setDocVersion:(NSString*)newVersion;
- (NSString*)docVersion;
- (void)setDocAuthor:(NSString*)newAuthor;
- (NSString*)docAuthor;
- (void)setDocCopyright:(NSString*)newCopy;
- (NSString*)docCopyright;
- (void)setDocComment:(NSString*)newComment;
- (NSString*)docComment;

/* Document name and file handling methods */
- (NSString *)filename;
- (NSString *)directory;
- (NSString *)name;
- (void)setName:(NSString *)name andDirectory:(NSString *)directory;
- (BOOL)setName:(NSString *)name;
- (void)setTemporaryTitle:(NSString *)title;
- (BOOL)save;
- (BOOL)save:(id <NSMenuItem>)invokingMenuItem;
- (BOOL)saveAs:(id <NSMenuItem>)invokingMenuItem;

- (void)setFontObject:(Type1Font*)fontObj;

- (void)printDocument:sender;
- (void)changeLayout:sender;

/* CAM */
- (void)setMagazineIndex:(int)i;
- (int)magazineIndex;

@end

#endif // VHF_H_DOCUMENT
