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/kotext/KoParagCounter.cpp | |
| 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/kotext/KoParagCounter.cpp')
| -rw-r--r-- | lib/kotext/KoParagCounter.cpp | 238 |
1 files changed, 119 insertions, 119 deletions
diff --git a/lib/kotext/KoParagCounter.cpp b/lib/kotext/KoParagCounter.cpp index e163f7579..71887c2c4 100644 --- a/lib/kotext/KoParagCounter.cpp +++ b/lib/kotext/KoParagCounter.cpp @@ -27,8 +27,8 @@ #include <KoGenStyles.h> #include <KoXmlNS.h> #include <kdebug.h> -#include <qdom.h> -#include <qbuffer.h> +#include <tqdom.h> +#include <tqbuffer.h> static KoTextParag * const INVALID_PARAG = (KoTextParag *)-1; @@ -40,10 +40,10 @@ KoParagCounter::KoParagCounter() m_startNumber = 1; m_displayLevels = 1; m_restartCounter = false; - m_customBulletChar = QChar( '-' ); - m_customBulletFont = QString::null; - m_align = Qt::AlignAuto; - invalidate(); + m_customBulletChar = TQChar( '-' ); + m_customBulletFont = TQString(); + m_align = TQt::AlignAuto; + tqinvalidate(); } bool KoParagCounter::operator==( const KoParagCounter & c2 ) const @@ -63,17 +63,17 @@ bool KoParagCounter::operator==( const KoParagCounter & c2 ) const m_custom==c2.m_custom); } -QString KoParagCounter::custom() const +TQString KoParagCounter::custom() const { return m_custom; } -QChar KoParagCounter::customBulletCharacter() const +TQChar KoParagCounter::customBulletCharacter() const { return m_customBulletChar; } -QString KoParagCounter::customBulletFont() const +TQString KoParagCounter::customBulletFont() const { return m_customBulletFont; } @@ -83,12 +83,12 @@ unsigned int KoParagCounter::depth() const return m_depth; } -void KoParagCounter::invalidate() +void KoParagCounter::tqinvalidate() { m_cache.number = -1; - m_cache.text = QString::null; + m_cache.text = TQString(); m_cache.width = -1; - m_cache.parent = INVALID_PARAG; + m_cache.tqparent = INVALID_PARAG; m_cache.counterFormat = 0; } @@ -112,7 +112,7 @@ bool KoParagCounter::isBullet() const return isBullet( m_style ); } -void KoParagCounter::load( QDomElement & element ) +void KoParagCounter::load( TQDomElement & element ) { m_numbering = static_cast<Numbering>( element.attribute("numberingtype", "2").toInt() ); m_style = static_cast<Style>( element.attribute("type").toInt() ); @@ -120,14 +120,14 @@ void KoParagCounter::load( QDomElement & element ) if ( m_numbering == NUM_LIST && m_style == STYLE_NONE ) m_numbering = NUM_NONE; m_depth = element.attribute("depth").toInt(); - m_customBulletChar = QChar( element.attribute("bullet").toInt() ); + m_customBulletChar = TQChar( element.attribute("bullet").toInt() ); m_prefix = element.attribute("lefttext"); if ( m_prefix.lower() == "(null)" ) // very old kword thing - m_prefix = QString::null; + m_prefix = TQString(); m_suffix = element.attribute("righttext"); if ( m_suffix.lower() == "(null)" ) - m_suffix = QString::null; - QString s = element.attribute("start"); + m_suffix = TQString(); + TQString s = element.attribute("start"); if ( s.isEmpty() ) m_startNumber = 1; else if ( s[0].isDigit() ) @@ -136,18 +136,18 @@ void KoParagCounter::load( QDomElement & element ) m_startNumber = s.lower()[0].latin1() - 'a' + 1; s = element.attribute("display-levels"); if ( !s.isEmpty() ) - m_displayLevels = QMIN( s.toInt(), m_depth+1 ); // can't be > depth+1 + m_displayLevels = TQMIN( s.toInt(), m_depth+1 ); // can't be > depth+1 else // Not specified -> compat with koffice-1.2: make equal to depth+1 m_displayLevels = m_depth+1; m_customBulletFont = element.attribute("bulletfont"); m_custom = element.attribute("customdef"); m_align = element.attribute("align", "0").toInt(); //AlignAuto as defeult - QString restart = element.attribute("restart"); + TQString restart = element.attribute("restart"); m_restartCounter = (restart == "true") || (restart == "1"); - invalidate(); + tqinvalidate(); } -static int importCounterType( QChar numFormat ) +static int importCounterType( TQChar numFormat ) { if ( numFormat == '1' ) return KoParagCounter::STYLE_NUM; @@ -163,7 +163,7 @@ static int importCounterType( QChar numFormat ) } // should only be called with style != none and != a bullet. -static QChar exportCounterType( KoParagCounter::Style style ) +static TQChar exportCounterType( KoParagCounter::Style style ) { static const int s_oasisCounterTypes[] = { '\0', '1', 'a', 'A', 'i', 'I', @@ -173,22 +173,22 @@ static QChar exportCounterType( KoParagCounter::Style style ) 0x25CF, // disc -> large disc 0x27A2 // box -> right-pointing triangle }; - return QChar( s_oasisCounterTypes[ style ] ); + return TQChar( s_oasisCounterTypes[ style ] ); } void KoParagCounter::loadOasis( KoOasisContext& context, int restartNumbering, bool orderedList, bool heading, int level, bool loadingStyle ) { - const QDomElement listStyle = context.listStyleStack().currentListStyle(); - const QDomElement listStyleProperties = context.listStyleStack().currentListStyleProperties(); - const QDomElement listStyleTextProperties = context.listStyleStack().currentListStyleTextProperties(); + const TQDomElement listStyle = context.listStyleStack().currentListStyle(); + const TQDomElement listStyleProperties = context.listStyleStack().currentListStyleProperties(); + const TQDomElement listStyleTextProperties = context.listStyleStack().currentListStyleTextProperties(); loadOasisListStyle( listStyle, listStyleProperties, listStyleTextProperties, restartNumbering, orderedList, heading, level, loadingStyle ); } -void KoParagCounter::loadOasisListStyle( const QDomElement& listStyle, - const QDomElement& listStyleProperties, - const QDomElement& listStyleTextProperties, +void KoParagCounter::loadOasisListStyle( const TQDomElement& listStyle, + const TQDomElement& listStyleProperties, + const TQDomElement& listStyleTextProperties, int restartNumbering, bool orderedList, bool heading, int level, bool loadingStyle ) @@ -197,26 +197,26 @@ void KoParagCounter::loadOasisListStyle( const QDomElement& listStyle, m_depth = level - 1; // depth start at 0 // restartNumbering can either be provided by caller, or taken from the style if ( restartNumbering == -1 && listStyle.hasAttributeNS( KoXmlNS::text, "start-value" ) ) - restartNumbering = listStyle.attributeNS( KoXmlNS::text, "start-value", QString::null ).toInt(); + restartNumbering = listStyle.attributeNS( KoXmlNS::text, "start-value", TQString() ).toInt(); // styles have a start-value, but that doesn't mean restartNumbering, as it does for paragraphs m_restartCounter = loadingStyle ? false : ( restartNumbering != -1 ); m_startNumber = ( restartNumbering != -1 ) ? restartNumbering : 1; //kdDebug() << k_funcinfo << "IN: restartNumbering=" << restartNumbering << " OUT: m_restartCounter=" << m_restartCounter << " m_startNumber=" << m_startNumber << endl; - m_prefix = listStyle.attributeNS( KoXmlNS::style, "num-prefix", QString::null ); - m_suffix = listStyle.attributeNS( KoXmlNS::style, "num-suffix", QString::null ); + m_prefix = listStyle.attributeNS( KoXmlNS::style, "num-prefix", TQString() ); + m_suffix = listStyle.attributeNS( KoXmlNS::style, "num-suffix", TQString() ); if ( orderedList || heading ) { - m_style = static_cast<Style>( importCounterType( listStyle.attributeNS( KoXmlNS::style, "num-format", QString::null)[0] ) ); - QString dl = listStyle.attributeNS( KoXmlNS::text, "display-levels", QString::null ); + m_style = static_cast<Style>( importCounterType( listStyle.attributeNS( KoXmlNS::style, "num-format", TQString())[0] ) ); + TQString dl = listStyle.attributeNS( KoXmlNS::text, "display-levels", TQString() ); m_displayLevels = dl.isEmpty() ? 1 : dl.toInt(); } else { // bullets, see 3.3.6 p138 m_style = STYLE_CUSTOMBULLET; - QString bulletChar = listStyle.attributeNS( KoXmlNS::text, "bullet-char", QString::null ); + TQString bulletChar = listStyle.attributeNS( KoXmlNS::text, "bullet-char", TQString() ); if ( !bulletChar.isEmpty() ) { // Reverse engineering, I found those codes: - switch( bulletChar[0].unicode() ) { + switch( bulletChar[0].tqunicode() ) { case 0x2022: // small disc -> circle m_style = STYLE_CIRCLEBULLET; break; @@ -235,22 +235,22 @@ void KoParagCounter::loadOasisListStyle( const QDomElement& listStyle, m_style = STYLE_BOXBULLET; break; default: - kdDebug() << "Unhandled bullet code 0x" << QString::number( (uint)m_customBulletChar.unicode(), 16 ) << endl; + kdDebug() << "Unhandled bullet code 0x" << TQString::number( (uint)m_customBulletChar.tqunicode(), 16 ) << endl; // fallback case 0x2794: // arrow case 0x2717: // cross case 0x2714: // checkmark m_customBulletChar = bulletChar[0]; - // often StarSymbol when it comes from OO; doesn't matter, Qt finds it in another font if needed. + // often StarSymbol when it comes from OO; doesn't matter, TQt finds it in another font if needed. if ( listStyleProperties.hasAttributeNS( KoXmlNS::style, "font-name" ) ) { - m_customBulletFont = listStyleProperties.attributeNS( KoXmlNS::style, "font-name", QString::null ); - kdDebug() << "m_customBulletFont style:font-name = " << listStyleProperties.attributeNS( KoXmlNS::style, "font-name", QString::null ) << endl; + m_customBulletFont = listStyleProperties.attributeNS( KoXmlNS::style, "font-name", TQString() ); + kdDebug() << "m_customBulletFont style:font-name = " << listStyleProperties.attributeNS( KoXmlNS::style, "font-name", TQString() ) << endl; } else if ( listStyleTextProperties.hasAttributeNS( KoXmlNS::fo, "font-family" ) ) { - m_customBulletFont = listStyleTextProperties.attributeNS( KoXmlNS::fo, "font-family", QString::null ); - kdDebug() << "m_customBulletFont fo:font-family = " << listStyleTextProperties.attributeNS( KoXmlNS::fo, "font-family", QString::null ) << endl; + m_customBulletFont = listStyleTextProperties.attributeNS( KoXmlNS::fo, "font-family", TQString() ); + kdDebug() << "m_customBulletFont fo:font-family = " << listStyleTextProperties.attributeNS( KoXmlNS::fo, "font-family", TQString() ) << endl; } // ## TODO in fact we're supposed to read it from the style pointed to by text:style-name break; @@ -259,7 +259,7 @@ void KoParagCounter::loadOasisListStyle( const QDomElement& listStyle, m_style = STYLE_DISCBULLET; } } - invalidate(); + tqinvalidate(); } void KoParagCounter::saveOasis( KoGenStyle& listStyle, bool savingStyle ) const @@ -267,16 +267,16 @@ void KoParagCounter::saveOasis( KoGenStyle& listStyle, bool savingStyle ) const Q_ASSERT( (Style)m_style != STYLE_NONE ); // Prepare a sub-xmlwriter for the list-level-style-* element - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter listLevelWriter( &buffer, 3 /*indentation*/ ); + KoXmlWriter listLevelWriter( TQT_TQIODEVICE(&buffer), 3 /*indentation*/ ); const char* tagName = isBullet() ? "text:list-level-style-bullet" : "text:list-level-style-number"; listLevelWriter.startElement( tagName ); saveOasisListLevel( listLevelWriter, true, savingStyle ); listLevelWriter.endElement(); - const QString listLevelContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + const TQString listLevelContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); listStyle.addChildElement( tagName, listLevelContents ); } @@ -289,7 +289,7 @@ void KoParagCounter::saveOasisListLevel( KoXmlWriter& listLevelWriter, bool incl if ( isBullet() ) { - QChar bulletChar; + TQChar bulletChar; if ( (Style)m_style == STYLE_CUSTOMBULLET ) { bulletChar = m_customBulletChar; @@ -299,7 +299,7 @@ void KoParagCounter::saveOasisListLevel( KoXmlWriter& listLevelWriter, bool incl { bulletChar = exportCounterType( (Style)m_style ); } - listLevelWriter.addAttribute( "text:bullet-char", QString( bulletChar ) ); + listLevelWriter.addAttribute( "text:bullet-char", TQString( bulletChar ) ); } else { @@ -308,7 +308,7 @@ void KoParagCounter::saveOasisListLevel( KoXmlWriter& listLevelWriter, bool incl if ( (Style)m_style == STYLE_CUSTOM ) ; // not implemented else - listLevelWriter.addAttribute( "style:num-format", QString( exportCounterType( (Style)m_style ) ) ); + listLevelWriter.addAttribute( "style:num-format", TQString( exportCounterType( (Style)m_style ) ) ); // m_startNumber/m_restartCounter is saved by kotextparag itself, except for styles. if ( savingStyle && m_restartCounter ) { @@ -324,9 +324,9 @@ void KoParagCounter::saveOasisListLevel( KoXmlWriter& listLevelWriter, bool incl if ( includeLevelAndProperties ) // false when called for footnotes-configuration { listLevelWriter.startElement( "style:list-level-properties" ); - listLevelWriter.addAttribute( "fo:text-align", KoParagLayout::saveOasisAlignment( (Qt::AlignmentFlags)m_align ) ); + listLevelWriter.addAttribute( "fo:text-align", KoParagLayout::saveOasisAlignment( (TQt::AlignmentFlags)m_align ) ); // OASIS has other style properties: text:space-before (indent), text:min-label-width (TODO), - // text:min-label-distance, style:font-name (for bullets), image size and vertical alignment. + // text:min-label-distance, style:font-name (for bullets), image size and vertical tqalignment. listLevelWriter.endElement(); // style:list-level-properties } } @@ -345,7 +345,7 @@ int KoParagCounter::number( const KoTextParag *paragraph ) } // Go looking for another paragraph at the same level or higher level. - // (This code shares logic with parent()) + // (This code shares logic with tqparent()) KoTextParag *otherParagraph = paragraph->prev(); KoParagCounter *otherCounter; @@ -434,11 +434,11 @@ KoParagCounter::Numbering KoParagCounter::numbering() const } // Go looking for another paragraph at a higher level. -KoTextParag *KoParagCounter::parent( const KoTextParag *paragraph ) +KoTextParag *KoParagCounter::tqparent( const KoTextParag *paragraph ) { // Return cached value if possible. - if ( m_cache.parent != INVALID_PARAG ) - return m_cache.parent; + if ( m_cache.tqparent != INVALID_PARAG ) + return m_cache.tqparent; KoTextParag *otherParagraph = paragraph->prev(); KoParagCounter *otherCounter; @@ -489,22 +489,22 @@ KoTextParag *KoParagCounter::parent( const KoTextParag *paragraph ) } break; } - m_cache.parent = otherParagraph; - return m_cache.parent; + m_cache.tqparent = otherParagraph; + return m_cache.tqparent; } -QString KoParagCounter::prefix() const +TQString KoParagCounter::prefix() const { return m_prefix; } -void KoParagCounter::save( QDomElement & element ) +void KoParagCounter::save( TQDomElement & element ) { element.setAttribute( "type", static_cast<int>( m_style ) ); element.setAttribute( "depth", m_depth ); if ( (Style)m_style == STYLE_CUSTOMBULLET ) { - element.setAttribute( "bullet", m_customBulletChar.unicode() ); + element.setAttribute( "bullet", m_customBulletChar.tqunicode() ); if ( !m_customBulletFont.isEmpty() ) element.setAttribute( "bulletfont", m_customBulletFont ); } @@ -528,69 +528,69 @@ void KoParagCounter::save( QDomElement & element ) element.setAttribute( "align", m_align ); } -void KoParagCounter::setCustom( QString c ) +void KoParagCounter::setCustom( TQString c ) { m_custom = c; - invalidate(); + tqinvalidate(); } -void KoParagCounter::setCustomBulletCharacter( QChar c ) +void KoParagCounter::setCustomBulletCharacter( TQChar c ) { m_customBulletChar = c; - invalidate(); + tqinvalidate(); } -void KoParagCounter::setCustomBulletFont( QString f ) +void KoParagCounter::setCustomBulletFont( TQString f ) { m_customBulletFont = f; - invalidate(); + tqinvalidate(); } void KoParagCounter::setDepth( unsigned int d ) { m_depth = d; - invalidate(); + tqinvalidate(); } void KoParagCounter::setNumbering( Numbering n ) { m_numbering = n; - invalidate(); + tqinvalidate(); } -void KoParagCounter::setPrefix( QString p ) +void KoParagCounter::setPrefix( TQString p ) { m_prefix = p; - invalidate(); + tqinvalidate(); } void KoParagCounter::setStartNumber( int s ) { m_startNumber = s; - invalidate(); + tqinvalidate(); } void KoParagCounter::setDisplayLevels( int l ) { m_displayLevels = l; - invalidate(); + tqinvalidate(); } -void KoParagCounter::setAlignment( int a ) +void KoParagCounter::tqsetAlignment( int a ) { m_align = a; - invalidate(); + tqinvalidate(); } void KoParagCounter::setStyle( Style s ) { m_style = s; - invalidate(); + tqinvalidate(); } -void KoParagCounter::setSuffix( QString s ) +void KoParagCounter::setSuffix( TQString s ) { m_suffix = s; - invalidate(); + tqinvalidate(); } int KoParagCounter::startNumber() const @@ -603,7 +603,7 @@ int KoParagCounter::displayLevels() const return m_displayLevels; } -int KoParagCounter::alignment() const +int KoParagCounter::tqalignment() const { return m_align; } @@ -613,7 +613,7 @@ KoParagCounter::Style KoParagCounter::style() const return m_style; } -QString KoParagCounter::suffix() const +TQString KoParagCounter::suffix() const { return m_suffix; } @@ -626,11 +626,11 @@ bool KoParagCounter::restartCounter() const void KoParagCounter::setRestartCounter( bool restart ) { m_restartCounter = restart; - invalidate(); + tqinvalidate(); } // Return the text for that level only -QString KoParagCounter::levelText( const KoTextParag *paragraph ) +TQString KoParagCounter::levelText( const KoTextParag *paragraph ) { if ( m_numbering == NUM_NONE ) return ""; @@ -643,7 +643,7 @@ QString KoParagCounter::levelText( const KoTextParag *paragraph ) bullet = false; } - QString text; + TQString text; if ( !bullet ) { // Ensure paragraph number is valid. @@ -705,7 +705,7 @@ QString KoParagCounter::levelText( const KoTextParag *paragraph ) } // Return the full text to be displayed -QString KoParagCounter::text( const KoTextParag *paragraph ) +TQString KoParagCounter::text( const KoTextParag *paragraph ) { // Return cached value if possible. if ( !m_cache.text.isNull() ) @@ -714,14 +714,14 @@ QString KoParagCounter::text( const KoTextParag *paragraph ) // If necessary, grab the text of the preceding levels. if ( m_displayLevels > 1 && m_numbering != NUM_NONE ) { - KoTextParag* p = parent( paragraph ); - int displayLevels = QMIN( m_displayLevels, m_depth+1 ); // can't be >depth+1 + KoTextParag* p = tqparent( paragraph ); + int displayLevels = TQMIN( m_displayLevels, m_depth+1 ); // can't be >depth+1 for ( int level = 1 ; level < displayLevels ; ++level ) { //kdDebug() << "additional level=" << level << "/" << displayLevels-1 << endl; if ( p ) { KoParagCounter* counter = p->counter(); - QString str = counter->levelText( p ); + TQString str = counter->levelText( p ); // If the preceding level is a bullet, replace it with blanks. if ( counter->isBullet() ) for ( unsigned i = 0; i < str.length(); i++ ) @@ -729,7 +729,7 @@ QString KoParagCounter::text( const KoTextParag *paragraph ) str.append('.'); // hardcoded on purpose (like OO) until anyone complains - // Find the number of missing parents, and add dummy text for them. + // Find the number of missing tqparents, and add dummy text for them. int missingParents = m_depth - level - p->counter()->m_depth; //kdDebug() << "levelText = " << str << " missingParents=" << missingParents << endl; level += missingParents; @@ -740,9 +740,9 @@ QString KoParagCounter::text( const KoTextParag *paragraph ) m_cache.text.prepend( str ); // Prepare next iteration if ( level < displayLevels ) // no need to calc it if we won't use it - p = counter->parent( p ); + p = counter->tqparent( p ); } - else // toplevel parents are missing + else // toplevel tqparents are missing { // Special case for one-paragraph-documents like preview widgets KoTextDocument* textdoc = paragraph->textDocument(); @@ -761,7 +761,7 @@ QString KoParagCounter::text( const KoTextParag *paragraph ) // Now apply prefix and suffix // We want the '.' to be before the number in a RTL parag, - // but we can't paint the whole string using QPainter::RTL direction, otherwise + // but we can't paint the whole string using TQPainter::RTL direction, otherwise // '10' becomes '01'. m_cache.text.prepend( paragraph->string()->isRightToLeft() ? suffix() : prefix() ); m_cache.text.append( paragraph->string()->isRightToLeft() ? prefix() : suffix() ); @@ -786,14 +786,14 @@ int KoParagCounter::width( const KoTextParag *paragraph ) m_cache.width = 0; if ( m_style != STYLE_NONE || m_numbering == NUM_FOOTNOTE) { - QString text = m_cache.text; + TQString text = m_cache.text; if ( m_style == STYLE_CUSTOMBULLET && !text.isEmpty() ) { text.append( " " ); // append two trailing spaces, see KoTextParag::drawLabel } else if ( !text.isEmpty() ) text.append( ' ' ); // append a trailing space, see KoTextParag::drawLabel - QFontMetrics fm = m_cache.counterFormat->refFontMetrics(); + TQFontMetrics fm = m_cache.counterFormat->refFontMetrics(); for ( unsigned int i = 0; i < text.length(); i++ ) //m_cache.width += m_cache.counterFormat->width( text, i ); m_cache.width += fm.width( text[i] ); @@ -811,8 +811,8 @@ int KoParagCounter::bulletX() Q_ASSERT( m_cache.width != -1 ); Q_ASSERT( m_cache.counterFormat ); int x = 0; - QFontMetrics fm = m_cache.counterFormat->refFontMetrics(); - QString text = prefix(); + TQFontMetrics fm = m_cache.counterFormat->refFontMetrics(); + TQString text = prefix(); for ( unsigned int i = 0; i < text.length(); i++ ) x += fm.width( text[i] ); // Now go from 100%-zoom to LU @@ -831,53 +831,53 @@ KoTextFormat* KoParagCounter::counterFormat( const KoTextParag *paragraph ) /// -const QCString RNUnits[] = {"", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix"}; -const QCString RNTens[] = {"", "x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc"}; -const QCString RNHundreds[] = {"", "c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm"}; -const QCString RNThousands[] = {"", "m", "mm", "mmm"}; +const TQCString RNUnits[] = {"", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix"}; +const TQCString RNTens[] = {"", "x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc"}; +const TQCString RNHundreds[] = {"", "c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm"}; +const TQCString RNThousands[] = {"", "m", "mm", "mmm"}; -QString KoParagCounter::makeRomanNumber( int n ) +TQString KoParagCounter::makeRomanNumber( int n ) { if ( n >= 0 ) - return QString::fromLatin1( RNThousands[ ( n / 1000 ) ] + + return TQString::tqfromLatin1( RNThousands[ ( n / 1000 ) ] + RNHundreds[ ( n / 100 ) % 10 ] + RNTens[ ( n / 10 ) % 10 ] + RNUnits[ ( n ) % 10 ] ); else { // should never happen, but better not crash if it does kdWarning(32500) << "makeRomanNumber: n=" << n << endl; - return QString::number( n ); + return TQString::number( n ); } } -QString KoParagCounter::makeAlphaUpperNumber( int n ) +TQString KoParagCounter::makeAlphaUpperNumber( int n ) { - QString tmp; + TQString tmp; char bottomDigit; while ( n > 26 ) { bottomDigit = (n-1) % 26; n = (n-1) / 26; - tmp.prepend( QChar( 'A' + bottomDigit ) ); + tmp.prepend( TQChar( 'A' + bottomDigit ) ); } - tmp.prepend( QChar( 'A' + n -1 ) ); + tmp.prepend( TQChar( 'A' + n -1 ) ); return tmp; } -QString KoParagCounter::makeAlphaLowerNumber( int n ) +TQString KoParagCounter::makeAlphaLowerNumber( int n ) { - QString tmp; + TQString tmp; char bottomDigit; while ( n > 26 ) { bottomDigit = (n-1) % 26; n = (n-1) / 26; - tmp.prepend( QChar( 'a' + bottomDigit ) ); + tmp.prepend( TQChar( 'a' + bottomDigit ) ); } - tmp.prepend( QChar( 'a' + n - 1 ) ); + tmp.prepend( TQChar( 'a' + n - 1 ) ); return tmp; } -int KoParagCounter::fromRomanNumber( const QString &string ) +int KoParagCounter::fromRomanNumber( const TQString &string ) { int ret = 0; int stringStart = 0; @@ -885,26 +885,26 @@ int KoParagCounter::fromRomanNumber( const QString &string ) for (int base = 1000; base >= 1 && stringStart < stringLen; base /= 10) { - const QCString *rn; + const TQCString *rn; int rnNum; switch (base) { case 1000: rn = RNThousands; - rnNum = sizeof (RNThousands) / sizeof (const QCString); + rnNum = sizeof (RNThousands) / sizeof (const TQCString); break; case 100: rn = RNHundreds; - rnNum = sizeof (RNHundreds) / sizeof (const QCString); + rnNum = sizeof (RNHundreds) / sizeof (const TQCString); break; case 10: rn = RNTens; - rnNum = sizeof (RNTens) / sizeof (const QCString); + rnNum = sizeof (RNTens) / sizeof (const TQCString); break; case 1: default: rn = RNUnits; - rnNum = sizeof (RNUnits) / sizeof (const QCString); + rnNum = sizeof (RNUnits) / sizeof (const TQCString); break; } @@ -924,7 +924,7 @@ int KoParagCounter::fromRomanNumber( const QString &string ) return (ret == 0 || stringStart != stringLen) ? -1 /*invalid value*/ : ret; } -int KoParagCounter::fromAlphaUpperNumber( const QString &string ) +int KoParagCounter::fromAlphaUpperNumber( const TQString &string ) { int ret = 0; @@ -945,7 +945,7 @@ int KoParagCounter::fromAlphaUpperNumber( const QString &string ) return (ret == 0) ? -1 /*invalid value*/ : ret; } -int KoParagCounter::fromAlphaLowerNumber( const QString &string ) +int KoParagCounter::fromAlphaLowerNumber( const TQString &string ) { int ret = 0; @@ -969,11 +969,11 @@ int KoParagCounter::fromAlphaLowerNumber( const QString &string ) #ifndef NDEBUG void KoParagCounter::printRTDebug( KoTextParag* parag ) { - QString additionalInfo; + TQString additionalInfo; if ( restartCounter() ) additionalInfo = "[restartCounter]"; if ( m_style == STYLE_CUSTOMBULLET ) - additionalInfo += " [customBullet: " + QString::number( m_customBulletChar.unicode() ) + additionalInfo += " [customBullet: " + TQString::number( m_customBulletChar.tqunicode() ) + " in font '" + m_customBulletFont + "']"; static const char * const s_numbering[] = { "List", "Chapter", "None", "Footnote" }; kdDebug(32500) << " Counter style=" << style() |
