diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kformula/kformulacontainer.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kformula/kformulacontainer.cc')
-rw-r--r-- | lib/kformula/kformulacontainer.cc | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/lib/kformula/kformulacontainer.cc b/lib/kformula/kformulacontainer.cc index 84471e1b..a141aa50 100644 --- a/lib/kformula/kformulacontainer.cc +++ b/lib/kformula/kformulacontainer.cc @@ -18,14 +18,14 @@ * Boston, MA 02110-1301, USA. */ -#include <qapplication.h> -#include <qdom.h> -#include <qevent.h> -#include <qfile.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qstring.h> -#include <qtextstream.h> +#include <tqapplication.h> +#include <tqdom.h> +#include <tqevent.h> +#include <tqfile.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqstring.h> +#include <tqtextstream.h> #include <kdebug.h> #include <klocale.h> @@ -194,7 +194,7 @@ void Container::moveOutBelow( FormulaCursor* cursor ) emit leaveFormula( this, cursor, EXIT_BELOW ); } -void Container::tell( const QString& msg ) +void Container::tell( const TQString& msg ) { emit statusMsg( msg ); } @@ -273,10 +273,10 @@ void Container::recalc() ContextStyle& context = impl->document->getContextStyle(); rootElement()->calcSizes( context ); - emit formulaChanged( context.layoutUnitToPixelX( rootElement()->getWidth() ), - context.layoutUnitToPixelY( rootElement()->getHeight() ) ); - emit formulaChanged( context.layoutUnitPtToPt( context.pixelXToPt( rootElement()->getWidth() ) ), - context.layoutUnitPtToPt( context.pixelYToPt( rootElement()->getHeight() ) ) ); + emit formulaChanged( context.tqlayoutUnitToPixelX( rootElement()->getWidth() ), + context.tqlayoutUnitToPixelY( rootElement()->getHeight() ) ); + emit formulaChanged( context.tqlayoutUnitPtToPt( context.pixelXToPt( rootElement()->getWidth() ) ), + context.tqlayoutUnitPtToPt( context.pixelYToPt( rootElement()->getHeight() ) ) ); emit cursorMoved( activeCursor() ); } @@ -292,16 +292,16 @@ const SymbolTable& Container::getSymbolTable() const } -void Container::draw( QPainter& painter, const QRect& r, const QColorGroup& cg, bool edit ) +void Container::draw( TQPainter& painter, const TQRect& r, const TQColorGroup& cg, bool edit ) { painter.fillRect( r, cg.base() ); draw( painter, r, edit ); } -void Container::draw( QPainter& painter, const QRect& r, bool edit ) +void Container::draw( TQPainter& painter, const TQRect& r, bool edit ) { - //ContextStyle& context = document()->getContextStyle( painter.device()->devType() == QInternal::Printer ); + //ContextStyle& context = document()->getContextStyle( painter.device()->devType() == TQInternal::Printer ); ContextStyle& context = document()->getContextStyle( edit ); rootElement()->draw( painter, context.pixelToLayoutUnit( r ), context ); } @@ -315,7 +315,7 @@ void Container::checkCursor() } } -void Container::input( QKeyEvent* event ) +void Container::input( TQKeyEvent* event ) { //if ( !hasValidCursor() ) if ( impl->activeCursor == 0 ) { @@ -339,20 +339,20 @@ void Container::paste() { if (!hasValidCursor()) return; - QClipboard* clipboard = QApplication::clipboard(); - const QMimeSource* source = clipboard->data(); + TQClipboard* clipboard = TQApplication::tqclipboard(); + const TQMimeSource* source = clipboard->data(); if (source->provides( MimeSource::selectionMimeType() )) { - QByteArray data = source->encodedData( MimeSource::selectionMimeType() ); - QDomDocument formula; + TQByteArray data = source->tqencodedData( MimeSource::selectionMimeType() ); + TQDomDocument formula; formula.setContent(data); paste( formula, i18n("Paste") ); } } -void Container::paste( const QDomDocument& document, QString desc ) +void Container::paste( const TQDomDocument& document, TQString desc ) { FormulaCursor* cursor = activeCursor(); - QPtrList<BasicElement> list; + TQPtrList<BasicElement> list; list.setAutoDelete( true ); if ( cursor->buildElementsFromMathMLDom( document.documentElement(), list ) ) { uint count = list.count(); @@ -372,9 +372,9 @@ void Container::copy() // read-only cursors are fine for copying. FormulaCursor* cursor = activeCursor(); if (cursor != 0) { - QDomDocument formula = document()->createMathMLDomDocument(); + TQDomDocument formula = document()->createMathMLDomDocument(); cursor->copy( formula ); - QClipboard* clipboard = QApplication::clipboard(); + TQClipboard* clipboard = TQApplication::tqclipboard(); clipboard->setData(new MimeSource(document(), formula)); } } @@ -392,7 +392,7 @@ void Container::cut() } -void Container::emitErrorMsg( const QString& msg ) +void Container::emitErrorMsg( const TQString& msg ) { emit errorMsg( msg ); } @@ -405,28 +405,28 @@ void Container::execute(KCommand* command) } -QRect Container::boundingRect() const +TQRect Container::boundingRect() const { const ContextStyle& context = document()->getContextStyle(); - return QRect( context.layoutUnitToPixelX( rootElement()->getX() ), - context.layoutUnitToPixelY( rootElement()->getY() ), - context.layoutUnitToPixelX( rootElement()->getWidth() ), - context.layoutUnitToPixelY( rootElement()->getHeight() ) ); + return TQRect( context.tqlayoutUnitToPixelX( rootElement()->getX() ), + context.tqlayoutUnitToPixelY( rootElement()->getY() ), + context.tqlayoutUnitToPixelX( rootElement()->getWidth() ), + context.tqlayoutUnitToPixelY( rootElement()->getHeight() ) ); } -QRect Container::coveredRect() +TQRect Container::coveredRect() { if ( impl->activeCursor != 0 ) { const ContextStyle& context = document()->getContextStyle(); const LuPixelRect& cursorRect = impl->activeCursor->getCursorSize(); - return QRect( context.layoutUnitToPixelX( rootElement()->getX() ), - context.layoutUnitToPixelY( rootElement()->getY() ), - context.layoutUnitToPixelX( rootElement()->getWidth() ), - context.layoutUnitToPixelY( rootElement()->getHeight() ) ) | - QRect( context.layoutUnitToPixelX( cursorRect.x() ), - context.layoutUnitToPixelY( cursorRect.y() ), - context.layoutUnitToPixelX( cursorRect.width() ), - context.layoutUnitToPixelY( cursorRect.height() ) ); + return TQRect( context.tqlayoutUnitToPixelX( rootElement()->getX() ), + context.tqlayoutUnitToPixelY( rootElement()->getY() ), + context.tqlayoutUnitToPixelX( rootElement()->getWidth() ), + context.tqlayoutUnitToPixelY( rootElement()->getHeight() ) ) | + TQRect( context.tqlayoutUnitToPixelX( cursorRect.x() ), + context.tqlayoutUnitToPixelY( cursorRect.y() ), + context.tqlayoutUnitToPixelX( cursorRect.width() ), + context.tqlayoutUnitToPixelY( cursorRect.height() ) ); } return boundingRect(); } @@ -434,20 +434,20 @@ QRect Container::coveredRect() double Container::width() const { const ContextStyle& context = document()->getContextStyle(); - return context.layoutUnitPtToPt( context.pixelXToPt( rootElement()->getWidth() ) ); + return context.tqlayoutUnitPtToPt( context.pixelXToPt( rootElement()->getWidth() ) ); } double Container::height() const { const ContextStyle& context = document()->getContextStyle(); - return context.layoutUnitPtToPt( context.pixelYToPt( rootElement()->getHeight() ) ); + return context.tqlayoutUnitPtToPt( context.pixelYToPt( rootElement()->getHeight() ) ); } double Container::baseline() const { const ContextStyle& context = document()->getContextStyle(); - //return context.layoutUnitToPixelY( rootElement()->getBaseline() ); - return context.layoutUnitPtToPt( context.pixelYToPt( rootElement()->getBaseline() ) ); + //return context.tqlayoutUnitToPixelY( rootElement()->getBaseline() ); + return context.tqlayoutUnitPtToPt( context.pixelYToPt( rootElement()->getBaseline() ) ); } void Container::moveTo( int x, int y ) @@ -464,7 +464,7 @@ int Container::fontSize() const } else { const ContextStyle& context = document()->getContextStyle(); - return qRound( context.baseSize() ); + return tqRound( context.baseSize() ); } } @@ -490,9 +490,9 @@ void Container::updateMatrixActions() document()->wrapper()->enableMatrixActions( false ); } -void Container::save( QDomElement &root ) +void Container::save( TQDomElement &root ) { - QDomDocument ownerDoc = root.ownerDocument(); + TQDomDocument ownerDoc = root.ownerDocument(); root.appendChild(rootElement()->getElementDom(ownerDoc)); } @@ -500,7 +500,7 @@ void Container::save( QDomElement &root ) /** * Loads a formula from the document. */ -bool Container::load( const QDomElement &fe ) +bool Container::load( const TQDomElement &fe ) { if (!fe.isNull()) { FormulaElement* root = createMainSequence(); @@ -524,9 +524,9 @@ bool Container::load( const QDomElement &fe ) } -void Container::saveMathML( QTextStream& stream, bool oasisFormat ) +void Container::saveMathML( TQTextStream& stream, bool oasisFormat ) { - QDomDocument doc; + TQDomDocument doc; if ( !oasisFormat ) { doc = document()->createMathMLDomDocument(); } @@ -534,13 +534,13 @@ void Container::saveMathML( QTextStream& stream, bool oasisFormat ) stream << doc; } -bool Container::loadMathML( const QDomDocument &doc, bool oasisFormat ) +bool Container::loadMathML( const TQDomDocument &doc, bool oasisFormat ) { return loadMathML( doc.documentElement(), oasisFormat ); } /* -bool Container::loadMathML( const QDomElement &element, bool oasisFormat ) +bool Container::loadMathML( const TQDomElement &element, bool oasisFormat ) { const ContextStyle& context = document()->getContextStyle(); MathML2KFormula filter( element, context, oasisFormat ); @@ -557,7 +557,7 @@ bool Container::loadMathML( const QDomElement &element, bool oasisFormat ) } */ -bool Container::loadMathML( const QDomElement &fe, bool /*oasisFormat*/ ) +bool Container::loadMathML( const TQDomElement &fe, bool /*oasisFormat*/ ) { kdDebug( DEBUGID ) << "loadMathML" << endl; if (!fe.isNull()) { @@ -585,7 +585,7 @@ bool Container::loadMathML( const QDomElement &fe, bool /*oasisFormat*/ ) void Container::print(KPrinter& printer) { //printer.setFullPage(true); - QPainter painter; + TQPainter painter; if (painter.begin(&printer)) { rootElement()->draw( painter, LuPixelRect( rootElement()->getX(), rootElement()->getY(), @@ -595,31 +595,31 @@ void Container::print(KPrinter& printer) } } -QImage Container::drawImage( int width, int height ) +TQImage Container::drawImage( int width, int height ) { ContextStyle& context = document()->getContextStyle( false ); - QRect rect(impl->rootElement->getX(), impl->rootElement->getY(), + TQRect rect(impl->rootElement->getX(), impl->rootElement->getY(), impl->rootElement->getWidth(), impl->rootElement->getHeight()); - int realWidth = context.layoutUnitToPixelX( impl->rootElement->getWidth() ); - int realHeight = context.layoutUnitToPixelY( impl->rootElement->getHeight() ); + int realWidth = context.tqlayoutUnitToPixelX( impl->rootElement->getWidth() ); + int realHeight = context.tqlayoutUnitToPixelY( impl->rootElement->getHeight() ); - double f = QMAX( static_cast<double>( width )/static_cast<double>( realWidth ), + double f = TQMAX( static_cast<double>( width )/static_cast<double>( realWidth ), static_cast<double>( height )/static_cast<double>( realHeight ) ); int oldZoom = context.zoom(); - context.setZoomAndResolution( qRound( oldZoom*f ), KoGlobal::dpiX(), KoGlobal::dpiY() ); + context.setZoomAndResolution( tqRound( oldZoom*f ), KoGlobal::dpiX(), KoGlobal::dpiY() ); kdDebug( DEBUGID ) << "Container::drawImage " << "(" << width << " " << height << ")" - << "(" << context.layoutUnitToPixelX( impl->rootElement->getWidth() ) - << " " << context.layoutUnitToPixelY( impl->rootElement->getHeight() ) << ")" + << "(" << context.tqlayoutUnitToPixelX( impl->rootElement->getWidth() ) + << " " << context.tqlayoutUnitToPixelY( impl->rootElement->getHeight() ) << ")" << endl; - QPixmap pm( context.layoutUnitToPixelX( impl->rootElement->getWidth() ), - context.layoutUnitToPixelY( impl->rootElement->getHeight() ) ); + TQPixmap pm( context.tqlayoutUnitToPixelX( impl->rootElement->getWidth() ), + context.tqlayoutUnitToPixelY( impl->rootElement->getHeight() ) ); pm.fill(); - QPainter paint(&pm); + TQPainter paint(&pm); impl->rootElement->draw(paint, rect, context); paint.end(); context.setZoomAndResolution( oldZoom, KoGlobal::dpiX(), KoGlobal::dpiY() ); @@ -627,12 +627,12 @@ QImage Container::drawImage( int width, int height ) return pm.convertToImage(); } -QString Container::texString() +TQString Container::texString() { return rootElement()->toLatex(); } -QString Container::formulaString() +TQString Container::formulaString() { return rootElement()->formulaString(); } |