summaryrefslogtreecommitdiffstats
path: root/lib/kotext/KoTextDocument.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kotext/KoTextDocument.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kotext/KoTextDocument.cpp')
-rw-r--r--lib/kotext/KoTextDocument.cpp308
1 files changed, 154 insertions, 154 deletions
diff --git a/lib/kotext/KoTextDocument.cpp b/lib/kotext/KoTextDocument.cpp
index 4e0f7dc9..2eb2dd00 100644
--- a/lib/kotext/KoTextDocument.cpp
+++ b/lib/kotext/KoTextDocument.cpp
@@ -31,20 +31,20 @@
#include <KoDom.h>
#include <kdebug.h>
#include <kdeversion.h>
-#include <qapplication.h>
+#include <tqapplication.h>
#include <assert.h>
//#define DEBUG_PAINTING
//// Note that many methods are implemented in korichtext.cpp
-//// Those are the ones that come from Qt, and that mostly work :)
+//// Those are the ones that come from TQt, and that mostly work :)
KoTextDocument::KoTextDocument( KoTextZoomHandler *zoomHandler, KoTextFormatCollection *fc,
KoTextFormatter *formatter, bool createInitialParag )
: m_zoomHandler( zoomHandler ),
m_bDestroying( false ),
-#ifdef QTEXTTABLE_AVAILABLE
- par( 0L /*we don't use parent documents */ ),
+#ifdef TQTEXTTABLE_AVAILABLE
+ par( 0L /*we don't use tqparent documents */ ),
tc( 0 ),
#endif
tArray( 0 ), tStopWidth( 0 )
@@ -74,7 +74,7 @@ void KoTextDocument::init()
fParag = 0;
m_pageBreakEnabled = false;
//minw = 0;
- align = Qt::AlignAuto;
+ align = TQt::AlignAuto;
nSelections = 2;
underlLinks = TRUE;
@@ -98,10 +98,10 @@ void KoTextDocument::init()
flow_ = new KoTextFlow;
//flow_->setWidth( cw );
- leftmargin = 0; // 4 in QRT
- rightmargin = 0; // 4 in QRT
+ leftmargin = 0; // 4 in TQRT
+ rightmargin = 0; // 4 in TQRT
- selectionColors[ Standard ] = QApplication::palette().color( QPalette::Active, QColorGroup::Highlight );
+ selectionColors[ Standard ] = TQApplication::palette().color( TQPalette::Active, TQColorGroup::Highlight );
selectionText[ Standard ] = TRUE;
assert( Standard < nSelections );
selectionText[ InputMethodPreedit ] = FALSE;
@@ -154,13 +154,13 @@ int KoTextDocument::widthUsed() const
KoTextParag *p = fParag;
int w = 0;
while ( p ) {
- int a = p->alignment();
- p->setAlignment( Qt::AlignLeft );
- p->invalidate( 0 );
+ int a = p->tqalignment();
+ p->tqsetAlignment( TQt::AlignLeft );
+ p->tqinvalidate( 0 );
p->format();
- w = QMAX( w, p->rect().width() );
- p->setAlignment( a );
- p->invalidate( 0 );
+ w = TQMAX( w, p->rect().width() );
+ p->tqsetAlignment( a );
+ p->tqinvalidate( 0 );
p = p->next();
}
return w;
@@ -173,7 +173,7 @@ int KoTextDocument::height() const
if ( lParag )
h = lParag->rect().top() + lParag->rect().height() + 1;
//int fh = flow_->boundingRect().height();
- //return QMAX( h, fh );
+ //return TQMAX( h, fh );
return h;
}
@@ -183,7 +183,7 @@ KoTextParag *KoTextDocument::createParag( KoTextDocument *d, KoTextParag *pr, Ko
return new KoTextParag( d, pr, nx, updateIds );
}
-void KoTextDocument::setPlainText( const QString &text )
+void KoTextDocument::setPlainText( const TQString &text )
{
clear();
//preferRichText = FALSE;
@@ -191,12 +191,12 @@ void KoTextDocument::setPlainText( const QString &text )
//oText = text;
int lastNl = 0;
- int nl = text.find( '\n' );
+ int nl = text.tqfind( '\n' );
if ( nl == -1 ) {
lParag = createParag( this, lParag, 0 );
if ( !fParag )
fParag = lParag;
- QString s = text;
+ TQString s = text;
if ( !s.isEmpty() ) {
if ( s[ (int)s.length() - 1 ] == '\r' )
s.remove( s.length() - 1, 1 );
@@ -207,7 +207,7 @@ void KoTextDocument::setPlainText( const QString &text )
lParag = createParag( this, lParag, 0 );
if ( !fParag )
fParag = lParag;
- QString s = text.mid( lastNl, nl - lastNl );
+ TQString s = text.mid( lastNl, nl - lastNl );
if ( !s.isEmpty() ) {
if ( s[ (int)s.length() - 1 ] == '\r' )
s.remove( s.length() - 1, 1 );
@@ -216,7 +216,7 @@ void KoTextDocument::setPlainText( const QString &text )
if ( nl == 0xffffff )
break;
lastNl = nl + 1;
- nl = text.find( '\n', nl + 1 );
+ nl = text.tqfind( '\n', nl + 1 );
if ( nl == -1 )
nl = 0xffffff;
}
@@ -225,16 +225,16 @@ void KoTextDocument::setPlainText( const QString &text )
lParag = fParag = createParag( this, 0, 0 );
}
-void KoTextDocument::setText( const QString &text, const QString & /*context*/ )
+void KoTextDocument::setText( const TQString &text, const TQString & /*context*/ )
{
selections.clear();
setPlainText( text );
}
-QString KoTextDocument::plainText() const
+TQString KoTextDocument::plainText() const
{
- QString buffer;
- QString s;
+ TQString buffer;
+ TQString s;
KoTextParag *p = fParag;
while ( p ) {
s = p->string()->toString();
@@ -247,18 +247,18 @@ QString KoTextDocument::plainText() const
return buffer;
}
-void KoTextDocument::invalidate()
+void KoTextDocument::tqinvalidate()
{
KoTextParag *s = fParag;
while ( s ) {
- s->invalidate( 0 );
+ s->tqinvalidate( 0 );
s = s->next();
}
}
void KoTextDocument::informParagraphDeleted( KoTextParag* parag )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.begin();
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.begin();
for ( ; it != selections.end(); ++it )
{
if ( (*it).startCursor.parag() == parag ) {
@@ -283,7 +283,7 @@ void KoTextDocument::informParagraphDeleted( KoTextParag* parag )
void KoTextDocument::selectionStart( int id, int &paragId, int &index )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return;
KoTextDocumentSelection &sel = *it;
@@ -293,7 +293,7 @@ void KoTextDocument::selectionStart( int id, int &paragId, int &index )
KoTextCursor KoTextDocument::selectionStartCursor( int id)
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return KoTextCursor( this );
KoTextDocumentSelection &sel = *it;
@@ -304,7 +304,7 @@ KoTextCursor KoTextDocument::selectionStartCursor( int id)
KoTextCursor KoTextDocument::selectionEndCursor( int id)
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return KoTextCursor( this );
KoTextDocumentSelection &sel = *it;
@@ -315,7 +315,7 @@ KoTextCursor KoTextDocument::selectionEndCursor( int id)
void KoTextDocument::selectionEnd( int id, int &paragId, int &index )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return;
KoTextDocumentSelection &sel = *it;
@@ -325,7 +325,7 @@ void KoTextDocument::selectionEnd( int id, int &paragId, int &index )
bool KoTextDocument::isSelectionSwapped( int id )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return false;
KoTextDocumentSelection &sel = *it;
@@ -334,7 +334,7 @@ bool KoTextDocument::isSelectionSwapped( int id )
KoTextParag *KoTextDocument::selectionStart( int id )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return 0;
KoTextDocumentSelection &sel = *it;
@@ -345,7 +345,7 @@ KoTextParag *KoTextDocument::selectionStart( int id )
KoTextParag *KoTextDocument::selectionEnd( int id )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return 0;
KoTextDocumentSelection &sel = *it;
@@ -356,7 +356,7 @@ KoTextParag *KoTextDocument::selectionEnd( int id )
void KoTextDocument::addSelection( int id )
{
- nSelections = QMAX( nSelections, id + 1 );
+ nSelections = TQMAX( nSelections, id + 1 );
}
static void setSelectionEndHelper( int id, KoTextDocumentSelection &sel, KoTextCursor &start, KoTextCursor &end )
@@ -374,7 +374,7 @@ static void setSelectionEndHelper( int id, KoTextDocumentSelection &sel, KoTextC
c1.parag()->setSelection( id, c1.index(), c1.parag()->length() - 1 );
c2.parag()->setSelection( id, 0, c2.index() );
} else {
- c1.parag()->setSelection( id, QMIN( c1.index(), c2.index() ), QMAX( c1.index(), c2.index() ) );
+ c1.parag()->setSelection( id, TQMIN( c1.index(), c2.index() ), TQMAX( c1.index(), c2.index() ) );
}
sel.startCursor = start;
@@ -385,7 +385,7 @@ static void setSelectionEndHelper( int id, KoTextDocumentSelection &sel, KoTextC
bool KoTextDocument::setSelectionEnd( int id, KoTextCursor *cursor )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return FALSE;
KoTextDocumentSelection &sel = *it;
@@ -459,7 +459,7 @@ bool KoTextDocument::setSelectionEnd( int id, KoTextCursor *cursor )
c.parag()->removeSelection( id );
if ( inSelection ) {
if ( c.parag() == start.parag() && start.parag() == end.parag() ) {
- c.parag()->setSelection( id, QMIN( start.index(), end.index() ), QMAX( start.index(), end.index() ) );
+ c.parag()->setSelection( id, TQMIN( start.index(), end.index() ), TQMAX( start.index(), end.index() ) );
} else if ( c.parag() == start.parag() && !hadEndParag ) {
c.parag()->setSelection( id, start.index(), c.parag()->length() - 1 );
} else if ( c.parag() == end.parag() && !hadStartParag ) {
@@ -514,11 +514,11 @@ void KoTextDocument::selectAll( int id )
KoTextParag *p = fParag;
while ( p ) {
p->setSelection( id, 0, p->length() - 1 );
-#ifdef QTEXTTABLE_AVAILABLE
+#ifdef TQTEXTTABLE_AVAILABLE
for ( int i = 0; i < (int)p->length(); ++i ) {
if ( p->at( i )->isCustom() && p->at( i )->customItem()->isNested() ) {
KoTextTable *t = (KoTextTable*)p->at( i )->customItem();
- QPtrList<KoTextTableCell> tableCells = t->tableCells();
+ TQPtrList<KoTextTableCell> tableCells = t->tableCells();
for ( KoTextTableCell *c = tableCells.first(); c; c = tableCells.next() )
c->richText()->selectAll( id );
}
@@ -532,7 +532,7 @@ void KoTextDocument::selectAll( int id )
bool KoTextDocument::removeSelection( int id )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return FALSE;
@@ -581,12 +581,12 @@ bool KoTextDocument::removeSelection( int id )
return TRUE;
}
-QString KoTextDocument::selectedText( int id, bool withCustom ) const
+TQString KoTextDocument::selectedText( int id, bool withCustom ) const
{
// ######## TODO: look at textFormat() and return rich text or plain text (like the text() method!)
- QMap<int, KoTextDocumentSelection>::ConstIterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::ConstIterator it = selections.tqfind( id );
if ( it == selections.end() )
- return QString::null;
+ return TQString();
KoTextDocumentSelection sel = *it;
@@ -599,21 +599,21 @@ QString KoTextDocument::selectedText( int id, bool withCustom ) const
}
if ( c1.parag() == c2.parag() ) {
- QString s;
+ TQString s;
KoTextParag *p = c1.parag();
int end = c2.index();
- if ( p->at( QMAX( 0, end - 1 ) )->isCustom() )
+ if ( p->at( TQMAX( 0, end - 1 ) )->isCustom() )
++end;
if ( !withCustom || !p->customItems() ) {
s += p->string()->toString().mid( c1.index(), end - c1.index() );
} else {
for ( int i = c1.index(); i < end; ++i ) {
if ( p->at( i )->isCustom() ) {
-#ifdef QTEXTTABLE_AVAILABLE
+#ifdef TQTEXTTABLE_AVAILABLE
if ( p->at( i )->customItem()->isNested() ) {
s += "\n";
KoTextTable *t = (KoTextTable*)p->at( i )->customItem();
- QPtrList<KoTextTableCell> cells = t->tableCells();
+ TQPtrList<KoTextTableCell> cells = t->tableCells();
for ( KoTextTableCell *c = cells.first(); c; c = cells.next() )
s += c->richText()->plainText() + "\n";
s += "\n";
@@ -628,12 +628,12 @@ QString KoTextDocument::selectedText( int id, bool withCustom ) const
return s;
}
- QString s;
+ TQString s;
KoTextParag *p = c1.parag();
int start = c1.index();
while ( p ) {
int end = p == c2.parag() ? c2.index() : p->length() - 1;
- if ( p == c2.parag() && p->at( QMAX( 0, end - 1 ) )->isCustom() )
+ if ( p == c2.parag() && p->at( TQMAX( 0, end - 1 ) )->isCustom() )
++end;
if ( !withCustom || !p->customItems() ) {
s += p->string()->toString().mid( start, end - start );
@@ -642,11 +642,11 @@ QString KoTextDocument::selectedText( int id, bool withCustom ) const
} else {
for ( int i = start; i < end; ++i ) {
if ( p->at( i )->isCustom() ) {
-#ifdef QTEXTTABLE_AVAILABLE
+#ifdef TQTEXTTABLE_AVAILABLE
if ( p->at( i )->customItem()->isNested() ) {
s += "\n";
KoTextTable *t = (KoTextTable*)p->at( i )->customItem();
- QPtrList<KoTextTableCell> cells = t->tableCells();
+ TQPtrList<KoTextTableCell> cells = t->tableCells();
for ( KoTextTableCell *c = cells.first(); c; c = cells.next() )
s += c->richText()->plainText() + "\n";
s += "\n";
@@ -666,11 +666,11 @@ QString KoTextDocument::selectedText( int id, bool withCustom ) const
return s;
}
-QString KoTextDocument::copySelection( KoXmlWriter& writer, KoSavingContext& context, int selectionId )
+TQString KoTextDocument::copySelection( KoXmlWriter& writer, KoSavingContext& context, int selectionId )
{
KoTextCursor c1 = selectionStartCursor( selectionId );
KoTextCursor c2 = selectionEndCursor( selectionId );
- QString text;
+ TQString text;
if ( c1.parag() == c2.parag() )
{
text = c1.parag()->toString( c1.index(), c2.index() - c1.index() );
@@ -696,7 +696,7 @@ QString KoTextDocument::copySelection( KoXmlWriter& writer, KoSavingContext& con
void KoTextDocument::setFormat( int id, const KoTextFormat *f, int flags )
{
- QMap<int, KoTextDocumentSelection>::ConstIterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::ConstIterator it = selections.tqfind( id );
if ( it == selections.end() )
return;
@@ -725,17 +725,17 @@ void KoTextDocument::setFormat( int id, const KoTextFormat *f, int flags )
/*void KoTextDocument::copySelectedText( int id )
{
-#ifndef QT_NO_CLIPBOARD
+#ifndef TQT_NO_CLIPBOARD
if ( !hasSelection( id ) )
return;
- QApplication::clipboard()->setText( selectedText( id ) );
+ TQApplication::tqclipboard()->setText( selectedText( id ) );
#endif
}*/
void KoTextDocument::removeSelectedText( int id, KoTextCursor *cursor )
{
- QMap<int, KoTextDocumentSelection>::Iterator it = selections.find( id );
+ TQMap<int, KoTextDocumentSelection>::Iterator it = selections.tqfind( id );
if ( it == selections.end() )
return;
@@ -756,7 +756,7 @@ void KoTextDocument::removeSelectedText( int id, KoTextCursor *cursor )
return;
}
- // ## Qt has a strange setValid/isValid on QTextCursor, only used in the few lines below !?!?
+ // ## TQt has a strange setValid/isValid on TQTextCursor, only used in the few lines below !?!?
bool valid = true;
if ( c1.parag() == fParag && c1.index() == 0 &&
c2.parag() == lParag && c2.index() == lParag->length() - 1 )
@@ -785,9 +785,9 @@ void KoTextDocument::removeSelectedText( int id, KoTextCursor *cursor )
p->move( dy );
//// kotext
if ( p->paragLayout().counter )
- p->paragLayout().counter->invalidate();
+ p->paragLayout().counter->tqinvalidate();
////
- p->invalidate( 0 );
+ p->tqinvalidate( 0 );
//p->setEndState( -1 );
p = p->next();
}
@@ -813,7 +813,7 @@ KoTextCursor *KoTextDocument::redo( KoTextCursor *c )
return commandHistory->redo( c );
}
-bool KoTextDocument::find( const QString &expr, bool cs, bool wo, bool forward,
+bool KoTextDocument::tqfind( const TQString &expr, bool cs, bool wo, bool forward,
int *parag, int *index, KoTextCursor *cursor )
{
KoTextParag *p = forward ? fParag : lParag;
@@ -824,7 +824,7 @@ bool KoTextDocument::find( const QString &expr, bool cs, bool wo, bool forward,
bool first = TRUE;
while ( p ) {
- QString s = p->string()->toString();
+ TQString s = p->string()->toString();
s.remove( s.length() - 1, 1 ); // get rid of trailing space
int start = forward ? 0 : s.length() - 1;
if ( first && index )
@@ -842,7 +842,7 @@ bool KoTextDocument::find( const QString &expr, bool cs, bool wo, bool forward,
first = FALSE;
for ( ;; ) {
- int res = forward ? s.find( expr, start, cs ) : s.findRev( expr, start, cs );
+ int res = forward ? s.tqfind( expr, start, cs ) : s.tqfindRev( expr, start, cs );
if ( res == -1 )
break;
@@ -881,9 +881,9 @@ bool KoTextDocument::find( const QString &expr, bool cs, bool wo, bool forward,
return FALSE;
}
-bool KoTextDocument::inSelection( int selId, const QPoint &pos ) const
+bool KoTextDocument::inSelection( int selId, const TQPoint &pos ) const
{
- QMap<int, KoTextDocumentSelection>::ConstIterator it = selections.find( selId );
+ TQMap<int, KoTextDocumentSelection>::ConstIterator it = selections.tqfind( selId );
if ( it == selections.end() )
return FALSE;
@@ -900,7 +900,7 @@ bool KoTextDocument::inSelection( int selId, const QPoint &pos ) const
KoTextParag *p = startParag;
while ( p ) {
- if ( p->rect().contains( pos ) ) {
+ if ( p->rect().tqcontains( pos ) ) {
bool inSel = FALSE;
int selStart = p->selectionStart( selId );
int selEnd = p->selectionEnd( selId );
@@ -912,8 +912,8 @@ bool KoTextDocument::inSelection( int selId, const QPoint &pos ) const
if ( i == selEnd )
break;
if ( p->at( i )->lineStart ) {
- y = (*p->lineStarts.find( i ))->y;
- h = (*p->lineStarts.find( i ))->h;
+ y = (*p->lineStarts.tqfind( i ))->y;
+ h = (*p->lineStarts.tqfind( i ))->h;
}
if ( pos.y() - p->rect().y() >= y && pos.y() - p->rect().y() <= y + h ) {
if ( inSel && pos.x() >= p->at( i )->x &&
@@ -932,17 +932,17 @@ bool KoTextDocument::inSelection( int selId, const QPoint &pos ) const
return FALSE;
}
-QPixmap *KoTextDocument::bufferPixmap( const QSize &s )
+TQPixmap *KoTextDocument::bufferPixmap( const TQSize &s )
{
if ( !buf_pixmap ) {
- int w = QABS( s.width() );
- int h = QABS( s.height() );
- buf_pixmap = new QPixmap( w, h );
+ int w = TQABS( s.width() );
+ int h = TQABS( s.height() );
+ buf_pixmap = new TQPixmap( w, h );
} else {
if ( buf_pixmap->width() < s.width() ||
buf_pixmap->height() < s.height() ) {
- buf_pixmap->resize( QMAX( s.width(), buf_pixmap->width() ),
- QMAX( s.height(), buf_pixmap->height() ) );
+ buf_pixmap->resize( TQMAX( s.width(), buf_pixmap->width() ),
+ TQMAX( s.height(), buf_pixmap->height() ) );
}
}
@@ -989,7 +989,7 @@ bool KoTextDocument::visitSelection( int selectionId, KoParagVisitor* visitor, b
bool KoTextDocument::hasSelection( int id, bool visible ) const
{
- return ( selections.find( id ) != selections.end() &&
+ return ( selections.tqfind( id ) != selections.end() &&
( !visible ||
( (KoTextDocument*)this )->selectionStartCursor( id ) !=
( (KoTextDocument*)this )->selectionEndCursor( id ) ) );
@@ -1059,12 +1059,12 @@ bool KoTextDocument::visitFromTo( KoTextParag *firstParag, int firstIndex, KoTex
}
}
-static bool is_printer( QPainter *p )
+static bool is_printer( TQPainter *p )
{
- return p && p->device() && p->device()->devType() == QInternal::Printer;
+ return p && p->device() && p->device()->devType() == TQInternal::Printer;
}
-KoTextParag *KoTextDocument::drawWYSIWYG( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg,
+KoTextParag *KoTextDocument::drawWYSIWYG( TQPainter *p, int cx, int cy, int cw, int ch, const TQColorGroup &cg,
KoTextZoomHandler* zoomHandler, bool onlyChanged,
bool drawCursor, KoTextCursor *cursor,
bool resetChanged, uint drawingFlags )
@@ -1079,7 +1079,7 @@ KoTextParag *KoTextDocument::drawWYSIWYG( QPainter *p, int cx, int cy, int cw, i
// If someone understand doLayout() please tell me (David)
/*if ( isWithoutDoubleBuffer() || par && par->withoutDoubleBuffer ) { */
//setWithoutDoubleBuffer( TRUE );
- QRect crect( cx, cy, cw, ch );
+ TQRect crect( cx, cy, cw, ch );
drawWithoutDoubleBuffer( p, crect, cg, zoomHandler );
return 0;
}
@@ -1091,27 +1091,27 @@ KoTextParag *KoTextDocument::drawWYSIWYG( QPainter *p, int cx, int cy, int cw, i
KoTextParag *lastFormatted = 0;
KoTextParag *parag = firstParag();
- QPixmap *doubleBuffer = 0;
- QPainter painter;
+ TQPixmap *doubleBuffer = 0;
+ TQPainter painter;
// All the coordinates in this method are in view pixels
- QRect crect( cx, cy, cw, ch );
+ TQRect crect( cx, cy, cw, ch );
Q_ASSERT( ch > 0 );
#ifdef DEBUG_PAINTING
kdDebug(32500) << "\nKoTextDocument::drawWYSIWYG crect=" << crect << endl;
#endif
// Space above first parag
- QRect pixelRect = parag->pixelRect( zoomHandler );
+ TQRect pixelRect = parag->pixelRect( zoomHandler );
if ( isPageBreakEnabled() && parag && cy <= pixelRect.y() && pixelRect.y() > 0 ) {
- QRect r( 0, 0,
- zoomHandler->layoutUnitToPixelX( parag->document()->x() + parag->document()->width() ),
+ TQRect r( 0, 0,
+ zoomHandler->tqlayoutUnitToPixelX( parag->document()->x() + parag->document()->width() ),
pixelRect.y() );
r &= crect;
if ( !r.isEmpty() ) {
#ifdef DEBUG_PAINTING
kdDebug(32500) << " drawWYSIWYG: space above first parag: " << r << " (pixels)" << endl;
#endif
- p->fillRect( r, cg.brush( QColorGroup::Base ) );
+ p->fillRect( r, cg.brush( TQColorGroup::Base ) );
}
}
@@ -1120,7 +1120,7 @@ KoTextParag *KoTextDocument::drawWYSIWYG( QPainter *p, int cx, int cy, int cw, i
if ( !parag->isValid() )
parag->format();
- QRect ir = parag->pixelRect( zoomHandler );
+ TQRect ir = parag->pixelRect( zoomHandler );
#ifdef DEBUG_PAINTING
kdDebug(32500) << " drawWYSIWYG: ir=" << ir << endl;
#endif
@@ -1130,8 +1130,8 @@ KoTextParag *KoTextDocument::drawWYSIWYG( QPainter *p, int cx, int cy, int cw, i
// Test ir.y+ir.height, which is the first pixel _under_ the parag
// (as opposed ir.bottom() which is the last pixel of the parag)
if ( ir.y() + ir.height() < nexty ) {
- QRect r( 0, ir.y() + ir.height(),
- zoomHandler->layoutUnitToPixelX( parag->document()->x() + parag->document()->width() ),
+ TQRect r( 0, ir.y() + ir.height(),
+ zoomHandler->tqlayoutUnitToPixelX( parag->document()->x() + parag->document()->width() ),
nexty - ( ir.y() + ir.height() ) );
r &= crect;
if ( !r.isEmpty() )
@@ -1139,16 +1139,16 @@ KoTextParag *KoTextDocument::drawWYSIWYG( QPainter *p, int cx, int cy, int cw, i
#ifdef DEBUG_PAINTING
kdDebug(32500) << " drawWYSIWYG: space between parag " << parag->paragId() << " and " << parag->next()->paragId() << " : " << r << " (pixels)" << endl;
#endif
- p->fillRect( r, cg.brush( QColorGroup::Base ) );
+ p->fillRect( r, cg.brush( TQColorGroup::Base ) );
}
}
}
if ( !ir.intersects( crect ) ) {
// Paragraph is not in the crect - but let's check if the area on its right is.
- ir.setWidth( zoomHandler->layoutUnitToPixelX( parag->document()->width() ) );
+ ir.setWidth( zoomHandler->tqlayoutUnitToPixelX( parag->document()->width() ) );
if ( ir.intersects( crect ) && ( drawingFlags & TransparentBackground ) == 0 )
- p->fillRect( ir.intersect( crect ), cg.brush( QColorGroup::Base ) );
+ p->fillRect( ir.intersect( crect ), cg.brush( TQColorGroup::Base ) );
if ( ir.y() > cy + ch ) {
goto floating;
}
@@ -1169,17 +1169,17 @@ KoTextParag *KoTextDocument::drawWYSIWYG( QPainter *p, int cx, int cy, int cw, i
floating:
pixelRect = parag->pixelRect(zoomHandler);
- int docheight = zoomHandler->layoutUnitToPixelY( parag->document()->height() );
+ int docheight = zoomHandler->tqlayoutUnitToPixelY( parag->document()->height() );
if ( pixelRect.y() + pixelRect.height() < docheight ) {
- int docwidth = zoomHandler->layoutUnitToPixelX( parag->document()->width() );
+ int docwidth = zoomHandler->tqlayoutUnitToPixelX( parag->document()->width() );
if ( ( drawingFlags & TransparentBackground ) == 0 ) {
p->fillRect( 0, pixelRect.y() + pixelRect.height(),
docwidth, docheight - ( pixelRect.y() + pixelRect.height() ),
- cg.brush( QColorGroup::Base ) );
+ cg.brush( TQColorGroup::Base ) );
}
if ( !flow()->isEmpty() ) {
- QRect cr( cx, cy, cw, ch );
- cr = cr.intersect( QRect( 0, pixelRect.y() + pixelRect.height(), docwidth,
+ TQRect cr( cx, cy, cw, ch );
+ cr = cr.intersect( TQRect( 0, pixelRect.y() + pixelRect.height(), docwidth,
docheight - ( pixelRect.y() + pixelRect.height() ) ) );
flow()->drawFloatingItems( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, FALSE );
}
@@ -1195,8 +1195,8 @@ floating:
// Used for printing
-void KoTextDocument::drawWithoutDoubleBuffer( QPainter *p, const QRect &cr, const QColorGroup &cg,
- KoTextZoomHandler* zoomHandler, const QBrush *paper )
+void KoTextDocument::drawWithoutDoubleBuffer( TQPainter *p, const TQRect &cr, const TQColorGroup &cg,
+ KoTextZoomHandler* zoomHandler, const TQBrush *paper )
{
if ( !firstParag() )
return;
@@ -1214,11 +1214,11 @@ void KoTextDocument::drawWithoutDoubleBuffer( QPainter *p, const QRect &cr, cons
if ( !parag->isValid() )
parag->format();
- QRect pr( parag->pixelRect( zoomHandler ) );
+ TQRect pr( parag->pixelRect( zoomHandler ) );
pr.setLeft( 0 );
- pr.setWidth( QWIDGETSIZE_MAX );
- // The cliprect is checked in layout units, in KoTextParag::paint
- QRect crect_lu( parag->rect() );
+ pr.setWidth( TQWIDGETSIZE_MAX );
+ // The cliprect is checked in tqlayout units, in KoTextParag::paint
+ TQRect crect_lu( parag->rect() );
if ( !cr.isNull() && !cr.intersects( pr ) ) {
parag = parag->next();
@@ -1229,28 +1229,28 @@ void KoTextDocument::drawWithoutDoubleBuffer( QPainter *p, const QRect &cr, cons
// No need to brush plain white on a printer. Brush all
// other cases (except "full transparent" case).
- QBrush brush = cg.brush( QColorGroup::Base );;
- bool needBrush = brush.style() != Qt::NoBrush &&
- !(brush.style() == Qt::SolidPattern &&
- brush.color() == Qt::white &&
+ TQBrush brush = cg.brush( TQColorGroup::Base );;
+ bool needBrush = brush.style() != TQt::NoBrush &&
+ !(brush.style() == TQt::SolidPattern &&
+ brush.color() == TQt::white &&
is_printer(p));
if ( needBrush && ( m_drawingFlags & TransparentBackground ) == 0 )
- p->fillRect( QRect( 0, 0, pr.width(), pr.height() ), brush );
+ p->fillRect( TQRect( 0, 0, pr.width(), pr.height() ), brush );
- //p->setBrushOrigin( p->brushOrigin() + QPoint( 0, pr.y() ) );
+ //p->setBrushOrigin( p->brushOrigin() + TQPoint( 0, pr.y() ) );
parag->paint( *p, cg, 0, FALSE,
crect_lu.x(), crect_lu.y(),
crect_lu.width(), crect_lu.height() );
p->translate( 0, -pr.y() );
- //p->setBrushOrigin( p->brushOrigin() - QPoint( 0, pr.y() ) );
+ //p->setBrushOrigin( p->brushOrigin() - TQPoint( 0, pr.y() ) );
parag = parag->next();
}
}
// Used for screen display (and also printing?)
// Called by drawWYSIWYG and the app's drawCursor
-void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx, int cy, int cw, int ch,
- QPixmap *&doubleBuffer, const QColorGroup &cg,
+void KoTextDocument::drawParagWYSIWYG( TQPainter *p, KoTextParag *parag, int cx, int cy, int cw, int ch,
+ TQPixmap *&doubleBuffer, const TQColorGroup &cg,
KoTextZoomHandler* zoomHandler, bool drawCursor,
KoTextCursor *cursor, bool resetChanged, uint drawingFlags )
{
@@ -1259,45 +1259,45 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
kdDebug(32500) << "KoTextDocument::drawParagWYSIWYG " << (void*)parag << " id:" << parag->paragId() << endl;
#endif
m_drawingFlags = drawingFlags;
- QPainter *painter = 0;
+ TQPainter *painter = 0;
// Those three rects are in pixels, in the document coordinates (0,0 == topleft of first parag)
- QRect rect = parag->pixelRect( zoomHandler ); // the parag rect
+ TQRect rect = parag->pixelRect( zoomHandler ); // the parag rect
int offsetY = 0;
// Start painting from a given line number.
if ( parag->lineChanged() > -1 )
{
- offsetY = zoomHandler->layoutUnitToPixelY( parag->lineY( parag->lineChanged() ) - parag->topMargin() );
+ offsetY = zoomHandler->tqlayoutUnitToPixelY( parag->lineY( parag->lineChanged() ) - parag->topMargin() );
#ifdef DEBUG_PAINTING
kdDebug(32500) << " Repainting from lineChanged=" << parag->lineChanged() << " -> adding " << offsetY << " to rect" << endl;
#endif
- // Skip the lines that are not repainted by moving Top. The bottom doesn't change.
+ // Skip the lines that are not tqrepainted by moving Top. The bottom doesn't change.
rect.rTop() += offsetY;
}
- QRect crect( cx, cy, cw, ch ); // the overall crect
- QRect ir( rect ); // will be the rect to be repainted
+ TQRect crect( cx, cy, cw, ch ); // the overall crect
+ TQRect ir( rect ); // will be the rect to be tqrepainted
- QBrush brush = cg.brush( QColorGroup::Base );
+ TQBrush brush = cg.brush( TQColorGroup::Base );
// No need to brush plain white on a printer. Brush all
// other cases (except "full transparent" case).
- bool needBrush = brush.style() != Qt::NoBrush &&
+ bool needBrush = brush.style() != TQt::NoBrush &&
( drawingFlags & TransparentBackground ) == 0 &&
- !(brush.style() == Qt::SolidPattern &&
- brush.color() == Qt::white &&
+ !(brush.style() == TQt::SolidPattern &&
+ brush.color() == TQt::white &&
is_printer(p));
- bool useDoubleBuffer = !parag->document()->parent();
+ bool useDoubleBuffer = !parag->document()->tqparent();
if ( is_printer(p) )
useDoubleBuffer = FALSE;
// Can't handle transparency using double-buffering, in case of rotation/scaling (due to bitBlt)
// The test on mat is almost like isIdentity(), but allows for translation.
//// ##### The way to fix this: initialize the pixmap to be fully transparent instead
// of being white.
- QWMatrix mat = p->worldMatrix();
+ TQWMatrix mat = p->tqworldMatrix();
if ( ( mat.m11() != 1.0 || mat.m22() != 1.0 || mat.m12() != 0.0 || mat.m21() != 0.0 )
- && brush.style() != Qt::SolidPattern )
+ && brush.style() != TQt::SolidPattern )
useDoubleBuffer = FALSE;
#ifdef DEBUG_PAINTING
@@ -1308,7 +1308,7 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
#endif
if ( useDoubleBuffer ) {
- painter = new QPainter;
+ painter = new TQPainter;
if ( cx >= 0 && cy >= 0 )
ir = ir.intersect( crect );
if ( !doubleBuffer ||
@@ -1333,7 +1333,7 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
if ( useDoubleBuffer || is_printer( painter ) ) {
// Transparent -> grab background from p's device
- if ( brush.style() != Qt::SolidPattern ) {
+ if ( brush.style() != TQt::SolidPattern ) {
bitBlt( doubleBuffer, 0, 0, p->device(),
ir.x() + (int)p->translationX(), ir.y() + (int)p->translationY(),
ir.width(), ir.height() );
@@ -1341,7 +1341,7 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
}
if ( needBrush )
- painter->fillRect( QRect( 0, 0, ir.width(), ir.height() ), brush );
+ painter->fillRect( TQRect( 0, 0, ir.width(), ir.height() ), brush );
// Now revert the previous painter translation, and instead make (0,0) the topleft of the PARAGRAPH
painter->translate( rect.x() - ir.x(), rect.y() - ir.y() );
@@ -1350,8 +1350,8 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
#endif
//painter->setBrushOrigin( painter->brushOrigin() + rect.topLeft() - ir.topLeft() );
- // The cliprect is checked in layout units, in KoTextParag::paint
- QRect crect_lu( zoomHandler->pixelToLayoutUnit( crect ) );
+ // The cliprect is checked in tqlayout units, in KoTextParag::paint
+ TQRect crect_lu( zoomHandler->pixelToLayoutUnit( crect ) );
#ifdef DEBUG_PAINTING
kdDebug(32500) << "KoTextDocument::drawParagWYSIWYG crect_lu=" << crect_lu << endl;
#endif
@@ -1368,10 +1368,10 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
if ( useDoubleBuffer ) {
delete painter;
painter = 0;
- p->drawPixmap( ir.topLeft(), *doubleBuffer, QRect( QPoint( 0, 0 ), ir.size() ) );
+ p->drawPixmap( ir.topLeft(), *doubleBuffer, TQRect( TQPoint( 0, 0 ), ir.size() ) );
#if 0 // for debug!
p->save();
- p->setPen( Qt::blue );
+ p->setPen( TQt::blue );
p->drawRect( ir.x(), ir.y(), ir.width(), ir.height() );
p->restore();
#endif
@@ -1384,7 +1384,7 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
}
if ( needBrush ) {
- int docright = zoomHandler->layoutUnitToPixelX( parag->document()->x() + parag->document()->width() );
+ int docright = zoomHandler->tqlayoutUnitToPixelX( parag->document()->x() + parag->document()->width() );
#ifdef DEBUG_PAINTING
// kdDebug(32500) << "KoTextDocument::drawParagWYSIWYG my rect is: " << rect << endl;
#endif
@@ -1394,7 +1394,7 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
#endif
p->fillRect( rect.x() + rect.width(), rect.y(),
docright - ( rect.x() + rect.width() ),
- rect.height(), cg.brush( QColorGroup::Base ) );
+ rect.height(), cg.brush( TQColorGroup::Base ) );
}
}
@@ -1403,19 +1403,19 @@ void KoTextDocument::drawParagWYSIWYG( QPainter *p, KoTextParag *parag, int cx,
}
-KoTextDocCommand *KoTextDocument::deleteTextCommand( KoTextDocument *textdoc, int id, int index, const QMemArray<KoTextStringChar> & str, const CustomItemsMap & customItemsMap, const QValueList<KoParagLayout> & oldParagLayouts )
+KoTextDocCommand *KoTextDocument::deleteTextCommand( KoTextDocument *textdoc, int id, int index, const TQMemArray<KoTextStringChar> & str, const CustomItemsMap & customItemsMap, const TQValueList<KoParagLayout> & oldParagLayouts )
{
return new KoTextDeleteCommand( textdoc, id, index, str, customItemsMap, oldParagLayouts );
}
-KoTextParag* KoTextDocument::loadOasisText( const QDomElement& bodyElem, KoOasisContext& context, KoTextParag* lastParagraph, KoStyleCollection* styleColl, KoTextParag* nextParagraph )
+KoTextParag* KoTextDocument::loadOasisText( const TQDomElement& bodyElem, KoOasisContext& context, KoTextParag* lastParagraph, KoStyleCollection* styleColl, KoTextParag* nextParagraph )
{
// was OoWriterImport::parseBodyOrSimilar
- QDomElement tag;
+ TQDomElement tag;
forEachElement( tag, bodyElem )
{
context.styleStack().save();
- const QString localName = tag.localName();
+ const TQString localName = tag.localName();
const bool isTextNS = tag.namespaceURI() == KoXmlNS::text;
uint pos = 0;
if ( isTextNS && localName == "p" ) { // text paragraph
@@ -1431,7 +1431,7 @@ KoTextParag* KoTextDocument::loadOasisText( const QDomElement& bodyElem, KoOasis
{
//kdDebug(32500) << " heading " << endl;
context.fillStyleStack( tag, KoXmlNS::text, "style-name", "paragraph" );
- int level = tag.attributeNS( KoXmlNS::text, "outline-level", QString::null ).toInt();
+ int level = tag.attributeNS( KoXmlNS::text, "outline-level", TQString() ).toInt();
bool listOK = false;
// When a heading is inside a list, it seems that the list prevails.
// Example:
@@ -1447,7 +1447,7 @@ KoTextParag* KoTextDocument::loadOasisText( const QDomElement& bodyElem, KoOasis
int restartNumbering = -1;
if ( tag.hasAttributeNS( KoXmlNS::text, "start-value" ) )
// OASIS extension http://lists.oasis-open.org/archives/office/200310/msg00033.html
- restartNumbering = tag.attributeNS( KoXmlNS::text, "start-value", QString::null ).toInt();
+ restartNumbering = tag.attributeNS( KoXmlNS::text, "start-value", TQString() ).toInt();
KoTextParag *parag = createParag( this, lastParagraph, nextParagraph );
parag->loadOasis( tag, context, styleColl, pos );
@@ -1478,13 +1478,13 @@ KoTextParag* KoTextDocument::loadOasisText( const QDomElement& bodyElem, KoOasis
}
else if ( isTextNS && localName == "user-field-decls" )
{
- QDomElement fd;
+ TQDomElement fd;
forEachElement( fd, tag )
{
if ( fd.namespaceURI() == KoXmlNS::text && fd.localName() == "user-field-decl" )
{
- const QString name = fd.attributeNS( KoXmlNS::text, "name", QString::null );
- const QString value = fd.attributeNS( KoXmlNS::office, "value", QString::null );
+ const TQString name = fd.attributeNS( KoXmlNS::text, "name", TQString() );
+ const TQString value = fd.attributeNS( KoXmlNS::office, "value", TQString() );
if ( !name.isEmpty() )
context.variableCollection().setVariableValue( name, value );
}
@@ -1507,13 +1507,13 @@ KoTextParag* KoTextDocument::loadOasisText( const QDomElement& bodyElem, KoOasis
return lastParagraph;
}
-KoTextParag* KoTextDocument::loadList( const QDomElement& list, KoOasisContext& context, KoTextParag* lastParagraph, KoStyleCollection * styleColl, KoTextParag* nextParagraph )
+KoTextParag* KoTextDocument::loadList( const TQDomElement& list, KoOasisContext& context, KoTextParag* lastParagraph, KoStyleCollection * styleColl, KoTextParag* nextParagraph )
{
- //kdDebug(32500) << "loadList: " << list.attributeNS( KoXmlNS::text, "style-name", QString::null ) << endl;
+ //kdDebug(32500) << "loadList: " << list.attributeNS( KoXmlNS::text, "style-name", TQString() ) << endl;
- const QString oldListStyleName = context.currentListStyleName();
+ const TQString oldListStyleName = context.currentListStyleName();
if ( list.hasAttributeNS( KoXmlNS::text, "style-name" ) )
- context.setCurrentListStyleName( list.attributeNS( KoXmlNS::text, "style-name", QString::null ) );
+ context.setCurrentListStyleName( list.attributeNS( KoXmlNS::text, "style-name", TQString() ) );
bool listOK = !context.currentListStyleName().isEmpty();
int level;
if ( list.localName() == "numbered-paragraph" )
@@ -1523,7 +1523,7 @@ KoTextParag* KoTextDocument::loadList( const QDomElement& list, KoOasisContext&
if ( listOK )
listOK = context.pushListLevelStyle( context.currentListStyleName(), level );
- const QDomElement listStyle = context.listStyleStack().currentListStyle();
+ const TQDomElement listStyle = context.listStyleStack().currentListStyle();
// The tag is either list-level-style-number or list-level-style-bullet
const bool orderedList = listStyle.localName() == "list-level-style-number";
@@ -1532,7 +1532,7 @@ KoTextParag* KoTextDocument::loadList( const QDomElement& list, KoOasisContext&
// A numbered-paragraph contains paragraphs directly (it's both a list and a list-item)
int restartNumbering = -1;
if ( list.hasAttributeNS( KoXmlNS::text, "start-value" ) )
- restartNumbering = list.attributeNS( KoXmlNS::text, "start-value", QString::null ).toInt();
+ restartNumbering = list.attributeNS( KoXmlNS::text, "start-value", TQString() ).toInt();
KoTextParag* oldLast = lastParagraph;
lastParagraph = loadOasisText( list, context, lastParagraph, styleColl, nextParagraph );
KoTextParag* firstListItem = oldLast ? oldLast->next() : firstParag();
@@ -1545,13 +1545,13 @@ KoTextParag* KoTextDocument::loadList( const QDomElement& list, KoOasisContext&
else
{
// Iterate over list items
- for ( QDomNode n = list.firstChild(); !n.isNull(); n = n.nextSibling() )
+ for ( TQDomNode n = list.firstChild(); !n.isNull(); n = n.nextSibling() )
{
- QDomElement listItem = n.toElement();
+ TQDomElement listItem = n.toElement();
int restartNumbering = -1;
if ( listItem.hasAttributeNS( KoXmlNS::text, "start-value" ) )
- restartNumbering = listItem.attributeNS( KoXmlNS::text, "start-value", QString::null ).toInt();
- bool isListHeader = listItem.localName() == "list-header" || listItem.attributeNS( KoXmlNS::text, "is-list-header", QString::null ) == "is-list-header";
+ restartNumbering = listItem.attributeNS( KoXmlNS::text, "start-value", TQString() ).toInt();
+ bool isListHeader = listItem.localName() == "list-header" || listItem.attributeNS( KoXmlNS::text, "is-list-header", TQString() ) == "is-list-header";
KoTextParag* oldLast = lastParagraph;
lastParagraph = loadOasisText( listItem, context, lastParagraph, styleColl, nextParagraph );
KoTextParag* firstListItem = oldLast ? oldLast->next() : firstParag();