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 /filters/kword/rtf/import/rtfimport.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 'filters/kword/rtf/import/rtfimport.cpp')
-rw-r--r-- | filters/kword/rtf/import/rtfimport.cpp | 514 |
1 files changed, 257 insertions, 257 deletions
diff --git a/filters/kword/rtf/import/rtfimport.cpp b/filters/kword/rtf/import/rtfimport.cpp index 7418494d3..bb17d5328 100644 --- a/filters/kword/rtf/import/rtfimport.cpp +++ b/filters/kword/rtf/import/rtfimport.cpp @@ -1,4 +1,4 @@ -// kate: space-indent on; indent-width 4; replace-tabs off; +// kate: space-indent on; indent-width 4; tqreplace-tabs off; /* This file is part of the KDE project Copyright (C) 2001 Ewald Snel <ewald@rambo.its.tudelft.nl> @@ -14,18 +14,18 @@ // ### FIXME: copyright holders/date #include <kdebug.h> -#include <qfontinfo.h> +#include <tqfontinfo.h> #include <stddef.h> #include <string.h> #include <KoFilterChain.h> #include <kgenericfactory.h> -#include <qcstring.h> -#include <qstringlist.h> -#include <qdir.h> -#include <qfileinfo.h> -#include <qregexp.h> -#include <qvaluelist.h> +#include <tqcstring.h> +#include <tqstringlist.h> +#include <tqdir.h> +#include <tqfileinfo.h> +#include <tqregexp.h> +#include <tqvaluelist.h> #include <kurl.h> #include <kmessagebox.h> @@ -98,7 +98,7 @@ static RTFProperty propertyTable[] = MEMBER( 0L, "b", setToggleProperty, state.format.bold, 0 ), // \bin is handled in the tokenizer MEMBER( "@colortbl", "blue", setNumericProperty, blue, 0 ), - MEMBER( 0L, "box", setEnumProperty, state.layout.border, 0 ), + MEMBER( 0L, "box", setEnumProperty, state.tqlayout.border, 0 ), PROP( 0L, "brdrb", selectLayoutBorder, 0L, 3 ), PROP( 0L, "brdrcf", setBorderColor, 0L, 0 ), PROP( 0L, "brdrdash", setBorderStyle, 0L, RTFBorder::Dashes ), @@ -146,29 +146,29 @@ static RTFProperty propertyTable[] = PROP( 0L, "expndtw", ignoreKeyword, 0L, 0 ), // Expansion/compression of character inter-space not supported MEMBER( 0L, "f", setNumericProperty, state.format.font, 0 ), MEMBER( "@rtf", "facingp", setFlagProperty, facingPages, true ), - PROP( 0L, "fcharset", setCharset, 0L, 0 ), // Not needed with Qt - PROP( "@fonttbl", "fdecor", setFontStyleHint, 0L, QFont::Decorative ), - MEMBER( 0L, "fi", setNumericProperty, state.layout.firstIndent, 0 ), - PROP( "@fonttbl", "fmodern", setFontStyleHint, 0L, QFont::TypeWriter ), - PROP( "@fonttbl", "fnil", setFontStyleHint, 0L, QFont::AnyStyle ), + PROP( 0L, "fcharset", setCharset, 0L, 0 ), // Not needed with TQt + PROP( "@fonttbl", "fdecor", setFontStyleHint, 0L, TQFont::Decorative ), + MEMBER( 0L, "fi", setNumericProperty, state.tqlayout.firstIndent, 0 ), + PROP( "@fonttbl", "fmodern", setFontStyleHint, 0L, TQFont::TypeWriter ), + PROP( "@fonttbl", "fnil", setFontStyleHint, 0L, TQFont::AnyStyle ), MEMBER( 0L, "footery", setNumericProperty, state.section.footerMargin, 0 ), PROP( 0L, "formshade", ignoreKeyword, 0L, 0 ), // Not supported, KWord has no form support MEMBER( "@fonttbl", "fprq", setNumericProperty, font.fixedPitch, 0 ), - PROP( "@fonttbl", "froman", setFontStyleHint, 0L, QFont::Serif ), + PROP( "@fonttbl", "froman", setFontStyleHint, 0L, TQFont::Serif ), MEMBER( 0L, "fs", setNumericProperty, state.format.fontSize, 0 ), - PROP( "@fonttbl", "fscript", setFontStyleHint, 0L, QFont::AnyStyle ), - PROP( "@fonttbl", "fswiss", setFontStyleHint, 0L, QFont::SansSerif ), - PROP( "@fonttbl", "ftech", setFontStyleHint, 0L, QFont::AnyStyle ), + PROP( "@fonttbl", "fscript", setFontStyleHint, 0L, TQFont::AnyStyle ), + PROP( "@fonttbl", "fswiss", setFontStyleHint, 0L, TQFont::SansSerif ), + PROP( "@fonttbl", "ftech", setFontStyleHint, 0L, TQFont::AnyStyle ), MEMBER( "@colortbl", "green", setNumericProperty, green, 0 ), MEMBER( 0L, "headery", setNumericProperty, state.section.headerMargin, 0 ), MEMBER( 0L, "i", setToggleProperty, state.format.italic, 0 ), - MEMBER( 0L, "intbl", setFlagProperty, state.layout.inTable, true ), + MEMBER( 0L, "intbl", setFlagProperty, state.tqlayout.inTable, true ), PROP( "@pict", "jpegblip", setPictureType, 0L, RTFPicture::JPEG ), - MEMBER( 0L, "keep", setFlagProperty, state.layout.keep, true ), - MEMBER( 0L, "keepn", setFlagProperty, state.layout.keepNext, true ), + MEMBER( 0L, "keep", setFlagProperty, state.tqlayout.keep, true ), + MEMBER( 0L, "keepn", setFlagProperty, state.tqlayout.keepNext, true ), MEMBER( "@rtf", "landscape", setFlagProperty, landscape, true ), PROP( 0L, "ldblquote", insertSymbol, 0L, 0x201c ), - MEMBER( 0L, "li", setNumericProperty, state.layout.leftIndent, 0 ), + MEMBER( 0L, "li", setNumericProperty, state.tqlayout.leftIndent, 0 ), PROP( 0L, "line", insertSymbol, 0L, 0x000a ), PROP( 0L, "lquote", insertSymbol, 0L, 0x2018 ), PROP( 0L, "ltrmark", insertSymbol, 0L, 0x200e ), @@ -180,14 +180,14 @@ static RTFProperty propertyTable[] = MEMBER( "@rtf", "margt", setNumericProperty, topMargin, 0 ), MEMBER( 0L, "nosupersub", setEnumProperty, state.format.vertAlign, RTFFormat::Normal ), PROP( "Text", "page", insertPageBreak, 0L, 0 ), - MEMBER( 0L, "pagebb", setFlagProperty, state.layout.pageBB, true ), + MEMBER( 0L, "pagebb", setFlagProperty, state.tqlayout.pageBB, true ), MEMBER( "@rtf", "paperh", setNumericProperty, paperHeight, 0 ), MEMBER( "@rtf", "paperw", setNumericProperty, paperWidth, 0 ), PROP( "Text", "par", insertParagraph, 0L, 0 ), PROP( 0L, "pard", setParagraphDefaults, 0L, 0 ), PROP( 0L, "pc", setPcCodepage, 0L, 0 ), PROP( 0L, "pca", setPcaCodepage, 0L, 0 ), - MEMBER( 0L, "pgbrk", setToggleProperty, state.layout.pageBA, true ), + MEMBER( 0L, "pgbrk", setToggleProperty, state.tqlayout.pageBA, true ), MEMBER( "@pict", "piccropb", setNumericProperty, picture.cropBottom, 0 ), MEMBER( "@pict", "piccropl", setNumericProperty, picture.cropLeft, 0 ), MEMBER( "@pict", "piccropr", setNumericProperty, picture.cropRight, 0 ), @@ -202,25 +202,25 @@ static RTFProperty propertyTable[] = PROP( 0L, "plain", setPlainFormatting, 0L, 0 ), PROP( "@pict", "pmmetafile", setPictureType, 0L, RTFPicture::WMF ), PROP( "@pict", "pngblip", setPictureType, 0L, RTFPicture::PNG ), - MEMBER( 0L, "qc", setEnumProperty, state.layout.alignment, RTFLayout::Centered ), - MEMBER( 0L, "qj", setEnumProperty, state.layout.alignment, RTFLayout::Justified ), - MEMBER( 0L, "ql", setEnumProperty, state.layout.alignment, RTFLayout::Left ), + MEMBER( 0L, "qc", setEnumProperty, state.tqlayout.tqalignment, RTFLayout::Centered ), + MEMBER( 0L, "qj", setEnumProperty, state.tqlayout.tqalignment, RTFLayout::Justified ), + MEMBER( 0L, "ql", setEnumProperty, state.tqlayout.tqalignment, RTFLayout::Left ), PROP( 0L, "qmspace", insertSymbol, 0L, 0x2004 ), - MEMBER( 0L, "qr", setEnumProperty, state.layout.alignment, RTFLayout::Right ), + MEMBER( 0L, "qr", setEnumProperty, state.tqlayout.tqalignment, RTFLayout::Right ), PROP( 0L, "rdblquote", insertSymbol, 0L, 0x201d ), MEMBER( "@colortbl", "red", setNumericProperty, red, 0 ), - MEMBER( 0L, "ri", setNumericProperty, state.layout.rightIndent, 0 ), + MEMBER( 0L, "ri", setNumericProperty, state.tqlayout.rightIndent, 0 ), PROP( "Text", "row", insertTableRow, 0L, 0 ), PROP( 0L, "rquote", insertSymbol, 0L, 0x2019 ), PROP( 0L, "rtlmark", insertSymbol, 0L, 0x200f ), - MEMBER( 0L, "s", setNumericProperty, state.layout.style, 0 ), - MEMBER( 0L, "sa", setNumericProperty, state.layout.spaceAfter, 0 ), - MEMBER( 0L, "sb", setNumericProperty, state.layout.spaceBefore, 0 ), + MEMBER( 0L, "s", setNumericProperty, state.tqlayout.style, 0 ), + MEMBER( 0L, "sa", setNumericProperty, state.tqlayout.spaceAfter, 0 ), + MEMBER( 0L, "sb", setNumericProperty, state.tqlayout.spaceBefore, 0 ), MEMBER( 0L, "scaps", setToggleProperty, state.format.smallCaps, 0 ), PROP( "Text", "sect", insertPageBreak, 0L, 0 ), PROP( 0L, "sectd", setSectionDefaults, 0L, 0 ), - MEMBER( 0L, "sl", setNumericProperty, state.layout.spaceBetween, 0 ), - MEMBER( 0L, "slmult", setToggleProperty, state.layout.spaceBetweenMultiple, 0 ), + MEMBER( 0L, "sl", setNumericProperty, state.tqlayout.spaceBetween, 0 ), + MEMBER( 0L, "slmult", setToggleProperty, state.tqlayout.spaceBetweenMultiple, 0 ), MEMBER( "@stylesheet", "snext", setNumericProperty, style.next, 0 ), MEMBER( 0L, "strike", setToggleProperty, state.format.strike, 0 ), MEMBER( 0L, "striked", setToggleProperty, state.format.striked, 0 ), @@ -228,18 +228,18 @@ static RTFProperty propertyTable[] = MEMBER( 0L, "super", setEnumProperty, state.format.vertAlign, RTFFormat::SuperScript ), PROP( 0L, "tab", insertSymbol, 0L, 0x0009 ), MEMBER( 0L, "titlepg", setFlagProperty, state.section.titlePage, true ), - MEMBER( 0L, "tldot", setEnumProperty, state.layout.tab.leader, RTFTab::Dots ), - MEMBER( 0L, "tlhyph", setEnumProperty, state.layout.tab.leader, RTFTab::Hyphens ), - MEMBER( 0L, "tlth", setEnumProperty, state.layout.tab.leader, RTFTab::ThickLine ), - MEMBER( 0L, "tlul", setEnumProperty, state.layout.tab.leader, RTFTab::Underline ), - MEMBER( 0L, "tqc", setEnumProperty, state.layout.tab.type, RTFTab::Centered ), - MEMBER( 0L, "tqdec", setEnumProperty, state.layout.tab.type, RTFTab::Decimal ), - MEMBER( 0L, "tqr", setEnumProperty, state.layout.tab.type, RTFTab::FlushRight ), + MEMBER( 0L, "tldot", setEnumProperty, state.tqlayout.tab.leader, RTFTab::Dots ), + MEMBER( 0L, "tlhyph", setEnumProperty, state.tqlayout.tab.leader, RTFTab::Hyphens ), + MEMBER( 0L, "tlth", setEnumProperty, state.tqlayout.tab.leader, RTFTab::ThickLine ), + MEMBER( 0L, "tlul", setEnumProperty, state.tqlayout.tab.leader, RTFTab::Underline ), + MEMBER( 0L, "tqc", setEnumProperty, state.tqlayout.tab.type, RTFTab::Centered ), + MEMBER( 0L, "tqdec", setEnumProperty, state.tqlayout.tab.type, RTFTab::Decimal ), + MEMBER( 0L, "tqr", setEnumProperty, state.tqlayout.tab.type, RTFTab::FlushRight ), MEMBER( 0L, "trleft", setNumericProperty, state.tableRow.left, 0 ), MEMBER( 0L, "trowd", setTableRowDefaults, state.tableRow, 0 ), - MEMBER( 0L, "trqc", setEnumProperty, state.tableRow.alignment, RTFLayout::Centered ), - MEMBER( 0L, "trql", setEnumProperty, state.tableRow.alignment, RTFLayout::Left ), - MEMBER( 0L, "trqr", setEnumProperty, state.tableRow.alignment, RTFLayout::Right ), + MEMBER( 0L, "trqc", setEnumProperty, state.tableRow.tqalignment, RTFLayout::Centered ), + MEMBER( 0L, "trql", setEnumProperty, state.tableRow.tqalignment, RTFLayout::Left ), + MEMBER( 0L, "trqr", setEnumProperty, state.tableRow.tqalignment, RTFLayout::Right ), MEMBER( 0L, "trrh", setNumericProperty, state.tableRow.height, 0 ), PROP( 0L, "tx", insertTabDef, 0L, 0 ), MEMBER( 0L, "u", insertUnicodeSymbol, state.format.uc, 0 ), @@ -287,7 +287,7 @@ static const char *alignN[4] = { "left", "right", "justify", "center" }; static const char *boolN[2] = { "false", "true" }; static const char *borderN[4] = { "LEFTBORDER", "RIGHTBORDER", "TOPBORDER", "BOTTOMBORDER" }; -RTFImport::RTFImport( KoFilter *, const char *, const QStringList& ) +RTFImport::RTFImport( KoFilter *, const char *, const TQStringList& ) : KoFilter(), properties(181), destinationProperties(29), textCodec(0), utf8TextCodec(0) { for (uint i=0; i < sizeof(propertyTable) / sizeof(propertyTable[0]); i++) @@ -299,7 +299,7 @@ RTFImport::RTFImport( KoFilter *, const char *, const QStringList& ) destinationProperties.insert( destinationPropertyTable[i].name, &destinationPropertyTable[i] ); } // DEBUG START - // Check the hash size (see QDict doc) + // Check the hash size (see TQDict doc) kdDebug(30515) << properties.count() << " normal and " << destinationProperties.count() << " destination keywords loaded" << endl; if (properties.size() < properties.count()) kdWarning(30515) << "Hash size of properties too small: " << properties.size() << ". It should be at least " << properties.count() << " and be a prime number"<< endl; @@ -309,13 +309,13 @@ RTFImport::RTFImport( KoFilter *, const char *, const QStringList& ) fnnum=0; } -KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCString& to ) +KoFilter::ConversiontqStatus RTFImport::convert( const TQCString& from, const TQCString& to ) { // This filter only supports RTF to KWord conversion if ((from != "text/rtf") || (to != "application/x-kword")) return KoFilter::NotImplemented; - QTime debugTime; + TQTime debugTime; debugTime.start(); // Are we in batch mode, i.e. non-interactive @@ -325,7 +325,7 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr // Open input file inFileName = m_chain->inputFile(); - QFile in( inFileName ); + TQFile in( inFileName ); if (!in.open( IO_ReadOnly )) { @@ -384,7 +384,7 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr if ( !m_batch ) { force = ( KMessageBox::warningYesNo( 0L, - i18n("The RTF (Rich Text Format) document has an unexpected version number: %1. Continuing might result in an erroneous conversion. Do you want to continue?").arg( token.value ), + i18n("The RTF (Rich Text Format) document has an unexpected version number: %1. Continuing might result in an erroneous conversion. Do you want to continue?").tqarg( token.value ), i18n("KWord's RTF Import Filter") ) == KMessageBox::Yes ); } if ( !force ) @@ -403,7 +403,7 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr if ( !m_batch ) { force = ( KMessageBox::warningYesNo( 0L, - i18n("The PWD (PocketWord's Rich Text Format) document has an unexpected version number: %1. Continuing might result in an erroneous conversion. Do you want to continue?").arg( token.value ), + i18n("The PWD (PocketWord's Rich Text Format) document has an unexpected version number: %1. Continuing might result in an erroneous conversion. Do you want to continue?").tqarg( token.value ), i18n("KWord's RTF Import Filter") ) == KMessageBox::Yes ); } if ( !force ) @@ -422,7 +422,7 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr if ( !m_batch ) { force = ( KMessageBox::warningYesNo( 0L, - i18n("The URTF (\"Unicode Rich Text Format\") document has an unexpected version number: %1. Continuing might result in an erroneous conversion. Do you want to continue?").arg( token.value ), + i18n("The URTF (\"Unicode Rich Text Format\") document has an unexpected version number: %1. Continuing might result in an erroneous conversion. Do you want to continue?").tqarg( token.value ), i18n("KWord's RTF Import Filter") ) == KMessageBox::Yes ); } if ( !force ) @@ -439,7 +439,7 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr if ( !m_batch ) { KMessageBox::error( 0L, - i18n("The RTF document cannot be loaded, as it has an unexpected first keyword: \\%1.").arg( token.text ), + i18n("The RTF document cannot be loaded, as it has an unexpected first keyword: \\%1.").tqarg( token.text ), i18n("KWord's RTF Import Filter"), 0 ); } return KoFilter::WrongFormat; @@ -487,12 +487,12 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr state.format.uc=1; state.ignoreGroup = false; - utf8TextCodec=QTextCodec::codecForName("UTF-8"); - kdDebug(30515) << "UTF-8 asked, given: " << (utf8TextCodec?utf8TextCodec->name():QString("-none-")) << endl; + utf8TextCodec=TQTextCodec::codecForName("UTF-8"); + kdDebug(30515) << "UTF-8 asked, given: " << (utf8TextCodec?TQString(utf8TextCodec->name()):TQString("-none-")) << endl; // There is no default encoding in RTF, it must be always declared. (But beware of buggy files!) - textCodec=QTextCodec::codecForName("CP 1252"); // Or IBM 437 ? - kdDebug(30515) << "CP 1252 asked, given: " << (textCodec?textCodec->name():QString("-none-")) << endl; + textCodec=TQTextCodec::codecForName("CP 1252"); // Or IBM 437 ? + kdDebug(30515) << "CP 1252 asked, given: " << (textCodec?TQString(textCodec->name()):TQString("-none-")) << endl; // Parse RTF document while (true) @@ -536,7 +536,7 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr destination = destinationStack.pop(); } } - // ### TODO: why can this not be simplified to use QValueList::isEmpty() + // ### TODO: why can this not be simplified to use TQValueList::isEmpty() if (stateStack.count() <= 1) { // End-of-document, keep formatting properties @@ -700,7 +700,7 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr int num=1; for(RTFTextState* i=footnotes.first();i;i=footnotes.next()) { - QCString str; + TQCString str; str.setNum(num); str.prepend("Footnote "); num++; @@ -722,16 +722,16 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr kwFormat.len = 0; // Process all styles in the style sheet - const QValueList<RTFStyle>::ConstIterator endStyleSheet=styleSheet.end(); - for (QValueList<RTFStyle>::ConstIterator it=styleSheet.begin();it!=endStyleSheet;++it) + const TQValueList<RTFStyle>::ConstIterator endStyleSheet=styleSheet.end(); + for (TQValueList<RTFStyle>::ConstIterator it=styleSheet.begin();it!=endStyleSheet;++it) { mainDoc.addNode( "STYLE" ); kwFormat.fmt = (*it).format; // Search for 'following' style - for (QValueList<RTFStyle>::ConstIterator it2=styleSheet.begin();it2!=endStyleSheet;++it2) + for (TQValueList<RTFStyle>::ConstIterator it2=styleSheet.begin();it2!=endStyleSheet;++it2) { - if ((*it2).layout.style == (*it).next) + if ((*it2).tqlayout.style == (*it).next) { mainDoc.addNode( "FOLLOWING" ); mainDoc.setAttribute( "name", CheckAndEscapeXmlText( (*it2).name )); @@ -739,7 +739,7 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr break; } } - addLayout( mainDoc, (*it).name, (*it).layout, false ); + addLayout( mainDoc, (*it).name, (*it).tqlayout, false ); addFormat( mainDoc, kwFormat, 0L ); mainDoc.closeNode( "STYLE" ); } @@ -791,9 +791,9 @@ KoFilter::ConversionStatus RTFImport::convert( const QCString& from, const QCStr kdDebug(30515) << "RTF FILTER TIME: " << debugTime.elapsed() << endl; - for (QMap<QString,int>::ConstIterator it=debugUnknownKeywords.begin(); + for (TQMap<TQString,int>::ConstIterator it=debugUnknownKeywords.begin(); it!=debugUnknownKeywords.end();it++) - kdDebug(30515) << "Unknown keyword: " << QString( "%1" ).arg( it.data(), 4 ) << " * " << it.key() << endl; + kdDebug(30515) << "Unknown keyword: " << TQString( "%1" ).tqarg( it.data(), 4 ) << " * " << it.key() << endl; return KoFilter::OK; } @@ -804,55 +804,55 @@ void RTFImport::ignoreKeyword( RTFProperty * ) void RTFImport::setCodepage( RTFProperty * ) { - QTextCodec* oldCodec = textCodec; - QCString cp; + TQTextCodec* oldCodec = textCodec; + TQCString cp; if ( token.value == 10000 ) { - cp = "Apple Roman"; // ### TODO: how to support the other ones (Qt does not know them!) + cp = "Apple Roman"; // ### TODO: how to support the other ones (TQt does not know them!) } else { cp.setNum( token.value ); cp.prepend("CP"); } - textCodec=QTextCodec::codecForName(cp); - kdDebug(30515) << "\\ansicpg: codepage: " << token.value << "asked: "<< cp << " given: " << (textCodec?textCodec->name():QString("-none-")) << endl; + textCodec=TQTextCodec::codecForName(cp); + kdDebug(30515) << "\\ansicpg: codepage: " << token.value << "asked: "<< cp << " given: " << (textCodec?TQString(textCodec->name()):TQString("-none-")) << endl; if ( ! textCodec ) textCodec = oldCodec; } void RTFImport::setMacCodepage( RTFProperty * ) { - QTextCodec* oldCodec = textCodec; - textCodec=QTextCodec::codecForName("Apple Roman"); - kdDebug(30515) << "\\mac " << (textCodec?textCodec->name():QString("-none-")) << endl; + TQTextCodec* oldCodec = textCodec; + textCodec=TQTextCodec::codecForName("Apple Roman"); + kdDebug(30515) << "\\mac " << (textCodec?TQString(textCodec->name()):TQString("-none-")) << endl; if ( ! textCodec ) textCodec = oldCodec; } void RTFImport::setAnsiCodepage( RTFProperty * ) { - QTextCodec* oldCodec = textCodec; - textCodec=QTextCodec::codecForName("CP1252"); - kdDebug(30515) << "\\ansi " << (textCodec?textCodec->name():QString("-none-")) << endl; + TQTextCodec* oldCodec = textCodec; + textCodec=TQTextCodec::codecForName("CP1252"); + kdDebug(30515) << "\\ansi " << (textCodec?TQString(textCodec->name()):TQString("-none-")) << endl; if ( ! textCodec ) textCodec = oldCodec; } void RTFImport::setPcaCodepage( RTFProperty * ) { - QTextCodec* oldCodec = textCodec; - textCodec=QTextCodec::codecForName("IBM 850"); // Qt writes the name with a space - kdDebug(30515) << "\\pca " << (textCodec?textCodec->name():QString("-none-")) << endl; + TQTextCodec* oldCodec = textCodec; + textCodec=TQTextCodec::codecForName("IBM 850"); // TQt writes the name with a space + kdDebug(30515) << "\\pca " << (textCodec?TQString(textCodec->name()):TQString("-none-")) << endl; if ( ! textCodec ) textCodec = oldCodec; } void RTFImport::setPcCodepage( RTFProperty * ) { - QTextCodec* oldCodec = textCodec; - textCodec=QTextCodec::codecForName("IBM 850"); // This is an approximation - kdDebug(30515) << "\\pc (approximation) " << (textCodec?textCodec->name():QString("-none-")) << endl; + TQTextCodec* oldCodec = textCodec; + textCodec=TQTextCodec::codecForName("IBM 850"); // This is an approximation + kdDebug(30515) << "\\pc (approximation) " << (textCodec?TQString(textCodec->name()):TQString("-none-")) << endl; if ( ! textCodec ) textCodec = oldCodec; } @@ -869,7 +869,7 @@ void RTFImport::setFlagProperty( RTFProperty *property ) void RTFImport::setCharset( RTFProperty *property ) { - QCString cp; + TQCString cp; switch(token.value) { case 0: cp = "CP1252"; break; // ANSI_CHARSET case 1: cp = "CP1252"; break; // DEFAULT_CHARSET @@ -877,7 +877,7 @@ void RTFImport::setCharset( RTFProperty *property ) case 77: cp = "Apple Roman"; break; // MAC_CHARSET case 128: cp = "Shift-JIS"; break; // SHIFTJIS_CHARSET "CP932" case 129: cp = "eucKR"; break; // HANGUL_CHARSET "CP949" - case 130: cp = "CP1361"; break; // JOHAB_CHARSET doesn't really seem to be supported by Qt :-( + case 130: cp = "CP1361"; break; // JOHAB_CHARSET doesn't really seem to be supported by TQt :-( case 134: cp = "GB2312"; break; // GB2312_CHARSET "CP936" case 136: cp = "Big5-HKSCS"; break; // CHINESEBIG5_CHARSET "CP950" case 161: cp = "CP1253"; break; // GREEK_CHARSET @@ -892,9 +892,9 @@ void RTFImport::setCharset( RTFProperty *property ) case 255: cp = "CP850"; break; // OEM_CHARSET "IBM 850" default: return; } - QTextCodec* oldCodec = textCodec; - textCodec=QTextCodec::codecForName(cp); - kdDebug(30515) << "\\fcharset: charset: " << token.value << " codepage: "<< cp << " given: " << (textCodec?textCodec->name():QString("-none-")) << endl; + TQTextCodec* oldCodec = textCodec; + textCodec=TQTextCodec::codecForName(cp); + kdDebug(30515) << "\\fcharset: charset: " << token.value << " codepage: "<< cp << " given: " << (textCodec?TQString(textCodec->name()):TQString("-none-")) << endl; if ( ! textCodec ) textCodec = oldCodec; } @@ -911,7 +911,7 @@ void RTFImport::setEnumProperty( RTFProperty *property ) void RTFImport::setFontStyleHint( RTFProperty* property ) { - font.styleHint = QFont::StyleHint( property->value ); + font.tqstyleHint = TQFont::StyleHint( property->value ); } void RTFImport::setPictureType( RTFProperty* property ) @@ -933,15 +933,15 @@ void RTFImport::setUnderlineProperty( RTFProperty* property ) void RTFImport::setBorderStyle( RTFProperty *property ) { - if (state.layout.border) + if (state.tqlayout.border) { - state.layout.border->style = static_cast <RTFBorder::BorderStyle> ( property->value ); + state.tqlayout.border->style = static_cast <RTFBorder::BorderStyle> ( property->value ); } else { for (uint i=0; i < 4; i++) { - state.layout.borders[i].style = static_cast <RTFBorder::BorderStyle> ( property->value ); + state.tqlayout.borders[i].style = static_cast <RTFBorder::BorderStyle> ( property->value ); } } } @@ -949,30 +949,30 @@ void RTFImport::setBorderStyle( RTFProperty *property ) void RTFImport::setBorderProperty( RTFProperty *property ) { //kdDebug() << "setBorderProperty: " << endl; - if (state.layout.border) + if (state.tqlayout.border) { - state.layout.border->width = token.value; + state.tqlayout.border->width = token.value; } else { for (uint i=0; i < 4; i++) { - state.layout.borders[i].width = token.value; + state.tqlayout.borders[i].width = token.value; } } } void RTFImport::setBorderColor( RTFProperty * ) { - if (state.layout.border) + if (state.tqlayout.border) { - state.layout.border->color = token.value; + state.tqlayout.border->color = token.value; } else { for (uint i=0; i < 4; i++) { - state.layout.borders[i].color = token.value; + state.tqlayout.borders[i].color = token.value; } } } @@ -1008,34 +1008,34 @@ void RTFImport::setPlainFormatting( RTFProperty * ) void RTFImport::setParagraphDefaults( RTFProperty * ) { - RTFLayout &layout = state.layout; + RTFLayout &tqlayout = state.tqlayout; - layout.tablist.clear(); - layout.tab.type = RTFTab::Left; - layout.tab.leader = RTFTab::None; + tqlayout.tablist.clear(); + tqlayout.tab.type = RTFTab::Left; + tqlayout.tab.leader = RTFTab::None; for (uint i=0; i < 4; i++) { - RTFBorder &border = layout.borders[i]; + RTFBorder &border = tqlayout.borders[i]; border.color = -1; border.width = 0; border.style = RTFBorder::None; } - layout.firstIndent = 0; - layout.leftIndent = 0; - layout.rightIndent = 0; - layout.spaceBefore = 0; - layout.spaceAfter = 0; - layout.spaceBetween = 0; - layout.spaceBetweenMultiple = false; - layout.style = 0; - layout.alignment = RTFLayout::Left; - layout.border = 0L; - layout.inTable = false; - layout.keep = false; - layout.keepNext = false; - layout.pageBB = false; - layout.pageBA = false; + tqlayout.firstIndent = 0; + tqlayout.leftIndent = 0; + tqlayout.rightIndent = 0; + tqlayout.spaceBefore = 0; + tqlayout.spaceAfter = 0; + tqlayout.spaceBetween = 0; + tqlayout.spaceBetweenMultiple = false; + tqlayout.style = 0; + tqlayout.tqalignment = RTFLayout::Left; + tqlayout.border = 0L; + tqlayout.inTable = false; + tqlayout.keep = false; + tqlayout.keepNext = false; + tqlayout.pageBB = false; + tqlayout.pageBA = false; } void RTFImport::setSectionDefaults( RTFProperty * ) @@ -1054,7 +1054,7 @@ void RTFImport::setTableRowDefaults( RTFProperty * ) tableRow.height = 0; tableRow.left = 0; - tableRow.alignment = RTFLayout::Left; + tableRow.tqalignment = RTFLayout::Left; tableRow.cells.clear(); tableCell.bgcolor = -1; @@ -1069,17 +1069,17 @@ void RTFImport::setTableRowDefaults( RTFProperty * ) void RTFImport::selectLayoutBorder( RTFProperty * property ) { - state.layout.border = & state.layout.borders [ property->value ]; + state.tqlayout.border = & state.tqlayout.borders [ property->value ]; } void RTFImport::selectLayoutBorderFromCell( RTFProperty * property ) { - state.layout.border = & state.tableCell.borders [ property->value ]; + state.tqlayout.border = & state.tableCell.borders [ property->value ]; } void RTFImport::insertParagraph( RTFProperty * ) { - if (state.layout.inTable) + if (state.tqlayout.inTable) { if (textState->table == 0) { @@ -1110,10 +1110,10 @@ void RTFImport::insertPageBreak( RTFProperty * ) void RTFImport::insertTableCell( RTFProperty * ) { //{{ - bool b = state.layout.inTable; - state.layout.inTable = true; + bool b = state.tqlayout.inTable; + state.tqlayout.inTable = true; insertParagraph(); - state.layout.inTable = b; + state.tqlayout.inTable = b; //}} textState->frameSets << textState->cell.toString(); textState->cell.clear( 3 ); @@ -1130,14 +1130,14 @@ void RTFImport::insertTableRow( RTFProperty * ) { char buf[64]; sprintf( buf, "Table %d", textState->table ); - RTFLayout::Alignment align = row.alignment; + RTFLayout::Alignment align = row.tqalignment; // Store the current state on the stack stateStack.push( state ); resetState(); - state.layout.alignment = align; // table alignment + state.tqlayout.tqalignment = align; // table tqalignment - // Add anchor for new table (default layout) + // Add anchor for new table (default tqlayout) addAnchor( buf ); addParagraph( textState->node, false ); @@ -1202,9 +1202,9 @@ void RTFImport::insertCellDef( RTFProperty * ) void RTFImport::insertTabDef( RTFProperty * ) { - RTFTab tab = state.layout.tab; + RTFTab tab = state.tqlayout.tab; tab.position = token.value; - state.layout.tablist.push( tab ); + state.tqlayout.tablist.push( tab ); tab.type = RTFTab::Left; tab.leader = RTFTab::None; } @@ -1235,12 +1235,12 @@ void RTFImport::insertUTF8( int ch ) *text++ = ch; *text++ = 0; - QTextCodec* oldCodec=textCodec; + TQTextCodec* oldCodec=textCodec; if (utf8TextCodec) textCodec=utf8TextCodec; else - kdError(30515) << "No UTF-8 QTextCodec available" << endl; + kdError(30515) << "No UTF-8 TQTextCodec available" << endl; (this->*destination.destproc)(0L); @@ -1297,7 +1297,7 @@ void RTFImport::insertUnicodeSymbol( RTFProperty * ) } else if (token.type == RTFTokenizer::PlainText) { - const uint len = qstrlen( token.text ); + const uint len = tqstrlen( token.text ); if ( len < i ) i -= len; else @@ -1320,8 +1320,8 @@ void RTFImport::parseFontTable( RTFProperty * ) { if (token.type == RTFTokenizer::OpenGroup) { - font.name = QString::null; - font.styleHint = QFont::AnyStyle; + font.name = TQString(); + font.tqstyleHint = TQFont::AnyStyle; font.fixedPitch = 0; } else if (token.type == RTFTokenizer::PlainText) @@ -1341,20 +1341,20 @@ void RTFImport::parseFontTable( RTFProperty * ) // Add font to font table *strchr( token.text, ';' ) = 0; // ### TODO: is this allowed with multi-byte Asian characters? font.name += textCodec->toUnicode( token.text ); - // Use Qt to look up the closest matching installed font - QFont qFont( font.name ); + // Use TQt to look up the closest matching installed font + TQFont qFont( font.name ); qFont.setFixedPitch( (font.fixedPitch == 1) ); - qFont.setStyleHint( font.styleHint ); + qFont.setStyleHint( font.tqstyleHint ); for(;!qFont.exactMatch();) { - int space=font.name.findRev(' ', font.name.length()); + int space=font.name.tqfindRev(' ', font.name.length()); if(space==-1) break; font.name.truncate(space); qFont.setFamily( font.name ); } - const QFontInfo info( qFont ); - const QString newFontName ( info.family() ); + const TQFontInfo info( qFont ); + const TQString newFontName ( info.family() ); kdDebug(30515) << "Font " << state.format.font << " asked: " << font.name << " given: " << newFontName << endl; if ( newFontName.isEmpty() ) @@ -1362,7 +1362,7 @@ void RTFImport::parseFontTable( RTFProperty * ) else fontTable.insert( state.format.font, newFontName ); font.name.truncate( 0 ); - font.styleHint = QFont::AnyStyle; + font.tqstyleHint = TQFont::AnyStyle; font.fixedPitch = 0; } } @@ -1386,8 +1386,8 @@ void RTFImport::parseStyleSheet( RTFProperty * ) *strchr( token.text, ';' ) = 0; // ### TODO: is this allowed with multi-byte Asian characters? style.name += textCodec->toUnicode( token.text ); style.format = state.format; - style.layout = state.layout; - style.next = (style.next == -1) ? style.layout.style : style.next; + style.tqlayout = state.tqlayout; + style.next = (style.next == -1) ? style.tqlayout.style : style.next; styleSheet << style; style.name.truncate( 0 ); style.next = -1; @@ -1409,7 +1409,7 @@ void RTFImport::parseColorTable( RTFProperty * ) // Search for semicolon(s) while ((token.text = strchr( token.text, ';' ))) { - colorTable << QColor( red, green, blue ); + colorTable << TQColor( red, green, blue ); red = green = blue = 0; ++token.text; } @@ -1420,11 +1420,11 @@ void RTFImport::parseBlipUid( RTFProperty * ) { if (token.type == RTFTokenizer::OpenGroup) { - picture.identifier = QString::null; + picture.identifier = TQString(); } else if (token.type == RTFTokenizer::PlainText) { - picture.identifier += QString::fromUtf8( token.text ); + picture.identifier += TQString::fromUtf8( token.text ); } else if (token.type == RTFTokenizer::CloseGroup) { @@ -1452,7 +1452,7 @@ void RTFImport::parsePicture( RTFProperty * ) picture.cropBottom = 0; picture.nibble = 0; picture.bits.truncate( 0 ); - picture.identifier = QString::null; + picture.identifier = TQString(); } else if (token.type == RTFTokenizer::PlainText) { @@ -1460,7 +1460,7 @@ void RTFImport::parsePicture( RTFProperty * ) { *(--token.text) = picture.nibble; } - uint n = qstrlen( token.text ) >> 1; + uint n = tqstrlen( token.text ) >> 1; picture.bits.resize( picture.bits.size() + n ); char *src = token.text; char *dst = (picture.bits.data() + picture.bits.size() - n); @@ -1506,15 +1506,15 @@ void RTFImport::parsePicture( RTFProperty * ) break; } const int id = ++pictureNumber; - QString pictName("pictures/picture"); - pictName += QString::number(id); + TQString pictName("pictures/picture"); + pictName += TQString::number(id); pictName += ext; - QCString frameName; + TQCString frameName; frameName.setNum(id); frameName.prepend("Picture "); - QString idStr; + TQString idStr; if (picture.identifier.isEmpty()) { idStr = pictName; @@ -1538,8 +1538,8 @@ void RTFImport::parsePicture( RTFProperty * ) // Add anchor to rich text destination addAnchor( frameName ); - // It is safe, as we call currentDateTime only once for each picture - const QDateTime dt(QDateTime::currentDateTime()); + // It is safe, as we call tqcurrentDateTime only once for each picture + const TQDateTime dt(TQDateTime::tqcurrentDateTime()); // Add pixmap or clipart (key) pictures.addKey( dt, idStr, pictName ); @@ -1556,11 +1556,11 @@ void RTFImport::parsePicture( RTFProperty * ) frameSets.addKey( dt, idStr ); frameSets.closeNode( "PICTURE" ); frameSets.closeNode( "FRAMESET" ); - picture.identifier = QString::null; + picture.identifier = TQString(); } } -void RTFImport::addImportedPicture( const QString& rawFileName ) +void RTFImport::addImportedPicture( const TQString& rawFileName ) { kdDebug(30515) << "Import field: reading " << rawFileName << endl; @@ -1570,12 +1570,12 @@ void RTFImport::addImportedPicture( const QString& rawFileName ) return; } - QString slashPath( rawFileName ); - slashPath.replace('\\','/'); // Replace directory separators. + TQString slashPath( rawFileName ); + slashPath.tqreplace('\\','/'); // Replace directory separators. // ### TODO: what with MS-DOS absolute paths? (Will only work for KOffice on Win32) - QFileInfo info; + TQFileInfo info; info.setFile( inFileName ); - QDir dir( info.dirPath() ); + TQDir dir( info.dirPath() ); KURL url; url.setPath(dir.filePath( rawFileName )); @@ -1583,7 +1583,7 @@ void RTFImport::addImportedPicture( const QString& rawFileName ) kdDebug(30515) << "Path: " << url.prettyURL() << endl; KoPicture pic; - pic.setKeyAndDownloadPicture(url, 0); // ### TODO: find a better parent if possible + pic.setKeyAndDownloadPicture(url, 0); // ### TODO: find a better tqparent if possible if (pic.isNull()) { kdError(30515) << "Import field: file is empty: " << rawFileName << endl; @@ -1592,12 +1592,12 @@ void RTFImport::addImportedPicture( const QString& rawFileName ) const uint id = ++pictureNumber; - QString pictName("pictures/picture"); - pictName += QString::number(id); + TQString pictName("pictures/picture"); + pictName += TQString::number(id); pictName += '.'; pictName += pic.getExtension(); - QCString frameName; + TQCString frameName; frameName.setNum(id); frameName.prepend("Picture "); @@ -1614,14 +1614,14 @@ void RTFImport::addImportedPicture( const QString& rawFileName ) // Add anchor to rich text destination addAnchor( frameName ); - // It is safe, as we call currentDateTime only once for each picture - const QDateTime dt( pic.getKey().lastModified() ); + // It is safe, as we call tqcurrentDateTime only once for each picture + const TQDateTime dt( pic.getKey().lastModified() ); // Add picture key pictures.addKey( dt, rawFileName, pictName ); // Add picture frameset - const QSize size ( pic.getOriginalSize() * 20 ); // We need twips for addFrame + const TQSize size ( pic.getOriginalSize() * 20 ); // We need twips for addFrame frameSets.addFrameSet( frameName, 2, 0 ); frameSets.addFrame( 0, 0, size.width(), size.height(), 0, 1, 0 ); frameSets.closeNode( "FRAME" ); @@ -1644,13 +1644,13 @@ void RTFImport::insertPageNumber( RTFProperty * ) void RTFImport::insertDateTime( RTFProperty *property ) { kdDebug(30515) << "insertDateTime: " << property->value << endl; - addDateTime( QString::null, bool(property->value), state.format ); + addDateTime( TQString(), bool(property->value), state.format ); } -void RTFImport::addDateTime( const QString& format, const bool isDate, RTFFormat& fmt ) +void RTFImport::addDateTime( const TQString& format, const bool isDate, RTFFormat& fmt ) { bool asDate=isDate; // Should the variable be a date variable? - QString kwordFormat(format); + TQString kwordFormat(format); if (format.isEmpty()) { if (isDate) @@ -1662,7 +1662,7 @@ void RTFImport::addDateTime( const QString& format, const bool isDate, RTFFormat { // It is a time with a specified format, so check if it is really a time // (as in KWord 1.3, a date can have a time format but a time cannot have a date format - const QRegExp regexp ("[yMd]"); // any date format character? + const TQRegExp regexp ("[yMd]"); // any date format character? asDate = (regexp.search(format)>-1); // if yes, then it is a date } DomNode node; @@ -1708,11 +1708,11 @@ void RTFImport::parseField( RTFProperty * ) if (!fldinst.isEmpty()) { DomNode node; - QStringList list ( QStringList::split( ' ', fldinst, false ) ); + TQStringList list ( TQStringList::split( ' ', fldinst, false ) ); kdDebug(30515) << "Field: " << list << endl; uint i; - QString fieldName ( list[0].upper() ); + TQString fieldName ( list[0].upper() ); fieldName.remove('\\'); // Remove \, especialy leading ones in OOWriter RTF files node.clear(7); @@ -1749,7 +1749,7 @@ void RTFImport::parseField( RTFProperty * ) } else if (fieldTable[i].type == 9) { - QString hrefName = QString::null; + TQString hrefName = TQString(); // Use ConstIterator for (uint i=1; i < list.count(); i++) @@ -1768,7 +1768,7 @@ void RTFImport::parseField( RTFProperty * ) } } node.addNode( "LINK" ); - node.setAttribute( "linkName", fldrslt ); + node.setAttribute( "linkName", !fldrslt.isNull() ); node.setAttribute( "hrefName", hrefName ); node.closeNode( "LINK" ); addVariable( node, 9, "STRING", &fldfmt); @@ -1790,21 +1790,21 @@ void RTFImport::parseField( RTFProperty * ) } else if (fieldName == "TIME" || fieldName == "DATE") { - QString strFldinst( QString::fromUtf8(fldinst) ); - QRegExp regexp("\\\\@\\s*\"(.+)\""); // \@ "Text" + TQString strFldinst( TQString::fromUtf8(fldinst) ); + TQRegExp regexp("\\\\@\\s*\"(.+)\""); // \@ "Text" if (regexp.search(strFldinst)==-1) { // Not found? Perhaps it is not in quotes (even if it is rare) kdWarning(30515) << "Date/time field format not in quotes!" << endl; strFldinst += ' '; // Add a space at the end to simplify the regular expression - regexp = QRegExp("\\\\@(\\S+)\\s+"); // \@some_text_up_to_a_space + regexp = TQRegExp("\\\\@(\\S+)\\s+"); // \@some_text_up_to_a_space regexp.search(strFldinst); } - QString format(regexp.cap(1)); + TQString format(regexp.cap(1)); kdDebug(30515) << "Date/time field format: " << format << endl; - format.replace("am/pm", "ap"); - format.replace("a/p", "ap"); // Approximation - format.replace("AM/PM", "AP"); - format.replace("A/P", "AP"); // Approximation + format.tqreplace("am/pm", "ap"); + format.tqreplace("a/p", "ap"); // Approximation + format.tqreplace("AM/PM", "AP"); + format.tqreplace("A/P", "AP"); // Approximation format.remove("'"); // KWord 1.3 cannot protect text in date/time addDateTime( format, (fieldName == "DATE"), fldfmt ); } @@ -1865,7 +1865,7 @@ void RTFImport::parseFldrslt( RTFProperty * ) } } -void RTFImport::addVariable (const DomNode& spec, int type, const QString& key, const RTFFormat* fmt) +void RTFImport::addVariable (const DomNode& spec, int type, const TQString& key, const RTFFormat* fmt) { DomNode node; @@ -1899,7 +1899,7 @@ void RTFImport::parseFootNote( RTFProperty * property) fnnum++; destination.target = newTextState; - QCString str; + TQCString str; str.setNum(fnnum); str.prepend("Footnote "); @@ -1909,7 +1909,7 @@ void RTFImport::parseFootNote( RTFProperty * property) node.addNode("FOOTNOTE"); node.setAttribute("numberingtype", "auto"); node.setAttribute("notetype", "footnote"); - node.setAttribute("frameset", str); + node.setAttribute("frameset", !str.isNull()); node.setAttribute("value", fnnum); node.closeNode("FOOTNOTE"); addVariable(node, 11, "STRING"); @@ -1942,7 +1942,7 @@ void RTFImport::parseRichText( RTFProperty * ) // Ignore hidden text if (!state.format.hidden) { - const int len = (token.text[0] < 0) ? 1 : qstrlen( token.text ); + const int len = (token.text[0] < 0) ? 1 : tqstrlen( token.text ); // Check and store format changes if ( textState->formats.isEmpty() || @@ -1954,7 +1954,7 @@ void RTFImport::parseRichText( RTFProperty * ) kwFormat.pos = textState->length; kwFormat.len = len; textState->formats << kwFormat; - kwFormat.xmldata = QString::null; + kwFormat.xmldata = TQString(); } else { @@ -2055,7 +2055,7 @@ void RTFImport::addFormat( DomNode &node, const KWFormat& format, const RTFForma int vertAlign0 = ~vertAlign; int fontSize0 = ~fontSize; - // Adjust vertical alignment and font size if (\dn, \up) are used + // Adjust vertical tqalignment and font size if (\dn, \up) are used if (format.fmt.vertAlign == RTFFormat::Normal && format.fmt.baseline) { if (format.fmt.baseline < 0) @@ -2096,7 +2096,7 @@ void RTFImport::addFormat( DomNode &node, const KWFormat& format, const RTFForma { node.addNode( "COLOR" ); node.addColor( ((uint)format.fmt.color >= colorTable.count()) - ? (QColor &)Qt::black : colorTable[format.fmt.color] ); + ? (TQColor &)TQt::black : colorTable[format.fmt.color] ); node.closeNode( "COLOR" ); } if ((uint)format.fmt.bgcolor < colorTable.count() && @@ -2110,7 +2110,7 @@ void RTFImport::addFormat( DomNode &node, const KWFormat& format, const RTFForma { node.addNode( "FONT" ); - if (fontTable.contains( format.fmt.font )) + if (fontTable.tqcontains( format.fmt.font )) { node.setAttribute( "name", fontTable[format.fmt.font] ); } @@ -2137,7 +2137,7 @@ void RTFImport::addFormat( DomNode &node, const KWFormat& format, const RTFForma if (!baseFormat || format.fmt.underline != baseFormat->underline ) { node.addNode( "UNDERLINE" ); - QCString st,styleline,wordbyword("0"); + TQCString st,styleline,wordbyword("0"); st.setNum(format.fmt.underline); int underlinecolor = format.fmt.underlinecolor; @@ -2205,10 +2205,10 @@ void RTFImport::addFormat( DomNode &node, const KWFormat& format, const RTFForma break; } } // end of switch - node.setAttribute( "value", st ); - node.setAttribute( "wordbyword", wordbyword ); + node.setAttribute( "value", !st.isNull() ); + node.setAttribute( "wordbyword", !wordbyword.isNull() ); if ( !styleline.isEmpty() ) - node.setAttribute( "styleline", styleline ); + node.setAttribute( "styleline", !styleline.isNull() ); if ( underlinecolor >= 0 && uint(underlinecolor) < colorTable.count() ) { node.setAttribute( "underlinecolor", colorTable[underlinecolor].name() ); @@ -2219,11 +2219,11 @@ void RTFImport::addFormat( DomNode &node, const KWFormat& format, const RTFForma if (!baseFormat || format.fmt.strike != baseFormat->strike || format.fmt.striked != baseFormat->striked) { node.addNode( "STRIKEOUT" ); - QCString st; + TQCString st; st.setNum(format.fmt.strike); if(format.fmt.striked) st="double"; - node.setAttribute( "value", st ); + node.setAttribute( "value", !st.isNull() ); node.closeNode( "STRIKEOUT" ); } if (vertAlign != vertAlign0) @@ -2235,20 +2235,20 @@ void RTFImport::addFormat( DomNode &node, const KWFormat& format, const RTFForma if (!baseFormat || format.fmt.caps != baseFormat->caps || format.fmt.smallCaps != baseFormat->smallCaps) { node.addNode( "FONTATTRIBUTE" ); - QCString fontattr; + TQCString fontattr; if ( format.fmt.caps ) fontattr="uppercase"; else if ( format.fmt.smallCaps ) fontattr="smallcaps"; else fontattr="none"; - node.setAttribute( "value", fontattr ); + node.setAttribute( "value", !fontattr.isNull() ); node.closeNode( "FONTATTRIBUTE" ); } if (!baseFormat) { node.addNode( "CHARSET" ); - node.setAttribute( "value", (int)QFont::Unicode ); + node.setAttribute( "value", (int)TQFont::Unicode ); node.closeNode( "CHARSET" ); } } @@ -2261,40 +2261,40 @@ void RTFImport::addFormat( DomNode &node, const KWFormat& format, const RTFForma node.closeNode( "FORMAT" ); } -void RTFImport::addLayout( DomNode &node, const QString &name, const RTFLayout &layout, bool frameBreak ) +void RTFImport::addLayout( DomNode &node, const TQString &name, const RTFLayout &tqlayout, bool frameBreak ) { - // Style name and alignment + // Style name and tqalignment node.addNode( "NAME" ); node.setAttribute( "value", CheckAndEscapeXmlText(name) ); node.closeNode( "NAME" ); node.addNode( "FLOW" ); - node.setAttribute( "align", alignN[layout.alignment] ); + node.setAttribute( "align", alignN[tqlayout.tqalignment] ); node.closeNode( "FLOW" ); // Indents - if (layout.firstIndent || layout.leftIndent || layout.rightIndent) + if (tqlayout.firstIndent || tqlayout.leftIndent || tqlayout.rightIndent) { node.addNode( "INDENTS" ); - if (layout.firstIndent) - node.setAttribute( "first", .05*layout.firstIndent ); - if (layout.leftIndent) - node.setAttribute( "left", .05*layout.leftIndent ); - if (layout.rightIndent) - node.setAttribute( "right", .05*layout.rightIndent ); + if (tqlayout.firstIndent) + node.setAttribute( "first", .05*tqlayout.firstIndent ); + if (tqlayout.leftIndent) + node.setAttribute( "left", .05*tqlayout.leftIndent ); + if (tqlayout.rightIndent) + node.setAttribute( "right", .05*tqlayout.rightIndent ); node.closeNode( "INDENTS" ); } // Offets - if (layout.spaceBefore || layout.spaceAfter) + if (tqlayout.spaceBefore || tqlayout.spaceAfter) { node.addNode( "OFFSETS" ); - if (layout.spaceBefore) - node.setAttribute( "before", .05*layout.spaceBefore ); - if (layout.spaceAfter) - node.setAttribute( "after", .05*layout.spaceAfter ); + if (tqlayout.spaceBefore) + node.setAttribute( "before", .05*tqlayout.spaceBefore ); + if (tqlayout.spaceAfter) + node.setAttribute( "after", .05*tqlayout.spaceAfter ); node.closeNode( "OFFSETS" ); } @@ -2302,12 +2302,12 @@ void RTFImport::addLayout( DomNode &node, const QString &name, const RTFLayout & // Linespacing - QString lineSpacingType; - QString lineSpacingValue; - if ( layout.spaceBetweenMultiple ) + TQString lineSpacingType; + TQString lineSpacingValue; + if ( tqlayout.spaceBetweenMultiple ) { // Note: 240 is a sort of magic value for one line (Once upon a time, it meant 12pt for a single line) - switch (layout.spaceBetween ) + switch (tqlayout.spaceBetween ) { case 240: { @@ -2326,10 +2326,10 @@ void RTFImport::addLayout( DomNode &node, const QString &name, const RTFLayout & } default: { - if ( layout.spaceBetween > 0 ) + if ( tqlayout.spaceBetween > 0 ) { lineSpacingType = "multiple"; - lineSpacingValue.setNum( layout.spaceBetween / 240.0 ); + lineSpacingValue.setNum( tqlayout.spaceBetween / 240.0 ); } break; } @@ -2337,16 +2337,16 @@ void RTFImport::addLayout( DomNode &node, const QString &name, const RTFLayout & } else { - if (layout.spaceBetween > 0) + if (tqlayout.spaceBetween > 0) { lineSpacingType = "atleast"; - lineSpacingValue.setNum( 0.05*layout.spaceBetween ); + lineSpacingValue.setNum( 0.05*tqlayout.spaceBetween ); } - if (layout.spaceBetween < 0) + if (tqlayout.spaceBetween < 0) { // negative linespace means "exact" lineSpacingType = "fixed" ; - lineSpacingValue.setNum( -0.05*layout.spaceBetween ); + lineSpacingValue.setNum( -0.05*tqlayout.spaceBetween ); } } @@ -2359,26 +2359,26 @@ void RTFImport::addLayout( DomNode &node, const QString &name, const RTFLayout & node.closeNode( "LINESPACING" ); } - if (layout.keep || layout.pageBB || layout.pageBA || frameBreak || layout.keepNext) + if (tqlayout.keep || tqlayout.pageBB || tqlayout.pageBA || frameBreak || tqlayout.keepNext) { node.addNode( "PAGEBREAKING" ); - node.setAttribute( "linesTogether", boolN[layout.keep] ); - node.setAttribute( "hardFrameBreak", boolN[layout.pageBB] ); - node.setAttribute( "hardFrameBreakAfter", boolN[layout.pageBA || frameBreak] ); - node.setAttribute( "keepWithNext", boolN[layout.keepNext] ); + node.setAttribute( "linesTogether", boolN[tqlayout.keep] ); + node.setAttribute( "hardFrameBreak", boolN[tqlayout.pageBB] ); + node.setAttribute( "hardFrameBreakAfter", boolN[tqlayout.pageBA || frameBreak] ); + node.setAttribute( "keepWithNext", boolN[tqlayout.keepNext] ); node.closeNode( "PAGEBREAKING" ); } // Paragraph borders for (uint i=0; i < 4; i++) { - const RTFBorder &border = layout.borders[i]; + const RTFBorder &border = tqlayout.borders[i]; if (border.style != RTFBorder::None || border.width > 0) { node.addNode( borderN[i] ); node.addColor( ((uint)border.color >= colorTable.count()) - ? (QColor &)Qt::black : colorTable[border.color] ); + ? (TQColor &)TQt::black : colorTable[border.color] ); node.setAttribute( "style", (int)border.style & 0xf ); node.setAttribute( "width", (border.width < 20) ? 1 : border.width /20 ); node.closeNode( borderN[i] ); @@ -2386,21 +2386,21 @@ void RTFImport::addLayout( DomNode &node, const QString &name, const RTFLayout & } // Add automatic tab stop for hanging indent - if (layout.firstIndent < 0 && layout.leftIndent > 0) + if (tqlayout.firstIndent < 0 && tqlayout.leftIndent > 0) { node.addNode( "TABULATOR" ); node.setAttribute( "type", 0 ); - node.setAttribute( "ptpos", .05*layout.leftIndent ); + node.setAttribute( "ptpos", .05*tqlayout.leftIndent ); node.closeNode( "TABULATOR" ); } // Tabulators - if (!layout.tablist.isEmpty()) + if (!tqlayout.tablist.isEmpty()) { // ### TODO: use ConstIterator - for (uint i=0; i < layout.tablist.count(); i++) + for (uint i=0; i < tqlayout.tablist.count(); i++) { - const RTFTab &tab = layout.tablist[i]; + const RTFTab &tab = tqlayout.tablist[i]; int l = (int)tab.leader; node.addNode( "TABULATOR" ); node.setAttribute( "type", tab.type ); @@ -2420,14 +2420,14 @@ void RTFImport::addParagraph( DomNode &node, bool frameBreak ) node.closeNode( "TEXT" ); // Search for style in style sheet - QString name; + TQString name; const RTFFormat* format = &state.format; - const int styleNum = state.layout.style; + const int styleNum = state.tqlayout.style; - const QValueList<RTFStyle>::ConstIterator endStyleSheet = styleSheet.end(); - for ( QValueList<RTFStyle>::ConstIterator it=styleSheet.begin(); it!=endStyleSheet; ++it ) + const TQValueList<RTFStyle>::ConstIterator endStyleSheet = styleSheet.end(); + for ( TQValueList<RTFStyle>::ConstIterator it=styleSheet.begin(); it!=endStyleSheet; ++it ) { - if ( (*it).layout.style == styleNum ) + if ( (*it).tqlayout.style == styleNum ) { if ( textState->length > 0 ) { @@ -2451,7 +2451,7 @@ void RTFImport::addParagraph( DomNode &node, bool frameBreak ) // Insert character formatting bool hasFormats = false; - for ( QValueList<KWFormat>::ConstIterator it = textState->formats.begin(); it != textState->formats.end(); ++it ) + for ( TQValueList<KWFormat>::ConstIterator it = textState->formats.begin(); it != textState->formats.end(); ++it ) { if ( (*it).id != 1 || (*it).fmt != *format ) { @@ -2468,9 +2468,9 @@ void RTFImport::addParagraph( DomNode &node, bool frameBreak ) node.closeNode( "FORMATS" ); } - // Write out layout and format + // Write out tqlayout and format node.addNode( "LAYOUT" ); - addLayout( node, name, state.layout, frameBreak ); + addLayout( node, name, state.tqlayout, frameBreak ); addFormat( node, kwFormat, 0L ); node.closeNode( "LAYOUT" ); node.closeNode( "PARAGRAPH" ); @@ -2484,8 +2484,8 @@ void RTFImport::addParagraph( DomNode &node, bool frameBreak ) void RTFImport::finishTable() { kdDebug(30515) << "Starting TFImport::finishTable..." << endl; - QCString emptyArray; - QValueList<int> cellx; + TQCString emptyArray; + TQValueList<int> cellx; int left = 0, right = 0; insertTableRow(); @@ -2524,10 +2524,10 @@ void RTFImport::finishTable() // ### TODO: use ConstIterator for (uint k=0; k < row.cells.count(); k++) { - if (!cellx.contains( row.cells[k].x )) + if (!cellx.tqcontains( row.cells[k].x )) cellx << row.cells[k].x; } - if (!cellx.contains( row.left )) + if (!cellx.tqcontains( row.left )) { cellx << row.left; } @@ -2562,7 +2562,7 @@ void RTFImport::finishTable() { char buf[64]; int x2 = row.cells[k].x; - int col = cellx.findIndex( x1 ); + int col = cellx.tqfindIndex( x1 ); sprintf( buf, "Table %d Cell %d,%d", textState->table, i, col ); frameSets.addFrameSet( buf, 1, 0 ); @@ -2571,7 +2571,7 @@ void RTFImport::finishTable() frameSets.setAttribute( "row", (int)i ); frameSets.setAttribute( "col", col ); frameSets.setAttribute( "rows", 1 ); - frameSets.setAttribute( "cols", cellx.findIndex( x2 ) - col ); + frameSets.setAttribute( "cols", cellx.tqfindIndex( x2 ) - col ); frameSets.addFrame( x1, y1, x2, y2, (row.height < 0) ? 2 : 0, 1, 0 ); @@ -2583,8 +2583,8 @@ void RTFImport::finishTable() if (border.style != RTFBorder::None || border.width > 0) { const char *id = "lrtb"; - QColor &c = ((uint)border.color >= colorTable.count()) - ? (QColor &)Qt::black : colorTable[border.color]; + TQColor &c = ((uint)border.color >= colorTable.count()) + ? (TQColor &)TQt::black : colorTable[border.color]; frameSets.addBorder( (int)id[i], c, (int)border.style & 0x0f, .05*(!border.width ? 10 : border.width) ); } @@ -2593,7 +2593,7 @@ void RTFImport::finishTable() // Frame background color if ((uint)row.cells[k].bgcolor < colorTable.count()) { - QColor &color = colorTable[row.cells[k].bgcolor]; + TQColor &color = colorTable[row.cells[k].bgcolor]; frameSets.setAttribute( "bkRed", color.red() ); frameSets.setAttribute( "bkGreen", color.green() ); frameSets.setAttribute( "bkBlue", color.blue() ); @@ -2615,8 +2615,8 @@ void RTFImport::writeOutPart( const char *name, const DomNode& node ) KoStoreDevice* dev = m_chain->storageFile( name, KoStore::Write ); if ( dev ) { - QTextStream stream( dev ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream stream( dev ); + stream.setEncoding( TQTextStream::UnicodeUTF8 ); stream << node.toString(); } else |