//
//  NSTextTable.h
//  mySTEP
//
//  Created by Dr. H. Nikolaus Schaller on Sat Jan 07 2006.
//  Copyright (c) 2005 DSITRI.
//
//  This file is part of the mySTEP Library and is provided
//  under the terms of the GNU Library General Public License.
//

#ifndef _mySTEP_H_NSTextTable
#define _mySTEP_H_NSTextTable

#import "AppKit/NSController.h"
#import "AppKit/NSText.h"

typedef enum _NSTextTableLayoutAlgorithm
{
	NSTextTableAutomaticLayoutAlgorithm =0,
	NSTextTableFixedLayoutAlgorithm
} NSTextTableLayoutAlgorithm;

@interface NSTextBlock : NSObject <NSCoding, NSCopying>
{
	NSTextTable *table;
	int _col;
	int _cspan;
	int _row;
	int _rspan;
}
- (int) columnSpan;
- (id) initWithTable:(NSTextTable *) table
		 startingRow:(int) row
			 rowSpan:(int) rspan
	  startingColumn:(int) col
		  columnSpan:(int) cspan;
- (int) rowSpan;
- (int) startingColumn;
- (int) startingRow;
- (NSTextTable *) table;
@end

@interface NSTextTable : NSObject <NSCoding>
{
	NSTextTableLayoutAlgorithm _layoutAlgorithm;
	unsigned _numberOfColumns;
	BOOL _collapsesBorders;
	BOOL _hidesEmptyCells;
}

- (NSRect) boundsRectForBlock:(NSTextTableBlock *) block
				  contentRect:(NSRect) content
					   inRect:(NSRect)rect
				textContainer:(NSTextContainer *) container
			   characterRange:(NSRange) range;
- (BOOL) collapsesBorders;
- (void) drawBackgroundForBlock:(NSTextTableBlock *) block
					  withFrame:(NSRect) frame
						 inView:(NSView *) controlView
				 characterRange:(NSRange) range
				  layoutManager:(NSLayoutManager *) manager;
- (BOOL) hidesEmptyCells;
- (NSTextTableLayoutAlgorithm) layoutAlgorithm;
- (unsigned) numberOfColumns;
- (NSRect) rectForBlock:(NSTextTableBlock *) block
		  layoutAtPoint:(NSPoint) start
				 inRect:(NSRect) rect
		  textContainer:(NSTextContainer *) container
		 characterRange:(NSRange) range;
- (void) setCollapsesBorders:(BOOL) flag;
- (void) setHidesEmptyCells:(BOOL) flag;
- (void) setLayoutAlgorithm:(NSTextTableLayoutAlgorithm) algorithm;
- (void) setNumberOfColumns:(unsigned) numCols;

@end

#endif /* _mySTEP_H_NSTextTable */
