diff options
Diffstat (limited to 'kpresenter/KPrTextObject.cpp')
| -rw-r--r-- | kpresenter/KPrTextObject.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/kpresenter/KPrTextObject.cpp b/kpresenter/KPrTextObject.cpp index 4d1a94c4a..c696a8e5b 100644 --- a/kpresenter/KPrTextObject.cpp +++ b/kpresenter/KPrTextObject.cpp @@ -970,7 +970,7 @@ KoTextFormat KPrTextObject::loadFormat( TQDomElement &n, KoTextFormat * refForma return format; } -KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & tqparentElem, KPrDocument *doc, bool findStyle) +KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & parentElem, KPrDocument *doc, bool findStyle) { KoParagLayout tqlayout; @@ -980,7 +980,7 @@ KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & tqparentElem, KPrDo KoParagStyle *style; // Name of the style. If there is no style, then we do not supply // any default! - TQDomElement element = tqparentElem.namedItem( "NAME" ).toElement(); + TQDomElement element = parentElem.namedItem( "NAME" ).toElement(); if ( !element.isNull() ) { TQString styleName = element.attribute( "value" ); @@ -1001,7 +1001,7 @@ KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & tqparentElem, KPrDo tqlayout.style = style; } - TQDomElement element = tqparentElem.namedItem( "INDENTS" ).toElement(); + TQDomElement element = parentElem.namedItem( "INDENTS" ).toElement(); if ( !element.isNull() ) { double val=0.0; @@ -1019,7 +1019,7 @@ KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & tqparentElem, KPrDo val=TQMAX(0, element.attribute("right").toDouble()); tqlayout.margins[TQStyleSheetItem::MarginRight] = val; } - element = tqparentElem.namedItem( "LINESPACING" ).toElement(); + element = parentElem.namedItem( "LINESPACING" ).toElement(); if ( !element.isNull() ) { //compatibility with koffice 1.1 @@ -1073,7 +1073,7 @@ KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & tqparentElem, KPrDo } } - element = tqparentElem.namedItem( "OFFSETS" ).toElement(); + element = parentElem.namedItem( "OFFSETS" ).toElement(); if ( !element.isNull() ) { double val =0.0; @@ -1087,31 +1087,31 @@ KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & tqparentElem, KPrDo } - element = tqparentElem.namedItem( "LEFTBORDER" ).toElement(); + element = parentElem.namedItem( "LEFTBORDER" ).toElement(); if ( !element.isNull() ) tqlayout.leftBorder = KoBorder::loadBorder( element ); else tqlayout.leftBorder.setPenWidth( 0); - element = tqparentElem.namedItem( "RIGHTBORDER" ).toElement(); + element = parentElem.namedItem( "RIGHTBORDER" ).toElement(); if ( !element.isNull() ) tqlayout.rightBorder = KoBorder::loadBorder( element ); else tqlayout.rightBorder.setPenWidth( 0); - element = tqparentElem.namedItem( "TOPBORDER" ).toElement(); + element = parentElem.namedItem( "TOPBORDER" ).toElement(); if ( !element.isNull() ) tqlayout.topBorder = KoBorder::loadBorder( element ); else tqlayout.topBorder.setPenWidth(0); - element = tqparentElem.namedItem( "BOTTOMBORDER" ).toElement(); + element = parentElem.namedItem( "BOTTOMBORDER" ).toElement(); if ( !element.isNull() ) tqlayout.bottomBorder = KoBorder::loadBorder( element ); else tqlayout.bottomBorder.setPenWidth(0); - element = tqparentElem.namedItem( "COUNTER" ).toElement(); + element = parentElem.namedItem( "COUNTER" ).toElement(); if ( !element.isNull() ) { tqlayout.counter = new KoParagCounter; @@ -1119,7 +1119,7 @@ KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & tqparentElem, KPrDo } KoTabulatorList tabList; - element = tqparentElem.firstChild().toElement(); + element = parentElem.firstChild().toElement(); for ( ; !element.isNull() ; element = element.nextSibling().toElement() ) { if ( element.tagName() == "TABULATOR" ) @@ -1146,11 +1146,11 @@ KoParagLayout KPrTextObject::loadParagLayout( TQDomElement & tqparentElem, KPrDo return tqlayout; } -void KPrTextObject::saveParagLayout( const KoParagLayout& tqlayout, TQDomElement & tqparentElem ) +void KPrTextObject::saveParagLayout( const KoParagLayout& tqlayout, TQDomElement & parentElem ) { - TQDomDocument doc = tqparentElem.ownerDocument(); + TQDomDocument doc = parentElem.ownerDocument(); TQDomElement element = doc.createElement( "NAME" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); if ( tqlayout.style ) element.setAttribute( "value", tqlayout.style->name() ); else @@ -1162,7 +1162,7 @@ void KPrTextObject::saveParagLayout( const KoParagLayout& tqlayout, TQDomElement tqlayout.margins[TQStyleSheetItem::MarginRight] != 0 ) { element = doc.createElement( "INDENTS" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); if ( tqlayout.margins[TQStyleSheetItem::MarginFirstLine] != 0 ) element.setAttribute( "first", tqlayout.margins[TQStyleSheetItem::MarginFirstLine] ); if ( tqlayout.margins[TQStyleSheetItem::MarginLeft] != 0 ) @@ -1176,7 +1176,7 @@ void KPrTextObject::saveParagLayout( const KoParagLayout& tqlayout, TQDomElement tqlayout.margins[TQStyleSheetItem::MarginBottom] != 0 ) { element = doc.createElement( "OFFSETS" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); if ( tqlayout.margins[TQStyleSheetItem::MarginTop] != 0 ) element.setAttribute( "before", tqlayout.margins[TQStyleSheetItem::MarginTop] ); if ( tqlayout.margins[TQStyleSheetItem::MarginBottom] != 0 ) @@ -1186,7 +1186,7 @@ void KPrTextObject::saveParagLayout( const KoParagLayout& tqlayout, TQDomElement if ( tqlayout.lineSpacingType != KoParagLayout::LS_SINGLE ) { element = doc.createElement( "LINESPACING" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); if ( tqlayout.lineSpacingType == KoParagLayout::LS_ONEANDHALF ) element.setAttribute( "type", "oneandhalf" ); else if ( tqlayout.lineSpacingType == KoParagLayout::LS_DOUBLE ) @@ -1213,32 +1213,32 @@ void KPrTextObject::saveParagLayout( const KoParagLayout& tqlayout, TQDomElement if ( tqlayout.leftBorder.penWidth() > 0 ) { element = doc.createElement( "LEFTBORDER" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); tqlayout.leftBorder.save( element ); } if ( tqlayout.rightBorder.penWidth() > 0 ) { element = doc.createElement( "RIGHTBORDER" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); tqlayout.rightBorder.save( element ); } if ( tqlayout.topBorder.penWidth() > 0 ) { element = doc.createElement( "TOPBORDER" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); tqlayout.topBorder.save( element ); } if ( tqlayout.bottomBorder.penWidth() > 0 ) { element = doc.createElement( "BOTTOMBORDER" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); tqlayout.bottomBorder.save( element ); } if ( tqlayout.counter && tqlayout.counter->numbering() != KoParagCounter::NUM_NONE ) { element = doc.createElement( "COUNTER" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); if (tqlayout.counter ) tqlayout.counter->save( element ); } @@ -1248,7 +1248,7 @@ void KPrTextObject::saveParagLayout( const KoParagLayout& tqlayout, TQDomElement for ( ; it != tabList.end() ; it++ ) { element = doc.createElement( "TABULATOR" ); - tqparentElem.appendChild( element ); + parentElem.appendChild( element ); element.setAttribute( "type", (*it).type ); element.setAttribute( "ptpos", (*it).ptPos ); element.setAttribute( "filling", (*it).filling ); @@ -1328,9 +1328,9 @@ void KPrTextObject::drawParags( TQPainter *painter, KoTextZoomHandler* zoomHandl if ( !parag->isValid() ) parag->format(); if ( i == from ) - r.setTop( m_doc->zoomHandler()->tqlayoutUnitToPixelY( parag->rect().top() ) ); + r.setTop( m_doc->zoomHandler()->layoutUnitToPixelY( parag->rect().top() ) ); if ( i == to ) { - r.setBottom( m_doc->zoomHandler()->tqlayoutUnitToPixelY( parag->rect().bottom() ) ); + r.setBottom( m_doc->zoomHandler()->layoutUnitToPixelY( parag->rect().bottom() ) ); break; } ++i; @@ -1361,11 +1361,11 @@ void KPrTextObject::drawCursor( TQPainter *p, KoTextCursor *cursor, bool cursorV TQPoint topLeft = parag->rect().topLeft(); // in TQRT coords int lineY; // Cursor height, in pixels - int cursorHeight = zh->tqlayoutUnitToPixelY( topLeft.y(), parag->lineHeightOfChar( cursor->index(), 0, &lineY ) ); + int cursorHeight = zh->layoutUnitToPixelY( topLeft.y(), parag->lineHeightOfChar( cursor->index(), 0, &lineY ) ); TQPoint iPoint( topLeft.x() + cursor->x(), topLeft.y() + lineY ); // from now on, iPoint will be in pixels - iPoint = zh->tqlayoutUnitToPixel( iPoint ); + iPoint = zh->layoutUnitToPixel( iPoint ); TQPoint vPoint = iPoint; // vPoint and iPoint are the same currently // do not simplify this, will be useful with viewmodes. @@ -1483,7 +1483,7 @@ void KPrTextObject::highlightPortion( KoTextParag * parag, int index, int length } // Now ensure text is fully visible TQRect rect = m_doc->zoomHandler()->zoomRect( getRect() ); - TQRect expose = m_doc->zoomHandler()->tqlayoutUnitToPixel( parag->rect() ); + TQRect expose = m_doc->zoomHandler()->layoutUnitToPixel( parag->rect() ); expose.moveBy( rect.x(), rect.y() ); canvas->ensureVisible( (expose.left()+expose.right()) / 2, // point = center of the rect (expose.top()+expose.bottom()) / 2, @@ -1578,7 +1578,7 @@ void KPrTextObject::applyStyleChange( KoStyleChangeDefMap changed ) void KPrTextObject::slotAfterFormatting( int bottom, KoTextParag* lastFormatted, bool* abort) { recalcVerticalAlignment(); - int availHeight = availableHeight() - m_doc->zoomHandler()->ptToLayoutUnitPixY(tqalignmentValue()); + int availHeight = availableHeight() - m_doc->zoomHandler()->ptToLayoutUnitPixY(alignmentValue()); if ( ( bottom > availHeight ) || // this parag is already below the avail height ( lastFormatted && (bottom + lastFormatted->rect().height() > availHeight) ) ) // or next parag will be below it { @@ -1601,7 +1601,7 @@ void KPrTextObject::slotAfterFormatting( int bottom, KoTextParag* lastFormatted, // We only auto-grow. We don't auto-shrink. if(difference > 0 && !isProtect()) { - double wantedPosition = m_doc->zoomHandler()->tqlayoutUnitPtToPt( m_doc->zoomHandler()->pixelYToPt( difference ) ) + double wantedPosition = m_doc->zoomHandler()->layoutUnitPtToPt( m_doc->zoomHandler()->pixelYToPt( difference ) ) + getRect().bottom(); const KoPageLayout& p = m_doc->pageLayout(); double pageBottom = p.ptHeight - p.ptBottom; @@ -1611,7 +1611,7 @@ void KPrTextObject::slotAfterFormatting( int bottom, KoTextParag* lastFormatted, if ( getRect().bottom() != newBottom ) { // We resize the text object, but skipping the KPrTextObject::setSize code - // (which tqinvalidates everything etc.) + // (which invalidates everything etc.) KPrObject::setSize( getSize().width(), newBottom - getOrig().y() ); // Do recalculate the new available height though slotAvailableHeightNeeded(); @@ -1652,7 +1652,7 @@ KCommand * KPrTextObject::textContentsToHeight() } } - double textHeight = m_doc->zoomHandler()->tqlayoutUnitPtToPt( textHeightLU ); + double textHeight = m_doc->zoomHandler()->layoutUnitPtToPt( textHeightLU ); double lineSpacing = ( innerHeight() - textHeight ) / numLines; // this gives the linespacing diff to apply, in pt //kdDebug(33001) << k_funcinfo << "lineSpacing=" << lineSpacing << endl; @@ -1681,11 +1681,11 @@ KCommand * KPrTextObject::textObjectToContents() KoTextParag * parag = textDocument()->firstParag(); double txtWidth = 10; for ( ; parag ; parag = parag->next() ) - txtWidth = TQMAX( txtWidth, m_doc->zoomHandler()->tqlayoutUnitPtToPt( parag->widthUsed() )); + txtWidth = TQMAX( txtWidth, m_doc->zoomHandler()->layoutUnitPtToPt( parag->widthUsed() )); // Calculate text height int heightLU = textDocument()->height(); - double txtHeight = m_doc->zoomHandler()->tqlayoutUnitPtToPt( heightLU ); + double txtHeight = m_doc->zoomHandler()->layoutUnitPtToPt( heightLU ); // Compare with current object's size KoSize sizeDiff = KoSize( txtWidth, txtHeight ) - innerRect().size(); @@ -1732,7 +1732,7 @@ void KPrTextObject::setVerticalAligment( VerticalAlignmentType _type) void KPrTextObject::recalcVerticalAlignment() { - double txtHeight = m_doc->zoomHandler()->tqlayoutUnitPtToPt( m_doc->zoomHandler()->pixelYToPt( textDocument()->height() ) ) + btop + bbottom; + double txtHeight = m_doc->zoomHandler()->layoutUnitPtToPt( m_doc->zoomHandler()->pixelYToPt( textDocument()->height() ) ) + btop + bbottom; double diffy = getSize().height() - txtHeight; //kdDebug(33001) << k_funcinfo << "txtHeight: " << txtHeight << " rectHeight:" << getSize().height() << " -> diffy=" << diffy << endl; @@ -1763,9 +1763,9 @@ TQPoint KPrTextObject::cursorPos(KPrCanvas *canvas, KoTextCursor *cursor) const TQPoint topLeft = parag->rect().topLeft(); // in TQRT coords int lineY = 0; // Cursor height, in pixels - //int cursorHeight = zh->tqlayoutUnitToPixelY( topLeft.y(), parag->lineHeightOfChar( cursor->index(), 0, &lineY ) ); + //int cursorHeight = zh->layoutUnitToPixelY( topLeft.y(), parag->lineHeightOfChar( cursor->index(), 0, &lineY ) ); TQPoint iPoint( topLeft.x() + cursor->x(), topLeft.y() + lineY ); - iPoint = zh->tqlayoutUnitToPixel( iPoint ); + iPoint = zh->layoutUnitToPixel( iPoint ); iPoint.rx() -= canvas->diffx(); iPoint.ry() -= canvas->diffy(); return origPix+iPoint; @@ -1943,12 +1943,12 @@ void KPrTextView::ensureCursorVisible() int w = 1; KPrDocument *doc= m_kptextobj->kPresenterDocument(); KoPoint pt= kpTextObject()->getOrig(); - pt.setX( doc->zoomHandler()->tqlayoutUnitPtToPt( doc->zoomHandler()->pixelXToPt( x) ) +pt.x()); - pt.setY( doc->zoomHandler()->tqlayoutUnitPtToPt( doc->zoomHandler()->pixelYToPt( y ))+pt.y() ); + pt.setX( doc->zoomHandler()->layoutUnitPtToPt( doc->zoomHandler()->pixelXToPt( x) ) +pt.x()); + pt.setY( doc->zoomHandler()->layoutUnitPtToPt( doc->zoomHandler()->pixelYToPt( y ))+pt.y() ); TQPoint p = m_kptextobj->kPresenterDocument()->zoomHandler()->zoomPoint( pt ); - w = m_kptextobj->kPresenterDocument()->zoomHandler()->tqlayoutUnitToPixelX( w ); - h = m_kptextobj->kPresenterDocument()->zoomHandler()->tqlayoutUnitToPixelY( h ); + w = m_kptextobj->kPresenterDocument()->zoomHandler()->layoutUnitToPixelX( w ); + h = m_kptextobj->kPresenterDocument()->zoomHandler()->layoutUnitToPixelY( h ); m_canvas->ensureVisible( p.x(), p.y() + h / 2, w, h / 2 + 2 ); } @@ -2515,7 +2515,7 @@ void KPrTextView::dropEvent( TQDropEvent * e ) } } -void KPrTextObject::saveParagraph( TQDomDocument& doc,KoTextParag * parag,TQDomElement &tqparentElem, +void KPrTextObject::saveParagraph( TQDomDocument& doc,KoTextParag * parag,TQDomElement &parentElem, int from /* default 0 */, int to /* default length()-2 */ ) { @@ -2566,7 +2566,7 @@ void KPrTextObject::saveParagraph( TQDomDocument& doc,KoTextParag * parag,TQDomE else paragraph.appendChild(saveHelper(tmpText, parag->string()->at(0).format(), doc)); - tqparentElem.appendChild(paragraph); + parentElem.appendChild(paragraph); } KoPen KPrTextObject::defaultPen() const @@ -2579,7 +2579,7 @@ TQPoint KPrTextObject::viewToInternal( const TQPoint & pos, KPrCanvas* canvas ) KoTextZoomHandler* zh = kPresenterDocument()->zoomHandler(); TQPoint iPoint = pos - zh->zoomPoint( getOrig() + KoPoint( bLeft(), - bTop() + tqalignmentValue()) ); + bTop() + alignmentValue()) ); iPoint = zh->pixelToLayoutUnit( TQPoint( iPoint.x() + canvas->diffx(), iPoint.y() + canvas->diffy() ) ); return iPoint; |
