/* Text_more.m				 
 *
 * This category makes dealing with the Text object easier. 
 * See the docu for details.
 *
 * For interface-info see the header file. The comments in this file mostly
 * cover only the real implementation details.
 *
 * Written by: 		Thomas Engel
 * Created:    		30.01.1995 (Copyleft)
 * Last modified: 	30.01.1995
 */

// The following define is a fake. Looks like NeXT...but it is a cheatmode
// action.
// We don't have a RTFD paste type. But I really need one !

#define NXRTFDPboardType NXUniqueString("NeXT RTFD pasteboard type")


#import "Text_more.h"

@implementation Text(More)

- copyTo:aPasteboard
{
	NXAtom textTypes[5];

	if( [self isMonoFont] )
	{
		textTypes[0] = NXAsciiPboardType;
		textTypes[1] = NULL;
	}
	// In the other case we will cheat. The RTFD type was NEVER defined by
	// NeXT. But we will use it...it works. (see the define)

	else
	{
		textTypes[0] = NXRTFDPboardType;
		textTypes[1] = NXTIFFPboardType;
		textTypes[2] = NXRTFPboardType;
		textTypes[3] = NXAsciiPboardType;
		textTypes[4] = NULL;
	}
	[self writeSelectionToPasteboard:aPasteboard types:textTypes];
	return self;
}

- cutTo:aPasteboard
{
	[self copyTo:aPasteboard];
	[self delete:self];
	return self;
}

- pasteFrom:aPasteboard
{
	[self readSelectionFromPasteboard:aPasteboard];
	return self;
}

- (BOOL)hasEmptySelection
{
	NXSelPt	start;
	NXSelPt	end;

	[self getSel:&start :&end];
	
	if( start.cp == end.cp || 
	    start.cp < 0 )
		return YES;
	
	return NO;
}

@end

/*
 * History: 30.01.95 Buh
 *			
 *
 * Bugs: - ...
 */