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/kofficecore/KoStyleStack.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/kofficecore/KoStyleStack.cpp')
-rw-r--r-- | lib/kofficecore/KoStyleStack.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/lib/kofficecore/KoStyleStack.cpp b/lib/kofficecore/KoStyleStack.cpp index 4b5b807b..22799209 100644 --- a/lib/kofficecore/KoStyleStack.cpp +++ b/lib/kofficecore/KoStyleStack.cpp @@ -81,27 +81,27 @@ void KoStyleStack::pop() #endif } -void KoStyleStack::push( const QDomElement& style ) +void KoStyleStack::push( const TQDomElement& style ) { m_stack.append( style ); #ifdef DEBUG_STYLESTACK - kdDebug(30003) << "pushed " << style.attributeNS( m_styleNSURI, "name", QString::null ) << " -> count=" << m_stack.count() << endl; + kdDebug(30003) << "pushed " << style.attributeNS( m_styleNSURI, "name", TQString() ) << " -> count=" << m_stack.count() << endl; #endif } -bool KoStyleStack::hasAttribute( const QString& name, const QString& detail ) const +bool KoStyleStack::hasAttribute( const TQString& name, const TQString& detail ) const { - QString fullName( name ); + TQString fullName( name ); if ( !detail.isEmpty() ) { fullName += '-'; fullName += detail; } - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - QDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement(); + TQDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement(); if ( properties.hasAttribute( name ) || ( !detail.isEmpty() && properties.hasAttribute( fullName ) ) ) return true; @@ -109,61 +109,61 @@ bool KoStyleStack::hasAttribute( const QString& name, const QString& detail ) co return false; } -QString KoStyleStack::attribute( const QString& name, const QString& detail ) const +TQString KoStyleStack::attribute( const TQString& name, const TQString& detail ) const { - QString fullName( name ); + TQString fullName( name ); if ( !detail.isEmpty() ) { fullName += '-'; fullName += detail; } - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - QDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement(); + TQDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement(); if ( properties.hasAttribute( name ) ) return properties.attribute( name ); if ( !detail.isEmpty() && properties.hasAttribute( fullName ) ) return properties.attribute( fullName ); } - return QString::null; + return TQString(); } -QString KoStyleStack::attributeNS( const char* nsURI, const char* name, const char* detail ) const +TQString KoStyleStack::attributeNS( const char* nsURI, const char* name, const char* detail ) const { - QString fullName( name ); + TQString fullName( name ); if ( detail ) { fullName += '-'; fullName += detail; } - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - QDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ); + TQDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ); if ( properties.hasAttributeNS( nsURI, name ) ) - return properties.attributeNS( nsURI, name, QString::null ); + return properties.attributeNS( nsURI, name, TQString() ); if ( detail && properties.hasAttributeNS( nsURI, fullName ) ) - return properties.attributeNS( nsURI, fullName, QString::null ); + return properties.attributeNS( nsURI, fullName, TQString() ); } - return QString::null; + return TQString(); } bool KoStyleStack::hasAttributeNS( const char* nsURI, const char* name, const char* detail ) const { - QString fullName( name ); + TQString fullName( name ); if ( detail ) { fullName += '-'; fullName += detail; } - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - QDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ); + TQDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ); if ( properties.hasAttributeNS( nsURI, name ) || ( detail && properties.hasAttributeNS( nsURI, fullName ) ) ) return true; @@ -171,21 +171,21 @@ bool KoStyleStack::hasAttributeNS( const char* nsURI, const char* name, const ch return false; } -// Font size is a bit special. "115%" applies to "the fontsize of the parent style". +// Font size is a bit special. "115%" applies to "the fontsize of the tqparent style". // This can be generalized though (hasAttributeThatCanBePercentOfParent() ? :) // Although, if we also add support for fo:font-size-rel here then it's not general anymore. double KoStyleStack::fontSize() const { - const QString name = "font-size"; + const TQString name = "font-size"; double percent = 1; - QValueList<QDomElement>::ConstIterator it = m_stack.end(); // reverse iterator + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); // reverse iterator while ( it != m_stack.begin() ) { --it; - QDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ).toElement(); + TQDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ).toElement(); if ( properties.hasAttributeNS( m_foNSURI, name ) ) { - const QString value = properties.attributeNS( m_foNSURI, name, QString::null ); + const TQString value = properties.attributeNS( m_foNSURI, name, TQString() ); if ( value.endsWith( "%" ) ) percent *= value.left( value.length() - 1 ).toDouble() / 100.0; else @@ -195,13 +195,13 @@ double KoStyleStack::fontSize() const return 0; } -bool KoStyleStack::hasChildNode(const QString & name) const +bool KoStyleStack::hasChildNode(const TQString & name) const { - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - QDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement(); + TQDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement(); if ( !properties.namedItem( name ).isNull() ) return true; } @@ -209,28 +209,28 @@ bool KoStyleStack::hasChildNode(const QString & name) const return false; } -QDomElement KoStyleStack::childNode(const QString & name) const +TQDomElement KoStyleStack::childNode(const TQString & name) const { - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - QDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement(); + TQDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement(); if ( !properties.namedItem( name ).isNull() ) return properties.namedItem( name ).toElement(); } - return QDomElement(); // a null element + return TQDomElement(); // a null element } bool KoStyleStack::hasChildNodeNS( const char* nsURI, const char* localName ) const { - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - QDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ); + TQDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ); if ( !KoDom::namedItemNS( properties, nsURI, localName ).isNull() ) return true; } @@ -238,59 +238,59 @@ bool KoStyleStack::hasChildNodeNS( const char* nsURI, const char* localName ) co return false; } -QDomElement KoStyleStack::childNodeNS( const char* nsURI, const char* localName) const +TQDomElement KoStyleStack::childNodeNS( const char* nsURI, const char* localName) const { - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - QDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ); - QDomElement e = KoDom::namedItemNS( properties, nsURI, localName ); + TQDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName ); + TQDomElement e = KoDom::namedItemNS( properties, nsURI, localName ); if ( !e.isNull() ) return e; } - return QDomElement(); // a null element + return TQDomElement(); // a null element } -bool KoStyleStack::isUserStyle( const QDomElement& e, const QString& family ) const +bool KoStyleStack::isUserStyle( const TQDomElement& e, const TQString& family ) const { - if ( e.attributeNS( m_styleNSURI, "family", QString::null ) != family ) + if ( e.attributeNS( m_styleNSURI, "family", TQString() ) != family ) return false; - const QDomElement parent = e.parentNode().toElement(); - //kdDebug(30003) << k_funcinfo << "tagName=" << e.tagName() << " parent-tagName=" << parent.tagName() << endl; - return parent.localName() == "styles" /*&& parent.namespaceURI() == KoXmlNS::office*/; + const TQDomElement tqparent = e.tqparentNode().toElement(); + //kdDebug(30003) << k_funcinfo << "tagName=" << e.tagName() << " tqparent-tagName=" << tqparent.tagName() << endl; + return tqparent.localName() == "styles" /*&& tqparent.namespaceURI() == KoXmlNS::office*/; } -QString KoStyleStack::userStyleName( const QString& family ) const +TQString KoStyleStack::userStyleName( const TQString& family ) const { - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; - //kdDebug(30003) << k_funcinfo << (*it).attributeNS( m_styleNSURI, "name", QString::null) << endl; + //kdDebug(30003) << k_funcinfo << (*it).attributeNS( m_styleNSURI, "name", TQString()) << endl; if ( isUserStyle( *it, family ) ) - return (*it).attributeNS( m_styleNSURI, "name", QString::null ); + return (*it).attributeNS( m_styleNSURI, "name", TQString() ); } // Can this ever happen? return "Standard"; } -QString KoStyleStack::userStyleDisplayName( const QString& family ) const +TQString KoStyleStack::userStyleDisplayName( const TQString& family ) const { - QValueList<QDomElement>::ConstIterator it = m_stack.end(); + TQValueList<TQDomElement>::ConstIterator it = m_stack.end(); while ( it != m_stack.begin() ) { --it; //kdDebug(30003) << k_funcinfo << (*it).attributeNS( m_styleNSURI, "display-name") << endl; if ( isUserStyle( *it, family ) ) - return (*it).attributeNS( m_styleNSURI, "display-name", QString::null ); + return (*it).attributeNS( m_styleNSURI, "display-name", TQString() ); } - return QString::null; // no display name, this can happen since it's optional + return TQString(); // no display name, this can happen since it's optional } void KoStyleStack::setTypeProperties( const char* typeProperties ) { - m_propertiesTagName = typeProperties == 0 ? QCString( "properties" ) : ( QCString( typeProperties ) + "-properties" ); + m_propertiesTagName = typeProperties == 0 ? TQCString( "properties" ) : ( TQCString( typeProperties ) + "-properties" ); } |