diff options
Diffstat (limited to 'kivio/kiviopart/kiviosdk/kivio_shape_data.cpp')
-rw-r--r-- | kivio/kiviopart/kiviosdk/kivio_shape_data.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/kivio/kiviopart/kiviosdk/kivio_shape_data.cpp b/kivio/kiviopart/kiviosdk/kivio_shape_data.cpp index ed974871..5305fe13 100644 --- a/kivio/kiviopart/kiviosdk/kivio_shape_data.cpp +++ b/kivio/kiviopart/kiviosdk/kivio_shape_data.cpp @@ -23,11 +23,11 @@ #include "kivio_shape_data.h" #include "kivio_text_style.h" -#include <qpainter.h> +#include <tqpainter.h> #include <kdebug.h> /* - * Struct for holding information about a shape type + * Struct for holding information about a tqshape type */ struct KivioShapeTypeInfo { @@ -36,10 +36,10 @@ struct KivioShapeTypeInfo }; /* - * Array of shape info used for loading/saving. + * Array of tqshape info used for loading/saving. */ static const int numShapeInfo = 12; -static struct KivioShapeTypeInfo shapeInfo[] = { +static struct KivioShapeTypeInfo tqshapeInfo[] = { { "Arc", KivioShapeData::kstArc }, { "Pie", KivioShapeData::kstPie }, { "LineArray", KivioShapeData::kstLineArray }, @@ -65,11 +65,11 @@ static struct KivioShapeTypeInfo shapeInfo[] = { KivioTextShapeData::KivioTextShapeData() { m_text = ""; - m_textFont = QFont("Times"); - m_textColor = QColor(0,0,0); + m_textFont = TQFont("Times"); + m_textColor = TQColor(0,0,0); m_isHtml = false; - m_hTextAlign = Qt::AlignHCenter; - m_vTextAlign = Qt::AlignVCenter; + m_hTextAlign = TQt::AlignHCenter; + m_vTextAlign = TQt::AlignVCenter; } @@ -77,14 +77,14 @@ KivioShapeData::KivioShapeData() : m_pOriginalPointList(NULL), m_pFillStyle(NULL) { - m_pOriginalPointList = new QPtrList<KivioPoint>; + m_pOriginalPointList = new TQPtrList<KivioPoint>; m_pOriginalPointList->setAutoDelete(true); m_pFillStyle = new KivioFillStyle(); m_pLineStyle = new KivioLineStyle(); -// m_fgColor = QColor( 0, 0, 0 ); +// m_fgColor = TQColor( 0, 0, 0 ); - m_shapeType = kstNone; + m_tqshapeType = kstNone; m_name = ""; // m_lineWidth = 1.0f; @@ -100,7 +100,7 @@ KivioShapeData::KivioShapeData( const KivioShapeData &source ) { // Allocate a new point list KivioPoint *pPoint; - m_pOriginalPointList = new QPtrList<KivioPoint>; + m_pOriginalPointList = new TQPtrList<KivioPoint>; m_pOriginalPointList->setAutoDelete(true); // Copy over the point list @@ -119,16 +119,16 @@ KivioShapeData::KivioShapeData( const KivioShapeData &source ) //m_fgColor = source.m_fgColor; // Copy the rest - m_shapeType = source.m_shapeType; - m_name = QString(source.m_name); + m_tqshapeType = source.m_tqshapeType; + m_name = TQString(source.m_name); //m_lineWidth = source.m_lineWidth; // Copy the position and size source.m_position.copyInto( &m_position ); source.m_dimensions.copyInto( &m_dimensions ); - // If this is a text shape, allocate a text data struct and copy the info - if( m_shapeType == kstTextBox ) + // If this is a text tqshape, allocate a text data struct and copy the info + if( m_tqshapeType == kstTextBox ) { m_pTextData = new KivioTextStyle(); @@ -191,7 +191,7 @@ void KivioShapeData::copyInto( KivioShapeData *pTarget ) const } // Create a new point list and copy it over - pTarget->m_pOriginalPointList = new QPtrList<KivioPoint>; + pTarget->m_pOriginalPointList = new TQPtrList<KivioPoint>; pTarget->m_pOriginalPointList->setAutoDelete(true); pPoint = m_pOriginalPointList->first(); while( pPoint ) @@ -208,8 +208,8 @@ void KivioShapeData::copyInto( KivioShapeData *pTarget ) const //pTarget->m_fgColor = m_fgColor; // Copy the rest - pTarget->m_shapeType = m_shapeType; - pTarget->m_name = QString(m_name); + pTarget->m_tqshapeType = m_tqshapeType; + pTarget->m_name = TQString(m_name); //pTarget->m_lineWidth = m_lineWidth; m_position.copyInto( &(pTarget->m_position) ); @@ -217,7 +217,7 @@ void KivioShapeData::copyInto( KivioShapeData *pTarget ) const // If this is a textbox, allocate & copy - if( m_shapeType == kstTextBox ) + if( m_tqshapeType == kstTextBox ) { if( !pTarget->m_pTextData ) { @@ -233,10 +233,10 @@ void KivioShapeData::copyInto( KivioShapeData *pTarget ) const kdWarning(43000) << "KivioShapeData::copyInto() - Shape is of type text-box, but our text data doens't exist." << endl; pTarget->m_pTextData->setText(""); pTarget->m_pTextData->setIsHtml(false); - pTarget->m_pTextData->setHTextAlign(Qt::AlignHCenter); - pTarget->m_pTextData->setVTextAlign(Qt::AlignVCenter); - pTarget->m_pTextData->setFont( QFont("Times",12) ); - pTarget->m_pTextData->setColor( QColor(0,0,0) ); + pTarget->m_pTextData->setHTextAlign(TQt::AlignHCenter); + pTarget->m_pTextData->setVTextAlign(TQt::AlignVCenter); + pTarget->m_pTextData->setFont( TQFont("Times",12) ); + pTarget->m_pTextData->setColor( TQColor(0,0,0) ); } } else @@ -254,21 +254,21 @@ void KivioShapeData::copyInto( KivioShapeData *pTarget ) const * Load this object from an XML element * */ -bool KivioShapeData::loadXML( const QDomElement &e ) +bool KivioShapeData::loadXML( const TQDomElement &e ) { - QDomNode node; - QDomElement ele; + TQDomNode node; + TQDomElement ele; // Maintain backwards compatibility with the eariler betas. They saved // fg color and line style in this node. - m_pLineStyle->setColor( XmlReadColor( e, "fgColor", QColor(0,0,0) ) ); + m_pLineStyle->setColor( XmlReadColor( e, "fgColor", TQColor(0,0,0) ) ); m_pLineStyle->setWidth( XmlReadFloat( e, "lineWidth", 1.0f ) ); node = e.firstChild(); while( !node.isNull() ) { - QString nodeName = node.nodeName(); + TQString nodeName = node.nodeName(); ele = node.toElement(); if( nodeName == "KivioLineStyle" ) @@ -283,7 +283,7 @@ bool KivioShapeData::loadXML( const QDomElement &e ) { // First make sure we are a text box - if( m_shapeType == kstTextBox ) + if( m_tqshapeType == kstTextBox ) { // If we don't have text data, allocate it if( !m_pTextData ) @@ -291,27 +291,27 @@ bool KivioShapeData::loadXML( const QDomElement &e ) m_pTextData->loadXML( ele ); - } // end if m_shapeType==kstTextBox + } // end if m_tqshapeType==kstTextBox } else if( nodeName == "KivioText" ) { // First make sure we are a text box - if( m_shapeType == kstTextBox ) + if( m_tqshapeType == kstTextBox ) { KivioTextShapeData *pData = new KivioTextShapeData; pData->m_text = XmlReadString( ele, "text", "" ); pData->m_isHtml = (bool)XmlReadInt( ele, "isHtml", (int)false ); - pData->m_hTextAlign = XmlReadInt( ele, "hTextAlign", Qt::AlignHCenter ); - pData->m_vTextAlign = XmlReadInt( ele, "vTextAlign", Qt::AlignVCenter ); + pData->m_hTextAlign = XmlReadInt( ele, "hTextAlign", TQt::AlignHCenter ); + pData->m_vTextAlign = XmlReadInt( ele, "vTextAlign", TQt::AlignVCenter ); // Search for the font - QDomNode innerNode = ele.firstChild(); + TQDomNode innerNode = ele.firstChild(); while( !innerNode.isNull() ) { - QString innerName = innerNode.nodeName(); - QDomElement innerE = innerNode.toElement(); + TQString innerName = innerNode.nodeName(); + TQDomElement innerE = innerNode.toElement(); if( innerName == "TextFont" ) { @@ -322,7 +322,7 @@ bool KivioShapeData::loadXML( const QDomElement &e ) pData->m_textFont.setUnderline( (bool)XmlReadInt( innerE, "underline", 12 ) ); pData->m_textFont.setStrikeOut( (bool)XmlReadInt( innerE, "strikeOut", 12 ) ); pData->m_textFont.setFixedPitch( (bool)XmlReadInt( innerE, "fixedPitch", false ) ); - pData->m_textColor = XmlReadColor( innerE, "color", QColor(0,0,0) ); + pData->m_textColor = XmlReadColor( innerE, "color", TQColor(0,0,0) ); } innerNode = innerNode.nextSibling(); @@ -338,7 +338,7 @@ bool KivioShapeData::loadXML( const QDomElement &e ) m_pTextData->setFont( pData->m_textFont ); m_pTextData->setColor( pData->m_textColor ); - } // end if m_shapeType==kstTextBox + } // end if m_tqshapeType==kstTextBox else { kdDebug(43000) << "KivioShapeData::loadXML() - Loading KivioText, but this is not a textbox!" << endl; @@ -355,51 +355,51 @@ bool KivioShapeData::loadXML( const QDomElement &e ) * Save this object to an XML element * */ -QDomElement KivioShapeData::saveXML( QDomDocument &doc ) +TQDomElement KivioShapeData::saveXML( TQDomDocument &doc ) { - QDomElement e = doc.createElement("KivioShapeData"); + TQDomElement e = doc.createElement("KivioShapeData"); // FIXME: Do we need to save m_pOriginalPointList // We save all this, but we won't necessarily load it back. // The positions - QDomElement posE = doc.createElement("Position"); + TQDomElement posE = doc.createElement("Position"); XmlWriteFloat( posE, "x", m_position.x() ); XmlWriteFloat( posE, "y", m_position.y() ); e.appendChild( posE ); // The dimensions - QDomElement dimE = doc.createElement("Dimension"); + TQDomElement dimE = doc.createElement("Dimension"); XmlWriteFloat( dimE, "w", m_dimensions.x() ); XmlWriteFloat( dimE, "h", m_dimensions.y() ); e.appendChild( dimE ); // The FGColor -// QDomElement foreE = doc.createElement("Foreground"); +// TQDomElement foreE = doc.createElement("Foreground"); // XmlWriteUInt( foreE, "color", m_fgColor.rgb() ); // XmlWriteFloat( foreE, "lineWidth", m_lineWidth ); // e.appendChild( foreE ); - QDomElement foreE = m_pLineStyle->saveXML( doc ); + TQDomElement foreE = m_pLineStyle->saveXML( doc ); e.appendChild( foreE ); // Save if we are a text box etc... - if( m_shapeType == kstTextBox ) + if( m_tqshapeType == kstTextBox ) { if( m_pTextData ) { e.appendChild( m_pTextData->saveXML(doc) ); /* // The text & formatting - QDomElement textE = doc.createElement("KivioText"); + TQDomElement textE = doc.createElement("KivioText"); XmlWriteString( textE, "text", m_pTextData->m_text ); XmlWriteInt( textE, "isHtml", m_pTextData->m_isHtml ); XmlWriteInt( textE, "hTextAlign", m_pTextData->m_hTextAlign ); XmlWriteInt( textE, "vTextAlign", m_pTextData->m_vTextAlign ); // Text font & color - QDomElement innerTextE = doc.createElement("TextFont"); + TQDomElement innerTextE = doc.createElement("TextFont"); XmlWriteString( innerTextE, "family", m_pTextData->m_textFont.family() ); XmlWriteColor( innerTextE, "color", m_pTextData->m_textColor ); XmlWriteInt( innerTextE, "size", m_pTextData->m_textFont.pointSize() ); @@ -420,21 +420,21 @@ QDomElement KivioShapeData::saveXML( QDomDocument &doc ) // The BGFillStyle e.appendChild( m_pFillStyle->saveXML( doc ) ); - // Shape type & name are stored in the shape node - //XmlWriteInt( e, "shapeType", m_shapeType ); + // Shape type & name are stored in the tqshape node + //XmlWriteInt( e, "tqshapeType", m_tqshapeType ); //XmlWriteString( e, "name", m_name ); return e; } -KivioShapeData::KivioShapeType KivioShapeData::shapeTypeFromString( const QString &str ) +KivioShapeData::KivioShapeType KivioShapeData::tqshapeTypeFromString( const TQString &str ) { for( int i=0; i<numShapeInfo; i++ ) { - if( str.compare( shapeInfo[i].name )==0 ) - return shapeInfo[i].type; + if( str.compare( tqshapeInfo[i].name )==0 ) + return tqshapeInfo[i].type; } return kstNone; @@ -442,7 +442,7 @@ KivioShapeData::KivioShapeType KivioShapeData::shapeTypeFromString( const QStrin void KivioShapeData::setShapeType( KivioShapeType st ) { - m_shapeType = st; + m_tqshapeType = st; // If it is a text box, make sure we have text data if( st == kstTextBox ) @@ -461,15 +461,15 @@ void KivioShapeData::setShapeType( KivioShapeType st ) } -QString KivioShapeData::text() +TQString KivioShapeData::text() { if( m_pTextData ) return m_pTextData->text(); - return QString(""); + return TQString(""); } -void KivioShapeData::setText( const QString &newText ) +void KivioShapeData::setText( const TQString &newText ) { if( m_pTextData ) { @@ -496,7 +496,7 @@ int KivioShapeData::hTextAlign() const if( m_pTextData ) return m_pTextData->hTextAlign(); - return Qt::AlignHCenter; + return TQt::AlignHCenter; } void KivioShapeData::setHTextAlign( int i ) @@ -510,7 +510,7 @@ int KivioShapeData::vTextAlign() const if( m_pTextData ) return m_pTextData->vTextAlign(); - return Qt::AlignVCenter; + return TQt::AlignVCenter; } void KivioShapeData::setVTextAlign( int i ) @@ -519,29 +519,29 @@ void KivioShapeData::setVTextAlign( int i ) m_pTextData->setVTextAlign(i); } -QFont KivioShapeData::textFont() +TQFont KivioShapeData::textFont() { if( m_pTextData ) return m_pTextData->font(); - return QFont("Times"); + return TQFont("Times"); } -void KivioShapeData::setTextFont( const QFont &f ) +void KivioShapeData::setTextFont( const TQFont &f ) { if( m_pTextData ) m_pTextData->setFont(f); } -QColor KivioShapeData::textColor() +TQColor KivioShapeData::textColor() { if( m_pTextData ) return m_pTextData->color(); - return QColor(0,0,0); + return TQColor(0,0,0); } -void KivioShapeData::setTextColor( QColor c ) +void KivioShapeData::setTextColor( TQColor c ) { if( m_pTextData ) m_pTextData->setColor(c); |