diff options
Diffstat (limited to 'lib/kofficecore/KoContainerHandler.cpp')
-rw-r--r-- | lib/kofficecore/KoContainerHandler.cpp | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/lib/kofficecore/KoContainerHandler.cpp b/lib/kofficecore/KoContainerHandler.cpp index 78060592..1f21df24 100644 --- a/lib/kofficecore/KoContainerHandler.cpp +++ b/lib/kofficecore/KoContainerHandler.cpp @@ -23,7 +23,7 @@ #include <kcursor.h> #include <kdebug.h> -KoEventHandler::KoEventHandler( QObject* target ) +KoEventHandler::KoEventHandler( TQObject* target ) { m_target = target; @@ -34,7 +34,7 @@ KoEventHandler::~KoEventHandler() { } -QObject* KoEventHandler::target() +TQObject* KoEventHandler::target() { return m_target; } @@ -43,11 +43,11 @@ QObject* KoEventHandler::target() class KoPartResizeHandlerPrivate { public: - KoPartResizeHandlerPrivate( const QWMatrix& matrix, KoView *view, KoChild* child, - KoChild::Gadget gadget, const QPoint& point ) : + KoPartResizeHandlerPrivate( const TQWMatrix& matrix, KoView *view, KoChild* child, + KoChild::Gadget gadget, const TQPoint& point ) : m_gadget(gadget), m_view(view), m_child(child), m_parentMatrix(matrix) { - m_geometryStart = child->geometry(); + m_tqgeometryStart = child->tqgeometry(); m_matrix = child->matrix() * matrix; m_invertParentMatrix = matrix.invert(); @@ -59,19 +59,19 @@ public: ~KoPartResizeHandlerPrivate() {} KoChild::Gadget m_gadget; - QPoint m_mouseStart; - QRect m_geometryStart; + TQPoint m_mouseStart; + TQRect m_tqgeometryStart; KoView* m_view; KoChild* m_child; - QWMatrix m_invert; - QWMatrix m_matrix; - QWMatrix m_parentMatrix; - QWMatrix m_invertParentMatrix; + TQWMatrix m_invert; + TQWMatrix m_matrix; + TQWMatrix m_parentMatrix; + TQWMatrix m_invertParentMatrix; }; -KoPartResizeHandler::KoPartResizeHandler( QWidget* widget, const QWMatrix& matrix, KoView* view, KoChild* child, - KoChild::Gadget gadget, const QPoint& point ) - : KoEventHandler( widget ) +KoPartResizeHandler::KoPartResizeHandler( TQWidget* widget, const TQWMatrix& matrix, KoView* view, KoChild* child, + KoChild::Gadget gadget, const TQPoint& point ) + : KoEventHandler( TQT_TQOBJECT(widget) ) { child->lock(); d=new KoPartResizeHandlerPrivate(matrix, view, child, gadget, point); @@ -84,25 +84,25 @@ KoPartResizeHandler::~KoPartResizeHandler() d=0L; } -void KoPartResizeHandler::repaint(QRegion &rgn) +void KoPartResizeHandler::tqrepaint(TQRegion &rgn) { rgn = rgn.unite( d->m_child->frameRegion( d->m_parentMatrix, true ) ); // rgn.translate(- d->m_view->canvasXOffset(), - d->m_view->canvasYOffset()); - ((QWidget*)target())->repaint( rgn ); + ((TQWidget*)target())->tqrepaint( rgn ); } -bool KoPartResizeHandler::eventFilter( QObject*, QEvent* ev ) +bool KoPartResizeHandler::eventFilter( TQObject*, TQEvent* ev ) { - if ( ev->type() == QEvent::MouseButtonRelease ) + if ( ev->type() == TQEvent::MouseButtonRelease ) { delete this; return true; } - else if ( ev->type() == QEvent::MouseMove ) + else if ( ev->type() == TQEvent::MouseMove ) { - QMouseEvent* e = (QMouseEvent*)ev; - QPoint p = d->m_invert.map( d->m_invertParentMatrix.map( e->pos() /*+ QPoint(d->m_view->canvasXOffset(), d->m_view->canvasYOffset()) */ ) ); - QRegion rgn( d->m_child->frameRegion( d->m_parentMatrix, true ) ); + TQMouseEvent* e = (TQMouseEvent*)ev; + TQPoint p = d->m_invert.map( d->m_invertParentMatrix.map( e->pos() /*+ TQPoint(d->m_view->canvasXOffset(), d->m_view->canvasYOffset()) */ ) ); + TQRegion rgn( d->m_child->frameRegion( d->m_parentMatrix, true ) ); double x1_x, x1_y, x2_x, x2_y; d->m_matrix.map( double( p.x() ), 0.0, &x1_x, &x1_y ); @@ -123,78 +123,78 @@ bool KoPartResizeHandler::eventFilter( QObject*, QEvent* ev ) { case KoChild::TopLeft: { - x = QMIN( d->m_geometryStart.width() - 1, x ); - y = QMIN( d->m_geometryStart.height() - 1, y ); + x = TQMIN( d->m_tqgeometryStart.width() - 1, x ); + y = TQMIN( d->m_tqgeometryStart.height() - 1, y ); - d->m_child->setGeometry( QRect( d->m_geometryStart.x() + x, d->m_geometryStart.y() + y, - d->m_geometryStart.width() - x, d->m_geometryStart.height() - y ) ); - repaint(rgn); + d->m_child->setGeometry( TQRect( d->m_tqgeometryStart.x() + x, d->m_tqgeometryStart.y() + y, + d->m_tqgeometryStart.width() - x, d->m_tqgeometryStart.height() - y ) ); + tqrepaint(rgn); } break; case KoChild::TopMid: { - y = QMIN( d->m_geometryStart.height() - 1, y ); + y = TQMIN( d->m_tqgeometryStart.height() - 1, y ); - d->m_child->setGeometry( QRect( d->m_geometryStart.x(), d->m_geometryStart.y() + y, - d->m_geometryStart.width(), d->m_geometryStart.height() - y ) ); - repaint(rgn); + d->m_child->setGeometry( TQRect( d->m_tqgeometryStart.x(), d->m_tqgeometryStart.y() + y, + d->m_tqgeometryStart.width(), d->m_tqgeometryStart.height() - y ) ); + tqrepaint(rgn); } break; case KoChild::TopRight: { - x = QMAX( -d->m_geometryStart.width() + 1, x ); - y = QMIN( d->m_geometryStart.height() - 1, y ); + x = TQMAX( -d->m_tqgeometryStart.width() + 1, x ); + y = TQMIN( d->m_tqgeometryStart.height() - 1, y ); - d->m_child->setGeometry( QRect( d->m_geometryStart.x(), d->m_geometryStart.y() + y, - d->m_geometryStart.width() + x, d->m_geometryStart.height() - y ) ); - repaint(rgn); + d->m_child->setGeometry( TQRect( d->m_tqgeometryStart.x(), d->m_tqgeometryStart.y() + y, + d->m_tqgeometryStart.width() + x, d->m_tqgeometryStart.height() - y ) ); + tqrepaint(rgn); } break; case KoChild::MidLeft: { - x = QMIN( d->m_geometryStart.width() - 1, x ); + x = TQMIN( d->m_tqgeometryStart.width() - 1, x ); - d->m_child->setGeometry( QRect( d->m_geometryStart.x() + x, d->m_geometryStart.y(), - d->m_geometryStart.width() - x, d->m_geometryStart.height() ) ); - repaint(rgn); + d->m_child->setGeometry( TQRect( d->m_tqgeometryStart.x() + x, d->m_tqgeometryStart.y(), + d->m_tqgeometryStart.width() - x, d->m_tqgeometryStart.height() ) ); + tqrepaint(rgn); } break; case KoChild::MidRight: { - x = QMAX( -d->m_geometryStart.width() + 1, x ); + x = TQMAX( -d->m_tqgeometryStart.width() + 1, x ); - d->m_child->setGeometry( QRect( d->m_geometryStart.x(), d->m_geometryStart.y(), - d->m_geometryStart.width() + x, d->m_geometryStart.height() ) ); - repaint(rgn); + d->m_child->setGeometry( TQRect( d->m_tqgeometryStart.x(), d->m_tqgeometryStart.y(), + d->m_tqgeometryStart.width() + x, d->m_tqgeometryStart.height() ) ); + tqrepaint(rgn); } break; case KoChild::BottomLeft: { - x = QMIN( d->m_geometryStart.width() - 1, x ); - y = QMAX( -d->m_geometryStart.height() + 1, y ); + x = TQMIN( d->m_tqgeometryStart.width() - 1, x ); + y = TQMAX( -d->m_tqgeometryStart.height() + 1, y ); - d->m_child->setGeometry( QRect( d->m_geometryStart.x() + x, d->m_geometryStart.y(), - d->m_geometryStart.width() - x, d->m_geometryStart.height() + y ) ); - repaint(rgn); + d->m_child->setGeometry( TQRect( d->m_tqgeometryStart.x() + x, d->m_tqgeometryStart.y(), + d->m_tqgeometryStart.width() - x, d->m_tqgeometryStart.height() + y ) ); + tqrepaint(rgn); } break; case KoChild::BottomMid: { - y = QMAX( -d->m_geometryStart.height() + 1, y ); + y = TQMAX( -d->m_tqgeometryStart.height() + 1, y ); - d->m_child->setGeometry( QRect( d->m_geometryStart.x(), d->m_geometryStart.y(), - d->m_geometryStart.width(), d->m_geometryStart.height() + y ) ); - repaint(rgn); + d->m_child->setGeometry( TQRect( d->m_tqgeometryStart.x(), d->m_tqgeometryStart.y(), + d->m_tqgeometryStart.width(), d->m_tqgeometryStart.height() + y ) ); + tqrepaint(rgn); } break; case KoChild::BottomRight: { - x = QMAX( -d->m_geometryStart.width() + 1, x ); - y = QMAX( -d->m_geometryStart.height() + 1, y ); + x = TQMAX( -d->m_tqgeometryStart.width() + 1, x ); + y = TQMAX( -d->m_tqgeometryStart.height() + 1, y ); - d->m_child->setGeometry( QRect( d->m_geometryStart.x(), d->m_geometryStart.y(), - d->m_geometryStart.width() + x, d->m_geometryStart.height() + y ) ); - repaint(rgn); + d->m_child->setGeometry( TQRect( d->m_tqgeometryStart.x(), d->m_tqgeometryStart.y(), + d->m_tqgeometryStart.width() + x, d->m_tqgeometryStart.height() + y ) ); + tqrepaint(rgn); } break; default: @@ -209,28 +209,28 @@ bool KoPartResizeHandler::eventFilter( QObject*, QEvent* ev ) class KoPartMoveHandlerPrivate { public: - KoPartMoveHandlerPrivate( const QWMatrix& matrix, KoView* view, KoChild* child, - const QPoint& point) : m_view(view), m_dragChild(child), + KoPartMoveHandlerPrivate( const TQWMatrix& matrix, KoView* view, KoChild* child, + const TQPoint& point) : m_view(view), m_dragChild(child), m_parentMatrix(matrix) { m_invertParentMatrix = matrix.invert(); m_mouseDragStart = m_invertParentMatrix.map( point ); - m_geometryDragStart = m_dragChild->geometry(); + m_tqgeometryDragStart = m_dragChild->tqgeometry(); m_rotationDragStart = m_dragChild->rotationPoint(); } ~KoPartMoveHandlerPrivate() {} KoView* m_view; KoChild* m_dragChild; - QPoint m_mouseDragStart; - QRect m_geometryDragStart; - QPoint m_rotationDragStart; - QWMatrix m_invertParentMatrix; - QWMatrix m_parentMatrix; + TQPoint m_mouseDragStart; + TQRect m_tqgeometryDragStart; + TQPoint m_rotationDragStart; + TQWMatrix m_invertParentMatrix; + TQWMatrix m_parentMatrix; }; -KoPartMoveHandler::KoPartMoveHandler( QWidget* widget, const QWMatrix& matrix, KoView* view, KoChild* child, - const QPoint& point ) - : KoEventHandler( widget ) +KoPartMoveHandler::KoPartMoveHandler( TQWidget* widget, const TQWMatrix& matrix, KoView* view, KoChild* child, + const TQPoint& point ) + : KoEventHandler( TQT_TQOBJECT(widget) ) { child->lock(); d=new KoPartMoveHandlerPrivate(matrix, view, child, point); @@ -243,27 +243,27 @@ KoPartMoveHandler::~KoPartMoveHandler() d=0L; } -bool KoPartMoveHandler::eventFilter( QObject*, QEvent* ev ) +bool KoPartMoveHandler::eventFilter( TQObject*, TQEvent* ev ) { - if ( ev->type() == QEvent::MouseButtonRelease ) + if ( ev->type() == TQEvent::MouseButtonRelease ) { delete this; return true; } - else if ( ev->type() == QEvent::MouseMove ) + else if ( ev->type() == TQEvent::MouseMove ) { - QMouseEvent* e = (QMouseEvent*)ev; - - QRegion bound = d->m_dragChild->frameRegion( d->m_parentMatrix, true ); - QPoint pos = d->m_invertParentMatrix.map( e->pos() /* + QPoint(d->m_view->canvasXOffset(), d->m_view->canvasYOffset()) */ ); - d->m_dragChild->setGeometry( QRect( d->m_geometryDragStart.x() + pos.x() - d->m_mouseDragStart.x(), - d->m_geometryDragStart.y() + pos.y() - d->m_mouseDragStart.y(), - d->m_geometryDragStart.width(), d->m_geometryDragStart.height() ) ); - d->m_dragChild->setRotationPoint( QPoint( d->m_rotationDragStart.x() + pos.x() - d->m_mouseDragStart.x(), + TQMouseEvent* e = (TQMouseEvent*)ev; + + TQRegion bound = d->m_dragChild->frameRegion( d->m_parentMatrix, true ); + TQPoint pos = d->m_invertParentMatrix.map( e->pos() /* + TQPoint(d->m_view->canvasXOffset(), d->m_view->canvasYOffset()) */ ); + d->m_dragChild->setGeometry( TQRect( d->m_tqgeometryDragStart.x() + pos.x() - d->m_mouseDragStart.x(), + d->m_tqgeometryDragStart.y() + pos.y() - d->m_mouseDragStart.y(), + d->m_tqgeometryDragStart.width(), d->m_tqgeometryDragStart.height() ) ); + d->m_dragChild->setRotationPoint( TQPoint( d->m_rotationDragStart.x() + pos.x() - d->m_mouseDragStart.x(), d->m_rotationDragStart.y() + pos.y() - d->m_mouseDragStart.y() ) ); bound = bound.unite( d->m_dragChild->frameRegion( d->m_parentMatrix, false ) ); // bound.translate(- d->m_view->canvasXOffset(), - d->m_view->canvasYOffset()); - ((QWidget*)target())->repaint( bound ); + ((TQWidget*)target())->tqrepaint( bound ); return true; } @@ -273,8 +273,8 @@ bool KoPartMoveHandler::eventFilter( QObject*, QEvent* ev ) // ------------------------------------------------------- -KoContainerHandler::KoContainerHandler( KoView* view, QWidget* widget ) - : KoEventHandler( widget ) +KoContainerHandler::KoContainerHandler( KoView* view, TQWidget* widget ) + : KoEventHandler( TQT_TQOBJECT(widget) ) { m_view = view; } @@ -283,51 +283,51 @@ KoContainerHandler::~KoContainerHandler() { } -bool KoContainerHandler::eventFilter( QObject*, QEvent* ev ) +bool KoContainerHandler::eventFilter( TQObject*, TQEvent* ev ) { - if ( ev->type() == QEvent::KeyPress ) + if ( ev->type() == TQEvent::KeyPress ) { - QKeyEvent* keyEvent=(QKeyEvent*)ev; + TQKeyEvent* keyEvent=(TQKeyEvent*)ev; KoChild* child=m_view->selectedChild(); if (child != 0) { - if (keyEvent->key()==Qt::Key_Delete) + if (keyEvent->key()==TQt::Key_Delete) emit deleteChild(child); } } - if ( ev->type() == QEvent::MouseButtonPress ) + if ( ev->type() == TQEvent::MouseButtonPress ) { KoChild::Gadget gadget; - QPoint pos; - QMouseEvent *e=static_cast<QMouseEvent*>(ev); + TQPoint pos; + TQMouseEvent *e=TQT_TQMOUSEEVENT(ev); KoChild *ch=child(gadget, pos, e); - if ( e->button() == RightButton && gadget != KoChild::NoGadget ) + if ( e->button() == Qt::RightButton && gadget != KoChild::NoGadget ) { emit popupMenu( ch, e->globalPos() ); return true; } - else if ( e->button() == LeftButton && gadget == KoChild::Move ) + else if ( e->button() == Qt::LeftButton && gadget == KoChild::Move ) { - (void)new KoPartMoveHandler( static_cast<QWidget*>(target()), m_view->matrix(), m_view, ch, pos ); + (void)new KoPartMoveHandler( TQT_TQWIDGET(target()), m_view->matrix(), m_view, ch, pos ); return true; } - else if ( e->button() == LeftButton && gadget != KoChild::NoGadget ) + else if ( e->button() == Qt::LeftButton && gadget != KoChild::NoGadget ) { - (void)new KoPartResizeHandler( static_cast<QWidget*>(target()), m_view->matrix(), m_view, ch, gadget, pos ); + (void)new KoPartResizeHandler( TQT_TQWIDGET(target()), m_view->matrix(), m_view, ch, gadget, pos ); return true; } return false; } - else if ( ev->type() == QEvent::MouseMove ) + else if ( ev->type() == TQEvent::MouseMove ) { - QWidget *targetWidget = static_cast<QWidget *>( target() ); + TQWidget *targetWidget = TQT_TQWIDGET( target() ); KoChild::Gadget gadget; - QPoint pos; - QMouseEvent *e=static_cast<QMouseEvent*>(ev); + TQPoint pos; + TQMouseEvent *e=TQT_TQMOUSEEVENT(ev); child(gadget, pos, e); bool retval = true; @@ -354,9 +354,9 @@ bool KoContainerHandler::eventFilter( QObject*, QEvent* ev ) return false; } -KoChild *KoContainerHandler::child(KoChild::Gadget &gadget, QPoint &pos, const QMouseEvent *ev) { +KoChild *KoContainerHandler::child(KoChild::Gadget &gadget, TQPoint &pos, const TQMouseEvent *ev) { - pos = ev->pos(); //+ QPoint(m_view->canvasXOffset(), m_view->canvasYOffset()); + pos = ev->pos(); //+ TQPoint(m_view->canvasXOffset(), m_view->canvasYOffset()); pos = m_view->reverseViewTransformations( pos ); |