Implemented handling of writing directions. These are needed for the

upcoming new RTFProducer.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16551 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
FredKiefer 2003-04-26 16:51:21 +00:00
parent 091eec6d4c
commit 23014ff1dc

View file

@ -127,6 +127,22 @@ static NSParagraphStyle *defaultStyle = nil;
return defaultStyle; return defaultStyle;
} }
+ (void) initialize
{
if (self == [NSParagraphStyle class])
{
/* Set the class version to 2, as the writing direction is now
stored in the encoding */
[self setVersion: 2];
}
}
+ (NSWritingDirection) defaultWritingDirectionForLanguage: (NSString*) language
{
// FIXME
return NSWritingDirectionNaturalDirection;
}
- (void) dealloc - (void) dealloc
{ {
if (self == defaultStyle) if (self == defaultStyle)
@ -150,6 +166,7 @@ static NSParagraphStyle *defaultStyle = nil;
_minimumLineHeight = 0.0; _minimumLineHeight = 0.0;
_paragraphSpacing = 0.0; _paragraphSpacing = 0.0;
_tailIndent = 0.0; _tailIndent = 0.0;
_baseDirection = NSWritingDirectionNaturalDirection;
_tabStops = [[NSMutableArray allocWithZone: [self zone]] _tabStops = [[NSMutableArray allocWithZone: [self zone]]
initWithCapacity: 12]; initWithCapacity: 12];
return self; return self;
@ -240,6 +257,11 @@ static NSParagraphStyle *defaultStyle = nil;
return _lineBreakMode; return _lineBreakMode;
} }
- (NSWritingDirection) baseWritingDirection
{
return _baseDirection;
}
- (id) copyWithZone: (NSZone*)aZone - (id) copyWithZone: (NSZone*)aZone
{ {
if (NSShouldRetainWithZone (self, aZone) == YES) if (NSShouldRetainWithZone (self, aZone) == YES)
@ -306,6 +328,11 @@ static NSParagraphStyle *defaultStyle = nil;
} }
} }
if ([aCoder versionForClassName: @"NSParagraphStyle"] >= 2)
{
[aCoder decodeValueOfObjCType: @encode(int) at: &_baseDirection];
}
return self; return self;
} }
@ -349,6 +376,8 @@ static NSParagraphStyle *defaultStyle = nil;
count: count count: count
at: types]; at: types];
} }
[aCoder encodeValueOfObjCType: @encode(int) at: &_baseDirection];
} }
@ -370,6 +399,7 @@ static NSParagraphStyle *defaultStyle = nil;
C(_maximumLineHeight); C(_maximumLineHeight);
C(_alignment); C(_alignment);
C(_lineBreakMode); C(_lineBreakMode);
C(_baseDirection);
#undef C #undef C
return [_tabStops isEqualToArray: other->_tabStops]; return [_tabStops isEqualToArray: other->_tabStops];
@ -443,6 +473,11 @@ static NSParagraphStyle *defaultStyle = nil;
_maximumLineHeight = aFloat; _maximumLineHeight = aFloat;
} }
- (void) setBaseWritingDirection: (NSWritingDirection)direction
{
_baseDirection = direction;
}
- (void) addTabStop: (NSTextTab*)anObject - (void) addTabStop: (NSTextTab*)anObject
{ {
unsigned count = [_tabStops count]; unsigned count = [_tabStops count];
@ -506,6 +541,7 @@ static NSParagraphStyle *defaultStyle = nil;
_minimumLineHeight = p->_minimumLineHeight; _minimumLineHeight = p->_minimumLineHeight;
_paragraphSpacing = p->_paragraphSpacing; _paragraphSpacing = p->_paragraphSpacing;
_tailIndent = p->_tailIndent; _tailIndent = p->_tailIndent;
_baseDirection = p->_baseDirection;
} }
- (id) copyWithZone: (NSZone*)aZone - (id) copyWithZone: (NSZone*)aZone