summaryrefslogtreecommitdiffstats
path: root/lib/kotext/KoRichText.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kotext/KoRichText.cpp')
-rw-r--r--lib/kotext/KoRichText.cpp138
1 files changed, 69 insertions, 69 deletions
diff --git a/lib/kotext/KoRichText.cpp b/lib/kotext/KoRichText.cpp
index b6787b25e..cd45006ad 100644
--- a/lib/kotext/KoRichText.cpp
+++ b/lib/kotext/KoRichText.cpp
@@ -60,7 +60,7 @@ void KoTextDocCommandHistory::addCommand( KoTextDocCommand *cmd )
{
if ( current < (int)history.count() - 1 ) {
TQPtrList<KoTextDocCommand> commands;
- commands.setAutoDelete( FALSE );
+ commands.setAutoDelete( false );
for( int i = 0; i <= current; ++i ) {
commands.insert( i, history.at( 0 ) );
@@ -70,7 +70,7 @@ void KoTextDocCommandHistory::addCommand( KoTextDocCommand *cmd )
commands.append( cmd );
history.clear();
history = commands;
- history.setAutoDelete( TRUE );
+ history.setAutoDelete( true );
} else {
history.append( cmd );
}
@@ -187,7 +187,7 @@ KoTextCursor *KoTextDocDeleteCommand::unexecute( KoTextCursor *c )
cursor.setParag( s );
cursor.setIndex( index );
TQString str = KoTextString::toString( text );
- cursor.insert( str, TRUE, &text );
+ cursor.insert( str, true, &text );
cursor.setParag( s );
cursor.setIndex( index );
if ( c ) {
@@ -200,7 +200,7 @@ KoTextCursor *KoTextDocDeleteCommand::unexecute( KoTextCursor *c )
s = cursor.parag();
while ( s ) {
s->format();
- s->setChanged( TRUE );
+ s->setChanged( true );
if ( c && s == c->parag() )
break;
s = s->next();
@@ -377,7 +377,7 @@ void KoTextCursor::insert( const TQString &str, bool checkNewLine, TQMemArray<Ko
{
string->invalidate( idx );
tmpIndex = -1;
- bool justInsert = TRUE;
+ bool justInsert = true;
TQString s( str );
#if defined(TQ_WS_WIN)
if ( checkNewLine )
@@ -391,27 +391,27 @@ void KoTextCursor::insert( const TQString &str, bool checkNewLine, TQMemArray<Ko
for ( int i = 0; i < (int)s.length(); ++i ) {
if ( formatting->at( i ).format() ) {
formatting->at( i ).format()->addRef();
- string->string()->setFormat( idx + i, formatting->at( i ).format(), TRUE );
+ string->string()->setFormat( idx + i, formatting->at( i ).format(), true );
}
}
}
idx += s.length();
} else {
- TQStringList lst = TQStringList::split( '\n', s, TRUE );
+ TQStringList lst = TQStringList::split( '\n', s, true );
TQStringList::Iterator it = lst.begin();
//int y = string->rect().y() + string->rect().height();
int lastIndex = 0;
KoTextFormat *lastFormat = 0;
for ( ; it != lst.end(); ) {
if ( it != lst.begin() ) {
- splitAndInsertEmptyParag( FALSE, TRUE );
+ splitAndInsertEmptyParag( false, true );
//string->setEndState( -1 );
#if 0 // no!
- string->prev()->format( -1, FALSE );
+ string->prev()->format( -1, false );
#endif
if ( lastFormat && formatting && string->prev() ) {
lastFormat->addRef();
- string->prev()->string()->setFormat( string->prev()->length() - 1, lastFormat, TRUE );
+ string->prev()->string()->setFormat( string->prev()->length() - 1, lastFormat, true );
}
}
lastFormat = 0;
@@ -427,7 +427,7 @@ void KoTextCursor::insert( const TQString &str, bool checkNewLine, TQMemArray<Ko
for ( int i = 0; i < len; ++i ) {
if ( formatting->at( i + lastIndex ).format() ) {
formatting->at( i + lastIndex ).format()->addRef();
- string->string()->setFormat( i + idx, formatting->at( i + lastIndex ).format(), TRUE );
+ string->string()->setFormat( i + idx, formatting->at( i + lastIndex ).format(), true );
}
}
if ( it != lst.end() )
@@ -439,7 +439,7 @@ void KoTextCursor::insert( const TQString &str, bool checkNewLine, TQMemArray<Ko
idx += s.length();
}
#if 0 //// useless and wrong. We'll format things and move them down correctly in KoTextObject::insert().
- string->format( -1, FALSE );
+ string->format( -1, false );
int dy = string->rect().y() + string->rect().height() - y;
#endif
KoTextParag *p = string;
@@ -455,7 +455,7 @@ void KoTextCursor::insert( const TQString &str, bool checkNewLine, TQMemArray<Ko
#if 0 //// useless and slow
int h = string->rect().height();
- string->format( -1, TRUE );
+ string->format( -1, true );
#endif
fixCursorPosition();
}
@@ -499,9 +499,9 @@ bool KoTextCursor::place( const TQPoint &p, KoTextParag *s, bool link, int *cust
}
if ( !s )
- return FALSE;
+ return false;
- setParag( s, FALSE );
+ setParag( s, false );
int y = s->rect().y();
int lines = s->lines();
KoTextStringChar *chr = 0;
@@ -514,7 +514,7 @@ bool KoTextCursor::place( const TQPoint &p, KoTextParag *s, bool link, int *cust
cy = s->lineY( i );
//ch = s->lineHeight( i );
if ( !chr )
- return FALSE;
+ return false;
if ( i < lines - 1 && pos.y() >= y + cy && pos.y() <= y + s->lineY( i+1 ) )
break;
}
@@ -545,7 +545,7 @@ bool KoTextCursor::place( const TQPoint &p, KoTextParag *s, bool link, int *cust
cpos += cw;
int d = cpos - pos.x();
bool dm = d < 0 ? !chr->rightToLeft : chr->rightToLeft;
- if ( (TQABS( d ) < dist || (dist == d && dm == TRUE )) && string->string()->validCursorPosition( i ) ) {
+ if ( (TQABS( d ) < dist || (dist == d && dm == true )) && string->string()->validCursorPosition( i ) ) {
dist = TQABS( d );
if ( !link || pos.x() >= x + chr->x ) {
curpos = i;
@@ -553,9 +553,9 @@ bool KoTextCursor::place( const TQPoint &p, KoTextParag *s, bool link, int *cust
}
i++;
}
- setIndex( curpos, FALSE );
+ setIndex( curpos, false );
- return TRUE;
+ return true;
}
void KoTextCursor::gotoRight()
@@ -781,7 +781,7 @@ void KoTextCursor::gotoPreviousWord()
gotoPreviousLetter();
tmpIndex = -1;
KoTextString *s = string->string();
- bool allowSame = FALSE;
+ bool allowSame = false;
if ( idx == ( (int)s->length()-1 ) )
return;
for ( int i = idx; i >= 0; --i ) {
@@ -794,7 +794,7 @@ void KoTextCursor::gotoPreviousWord()
}
if ( !allowSame && !( s->at( i ).c.isSpace() || s->at( i ).c == '\t' || s->at( i ).c == '.' ||
s->at( i ).c == ',' || s->at( i ).c == ':' || s->at( i ).c == ';' ) )
- allowSame = TRUE;
+ allowSame = true;
}
idx = 0;
}
@@ -803,7 +803,7 @@ void KoTextCursor::gotoNextWord()
{
tmpIndex = -1;
KoTextString *s = string->string();
- bool allowSame = FALSE;
+ bool allowSame = false;
for ( int i = idx; i < (int)s->length(); ++i ) {
if ( ! ( s->at( i ).c.isSpace() || s->at( i ).c == '\t' || s->at( i ).c == '.' ||
s->at( i ).c == ',' || s->at( i ).c == ':' || s->at( i ).c == ';' ) ) {
@@ -814,7 +814,7 @@ void KoTextCursor::gotoNextWord()
}
if ( !allowSame && ( s->at( i ).c.isSpace() || s->at( i ).c == '\t' || s->at( i ).c == '.' ||
s->at( i ).c == ',' || s->at( i ).c == ':' || s->at( i ).c == ';' ) )
- allowSame = TRUE;
+ allowSame = true;
}
if ( idx < ((int)s->length()-1) ) {
@@ -860,7 +860,7 @@ void KoTextCursor::splitAndInsertEmptyParag( bool ind, bool updateIds )
KoTextParag *n = string->next();
KoTextParag *s = doc->createParag( doc, string, n, updateIds );
if ( f )
- s->setFormat( 0, 1, f, TRUE );
+ s->setFormat( 0, 1, f, true );
s->copyParagData( string );
#if 0
if ( ind ) {
@@ -878,7 +878,7 @@ void KoTextCursor::splitAndInsertEmptyParag( bool ind, bool updateIds )
KoTextParag *p = string->prev();
KoTextParag *s = doc->createParag( doc, p, string, updateIds );
if ( f )
- s->setFormat( 0, 1, f, TRUE );
+ s->setFormat( 0, 1, f, true );
s->copyParagData( string );
if ( ind ) {
//s->indent();
@@ -892,10 +892,10 @@ void KoTextCursor::splitAndInsertEmptyParag( bool ind, bool updateIds )
KoTextParag *s = doc->createParag( doc, string, n, updateIds );
s->copyParagData( string );
s->remove( 0, 1 );
- s->append( str, TRUE );
+ s->append( str, true );
for ( uint i = 0; i < str.length(); ++i ) {
KoTextStringChar* tsc = string->at( idx + i );
- s->setFormat( i, 1, tsc->format(), TRUE );
+ s->setFormat( i, 1, tsc->format(), true );
if ( tsc->isCustom() ) {
KoTextCustomItem * item = tsc->customItem();
s->at( i )->setCustomItem( item );
@@ -932,17 +932,17 @@ bool KoTextCursor::removePreviousChar()
idx--;
// shouldn't be needed, just to make sure.
fixCursorPosition();
- string->format( -1, TRUE );
+ string->format( -1, true );
//else if ( string->document() && string->document()->parent() )
- // string->document()->nextDoubleBuffered = TRUE;
- return FALSE;
+ // string->document()->nextDoubleBuffered = true;
+ return false;
} else if ( string->prev() ) {
string = string->prev();
string->join( string->next() );
string->invalidateCounters();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool KoTextCursor::remove()
@@ -951,10 +951,10 @@ bool KoTextCursor::remove()
if ( !atParagEnd() ) {
int next = string->string()->nextCursorPosition( idx );
string->remove( idx, next-idx );
- string->format( -1, TRUE );
+ string->format( -1, true );
//else if ( doc && doc->parent() )
- // doc->nextDoubleBuffered = TRUE;
- return FALSE;
+ // doc->nextDoubleBuffered = true;
+ return false;
} else if ( string->next() ) {
if ( string->length() == 1 ) {
string->next()->setPrev( string->prev() );
@@ -971,17 +971,17 @@ bool KoTextCursor::remove()
while ( s ) {
s->id = s->p ? s->p->id + 1 : 0;
//s->state = -1;
- //s->needPreProcess = TRUE;
- s->changed = TRUE;
+ //s->needPreProcess = true;
+ s->changed = true;
s = s->n;
}
string->format();
} else {
string->join( string->next() );
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void KoTextCursor::killLine()
@@ -989,9 +989,9 @@ void KoTextCursor::killLine()
if ( atParagEnd() )
return;
string->remove( idx, string->length() - idx - 1 );
- string->format( -1, TRUE );
+ string->format( -1, true );
//else if ( doc && doc->parent() )
- //doc->nextDoubleBuffered = TRUE;
+ //doc->nextDoubleBuffered = true;
}
#if 0
@@ -1069,10 +1069,10 @@ void KoTextCursor::fixCursorPosition()
KoTextString::KoTextString()
{
- bidiDirty = TRUE;
+ bidiDirty = true;
bNeedsSpellCheck = true;
- bidi = FALSE;
- rightToLeft = FALSE;
+ bidi = false;
+ rightToLeft = false;
dir = TQChar::DirON;
}
@@ -1117,7 +1117,7 @@ void KoTextString::insert( int index, const TQString &s, KoTextFormat *f )
#endif
ch.setFormat( f );
}
- bidiDirty = TRUE;
+ bidiDirty = true;
bNeedsSpellCheck = true;
}
@@ -1145,7 +1145,7 @@ void KoTextString::insert( int index, KoTextStringChar *c )
ch.d.format = 0;
ch.type = KoTextStringChar::Regular;
ch.setFormat( c->format() );
- bidiDirty = TRUE;
+ bidiDirty = true;
bNeedsSpellCheck = true;
}
@@ -1168,7 +1168,7 @@ void KoTextString::truncate( int index )
}
}
data.truncate( index );
- bidiDirty = TRUE;
+ bidiDirty = true;
bNeedsSpellCheck = true;
}
@@ -1189,7 +1189,7 @@ void KoTextString::remove( int index, int len )
memmove( data.data() + index, data.data() + index + len,
sizeof( KoTextStringChar ) * ( data.size() - index - len ) );
data.resize( data.size() - len, TQGArray::SpeedOptim );
- bidiDirty = TRUE;
+ bidiDirty = true;
bNeedsSpellCheck = true;
}
@@ -1232,10 +1232,10 @@ void KoTextString::setFormat( int index, KoTextFormat *f, bool useCollection, bo
void KoTextString::checkBidi() const
{
KoTextString *that = (KoTextString *)this;
- that->bidiDirty = FALSE;
+ that->bidiDirty = false;
int length = data.size();
if ( !length ) {
- that->bidi = FALSE;
+ that->bidi = false;
that->rightToLeft = dir == TQChar::DirR;
return;
}
@@ -1251,7 +1251,7 @@ void KoTextString::checkBidi() const
TQScriptItem *item = &textEngine.items[textEngine.items.size()-1];
unsigned char bidiLevel = item->analysis.bidiLevel;
if ( bidiLevel )
- that->bidi = TRUE;
+ that->bidi = true;
int pos = length-1;
while ( ch >= start ) {
if ( item->position > pos ) {
@@ -1260,7 +1260,7 @@ void KoTextString::checkBidi() const
Q_ASSERT( item < &textEngine.items[textEngine.items.size()] );
bidiLevel = item->analysis.bidiLevel;
if ( bidiLevel )
- that->bidi = TRUE;
+ that->bidi = true;
}
ch->softBreak = ca->softBreak;
ch->whiteSpace = ca->whiteSpace;
@@ -1274,10 +1274,10 @@ void KoTextString::checkBidi() const
}
if ( dir == TQChar::DirR ) {
- that->bidi = TRUE;
- that->rightToLeft = TRUE;
+ that->bidi = true;
+ that->rightToLeft = true;
} else if ( dir == TQChar::DirL ) {
- that->rightToLeft = FALSE;
+ that->rightToLeft = false;
} else {
that->rightToLeft = (textEngine.direction == TQChar::DirR);
}
@@ -1476,7 +1476,7 @@ int KoTextStringChar::descent() const
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
KoTextFormatterBase::KoTextFormatterBase()
- : wrapColumn( -1 ), //wrapEnabled( TRUE ),
+ : wrapColumn( -1 ), //wrapEnabled( true ),
m_bViewFormattingChars( false ),
biw( true /*default in kotext*/ )
{
@@ -1533,7 +1533,7 @@ KoTextParagLineStart *KoTextFormatterBase::bidiReorderLine( KoTextParag * /*para
}
}
int toAdd = 0;
- bool first = TRUE;
+ bool first = true;
KoTextRun *r = runs->first();
int xmax = -0xffffff;
while ( r ) {
@@ -1548,13 +1548,13 @@ KoTextParagLineStart *KoTextFormatterBase::bidiReorderLine( KoTextParag * /*para
space -= s;
numSpaces--;
} else if ( first ) {
- first = FALSE;
+ first = false;
if ( c->c == ' ' )
x -= c->format()->width( ' ' );
}
c->x = x + toAdd;
- c->rightToLeft = TRUE;
- c->startOfRun = FALSE;
+ c->rightToLeft = true;
+ c->startOfRun = false;
int ww = 0;
if ( c->c.unicode() >= 32 || c->c == '\t' || c->c == '\n' || c->isCustom() ) {
ww = c->width;
@@ -1575,13 +1575,13 @@ KoTextParagLineStart *KoTextFormatterBase::bidiReorderLine( KoTextParag * /*para
space -= s;
numSpaces--;
} else if ( first ) {
- first = FALSE;
+ first = false;
if ( c->c == ' ' )
x -= c->format()->width( ' ' );
}
c->x = x + toAdd;
- c->rightToLeft = FALSE;
- c->startOfRun = FALSE;
+ c->rightToLeft = false;
+ c->startOfRun = false;
int ww = 0;
if ( c->c.unicode() >= 32 || c->c == '\t' || c->isCustom() ) {
ww = c->width;
@@ -1594,7 +1594,7 @@ KoTextParagLineStart *KoTextFormatterBase::bidiReorderLine( KoTextParag * /*para
pos++;
}
}
- text->at( r->start + start ).startOfRun = TRUE;
+ text->at( r->start + start ).startOfRun = true;
r = runs->next();
}
@@ -1617,7 +1617,7 @@ bool KoTextFormatterBase::isStretchable( KoTextString *string, int pos ) const
bool KoTextFormatterBase::isBreakable( KoTextString *string, int pos ) const
{
//if (string->at(pos).nobreak)
- // return FALSE;
+ // return false;
return (pos < string->length()-1 && string->at(pos+1).softBreak);
}
@@ -1662,12 +1662,12 @@ int KoTextFormatterBase::formatVertically( KoTextDocument* doc, KoTextParag* par
int delta = c->customItem()->height - h;
ls->h += delta;
if ( delta )
- parag->setMovedDown( TRUE );
+ parag->setMovedDown( true );
} else {
int shift = doc->flow()->adjustFlow( parag->rect().y() + ls->y, ls->w, ls->h );
ls->y += shift;
if ( shift )
- parag->setMovedDown( TRUE );
+ parag->setMovedDown( true );
}
h = ls->y + ls->h;
}
@@ -1696,8 +1696,8 @@ KoTextCustomItem::~KoTextCustomItem()
KoTextFlow::KoTextFlow()
{
w = 0;
- leftItems.setAutoDelete( FALSE );
- rightItems.setAutoDelete( FALSE );
+ leftItems.setAutoDelete( false );
+ rightItems.setAutoDelete( false );
}
KoTextFlow::~KoTextFlow()