diff options
Diffstat (limited to 'lib/kotext/KoTextParag.cpp')
-rw-r--r-- | lib/kotext/KoTextParag.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/lib/kotext/KoTextParag.cpp b/lib/kotext/KoTextParag.cpp index 8f948596..f516b7ca 100644 --- a/lib/kotext/KoTextParag.cpp +++ b/lib/kotext/KoTextParag.cpp @@ -254,7 +254,7 @@ void KoTextParag::join( KoTextParag *s ) delete s; tqinvalidate( 0 ); //// kotext - tqinvalidateCounters(); + invalidateCounters(); //// r.setHeight( oh ); //needPreProcess = TRUE; @@ -693,7 +693,7 @@ void KoTextParag::setDirection( TQChar::Direction d ) tqinvalidate( 0 ); //// kotext m_layout.direction = d; - tqinvalidateCounters(); // #47178 + invalidateCounters(); // #47178 //// } } @@ -1012,7 +1012,7 @@ void KoTextParag::setNoCounter() { delete m_layout.counter; m_layout.counter = 0L; - tqinvalidateCounters(); + invalidateCounters(); } void KoTextParag::setCounter( const KoParagCounter * pCounter ) @@ -1028,7 +1028,7 @@ void KoTextParag::setCounter( const KoParagCounter * pCounter ) m_layout.counter->setStyle( KoParagCounter::STYLE_NONE ); // no number after the 'prefix' m_layout.counter->setPrefix( footNotePrefix ); m_layout.counter->setSuffix( TQString() ); - tqinvalidateCounters(); + invalidateCounters(); } else { if ( pCounter ) setCounter( *pCounter ); @@ -1052,11 +1052,11 @@ void KoTextParag::setCounter( const KoParagCounter & counter ) m_layout.counter = new KoParagCounter( counter ); // Invalidate the counters - tqinvalidateCounters(); + invalidateCounters(); } } -void KoTextParag::tqinvalidateCounters() +void KoTextParag::invalidateCounters() { // Invalidate this paragraph and all the following ones // (Numbering may have changed) @@ -1065,7 +1065,7 @@ void KoTextParag::tqinvalidateCounters() m_layout.counter->tqinvalidate(); KoTextParag *s = next(); // #### Possible optimization: since any invalidation propagates down, - // it's enough to stop at the first paragraph with an already-tqinvalidated counter, isn't it? + // it's enough to stop at the first paragraph with an already-invalidated counter, isn't it? // This is only true if nobody else calls counter->tqinvalidate... while ( s ) { if ( s->m_layout.counter ) @@ -1117,12 +1117,12 @@ void KoTextParag::drawLabel( TQPainter* p, int xLU, int yLU, int /*wLU*/, int /* //bool forPrint = ( p->device()->devType() == TQInternal::Printer ); bool rtl = str->isRightToLeft(); // when true, we put suffix+counter+prefix at the RIGHT of the paragraph. - int xLeft = zh->tqlayoutUnitToPixelX( xLU - (rtl ? 0 : counterWidthLU) ); - int y = zh->tqlayoutUnitToPixelY( yLU ); - //int h = zh->tqlayoutUnitToPixelY( yLU, hLU ); - int base = zh->tqlayoutUnitToPixelY( yLU, baseLU ); - int counterWidth = zh->tqlayoutUnitToPixelX( xLU, counterWidthLU ); - int height = zh->tqlayoutUnitToPixelY( yLU, format->height() ); + int xLeft = zh->layoutUnitToPixelX( xLU - (rtl ? 0 : counterWidthLU) ); + int y = zh->layoutUnitToPixelY( yLU ); + //int h = zh->layoutUnitToPixelY( yLU, hLU ); + int base = zh->layoutUnitToPixelY( yLU, baseLU ); + int counterWidth = zh->layoutUnitToPixelX( xLU, counterWidthLU ); + int height = zh->layoutUnitToPixelY( yLU, format->height() ); TQFont font( format->screenFont( zh ) ); // Footnote numbers are in superscript (in WP and Word, not in OO) @@ -1137,11 +1137,11 @@ void KoTextParag::drawLabel( TQPainter* p, int xLU, int yLU, int /*wLU*/, int /* // Now draw any bullet that is required over the space left for it. if ( m_layout.counter->isBullet() ) { - int xBullet = xLeft + zh->tqlayoutUnitToPixelX( m_layout.counter->bulletX() ); + int xBullet = xLeft + zh->layoutUnitToPixelX( m_layout.counter->bulletX() ); //kdDebug(32500) << "KoTextParag::drawLabel xLU=" << xLU << " counterWidthLU=" << counterWidthLU << endl; // The width and height of the bullet is the width of one space - int width = zh->tqlayoutUnitToPixelX( xLeft, format->width( ' ' ) ); + int width = zh->layoutUnitToPixelX( xLeft, format->width( ' ' ) ); //kdDebug(32500) << "Pix: xLeft=" << xLeft << " counterWidth=" << counterWidth // << " xBullet=" << xBullet << " width=" << width << endl; @@ -1387,14 +1387,14 @@ int KoTextParag::calculateLineSpacing( int line, int startChar, int lastChar ) c TQRect KoTextParag::pixelRect( KoTextZoomHandler *zh ) const { - TQRect rct( zh->tqlayoutUnitToPixel( rect() ) ); + TQRect rct( zh->layoutUnitToPixel( rect() ) ); //kdDebug(32500) << " pixelRect for parag " << paragId() // << ": rect=" << rect() << " pixelRect=" << rct << endl; // After division we almost always end up with the top overwriting the bottom of the parag above if ( prev() ) { - TQRect prevRect( zh->tqlayoutUnitToPixel( prev()->rect() ) ); + TQRect prevRect( zh->layoutUnitToPixel( prev()->rect() ) ); if ( rct.top() < prevRect.bottom() + 1 ) { //kdDebug(32500) << " pixelRect: rct.top() adjusted to " << prevRect.bottom() + 1 << " (was " << rct.top() << ")" << endl; @@ -1411,7 +1411,7 @@ void KoTextParag::paint( TQPainter &painter, const TQColorGroup &cg, KoTextCurso { #ifdef DEBUG_PAINT kdDebug(32500) << "KoTextParag::paint ===== id=" << paragId() << " clipx=" << clipx << " clipy=" << clipy << " clipw=" << clipw << " cliph=" << cliph << endl; - kdDebug(32500) << " clipw in pix (approx) : " << textDocument()->paintingZoomHandler()->tqlayoutUnitToPixelX( clipw ) << " cliph in pix (approx) : " << textDocument()->paintingZoomHandler()->tqlayoutUnitToPixelX( cliph ) << endl; + kdDebug(32500) << " clipw in pix (approx) : " << textDocument()->paintingZoomHandler()->layoutUnitToPixelX( clipw ) << " cliph in pix (approx) : " << textDocument()->paintingZoomHandler()->layoutUnitToPixelX( cliph ) << endl; #endif KoTextZoomHandler * zh = textDocument()->paintingZoomHandler(); @@ -1420,13 +1420,13 @@ void KoTextParag::paint( TQPainter &painter, const TQColorGroup &cg, KoTextCurso TQRect paraRect = pixelRect( zh ); // Find left margin size, first line offset and right margin in pixels - int leftMarginPix = zh->tqlayoutUnitToPixelX( leftMargin() ); - int firstLineOffset = zh->tqlayoutUnitToPixelX( firstLineMargin() ); + int leftMarginPix = zh->layoutUnitToPixelX( leftMargin() ); + int firstLineOffset = zh->layoutUnitToPixelX( firstLineMargin() ); // The furthest left and right x-coords of the paragraph, // including the bullet/counter, but not the borders. int leftExtent = TQMIN ( leftMarginPix, leftMarginPix + firstLineOffset ); - int rightExtent = paraRect.width() - zh->tqlayoutUnitToPixelX( rightMargin() ); + int rightExtent = paraRect.width() - zh->layoutUnitToPixelX( rightMargin() ); // Draw the paragraph background color if ( backgroundColor().isValid() ) @@ -1470,7 +1470,7 @@ void KoTextParag::paint( TQPainter &painter, const TQColorGroup &cg, KoTextCurso TQRect r; r.setLeft( leftExtent ); r.setRight( rightExtent ); - r.setTop( zh->tqlayoutUnitToPixelY(lineY( 0 )) ); + r.setTop( zh->layoutUnitToPixelY(lineY( 0 )) ); int lastLine = lines() - 1; // We need to start from the pixelRect, to make sure the bottom border is entirely painted. @@ -1479,13 +1479,13 @@ void KoTextParag::paint( TQPainter &painter, const TQColorGroup &cg, KoTextCurso // If we don't have a bottom border, we need go as low as possible ( to touch the next parag's border ). // If we have a bottom border, then we rather exclude the linespacing. Looks nicer. OO does that too. if ( m_layout.bottomBorder.width() > 0 && drawBottomBorder) - paragBottom -= zh->tqlayoutUnitToPixelY( lineSpacing( lastLine ) ); + paragBottom -= zh->layoutUnitToPixelY( lineSpacing( lastLine ) ); paragBottom -= KoBorder::zoomWidthY( m_layout.bottomBorder.width(), zh, 0 ); //kdDebug(32500) << "Parag border: paragBottom=" << paragBottom // << " bottom border width = " << KoBorder::zoomWidthY( m_layout.bottomBorder.width(), zh, 0 ) << endl; r.setBottom( paragBottom ); - //kdDebug(32500) << "KoTextParag::paint documentWidth=" << documentWidth() << " LU (" << zh->tqlayoutUnitToPixelX(documentWidth()) << " pixels) bordersRect=" << r << endl; + //kdDebug(32500) << "KoTextParag::paint documentWidth=" << documentWidth() << " LU (" << zh->layoutUnitToPixelX(documentWidth()) << " pixels) bordersRect=" << r << endl; KoBorder::drawBorders( painter, zh, r, m_layout.leftBorder, m_layout.rightBorder, m_layout.topBorder, m_layout.bottomBorder, 0, TQPen(), drawTopBorder, drawBottomBorder ); @@ -1696,19 +1696,19 @@ void KoTextParag::drawParagString( TQPainter &painter, const TQString &str, int // Calculate offset (e.g. due to shadow on left or top) // Important: don't use the 2-args methods here, offsets are not heights // (0 should be 0, not 1) (#63256) - int shadowOffsetX_pix = zh->tqlayoutUnitToPixelX( format->offsetX() ); - int shadowOffsetY_pix = zh->tqlayoutUnitToPixelY( format->offsetY() ); + int shadowOffsetX_pix = zh->layoutUnitToPixelX( format->offsetX() ); + int shadowOffsetY_pix = zh->layoutUnitToPixelY( format->offsetY() ); // Calculate startX in pixels - int startX_pix = zh->tqlayoutUnitToPixelX( startX ) /* + at( rightToLeft ? start+len-1 : start )->pixelxadj */; + int startX_pix = zh->layoutUnitToPixelX( startX ) /* + at( rightToLeft ? start+len-1 : start )->pixelxadj */; #ifdef DEBUG_PAINT kdDebug(32500) << "KoTextParag::drawParagString startX in pixels : " << startX_pix /*<< " adjustment:" << at( rightToLeft ? start+len-1 : start )->pixelxadj*/ << " bw=" << bw << endl; #endif - int bw_pix = zh->tqlayoutUnitToPixelX( startX, bw ); - int lastY_pix = zh->tqlayoutUnitToPixelY( lastY ); - int baseLine_pix = zh->tqlayoutUnitToPixelY( lastY, baseLine ); // 2 args=>+1. Is that correct? - int h_pix = zh->tqlayoutUnitToPixelY( lastY, h ); + int bw_pix = zh->layoutUnitToPixelX( startX, bw ); + int lastY_pix = zh->layoutUnitToPixelY( lastY ); + int baseLine_pix = zh->layoutUnitToPixelY( lastY, baseLine ); // 2 args=>+1. Is that correct? + int h_pix = zh->layoutUnitToPixelY( lastY, h ); #ifdef DEBUG_PAINT kdDebug(32500) << "KoTextParag::drawParagString h(LU)=" << h << " lastY(LU)=" << lastY << " h(PIX)=" << h_pix << " lastY(PIX)=" << lastY_pix @@ -1772,7 +1772,7 @@ void KoTextParag::drawParagString( TQPainter &painter, const TQString &str, int if ( draw_len > 0 ) { - int draw_startX_pix = zh->tqlayoutUnitToPixelX( draw_startX ) /* + at( rightToLeft ? start+draw_len-1 : start )->pixelxadj*/; + int draw_startX_pix = zh->layoutUnitToPixelX( draw_startX ) /* + at( rightToLeft ? start+draw_len-1 : start )->pixelxadj*/; draw_startX_pix += shadowOffsetX_pix; lastY_pix += shadowOffsetY_pix; @@ -2028,11 +2028,11 @@ bool KoTextParag::lineHyphenated( int l ) const void KoTextParag::drawCursor( TQPainter &painter, KoTextCursor *cursor, int curx, int cury, int curh, const TQColorGroup &cg ) { KoTextZoomHandler * zh = textDocument()->paintingZoomHandler(); - int x = zh->tqlayoutUnitToPixelX( curx ) /*+ cursor->parag()->at( cursor->index() )->pixelxadj*/; - //kdDebug(32500) << " drawCursor: LU: [cur]x=" << curx << ", cury=" << cury << " -> PIX: x=" << x << ", y=" << zh->tqlayoutUnitToPixelY( cury ) << endl; + int x = zh->layoutUnitToPixelX( curx ) /*+ cursor->parag()->at( cursor->index() )->pixelxadj*/; + //kdDebug(32500) << " drawCursor: LU: [cur]x=" << curx << ", cury=" << cury << " -> PIX: x=" << x << ", y=" << zh->layoutUnitToPixelY( cury ) << endl; KoTextParag::drawCursorDefault( painter, cursor, x, - zh->tqlayoutUnitToPixelY( cury ), - zh->tqlayoutUnitToPixelY( cury, curh ), cg ); + zh->layoutUnitToPixelY( cury ), + zh->layoutUnitToPixelY( cury, curh ), cg ); } // Reimplemented from KoTextParag @@ -2407,7 +2407,7 @@ void KoTextParag::printRTDebug( int info ) for ( int i = 0 ; i < s->length() ; ++i ) { KoTextStringChar & ch = s->at(i); - int pixelx = textDocument()->formattingZoomHandler()->tqlayoutUnitToPixelX( ch.x ) + int pixelx = textDocument()->formattingZoomHandler()->layoutUnitToPixelX( ch.x ) + ch.pixelxadj; if ( ch.lineStart ) kdDebug(32500) << "LINESTART" << endl; @@ -2916,11 +2916,11 @@ void KoTextParag::saveOasis( KoXmlWriter& writer, KoSavingContext& context, KoGenStyles& mainStyles = context.mainStyles(); // Write paragtqlayout to styles (with tqparent == the parag's style) - TQString tqparentStyleName; + TQString parentStyleName; if ( m_layout.style ) - tqparentStyleName = m_layout.style->name(); + parentStyleName = m_layout.style->name(); - KoGenStyle autoStyle( KoGenStyle::STYLE_AUTO, "paragraph", tqparentStyleName ); + KoGenStyle autoStyle( KoGenStyle::STYLE_AUTO, "paragraph", parentStyleName ); paragFormat()->save( autoStyle, context ); m_layout.saveOasis( autoStyle, context, false ); @@ -3116,7 +3116,7 @@ void KoTextParag::applyListStyle( KoOasisContext& context, int restartNumbering, double spaceBefore = KoUnit::parseValue( listStyleProperties.attributeNS( KoXmlNS::text, "space-before", TQString() ) ); m_layout.margins[ TQStyleSheetItem::MarginLeft ] += spaceBefore; // added to left-margin, see 15.12 in spec. } - // need to call tqinvalidateCounters() ? Not during the initial loading at least. + // need to call invalidateCounters() ? Not during the initial loading at least. } int KoTextParag::documentWidth() const @@ -3177,9 +3177,9 @@ void KoTextParag::drawFormattingChars( TQPainter &painter, int start, int len, //kdDebug() << "startX=" << startX << " bw=" << bw << " w=" << w << endl; int x; if ( rightToLeft ) - x = zh->tqlayoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + ch.pixelwidth - 1; + x = zh->layoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + ch.pixelwidth - 1; else - x = zh->tqlayoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + w; + x = zh->layoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + w; int y = lastY_pix + baseLine_pix; //kdDebug() << "KWTextParag::drawFormattingChars drawing CR at " << x << "," << y << endl; painter.drawLine( (int)(x - size * 0.2), y - size, (int)(x - size * 0.2), y ); @@ -3189,7 +3189,7 @@ void KoTextParag::drawFormattingChars( TQPainter &painter, int start, int len, painter.drawArc( x - size, y - size, size, (int)(size / 2), -90*16, -180*16 ); #ifdef DEBUG_FORMATTING painter.setPen( TQt::blue ); - painter.drawRect( zh->tqlayoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ - 1, lastY_pix, ch.pixelwidth, baseLine_pix ); + painter.drawRect( zh->layoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ - 1, lastY_pix, ch.pixelwidth, baseLine_pix ); TQPen pen( cg.color( TQColorGroup::Highlight ) ); painter.setPen( pen ); #endif @@ -3206,7 +3206,7 @@ void KoTextParag::drawFormattingChars( TQPainter &painter, int start, int len, KoTextStringChar &ch = str->at(i); #ifdef DEBUG_FORMATTING painter.setPen( (i % 2)? TQt::red: TQt::green ); - painter.drawRect( zh->tqlayoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ - 1, lastY_pix, ch.pixelwidth, baseLine_pix ); + painter.drawRect( zh->layoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ - 1, lastY_pix, ch.pixelwidth, baseLine_pix ); TQPen pen( cg.color( TQColorGroup::Highlight ) ); painter.setPen( pen ); #endif @@ -3217,10 +3217,10 @@ void KoTextParag::drawFormattingChars( TQPainter &painter, int start, int len, { // Don't use ch.pixelwidth here. We want a square with // the same size for all spaces, even the justified ones - int w = zh->tqlayoutUnitToPixelX( ch.format()->width( ' ' ) ); - int height = zh->tqlayoutUnitToPixelY( ch.ascent() ); + int w = zh->layoutUnitToPixelX( ch.format()->width( ' ' ) ); + int height = zh->layoutUnitToPixelY( ch.ascent() ); int size = TQMAX( 2, TQMIN( w/2, height/3 ) ); // Enfore that it's a square, and that it's visible - int x = zh->tqlayoutUnitToPixelX( ch.x ); // + ch.pixelxadj; + int x = zh->layoutUnitToPixelX( ch.x ); // + ch.pixelxadj; TQRect spcRect( x + (ch.pixelwidth - size) / 2, lastY_pix + baseLine_pix - (height - size) / 2, size, size ); if ( ch.c == ' ' ) painter.drawRect( spcRect ); @@ -3234,15 +3234,15 @@ void KoTextParag::drawFormattingChars( TQPainter &painter, int start, int len, //kdDebug() << "tab x=" << ch.x << " nextch.x=" << nextch.x // << " nextx=" << nextx << " startX=" << startX << " bw=" << bw << endl; int availWidth = nextx - ch.x - 1; - availWidth=zh->tqlayoutUnitToPixelX(availWidth);*/ + availWidth=zh->layoutUnitToPixelX(availWidth);*/ int availWidth = ch.pixelwidth; KoTextFormat* format = ch.format(); - int x = zh->tqlayoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + availWidth / 2; + int x = zh->layoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + availWidth / 2; int charWidth = format->screenFontMetrics( zh ).width( 'W' ); int size = TQMIN( availWidth, charWidth ) / 2 ; // actually the half size - int y = lastY_pix + baseLine_pix - zh->tqlayoutUnitToPixelY( ch.ascent()/2 ); + int y = lastY_pix + baseLine_pix - zh->layoutUnitToPixelY( ch.ascent()/2 ); int arrowsize = zh->zoomItY( 2 ); painter.drawLine( x - size, y, x + size, y ); if ( rightToLeft ) @@ -3269,7 +3269,7 @@ void KoTextParag::drawFormattingChars( TQPainter &painter, int start, int len, //kdDebug() << "KWTextParag::drawFormattingChars drawing Line Break at " << x << "," << y << endl; if ( rightToLeft ) { - int x = zh->tqlayoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + ch.pixelwidth - 1; + int x = zh->layoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + ch.pixelwidth - 1; painter.drawLine( x - size, y - size, x - size, y ); painter.drawLine( x - size, y, (int)(x - size * 0.3), y ); // Now the arrow @@ -3278,7 +3278,7 @@ void KoTextParag::drawFormattingChars( TQPainter &painter, int start, int len, } else { - int x = zh->tqlayoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + w - 1; + int x = zh->layoutUnitToPixelX( ch.x ) /*+ ch.pixelxadj*/ + w - 1; painter.drawLine( x, y - size, x, y ); painter.drawLine( x, y, (int)(x - size * 0.7), y ); // Now the arrow |