diff options
Diffstat (limited to 'src/kernel/qrichtext.cpp')
-rw-r--r-- | src/kernel/qrichtext.cpp | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/src/kernel/qrichtext.cpp b/src/kernel/qrichtext.cpp index eb43f3c..71095a3 100644 --- a/src/kernel/qrichtext.cpp +++ b/src/kernel/qrichtext.cpp @@ -177,7 +177,7 @@ bool QTextCommandHistory::isUndoAvailable() bool QTextCommandHistory::isRedoAvailable() { - return current > -1 && current < (int)history.count() - 1 || current == -1 && history.count() > 0; + return ( current > -1 && current < (int)history.count() - 1 ) || ( current == -1 && history.count() > 0 ); } // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -2127,11 +2127,12 @@ void QTextDocument::setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheet stylesPar->utm = 0; } else { m = QMAX(0, item->margin( QStyleSheetItem::MarginTop ) ); - if ( stylesPar->ldepth ) + if ( stylesPar->ldepth ) { if ( item->displayMode() == QStyleSheetItem::DisplayListItem ) m /= stylesPar->ldepth * stylesPar->ldepth; else m = 0; + } } for ( i = (int)curStyle->size() - 2 ; i >= 0; --i ) { item = (*curStyle)[ i ]; @@ -2155,11 +2156,12 @@ void QTextDocument::setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheet stylesPar->ubm = 0; } else { m = QMAX(0, item->margin( QStyleSheetItem::MarginBottom ) ); - if ( stylesPar->ldepth ) + if ( stylesPar->ldepth ) { if ( item->displayMode() == QStyleSheetItem::DisplayListItem ) m /= stylesPar->ldepth * stylesPar->ldepth; else m = 0; + } } for ( i = (int)curStyle->size() - 2 ; i >= 0; --i ) { item = (*curStyle)[ i ]; @@ -2243,7 +2245,7 @@ void QTextDocument::setText( const QString &text, const QString &context ) { focusIndicator.parag = 0; selections.clear(); - if ( txtFormat == Qt::AutoText && QStyleSheet::mightBeRichText( text ) || + if ( ( txtFormat == Qt::AutoText && QStyleSheet::mightBeRichText( text ) ) || txtFormat == Qt::RichText ) setRichText( text, context ); else @@ -2459,7 +2461,7 @@ QString QTextDocument::richText() const QString QTextDocument::text() const { - if ( txtFormat == Qt::AutoText && preferRichText || txtFormat == Qt::RichText ) + if ( ( txtFormat == Qt::AutoText && preferRichText ) || txtFormat == Qt::RichText ) return richText(); return plainText(); } @@ -2470,7 +2472,7 @@ QString QTextDocument::text( int parag ) const if ( !p ) return QString::null; - if ( txtFormat == Qt::AutoText && preferRichText || txtFormat == Qt::RichText ) + if ( ( txtFormat == Qt::AutoText && preferRichText ) || txtFormat == Qt::RichText ) return p->richText(); else return p->string()->toString(); @@ -2609,12 +2611,12 @@ bool QTextDocument::setSelectionEnd( int id, const QTextCursor &cursor ) hadOldEnd = TRUE; if ( !sel.swapped && - ( hadEnd && !hadStart || - hadEnd && hadStart && start.paragraph() == end.paragraph() && start.index() > end.index() ) ) + ( ( hadEnd && !hadStart ) || + ( hadEnd && hadStart && start.paragraph() == end.paragraph() && start.index() > end.index() ) ) ) sel.swapped = TRUE; - if ( c == end && hadStartParag || - c == start && hadEndParag ) { + if ( ( c == end && hadStartParag ) || + ( c == start && hadEndParag ) ) { QTextCursor tmp = c; tmp.restoreState(); if ( tmp.paragraph() != c.paragraph() ) { @@ -2625,7 +2627,7 @@ bool QTextDocument::setSelectionEnd( int id, const QTextCursor &cursor ) } if ( inSelection && - ( c == end && hadStart || c == start && hadEnd ) ) + ( ( c == end && hadStart ) || ( c == start && hadEnd ) ) ) leftSelection = TRUE; else if ( !leftSelection && !inSelection && ( hadStart || hadEnd ) ) inSelection = TRUE; @@ -3253,7 +3255,7 @@ void QTextDocument::drawParagraph( QPainter *p, QTextParagraph *parag, int cx, i QTextParagraph *QTextDocument::draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, bool onlyChanged, bool drawCursor, QTextCursor *cursor, bool resetChanged ) { - if ( withoutDoubleBuffer || par && par->withoutDoubleBuffer ) { + if ( withoutDoubleBuffer || ( par && par->withoutDoubleBuffer ) ) { withoutDoubleBuffer = TRUE; QRect r; draw( p, r, cg ); @@ -4754,7 +4756,7 @@ void QTextParagraph::drawString( QPainter &painter, const QString &str, int star bool plainText = hasdoc ? document()->textFormat() == Qt::PlainText : FALSE; QTextFormat* format = formatChar->format(); - if ( !plainText || hasdoc && format->color() != document()->formatCollection()->defaultFormat()->color() ) + if ( !plainText || ( hasdoc && format->color() != document()->formatCollection()->defaultFormat()->color() ) ) painter.setPen( QPen( format->color() ) ); else painter.setPen( cg.text() ); @@ -4848,9 +4850,9 @@ void QTextParagraph::drawString( QPainter &painter, const QString &str, int star } if (selStart < real_selEnd || - selWrap && fullSelectionWidth && extendRight && + (selWrap && fullSelectionWidth && extendRight && // don't draw the standard selection on a printer= - (it.key() != QTextDocument::Standard || !is_printer( &painter))) { + (it.key() != QTextDocument::Standard || !is_printer( &painter)))) { int selection = it.key(); QColor color; setColorForSelection( color, painter, cg, selection ); @@ -4904,10 +4906,10 @@ void QTextParagraph::drawString( QPainter &painter, const QString &str, int star if ( hasdoc && formatChar->isAnchor() && !formatChar->anchorHref().isEmpty() && document()->focusIndicator.parag == this && - ( document()->focusIndicator.start >= start && - document()->focusIndicator.start + document()->focusIndicator.len <= start + len || - document()->focusIndicator.start <= start && - document()->focusIndicator.start + document()->focusIndicator.len >= start + len ) ) + ( ( document()->focusIndicator.start >= start && + document()->focusIndicator.start + document()->focusIndicator.len <= start + len ) || + ( document()->focusIndicator.start <= start && + document()->focusIndicator.start + document()->focusIndicator.len >= start + len ) ) ) painter.drawWinFocusRect( QRect( xstart, y, w, h ) ); } @@ -5652,8 +5654,8 @@ int QTextFormatterBreakInWords::format( QTextDocument *doc,QTextParagraph *parag #endif if ( wrapEnabled && - ( wrapAtColumn() == -1 && x + ww > w || - wrapAtColumn() != -1 && col >= wrapAtColumn() ) ) { + ( ( wrapAtColumn() == -1 && x + ww > w ) || + ( wrapAtColumn() != -1 && col >= wrapAtColumn() ) ) ) { x = doc ? parag->document()->flow()->adjustLMargin( y + parag->rect().y(), parag->rect().height(), left, 4 ) : left; w = dw; y += h; @@ -5798,7 +5800,7 @@ int QTextFormatterBreakWords::format( QTextDocument *doc, QTextParagraph *parag, x -= rb; } - if ( i > 0 && (x > curLeft || ww == 0) || lastWasNonInlineCustom ) { + if ( ( i > 0 && (x > curLeft || ww == 0) ) || lastWasNonInlineCustom ) { c->lineStart = 0; } else { c->lineStart = 1; @@ -7733,7 +7735,7 @@ void QTextTable::draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, } for (QTextTableCell* cell = cells.first(); cell; cell = cells.next() ) { - if ( cx < 0 && cy < 0 || + if ( ( cx < 0 && cy < 0 ) || QRect( cx, cy, cw, ch ).intersects( QRect( x + outerborder + cell->geometry().x(), y + outerborder + cell->geometry().y(), cell->geometry().width(), cell->geometry().height() ) ) ) { |