diff options
Diffstat (limited to 'kspread/kspread_object.cc')
-rw-r--r-- | kspread/kspread_object.cc | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/kspread/kspread_object.cc b/kspread/kspread_object.cc index 9257a3f5..8c273700 100644 --- a/kspread/kspread_object.cc +++ b/kspread/kspread_object.cc @@ -55,8 +55,8 @@ class View; * EmbeddedObject * **********************************************************/ -EmbeddedObject::EmbeddedObject( Sheet *_sheet, const KoRect& _tqgeometry ) - : m_tqgeometry( _tqgeometry), m_sheet(_sheet), m_objectName(""), m_selected(false), m_protect(false), m_keepRatio(false), pen( TQt::black, 1, Qt::SolidLine ) +EmbeddedObject::EmbeddedObject( Sheet *_sheet, const KoRect& _geometry ) + : m_geometry( _geometry), m_sheet(_sheet), m_objectName(""), m_selected(false), m_protect(false), m_keepRatio(false), pen( TQt::black, 1, Qt::SolidLine ) { angle = 0.0; inObjList = true; @@ -66,23 +66,23 @@ EmbeddedObject::EmbeddedObject( Sheet *_sheet, const KoRect& _tqgeometry ) EmbeddedObject::~EmbeddedObject() { } -KoRect EmbeddedObject::tqgeometry() +KoRect EmbeddedObject::geometry() { - return m_tqgeometry; + return m_geometry; } void EmbeddedObject::setGeometry( const KoRect &rect ) { - m_tqgeometry = rect; + m_geometry = rect; } void EmbeddedObject::moveBy( const KoPoint &_point ) { - m_tqgeometry.moveTopLeft( m_tqgeometry.topLeft() + _point ); + m_geometry.moveTopLeft( m_geometry.topLeft() + _point ); } void EmbeddedObject::moveBy( double _dx, double _dy ) { - m_tqgeometry.moveTopLeft( m_tqgeometry.topLeft() + KoPoint( _dx, _dy ) ); + m_geometry.moveTopLeft( m_geometry.topLeft() + KoPoint( _dx, _dy ) ); } void EmbeddedObject::resizeBy( const KoSize & _size ) @@ -92,7 +92,7 @@ void EmbeddedObject::resizeBy( const KoSize & _size ) void EmbeddedObject::resizeBy( double _dx, double _dy) { - m_tqgeometry.setSize( KoSize( m_tqgeometry.width()+_dx, m_tqgeometry.height()+_dy) ); + m_geometry.setSize( KoSize( m_geometry.width()+_dx, m_geometry.height()+_dy) ); } // call (possibly reimplemented) setSize bool EmbeddedObject::load( const TQDomElement& /*element*/ ) @@ -105,10 +105,10 @@ void EmbeddedObject::loadOasis(const TQDomElement &element, KoOasisLoadingContex { if(element.hasAttributeNS( KoXmlNS::draw, "name" )) m_objectName = element.attributeNS( KoXmlNS::draw, "name", TQString()); - m_tqgeometry.setX( KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "x", TQString() ) ) ); - m_tqgeometry.setY( KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "y", TQString() ) ) ); - m_tqgeometry.setWidth(KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "width", TQString() )) ); - m_tqgeometry.setHeight(KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "height", TQString() ) ) ); + m_geometry.setX( KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "x", TQString() ) ) ); + m_geometry.setY( KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "y", TQString() ) ) ); + m_geometry.setWidth(KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "width", TQString() )) ); + m_geometry.setHeight(KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "height", TQString() ) ) ); //kdDebug()<<" orig.x() :"<<orig.x() <<" orig.y() :"<<orig.y() <<"ext.width() :"<<ext.width()<<" ext.height(): "<<ext.height()<<endl; KoStyleStack &styleStack = context.styleStack(); @@ -126,15 +126,15 @@ void EmbeddedObject::saveOasisPosObject( KoXmlWriter &xmlWriter, int indexObj ) { xmlWriter.addAttribute( "draw:id", "object" + TQString::number( indexObj ) ); //save all into pt - xmlWriter.addAttributePt( "svg:x", sheet()->doc()->savingWholeDocument() ? m_tqgeometry.x() : m_tqgeometry.x() + 20.0 ); - xmlWriter.addAttributePt( "svg:y", sheet()->doc()->savingWholeDocument() ? m_tqgeometry.y() : m_tqgeometry.y() + 20.0 ); - xmlWriter.addAttributePt( "svg:width", m_tqgeometry.width() ); - xmlWriter.addAttributePt( "svg:height", m_tqgeometry.height() ); + xmlWriter.addAttributePt( "svg:x", sheet()->doc()->savingWholeDocument() ? m_geometry.x() : m_geometry.x() + 20.0 ); + xmlWriter.addAttributePt( "svg:y", sheet()->doc()->savingWholeDocument() ? m_geometry.y() : m_geometry.y() + 20.0 ); + xmlWriter.addAttributePt( "svg:width", m_geometry.width() ); + xmlWriter.addAttributePt( "svg:height", m_geometry.height() ); // if ( kAbs( angle ) > 1E-6 ) // { // double value = -1 * ( ( double )angle* M_PI )/180.0; -// TQString str=TQString( "rotate (%1)" ).tqarg( value ); +// TQString str=TQString( "rotate (%1)" ).arg( value ); // xmlWriter.addAttribute( "draw:transform", str ); // } } @@ -187,7 +187,7 @@ TQPixmap EmbeddedObject::toPixmap(double /*xZoom*/ , double /*yZoom*/) void EmbeddedObject::calculateRequiredZoom( TQSize desiredSize, double& xZoom, double& yZoom) { - TQSize actualSize = tqgeometry().size().toTQSize(); + TQSize actualSize = geometry().size().toTQSize(); xZoom = (double) desiredSize.width() / (double)actualSize.width(); yZoom = (double) desiredSize.height() / (double)actualSize.height(); @@ -199,8 +199,8 @@ void EmbeddedObject::paintSelection( TQPainter *_painter, SelectionMode mode ) return; _painter->save(); - KoRect bound( tqgeometry().left(), tqgeometry().top(), - tqgeometry().width() , tqgeometry().height() ); + KoRect bound( geometry().left(), geometry().top(), + geometry().width() , geometry().height() ); TQRect zoomedBound = sheet()->doc()->zoomRect( bound ) ; //_painter->setPen( TQPen( TQt::black, 1, TQPen::SolidLine ) ); @@ -261,14 +261,14 @@ void EmbeddedObject::paintSelection( TQPainter *_painter, SelectionMode mode ) _painter->restore(); } -TQCursor EmbeddedObject::getCursor( const TQPoint &_point, ModifyType &_modType, TQRect &tqgeometry) const +TQCursor EmbeddedObject::getCursor( const TQPoint &_point, ModifyType &_modType, TQRect &geometry) const { int px = /*sheet()->doc()->zoomItX*/(_point.x()); int py = /*sheet()->doc()->zoomItY*/(_point.y()); - int ox = /*sheet()->doc()->zoomItX*/(/*orig*/tqgeometry.x()); - int oy = /*sheet()->doc()->zoomItY*/(/*orig*/tqgeometry.y()); - int ow = /*sheet()->doc()->zoomItX*/(/*ext*/tqgeometry.width()); - int oh = /*sheet()->doc()->zoomItY*/(/*ext*/tqgeometry.height()); + int ox = /*sheet()->doc()->zoomItX*/(/*orig*/geometry.x()); + int oy = /*sheet()->doc()->zoomItY*/(/*orig*/geometry.y()); + int ow = /*sheet()->doc()->zoomItX*/(/*ext*/geometry.width()); + int oh = /*sheet()->doc()->zoomItY*/(/*ext*/geometry.height()); // if ( angle != 0.0 ) // { @@ -367,10 +367,10 @@ void EmbeddedObject::doDelete() * EmbeddedKOfficeObject * **********************************************************/ -EmbeddedKOfficeObject::EmbeddedKOfficeObject( Doc *parent, Sheet *_sheet, KoDocument* doc, const KoRect& tqgeometry ) - : EmbeddedObject( _sheet, tqgeometry ), m_parent(parent) +EmbeddedKOfficeObject::EmbeddedKOfficeObject( Doc *parent, Sheet *_sheet, KoDocument* doc, const KoRect& geometry ) + : EmbeddedObject( _sheet, geometry ), m_parent(parent) { - m_embeddedObject = new KoDocumentChild(parent, doc, tqgeometry.toTQRect() ); + m_embeddedObject = new KoDocumentChild(parent, doc, geometry.toTQRect() ); } EmbeddedKOfficeObject::EmbeddedKOfficeObject( Doc *parent, Sheet *_sheet ) @@ -399,7 +399,7 @@ bool EmbeddedKOfficeObject::saveOasisObjectAttributes( KSpreadOasisSaveContext & kdDebug() << "EmbeddedKOfficeObject::saveOasisPart " << sc.partIndexObj << endl; sc.xmlWriter.startElement( "draw:object" ); - const TQString name = TQString( "Object_%1" ).tqarg( sc.partIndexObj + 1 ); + const TQString name = TQString( "Object_%1" ).arg( sc.partIndexObj + 1 ); ++sc.partIndexObj; m_embeddedObject->saveOasisAttributes( sc.xmlWriter, name ); @@ -417,7 +417,7 @@ bool EmbeddedKOfficeObject::load( const TQDomElement& element ) { kdDebug() << "Loading EmbeddedKOfficeObject" << endl; bool result = embeddedObject()->load( element ); - setGeometry( KoRect::fromTQRect( embeddedObject()->tqgeometry() ) ); + setGeometry( KoRect::fromTQRect( embeddedObject()->geometry() ) ); return result; } @@ -436,7 +436,7 @@ void EmbeddedKOfficeObject::loadOasis(const TQDomElement &element, KoOasisLoadin TQDomElement EmbeddedKOfficeObject::save( TQDomDocument& doc ) { kdDebug() << "Saving EmbeddedKOfficeObject" << endl; - embeddedObject()->setGeometry( tqgeometry().toTQRect() ); + embeddedObject()->setGeometry( geometry().toTQRect() ); return m_embeddedObject->save( doc ); } @@ -446,21 +446,21 @@ void EmbeddedKOfficeObject::draw( TQPainter *_painter ) int const penw = pen.width() ; KoRect bound( 0, 0, - tqgeometry().width() - ( 2 * penw ), tqgeometry().height() - ( 2 * penw ) ); + geometry().width() - ( 2 * penw ), geometry().height() - ( 2 * penw ) ); TQRect const zoomedBound = sheet()->doc()->zoomRect( bound ); _painter->save(); - int const xOffset = sheet()->doc()->zoomItX( tqgeometry().left() + penw); - int const yOffset = sheet()->doc()->zoomItY( tqgeometry().top() + penw ); + int const xOffset = sheet()->doc()->zoomItX( geometry().left() + penw); + int const yOffset = sheet()->doc()->zoomItY( geometry().top() + penw ); - TQRect new_tqgeometry = zoomedBound; + TQRect new_geometry = zoomedBound; //if ( translate ) //{ _painter->translate( xOffset , yOffset ); - new_tqgeometry.moveBy( xOffset , yOffset ); - new_tqgeometry.moveBy( -_painter->window().x(), -_painter->window().y() ); + new_geometry.moveBy( xOffset , yOffset ); + new_geometry.moveBy( -_painter->window().x(), -_painter->window().y() ); //} _painter->setClipRect( zoomedBound, TQPainter::CoordPainter ); @@ -477,7 +477,7 @@ void EmbeddedKOfficeObject::draw( TQPainter *_painter ) zoomY ); - embeddedObject()->setGeometry( new_tqgeometry ); + embeddedObject()->setGeometry( new_geometry ); _painter->restore(); EmbeddedObject::draw( _painter ); @@ -485,10 +485,10 @@ void EmbeddedKOfficeObject::draw( TQPainter *_painter ) TQPixmap EmbeddedKOfficeObject::toPixmap( double xZoom , double yZoom ) { - TQPixmap pixmap( (int)( tqgeometry().width()*xZoom ), (int)( tqgeometry().height()*yZoom ) ); + TQPixmap pixmap( (int)( geometry().width()*xZoom ), (int)( geometry().height()*yZoom ) ); TQPainter painter(&pixmap); - TQRect bound( 0,0,(int)( tqgeometry().width()*xZoom ), (int)(tqgeometry().height()*yZoom) ); + TQRect bound( 0,0,(int)( geometry().width()*xZoom ), (int)(geometry().height()*yZoom) ); embeddedObject()->document()->paintEverything(painter,bound, embeddedObject()->isTransparent(), 0, @@ -516,10 +516,10 @@ void EmbeddedKOfficeObject::deactivate() void EmbeddedKOfficeObject::updateChildGeometry() { // KoZoomHandler* zh = m_sheet->doc(); -// embeddedObject()->setGeometry( zh->zoomRect( tqgeometry() ), true ); +// embeddedObject()->setGeometry( zh->zoomRect( geometry() ), true ); // return; -// TQRect r = sheet()->doc()->zoomRect( tqgeometry() ); +// TQRect r = sheet()->doc()->zoomRect( geometry() ); // if ( _canvas ) // { // kdDebug() << "_canvas->xOffset():" << _canvas->xOffset() << endl; @@ -537,8 +537,8 @@ void EmbeddedKOfficeObject::updateChildGeometry() * **********************************************************/ -EmbeddedChart::EmbeddedChart( Doc *_spread, Sheet *_sheet, KoDocument* doc, const KoRect& tqgeometry ) - : EmbeddedKOfficeObject( _spread, _sheet, doc, tqgeometry ) +EmbeddedChart::EmbeddedChart( Doc *_spread, Sheet *_sheet, KoDocument* doc, const KoRect& geometry ) + : EmbeddedKOfficeObject( _spread, _sheet, doc, geometry ) { m_pBinding = 0; } @@ -687,8 +687,8 @@ KoChart::Part* EmbeddedChart::chart() * EmbeddedPictureObject * **********************************************************/ -EmbeddedPictureObject::EmbeddedPictureObject( Sheet *_sheet, const KoRect& _tqgeometry, KoPictureCollection *_imageCollection ) - : EmbeddedObject( _sheet, _tqgeometry ) +EmbeddedPictureObject::EmbeddedPictureObject( Sheet *_sheet, const KoRect& _geometry, KoPictureCollection *_imageCollection ) + : EmbeddedObject( _sheet, _geometry ) { imageCollection = _imageCollection; pen = KoPen( TQt::black, 1.0, Qt::NoPen ); @@ -706,8 +706,8 @@ EmbeddedPictureObject::EmbeddedPictureObject( Sheet *_sheet, const KoRect& _tqge } -EmbeddedPictureObject::EmbeddedPictureObject( Sheet *_sheet, const KoRect& _tqgeometry, KoPictureCollection *_imageCollection, const KoPictureKey & key ) - : EmbeddedObject( _sheet, _tqgeometry ) +EmbeddedPictureObject::EmbeddedPictureObject( Sheet *_sheet, const KoRect& _geometry, KoPictureCollection *_imageCollection, const KoPictureKey & key ) + : EmbeddedObject( _sheet, _geometry ) { imageCollection = _imageCollection; @@ -1015,7 +1015,7 @@ void EmbeddedPictureObject::loadOasis(const TQDomElement &element, KoOasisLoadin strExtension=href.mid(result+1); // As we are using KoPicture, the extension should be without the dot. } TQString filename(href/*.mid(1)*/); - const KoPictureKey key(filename, TQDateTime::tqcurrentDateTime(Qt::UTC)); + const KoPictureKey key(filename, TQDateTime::currentDateTime(Qt::UTC)); image.setKey(key); KoStore* store = context.store(); @@ -1149,10 +1149,10 @@ void EmbeddedPictureObject::loadOasis(const TQDomElement &element, KoOasisLoadin void EmbeddedPictureObject::drawShadow( TQPainter* /*_painter*/, KoZoomHandler* /*_zoomHandler*/) { -// const double ox = /*orig*/m_tqgeometry.x(); -// const double oy = /*orig*/m_tqgeometry.y(); -// const double ow = /*ext*/m_tqgeometry.width(); -// const double oh = /*ext*/m_tqgeometry.height(); +// const double ox = /*orig*/m_geometry.x(); +// const double oy = /*orig*/m_geometry.y(); +// const double ow = /*ext*/m_geometry.width(); +// const double oh = /*ext*/m_geometry.height(); // // _painter->save(); // @@ -1208,7 +1208,7 @@ TQPixmap EmbeddedPictureObject::generatePixmap(KoZoomHandler*_zoomHandler) { const double penw = _zoomHandler->zoomItX( ( ( pen.style() == Qt::NoPen ) ? 1 : pen.width() ) / 2.0 ); - TQSize size( _zoomHandler->zoomSize( m_tqgeometry.size() /*ext*/ ) ); + TQSize size( _zoomHandler->zoomSize( m_geometry.size() /*ext*/ ) ); //kdDebug(33001) << "EmbeddedPictureObject::generatePixmap size= " << size << endl; TQPixmap pixmap(size); TQPainter paint; @@ -1221,8 +1221,8 @@ TQPixmap EmbeddedPictureObject::generatePixmap(KoZoomHandler*_zoomHandler) paint.setBrush( getBrush() ); TQRect rect( (int)( penw ), (int)( penw ), - (int)( _zoomHandler->zoomItX( /*ext*/m_tqgeometry.width() ) - 2.0 * penw ), - (int)( _zoomHandler->zoomItY( /*ext*/m_tqgeometry.height() ) - 2.0 * penw ) ); + (int)( _zoomHandler->zoomItX( /*ext*/m_geometry.width() ) - 2.0 * penw ), + (int)( _zoomHandler->zoomItY( /*ext*/m_geometry.height() ) - 2.0 * penw ) ); // if ( getFillType() == FT_BRUSH || !gradient ) paint.drawRect( rect ); @@ -1231,8 +1231,8 @@ TQPixmap EmbeddedPictureObject::generatePixmap(KoZoomHandler*_zoomHandler) // gradient->setSize( size ); // paint.drawPixmap( (int)( penw ), (int)( penw ), // gradient->pixmap(), 0, 0, -// (int)( _zoomHandler->zoomItX( m_tqgeometry/*ext*/.width() ) - 2 * penw ), -// (int)( _zoomHandler->zoomItY( m_tqgeometry/*ext*/.height() ) - 2 * penw ) ); +// (int)( _zoomHandler->zoomItX( m_geometry/*ext*/.width() ) - 2 * penw ), +// (int)( _zoomHandler->zoomItY( m_geometry/*ext*/.height() ) - 2 * penw ) ); // } @@ -1260,10 +1260,10 @@ void EmbeddedPictureObject::draw( TQPainter *_painter/*, KoZoomHandler*_zoomHand // if ( shadowDistance > 0 && !drawContour ) // drawShadow(_painter, _zoomHandler); - const double ox = /*orig*/m_tqgeometry.x(); - const double oy = /*orig*/m_tqgeometry.y(); - const double ow = /*ext*/m_tqgeometry.width(); - const double oh = /*ext*/m_tqgeometry.height(); + const double ox = /*orig*/m_geometry.x(); + const double oy = /*orig*/m_geometry.y(); + const double ow = /*ext*/m_geometry.width(); + const double oh = /*ext*/m_geometry.height(); //const double penw = _zoomHandler->zoomItX( ( ( pen.style() == Qt::NoPen ) ? 1.0 : pen.width() ) / 2.0 ); _painter->save(); |