diff options
Diffstat (limited to 'lib/kofficecore/KoOasisStyles.cpp')
-rw-r--r-- | lib/kofficecore/KoOasisStyles.cpp | 348 |
1 files changed, 174 insertions, 174 deletions
diff --git a/lib/kofficecore/KoOasisStyles.cpp b/lib/kofficecore/KoOasisStyles.cpp index 3a018767..d135a501 100644 --- a/lib/kofficecore/KoOasisStyles.cpp +++ b/lib/kofficecore/KoOasisStyles.cpp @@ -19,22 +19,22 @@ #include "KoOasisStyles.h" #include <KoXmlWriter.h> #include <kdebug.h> -#include <qdom.h> +#include <tqdom.h> #include "KoDom.h" #include "KoXmlNS.h" #include "KoGenStyles.h" -#include <qbuffer.h> +#include <tqbuffer.h> #include <kglobal.h> #include <klocale.h> -#include <qbrush.h> +#include <tqbrush.h> #include <KoStyleStack.h> class KoOasisStyles::Private { public: // The key of the map is the family - QMap<QString, QDict<QDomElement> > m_styles; - QMap<QString, QDict<QDomElement> > m_stylesAutoStyles; + TQMap<TQString, TQDict<TQDomElement> > m_styles; + TQMap<TQString, TQDict<TQDomElement> > m_stylesAutoStyles; }; KoOasisStyles::KoOasisStyles() @@ -51,11 +51,11 @@ KoOasisStyles::~KoOasisStyles() delete d; } -void KoOasisStyles::createStyleMap( const QDomDocument& doc, bool stylesDotXml ) +void KoOasisStyles::createStyleMap( const TQDomDocument& doc, bool stylesDotXml ) { - const QDomElement docElement = doc.documentElement(); + const TQDomElement docElement = doc.documentElement(); // We used to have the office:version check here, but better let the apps do that - QDomElement fontStyles = KoDom::namedItemNS( docElement, KoXmlNS::office, "font-decls" ); + TQDomElement fontStyles = KoDom::namedItemNS( docElement, KoXmlNS::office, "font-decls" ); if ( !fontStyles.isNull() ) { //kdDebug(30003) << "Starting reading in font-decl..." << endl; @@ -65,7 +65,7 @@ void KoOasisStyles::createStyleMap( const QDomDocument& doc, bool stylesDotXml ) //kdDebug(30003) << "Starting reading in office:automatic-styles. stylesDotXml=" << stylesDotXml << endl; - QDomElement autoStyles = KoDom::namedItemNS( docElement, KoXmlNS::office, "automatic-styles" ); + TQDomElement autoStyles = KoDom::namedItemNS( docElement, KoXmlNS::office, "automatic-styles" ); if ( !autoStyles.isNull() ) { insertStyles( autoStyles, stylesDotXml ); }// else @@ -74,17 +74,17 @@ void KoOasisStyles::createStyleMap( const QDomDocument& doc, bool stylesDotXml ) //kdDebug(30003) << "Reading in master styles" << endl; - QDomNode masterStyles = KoDom::namedItemNS( docElement, KoXmlNS::office, "master-styles" ); + TQDomNode masterStyles = KoDom::namedItemNS( docElement, KoXmlNS::office, "master-styles" ); if ( !masterStyles.isNull() ) { - QDomElement master; + TQDomElement master; forEachElement( master, masterStyles ) { if ( master.localName() == "master-page" && master.namespaceURI() == KoXmlNS::style ) { - const QString name = master.attributeNS( KoXmlNS::style, "name", QString::null ); + const TQString name = master.attributeNS( KoXmlNS::style, "name", TQString() ); kdDebug(30003) << "Master style: '" << name << "' loaded " << endl; - m_masterPages.insert( name, new QDomElement( master ) ); + m_masterPages.insert( name, new TQDomElement( master ) ); } else // OASIS docu mentions style:handout-master and draw:layer-set here kdWarning(30003) << "Unknown tag " << master.tagName() << " in office:master-styles" << endl; @@ -94,7 +94,7 @@ void KoOasisStyles::createStyleMap( const QDomDocument& doc, bool stylesDotXml ) kdDebug(30003) << "Starting reading in office:styles" << endl; - const QDomElement officeStyle = KoDom::namedItemNS( docElement, KoXmlNS::office, "styles" ); + const TQDomElement officeStyle = KoDom::namedItemNS( docElement, KoXmlNS::office, "styles" ); if ( !officeStyle.isNull() ) { m_officeStyle = officeStyle; @@ -105,12 +105,12 @@ void KoOasisStyles::createStyleMap( const QDomDocument& doc, bool stylesDotXml ) //kdDebug(30003) << "Styles read in." << endl; } -QValueVector<QDomElement> KoOasisStyles::userStyles() const +TQValueVector<TQDomElement> KoOasisStyles::userStyles() const { - QValueVector<QDomElement> vec; + TQValueVector<TQDomElement> vec; // Collect user styles unsigned int i = 0; - QDomElement e; + TQDomElement e; forEachElement( e, m_officeStyle ) { if ( e.localName() == "style" && @@ -123,20 +123,20 @@ QValueVector<QDomElement> KoOasisStyles::userStyles() const return vec; } -const QDict<QDomElement>& KoOasisStyles::styles(const QString& family) const +const TQDict<TQDomElement>& KoOasisStyles::styles(const TQString& family) const { // hmm this can create an empty item in the map, but otherwise we couldn't // return a const reference. return d->m_styles[family]; } -void KoOasisStyles::insertOfficeStyles( const QDomElement& styles ) +void KoOasisStyles::insertOfficeStyles( const TQDomElement& styles ) { - QDomElement e; + TQDomElement e; forEachElement( e, styles ) { - const QString localName = e.localName(); - const QString ns = e.namespaceURI(); + const TQString localName = e.localName(); + const TQString ns = e.namespaceURI(); if ( ( ns == KoXmlNS::svg && ( localName == "linearGradient" || localName == "radialGradient" ) ) @@ -149,9 +149,9 @@ void KoOasisStyles::insertOfficeStyles( const QDomElement& styles ) || localName == "opacity" ) ) ) { - const QString name = e.attributeNS( KoXmlNS::draw, "name", QString::null ); + const TQString name = e.attributeNS( KoXmlNS::draw, "name", TQString() ); Q_ASSERT( !name.isEmpty() ); - QDomElement* ep = new QDomElement( e ); + TQDomElement* ep = new TQDomElement( e ); m_drawStyles.insert( name, ep ); } else @@ -160,53 +160,53 @@ void KoOasisStyles::insertOfficeStyles( const QDomElement& styles ) } -void KoOasisStyles::insertStyles( const QDomElement& styles, bool styleAutoStyles ) +void KoOasisStyles::insertStyles( const TQDomElement& styles, bool styleAutoStyles ) { //kdDebug(30003) << "Inserting styles from " << styles.tagName() << endl; - QDomElement e; + TQDomElement e; forEachElement( e, styles ) insertStyle( e, styleAutoStyles ); } -void KoOasisStyles::insertStyle( const QDomElement& e, bool styleAutoStyles ) +void KoOasisStyles::insertStyle( const TQDomElement& e, bool styleAutoStyles ) { - const QString localName = e.localName(); - const QString ns = e.namespaceURI(); + const TQString localName = e.localName(); + const TQString ns = e.namespaceURI(); - const QString name = e.attributeNS( KoXmlNS::style, "name", QString::null ); + const TQString name = e.attributeNS( KoXmlNS::style, "name", TQString() ); if ( ns == KoXmlNS::style && localName == "style" ) { - const QString family = e.attributeNS( KoXmlNS::style, "family", QString::null ); + const TQString family = e.attributeNS( KoXmlNS::style, "family", TQString() ); if ( styleAutoStyles ) { - QDict<QDomElement>& dict = d->m_stylesAutoStyles[ family ]; + TQDict<TQDomElement>& dict = d->m_stylesAutoStyles[ family ]; dict.setAutoDelete( true ); - if ( dict.find( name ) != 0 ) + if ( dict.tqfind( name ) != 0 ) kdDebug(30003) << "Auto-style: '" << name << "' already exists" << endl; - dict.insert( name, new QDomElement( e ) ); + dict.insert( name, new TQDomElement( e ) ); //kdDebug(30003) << "Style: '" << name << "' loaded as a style auto style" << endl; } else { - QDict<QDomElement>& dict = d->m_styles[ family ]; + TQDict<TQDomElement>& dict = d->m_styles[ family ]; dict.setAutoDelete( true ); - if ( dict.find( name ) != 0 ) + if ( dict.tqfind( name ) != 0 ) kdDebug(30003) << "Style: '" << name << "' already exists" << endl; - dict.insert( name, new QDomElement( e ) ); + dict.insert( name, new TQDomElement( e ) ); //kdDebug(30003) << "Style: '" << name << "' loaded " << endl; } } else if ( ns == KoXmlNS::style && ( - localName == "page-layout" + localName == "page-tqlayout" || localName == "font-decl" - || localName == "presentation-page-layout" ) ) + || localName == "presentation-page-tqlayout" ) ) { - if ( m_styles.find( name ) != 0 ) + if ( m_styles.tqfind( name ) != 0 ) kdDebug(30003) << "Style: '" << name << "' already exists" << endl; - m_styles.insert( name, new QDomElement( e ) ); + m_styles.insert( name, new TQDomElement( e ) ); } else if ( localName == "default-style" && ns == KoXmlNS::style ) { - const QString family = e.attributeNS( KoXmlNS::style, "family", QString::null ); + const TQString family = e.attributeNS( KoXmlNS::style, "family", TQString() ); if ( !family.isEmpty() ) - m_defaultStyle.insert( family, new QDomElement( e ) ); + m_defaultStyle.insert( family, new TQDomElement( e ) ); } else if ( localName == "list-style" && ns == KoXmlNS::text ) { - m_listStyles.insert( name, new QDomElement( e ) ); + m_listStyles.insert( name, new TQDomElement( e ) ); //kdDebug(30003) << "List style: '" << name << "' loaded " << endl; } else if ( ns == KoXmlNS::number && ( localName == "number-style" @@ -221,14 +221,14 @@ void KoOasisStyles::insertStyle( const QDomElement& e, bool styleAutoStyles ) // The rest (text:*-configuration and text:outline-style) is to be done by the apps. } -// OO spec 2.5.4. p68. Conversion to Qt format: see qdate.html +// OO spec 2.5.4. p68. Conversion to TQt format: see qdate.html // OpenCalcImport::loadFormat has similar code, but slower, intermixed with other stuff, // lacking long-textual forms. -void KoOasisStyles::importDataStyle( const QDomElement& parent ) +void KoOasisStyles::importDataStyle( const TQDomElement& tqparent ) { NumericStyleFormat dataStyle; - const QString localName = parent.localName(); + const TQString localName = tqparent.localName(); if (localName == "number-style") dataStyle.type = NumericStyleFormat::Number; else if (localName == "currency-style") @@ -244,7 +244,7 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) else if (localName == "time-style") dataStyle.type = NumericStyleFormat::Time; - QString format; + TQString format; int precision = -1; int leadingZ = 1; bool thousandsSep = false; @@ -252,26 +252,26 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) //bool negRed = false; bool ok = false; int i = 0; - QDomElement e; - QString prefix; - QString suffix; - forEachElement( e, parent ) + TQDomElement e; + TQString prefix; + TQString suffix; + forEachElement( e, tqparent ) { if ( e.namespaceURI() != KoXmlNS::number ) continue; - QString localName = e.localName(); - const QString numberStyle = e.attributeNS( KoXmlNS::number, "style", QString::null ); + TQString localName = e.localName(); + const TQString numberStyle = e.attributeNS( KoXmlNS::number, "style", TQString() ); const bool shortForm = numberStyle == "short" || numberStyle.isEmpty(); if ( localName == "day" ) { format += shortForm ? "d" : "dd"; } else if ( localName == "day-of-week" ) { format += shortForm ? "ddd" : "dddd"; } else if ( localName == "month" ) { - if ( e.attributeNS( KoXmlNS::number, "possessive-form", QString::null ) == "true" ) { + if ( e.attributeNS( KoXmlNS::number, "possessive-form", TQString() ) == "true" ) { format += shortForm ? "PPP" : "PPPP"; } // TODO the spec has a strange mention of number:format-source - else if ( e.attributeNS( KoXmlNS::number, "textual", QString::null ) == "true" ) { + else if ( e.attributeNS( KoXmlNS::number, "textual", TQString() ) == "true" ) { format += shortForm ? "MMM" : "MMMM"; } else { // month number format += shortForm ? "M" : "MM"; @@ -281,7 +281,7 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) } else if ( localName == "era" ) { //TODO I don't know what is it... (define into oo spec) } else if ( localName == "week-of-year" || localName == "quarter") { - // ### not supported in Qt + // ### not supported in TQt } else if ( localName == "hours" ) { format += shortForm ? "h" : "hh"; } else if ( localName == "minutes" ) { @@ -309,13 +309,13 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) // TODO: number:grouping="true" if ( e.hasAttributeNS( KoXmlNS::number, "decimal-places" ) ) { - int d = e.attributeNS( KoXmlNS::number, "decimal-places", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "decimal-places", TQString() ).toInt( &ok ); if ( ok ) precision = d; } if ( e.hasAttributeNS( KoXmlNS::number, "min-integer-digits" ) ) { - int d = e.attributeNS( KoXmlNS::number, "min-integer-digits", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "min-integer-digits", TQString() ).toInt( &ok ); if ( ok ) leadingZ = d; } @@ -345,21 +345,21 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) if ( e.hasAttributeNS( KoXmlNS::number, "decimal-places" ) ) { - int d = e.attributeNS( KoXmlNS::number, "decimal-places", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "decimal-places", TQString() ).toInt( &ok ); if ( ok ) precision = d; } if ( e.hasAttributeNS( KoXmlNS::number, "min-integer-digits" ) ) { - int d = e.attributeNS( KoXmlNS::number, "min-integer-digits", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "min-integer-digits", TQString() ).toInt( &ok ); if ( ok ) leadingZ = d; } if ( e.hasAttributeNS( KoXmlNS::number, "min-exponent-digits" ) ) { - int d = e.attributeNS( KoXmlNS::number, "min-exponent-digits", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "min-exponent-digits", TQString() ).toInt( &ok ); if ( ok ) exp = d; if ( exp <= 0 ) @@ -399,25 +399,25 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) int denominatorValue=0; if ( e.hasAttributeNS( KoXmlNS::number, "min-integer-digits" ) ) { - int d = e.attributeNS( KoXmlNS::number, "min-integer-digits", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "min-integer-digits", TQString() ).toInt( &ok ); if ( ok ) integer = d; } if ( e.hasAttributeNS( KoXmlNS::number, "min-numerator-digits" ) ) { - int d = e.attributeNS( KoXmlNS::number, "min-numerator-digits", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "min-numerator-digits", TQString() ).toInt( &ok ); if ( ok ) numerator = d; } if ( e.hasAttributeNS( KoXmlNS::number, "min-denominator-digits" ) ) { - int d = e.attributeNS( KoXmlNS::number, "min-denominator-digits", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "min-denominator-digits", TQString() ).toInt( &ok ); if ( ok ) denominator = d; } if ( e.hasAttributeNS( KoXmlNS::number, "denominator-value" ) ) { - int d = e.attributeNS( KoXmlNS::number, "denominator-value", QString::null ).toInt( &ok ); + int d = e.attributeNS( KoXmlNS::number, "denominator-value", TQString() ).toInt( &ok ); if ( ok ) denominatorValue = d; } @@ -433,7 +433,7 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) format+='/'; if ( denominatorValue != 0 ) - format+=QString::number( denominatorValue ); + format+=TQString::number( denominatorValue ); else { for ( i = 0; i < denominator; ++i ) @@ -446,7 +446,7 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) } - const QString styleName = parent.attributeNS( KoXmlNS::style, "name", QString::null ); + const TQString styleName = tqparent.attributeNS( KoXmlNS::style, "name", TQString() ); kdDebug(30003) << "data style: " << styleName << " qt format=" << format << endl; if ( !prefix.isEmpty() ) { @@ -456,7 +456,7 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) format = format.right( format.length()-prefix.length() ); } else - prefix = QString::null; + prefix = TQString(); } if ( !suffix.isEmpty() ) { @@ -466,7 +466,7 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) format = format.left( format.length()-suffix.length() ); } else - suffix = QString::null; + suffix = TQString(); } dataStyle.formatStr = format; @@ -487,9 +487,9 @@ void KoOasisStyles::importDataStyle( const QDomElement& parent ) } \ } -void KoOasisStyles::parseOasisTimeKlocale(KoXmlWriter &elementWriter, QString & format, QString & text ) +void KoOasisStyles::parseOasisTimeKlocale(KoXmlWriter &elementWriter, TQString & format, TQString & text ) { - kdDebug(30003)<<"parseOasisTimeKlocale(KoXmlWriter &elementWriter, QString & format, QString & text ) :"<<format<<endl; + kdDebug(30003)<<"parseOasisTimeKlocale(KoXmlWriter &elementWriter, TQString & format, TQString & text ) :"<<format<<endl; do { if ( !saveOasisKlocaleTimeFormat( elementWriter, format, text ) ) @@ -502,7 +502,7 @@ void KoOasisStyles::parseOasisTimeKlocale(KoXmlWriter &elementWriter, QString & addTextNumber( text, elementWriter ); } -bool KoOasisStyles::saveOasisKlocaleTimeFormat( KoXmlWriter &elementWriter, QString & format, QString & text ) +bool KoOasisStyles::saveOasisKlocaleTimeFormat( KoXmlWriter &elementWriter, TQString & format, TQString & text ) { bool changed = false; if ( format.startsWith( "%H" ) ) //hh @@ -571,7 +571,7 @@ bool KoOasisStyles::saveOasisKlocaleTimeFormat( KoXmlWriter &elementWriter, QStr } -bool KoOasisStyles::saveOasisTimeFormat( KoXmlWriter &elementWriter, QString & format, QString & text, bool &antislash ) +bool KoOasisStyles::saveOasisTimeFormat( KoXmlWriter &elementWriter, TQString & format, TQString & text, bool &antislash ) { bool changed = false; //we can also add time to date. @@ -654,18 +654,18 @@ bool KoOasisStyles::saveOasisTimeFormat( KoXmlWriter &elementWriter, QString & f return changed; } -QString KoOasisStyles::saveOasisTimeStyle( KoGenStyles &mainStyles, const QString & _format, bool klocaleFormat, - const QString & _prefix, const QString & _suffix ) +TQString KoOasisStyles::saveOasisTimeStyle( KoGenStyles &mainStyles, const TQString & _format, bool klocaleFormat, + const TQString & _prefix, const TQString & _suffix ) { Q_UNUSED(_prefix); Q_UNUSED(_suffix); - kdDebug(30003)<<"QString KoOasisStyles::saveOasisTimeStyle( KoGenStyles &mainStyles, const QString & _format ) :"<<_format<<endl; - QString format( _format ); + kdDebug(30003)<<"TQString KoOasisStyles::saveOasisTimeStyle( KoGenStyles &mainStyles, const TQString & _format ) :"<<_format<<endl; + TQString format( _format ); KoGenStyle currentStyle( KoGenStyle::STYLE_NUMERIC_TIME ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level - QString text; + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level + TQString text; if ( klocaleFormat ) { parseOasisTimeKlocale( elementWriter, format, text ); @@ -677,7 +677,7 @@ QString KoOasisStyles::saveOasisTimeStyle( KoGenStyles &mainStyles, const QStrin { if ( !saveOasisTimeFormat( elementWriter, format, text, antislash ) ) { - QString elem( format[0] ); + TQString elem( format[0] ); format = format.remove( 0, 1 ); if ( elem == "\\" ) { @@ -693,15 +693,15 @@ QString KoOasisStyles::saveOasisTimeStyle( KoGenStyles &mainStyles, const QStrin while ( format.length() > 0 ); addTextNumber( text, elementWriter ); } - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); currentStyle.addChildElement( "number", elementContents ); return mainStyles.lookup( currentStyle, "N" ); } //convert klocale string to good format -void KoOasisStyles::parseOasisDateKlocale(KoXmlWriter &elementWriter, QString & format, QString & text ) +void KoOasisStyles::parseOasisDateKlocale(KoXmlWriter &elementWriter, TQString & format, TQString & text ) { - kdDebug(30003)<<"KoOasisStyles::parseOasisDateKlocale(KoXmlWriter &elementWriter, QString & format, QString & text ) :"<<format<<endl; + kdDebug(30003)<<"KoOasisStyles::parseOasisDateKlocale(KoXmlWriter &elementWriter, TQString & format, TQString & text ) :"<<format<<endl; do { if ( format.startsWith( "%Y" ) ) @@ -806,21 +806,21 @@ void KoOasisStyles::parseOasisDateKlocale(KoXmlWriter &elementWriter, QString & addTextNumber( text, elementWriter ); } -QString KoOasisStyles::saveOasisDateStyle( KoGenStyles &mainStyles, const QString & _format, bool klocaleFormat, - const QString & _prefix, const QString & _suffix ) +TQString KoOasisStyles::saveOasisDateStyle( KoGenStyles &mainStyles, const TQString & _format, bool klocaleFormat, + const TQString & _prefix, const TQString & _suffix ) { Q_UNUSED(_prefix); Q_UNUSED(_suffix); - kdDebug(30003)<<"QString KoOasisStyles::saveOasisDateStyle( KoGenStyles &mainStyles, const QString & _format ) :"<<_format<<endl; - QString format( _format ); + kdDebug(30003)<<"TQString KoOasisStyles::saveOasisDateStyle( KoGenStyles &mainStyles, const TQString & _format ) :"<<_format<<endl; + TQString format( _format ); - // Not supported into Qt: "era" "week-of-year" "quarter" + // Not supported into TQt: "era" "week-of-year" "quarter" KoGenStyle currentStyle( KoGenStyle::STYLE_NUMERIC_DATE ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level - QString text; + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level + TQString text; if ( klocaleFormat ) { parseOasisDateKlocale( elementWriter, format, text ); @@ -961,7 +961,7 @@ QString KoOasisStyles::saveOasisDateStyle( KoGenStyles &mainStyles, const QStrin { if ( !saveOasisTimeFormat( elementWriter, format, text,antislash ) ) { - QString elem( format[0] ); + TQString elem( format[0] ); format = format.remove( 0, 1 ); if ( elem == "\\" ) { @@ -979,22 +979,22 @@ QString KoOasisStyles::saveOasisDateStyle( KoGenStyles &mainStyles, const QStrin addTextNumber( text, elementWriter ); } - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); currentStyle.addChildElement( "number", elementContents ); return mainStyles.lookup( currentStyle, "N" ); } -QString KoOasisStyles::saveOasisFractionStyle( KoGenStyles &mainStyles, const QString & _format, const QString &_prefix, const QString &_suffix ) +TQString KoOasisStyles::saveOasisFractionStyle( KoGenStyles &mainStyles, const TQString & _format, const TQString &_prefix, const TQString &_suffix ) { - kdDebug(30003)<<"QString saveOasisFractionStyle( KoGenStyles &mainStyles, const QString & _format ) :"<<_format<<endl; - QString format( _format ); + kdDebug(30003)<<"TQString saveOasisFractionStyle( KoGenStyles &mainStyles, const TQString & _format ) :"<<_format<<endl; + TQString format( _format ); KoGenStyle currentStyle( KoGenStyle::STYLE_NUMERIC_FRACTION ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level - QString text; + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level + TQString text; int integer = 0; int numerator = 0; int denominator = 0; @@ -1043,22 +1043,22 @@ QString KoOasisStyles::saveOasisFractionStyle( KoGenStyles &mainStyles, const QS text=_suffix; addTextNumber(text, elementWriter ); - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); currentStyle.addChildElement( "number", elementContents ); return mainStyles.lookup( currentStyle, "N" ); } -QString KoOasisStyles::saveOasisNumberStyle( KoGenStyles &mainStyles, const QString & _format, const QString &_prefix, const QString &_suffix ) +TQString KoOasisStyles::saveOasisNumberStyle( KoGenStyles &mainStyles, const TQString & _format, const TQString &_prefix, const TQString &_suffix ) { - kdDebug(30003)<<"QString saveOasisNumberStyle( KoGenStyles &mainStyles, const QString & _format ) :"<<_format<<endl; - QString format( _format ); + kdDebug(30003)<<"TQString saveOasisNumberStyle( KoGenStyles &mainStyles, const TQString & _format ) :"<<_format<<endl; + TQString format( _format ); KoGenStyle currentStyle( KoGenStyle::STYLE_NUMERIC_NUMBER ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level - QString text; + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level + TQString text; int decimalplaces = 0; int integerdigits = 0; bool beforeSeparator = true; @@ -1088,26 +1088,26 @@ QString KoOasisStyles::saveOasisNumberStyle( KoGenStyles &mainStyles, const QStr addTextNumber(text, elementWriter ); addKofficeNumericStyleExtension( elementWriter, _suffix,_prefix ); - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); currentStyle.addChildElement( "number", elementContents ); return mainStyles.lookup( currentStyle, "N" ); } -QString KoOasisStyles::saveOasisPercentageStyle( KoGenStyles &mainStyles, const QString & _format, const QString &_prefix, const QString &_suffix ) +TQString KoOasisStyles::saveOasisPercentageStyle( KoGenStyles &mainStyles, const TQString & _format, const TQString &_prefix, const TQString &_suffix ) { //<number:percentage-style style:name="N11"> //<number:number number:decimal-places="2" number:min-integer-digits="1"/> //<number:text>%</number:text> //</number:percentage-style> - kdDebug(30003)<<"QString saveOasisPercentageStyle( KoGenStyles &mainStyles, const QString & _format ) :"<<_format<<endl; - QString format( _format ); + kdDebug(30003)<<"TQString saveOasisPercentageStyle( KoGenStyles &mainStyles, const TQString & _format ) :"<<_format<<endl; + TQString format( _format ); KoGenStyle currentStyle( KoGenStyle::STYLE_NUMERIC_PERCENTAGE ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level - QString text; + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level + TQString text; int decimalplaces = 0; int integerdigits = 0; bool beforeSeparator = true; @@ -1132,36 +1132,36 @@ QString KoOasisStyles::saveOasisPercentageStyle( KoGenStyles &mainStyles, const elementWriter.addAttribute( "number:min-integer-digits", integerdigits ); elementWriter.endElement(); - addTextNumber(QString( "%" ), elementWriter ); + addTextNumber(TQString( "%" ), elementWriter ); text =_suffix ; addTextNumber(text, elementWriter ); addKofficeNumericStyleExtension( elementWriter, _suffix,_prefix ); - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); currentStyle.addChildElement( "number", elementContents ); return mainStyles.lookup( currentStyle, "N" ); } -QString KoOasisStyles::saveOasisScientificStyle( KoGenStyles &mainStyles, const QString & _format, const QString &_prefix, const QString &_suffix ) +TQString KoOasisStyles::saveOasisScientificStyle( KoGenStyles &mainStyles, const TQString & _format, const TQString &_prefix, const TQString &_suffix ) { //<number:number-style style:name="N60"> //<number:scientific-number number:decimal-places="2" number:min-integer-digits="1" number:min-exponent-digits="3"/> //</number:number-style> //example 000,000e+0000 - kdDebug(30003)<<"QString saveOasisScientificStyle( KoGenStyles &mainStyles, const QString & _format ) :"<<_format<<endl; - QString format( _format ); + kdDebug(30003)<<"TQString saveOasisScientificStyle( KoGenStyles &mainStyles, const TQString & _format ) :"<<_format<<endl; + TQString format( _format ); KoGenStyle currentStyle( KoGenStyle::STYLE_NUMERIC_SCIENTIFIC ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); int decimalplace = 0; int integerdigits = 0; int exponentdigits = 0; - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level - QString text; + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level + TQString text; bool beforeSeparator = true; bool exponential = false; bool positive = true; @@ -1214,14 +1214,14 @@ QString KoOasisStyles::saveOasisScientificStyle( KoGenStyles &mainStyles, const addTextNumber(text, elementWriter ); addKofficeNumericStyleExtension( elementWriter, _suffix,_prefix ); - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); currentStyle.addChildElement( "number", elementContents ); return mainStyles.lookup( currentStyle, "N" ); } -QString KoOasisStyles::saveOasisCurrencyStyle( KoGenStyles &mainStyles, - const QString & _format, const QString &symbol, - const QString &_prefix, const QString &_suffix ) +TQString KoOasisStyles::saveOasisCurrencyStyle( KoGenStyles &mainStyles, + const TQString & _format, const TQString &symbol, + const TQString &_prefix, const TQString &_suffix ) { //<number:currency-style style:name="N107P0" style:volatile="true"> @@ -1230,14 +1230,14 @@ QString KoOasisStyles::saveOasisCurrencyStyle( KoGenStyles &mainStyles, //<number:currency-symbol>VEB</number:currency-symbol> //</number:currency-style> - kdDebug(30003)<<"QString saveOasisCurrencyStyle( KoGenStyles &mainStyles, const QString & _format ) :"<<_format<<endl; - QString format( _format ); + kdDebug(30003)<<"TQString saveOasisCurrencyStyle( KoGenStyles &mainStyles, const TQString & _format ) :"<<_format<<endl; + TQString format( _format ); KoGenStyle currentStyle( KoGenStyle::STYLE_NUMERIC_CURRENCY ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level - QString text; + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level + TQString text; int decimalplaces = 0; int integerdigits = 0; bool beforeSeparator = true; @@ -1274,26 +1274,26 @@ QString KoOasisStyles::saveOasisCurrencyStyle( KoGenStyles &mainStyles, elementWriter.addTextNode( symbol.utf8() ); elementWriter.endElement(); - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); currentStyle.addChildElement( "number", elementContents ); return mainStyles.lookup( currentStyle, "N" ); } -QString KoOasisStyles::saveOasisTextStyle( KoGenStyles &mainStyles, const QString & _format, const QString &_prefix, const QString &_suffix ) +TQString KoOasisStyles::saveOasisTextStyle( KoGenStyles &mainStyles, const TQString & _format, const TQString &_prefix, const TQString &_suffix ) { //<number:text-style style:name="N100"> //<number:text-content/> ///</number:text-style> - kdDebug(30003)<<"QString saveOasisTextStyle( KoGenStyles &mainStyles, const QString & _format ) :"<<_format<<endl; - QString format( _format ); + kdDebug(30003)<<"TQString saveOasisTextStyle( KoGenStyles &mainStyles, const TQString & _format ) :"<<_format<<endl; + TQString format( _format ); KoGenStyle currentStyle( KoGenStyle::STYLE_NUMERIC_TEXT ); - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - KoXmlWriter elementWriter( &buffer ); // TODO pass indentation level - QString text; + KoXmlWriter elementWriter( TQT_TQIODEVICE(&buffer) ); // TODO pass indentation level + TQString text; do { format.remove( 0,1 ); @@ -1309,13 +1309,13 @@ QString KoOasisStyles::saveOasisTextStyle( KoGenStyles &mainStyles, const QStrin addKofficeNumericStyleExtension( elementWriter, _suffix,_prefix ); elementWriter.endElement(); - QString elementContents = QString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); + TQString elementContents = TQString::fromUtf8( buffer.buffer(), buffer.buffer().size() ); currentStyle.addChildElement( "number", elementContents ); return mainStyles.lookup( currentStyle, "N" ); } //This is an extension of numeric style. For the moment we used namespace of oasis format for specific koffice extention. change it for the futur. -void KoOasisStyles::addKofficeNumericStyleExtension( KoXmlWriter & elementWriter, const QString &_suffix, const QString &_prefix ) +void KoOasisStyles::addKofficeNumericStyleExtension( KoXmlWriter & elementWriter, const TQString &_suffix, const TQString &_prefix ) { if ( !_suffix.isEmpty() ) { @@ -1331,50 +1331,50 @@ void KoOasisStyles::addKofficeNumericStyleExtension( KoXmlWriter & elementWriter } } -void KoOasisStyles::saveOasisFillStyle( KoGenStyle &styleFill, KoGenStyles& mainStyles, const QBrush & brush ) +void KoOasisStyles::saveOasisFillStyle( KoGenStyle &styleFill, KoGenStyles& mainStyles, const TQBrush & brush ) { - if ( brush.style() == Qt::SolidPattern ) + if ( brush.style() == TQt::SolidPattern ) { styleFill.addProperty( "draw:fill","solid" ); styleFill.addProperty( "draw:fill-color", brush.color().name() ); } - else if ( brush.style() == Qt::Dense1Pattern ) + else if ( brush.style() == TQt::Dense1Pattern ) { styleFill.addProperty( "draw:transparency", "94%" ); styleFill.addProperty( "draw:fill","solid" ); styleFill.addProperty( "draw:fill-color", brush.color().name() ); } - else if ( brush.style() == Qt::Dense2Pattern ) + else if ( brush.style() == TQt::Dense2Pattern ) { styleFill.addProperty( "draw:transparency", "88%" ); styleFill.addProperty( "draw:fill","solid" ); styleFill.addProperty( "draw:fill-color", brush.color().name() ); } - else if ( brush.style() == Qt::Dense3Pattern ) + else if ( brush.style() == TQt::Dense3Pattern ) { styleFill.addProperty( "draw:transparency", "63%" ); styleFill.addProperty( "draw:fill","solid" ); styleFill.addProperty( "draw:fill-color", brush.color().name() ); } - else if ( brush.style() == Qt::Dense4Pattern ) + else if ( brush.style() == TQt::Dense4Pattern ) { styleFill.addProperty( "draw:transparency", "50%" ); styleFill.addProperty( "draw:fill","solid" ); styleFill.addProperty( "draw:fill-color", brush.color().name() ); } - else if ( brush.style() == Qt::Dense5Pattern ) + else if ( brush.style() == TQt::Dense5Pattern ) { styleFill.addProperty( "draw:transparency", "37%" ); styleFill.addProperty( "draw:fill","solid" ); styleFill.addProperty( "draw:fill-color", brush.color().name() ); } - else if ( brush.style() == Qt::Dense6Pattern ) + else if ( brush.style() == TQt::Dense6Pattern ) { styleFill.addProperty( "draw:transparency", "12%" ); styleFill.addProperty( "draw:fill","solid" ); styleFill.addProperty( "draw:fill-color", brush.color().name() ); } - else if ( brush.style() == Qt::Dense7Pattern ) + else if ( brush.style() == TQt::Dense7Pattern ) { styleFill.addProperty( "draw:transparency", "6%" ); styleFill.addProperty( "draw:fill","solid" ); @@ -1388,34 +1388,34 @@ void KoOasisStyles::saveOasisFillStyle( KoGenStyle &styleFill, KoGenStyles& main } -QString KoOasisStyles::saveOasisHatchStyle( KoGenStyles& mainStyles, const QBrush &brush ) +TQString KoOasisStyles::saveOasisHatchStyle( KoGenStyles& mainStyles, const TQBrush &brush ) { KoGenStyle hatchStyle( KoGenStyle::STYLE_HATCH /*no family name*/); hatchStyle.addAttribute( "draw:color", brush.color().name() ); //hatchStyle.addAttribute( "draw:distance", m_distance ); not implemented into kpresenter switch( brush.style() ) { - case Qt::HorPattern: + case TQt::HorPattern: hatchStyle.addAttribute( "draw:style", "single" ); hatchStyle.addAttribute( "draw:rotation", 0); break; - case Qt::BDiagPattern: + case TQt::BDiagPattern: hatchStyle.addAttribute( "draw:style", "single" ); hatchStyle.addAttribute( "draw:rotation", 450); break; - case Qt::VerPattern: + case TQt::VerPattern: hatchStyle.addAttribute( "draw:style", "single" ); hatchStyle.addAttribute( "draw:rotation", 900); break; - case Qt::FDiagPattern: + case TQt::FDiagPattern: hatchStyle.addAttribute( "draw:style", "single" ); hatchStyle.addAttribute( "draw:rotation", 1350); break; - case Qt::CrossPattern: + case TQt::CrossPattern: hatchStyle.addAttribute( "draw:style", "double" ); hatchStyle.addAttribute( "draw:rotation", 0); break; - case Qt::DiagCrossPattern: + case TQt::DiagCrossPattern: hatchStyle.addAttribute( "draw:style", "double" ); hatchStyle.addAttribute( "draw:rotation", 450); break; @@ -1426,9 +1426,9 @@ QString KoOasisStyles::saveOasisHatchStyle( KoGenStyles& mainStyles, const QBrus return mainStyles.lookup( hatchStyle, "hatch" ); } -QBrush KoOasisStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const QString & fill, const KoOasisStyles & oasisStyles ) +TQBrush KoOasisStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const TQString & fill, const KoOasisStyles & oasisStyles ) { - QBrush tmpBrush; + TQBrush tmpBrush; if ( fill == "solid" ) { tmpBrush.setStyle(static_cast<Qt::BrushStyle>( 1 ) ); @@ -1436,7 +1436,7 @@ QBrush KoOasisStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const tmpBrush.setColor(styleStack.attributeNS( KoXmlNS::draw, "fill-color" ) ); if ( styleStack.hasAttributeNS( KoXmlNS::draw, "transparency" ) ) { - QString transparency = styleStack.attributeNS( KoXmlNS::draw, "transparency" ); + TQString transparency = styleStack.attributeNS( KoXmlNS::draw, "transparency" ); if ( transparency == "94%" ) { tmpBrush.setStyle(Qt::Dense1Pattern); @@ -1476,25 +1476,25 @@ QBrush KoOasisStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const } else if ( fill == "hatch" ) { - QString style = styleStack.attributeNS( KoXmlNS::draw, "fill-hatch-name" ); + TQString style = styleStack.attributeNS( KoXmlNS::draw, "fill-hatch-name" ); kdDebug()<<" hatch style is : "<<style<<endl; //type not defined by default //try to use style. - QDomElement* draw = oasisStyles.drawStyles()[style]; + TQDomElement* draw = oasisStyles.drawStyles()[style]; if ( draw) { kdDebug()<<"We have a style\n"; int angle = 0; if( draw->hasAttributeNS( KoXmlNS::draw, "rotation" )) { - angle = (draw->attributeNS( KoXmlNS::draw, "rotation", QString::null ).toInt())/10; + angle = (draw->attributeNS( KoXmlNS::draw, "rotation", TQString() ).toInt())/10; kdDebug()<<"angle :"<<angle<<endl; } if(draw->hasAttributeNS( KoXmlNS::draw, "color" ) ) { - //kdDebug()<<" draw:color :"<<draw->attributeNS( KoXmlNS::draw, "color", QString::null )<<endl; - tmpBrush.setColor(draw->attributeNS( KoXmlNS::draw, "color", QString::null ) ); + //kdDebug()<<" draw:color :"<<draw->attributeNS( KoXmlNS::draw, "color", TQString() )<<endl; + tmpBrush.setColor(draw->attributeNS( KoXmlNS::draw, "color", TQString() ) ); } if( draw->hasAttributeNS( KoXmlNS::draw, "distance" )) { @@ -1507,7 +1507,7 @@ QBrush KoOasisStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const if( draw->hasAttributeNS( KoXmlNS::draw, "style" )) { //todo implemente it into kpresenter - QString styleHash = draw->attributeNS( KoXmlNS::draw, "style", QString::null ); + TQString styleHash = draw->attributeNS( KoXmlNS::draw, "style", TQString() ); if( styleHash == "single") { switch( angle ) @@ -1567,21 +1567,21 @@ QBrush KoOasisStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const return tmpBrush; } -const QDomElement* KoOasisStyles::defaultStyle( const QString& family ) const +const TQDomElement* KoOasisStyles::defaultStyle( const TQString& family ) const { return m_defaultStyle[family]; } -const QDomElement* KoOasisStyles::findStyle( const QString& name ) const +const TQDomElement* KoOasisStyles::findStyle( const TQString& name ) const { return m_styles[ name ]; } -const QDomElement* KoOasisStyles::findStyle( const QString& styleName, const QString& family ) const +const TQDomElement* KoOasisStyles::findStyle( const TQString& styleName, const TQString& family ) const { - const QDomElement* style = d->m_styles[ family ][ styleName ]; + const TQDomElement* style = d->m_styles[ family ][ styleName ]; if ( style && !family.isEmpty() ) { - const QString styleFamily = style->attributeNS( KoXmlNS::style, "family", QString::null ); + const TQString styleFamily = style->attributeNS( KoXmlNS::style, "family", TQString() ); if ( styleFamily != family ) { kdWarning() << "KoOasisStyles: was looking for style " << styleName << " in family " << family << " but got " << styleFamily << endl; @@ -1590,11 +1590,11 @@ const QDomElement* KoOasisStyles::findStyle( const QString& styleName, const QSt return style; } -const QDomElement* KoOasisStyles::findStyleAutoStyle( const QString& styleName, const QString& family ) const +const TQDomElement* KoOasisStyles::findStyleAutoStyle( const TQString& styleName, const TQString& family ) const { - const QDomElement* style = d->m_stylesAutoStyles[ family ][ styleName ]; + const TQDomElement* style = d->m_stylesAutoStyles[ family ][ styleName ]; if ( style ) { - const QString styleFamily = style->attributeNS( KoXmlNS::style, "family", QString::null ); + const TQString styleFamily = style->attributeNS( KoXmlNS::style, "family", TQString() ); if ( styleFamily != family ) { kdWarning() << "KoOasisStyles: was looking for style " << styleName << " in family " << family << " but got " << styleFamily << endl; |