summaryrefslogtreecommitdiffstats
path: root/lib/kformula/kformuladocument.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kformula/kformuladocument.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kformula/kformuladocument.cc')
-rw-r--r--lib/kformula/kformuladocument.cc232
1 files changed, 116 insertions, 116 deletions
diff --git a/lib/kformula/kformuladocument.cc b/lib/kformula/kformuladocument.cc
index 57b5bc04..3a19ac70 100644
--- a/lib/kformula/kformuladocument.cc
+++ b/lib/kformula/kformuladocument.cc
@@ -18,8 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qptrlist.h>
-#include <qstringlist.h>
+#include <tqptrlist.h>
+#include <tqstringlist.h>
#include <kdebug.h>
#include <kglobal.h>
@@ -45,7 +45,7 @@ static const int CURRENT_SYNTAX_VERSION = 1;
// Make sure an appropriate DTD is available in www/koffice/DTD if changing this value
static const char * CURRENT_DTD_VERSION = "1.3";
-int FormulaList::compareItems( QPtrCollection::Item a, QPtrCollection::Item b )
+int FormulaList::compareItems( TQPtrCollection::Item a, TQPtrCollection::Item b )
{
double ya = static_cast<Container*>( a )->getDocumentY();
double yb = static_cast<Container*>( b )->getDocumentY();
@@ -61,9 +61,9 @@ int FormulaList::compareItems( QPtrCollection::Item a, QPtrCollection::Item b )
}
-Document::Document( QObject *parent, const char *name,
- const QStringList &/*args*/ )
- : QObject( parent, name ), m_wrapper( 0 ), m_formula( 0 ), creationStrategy( 0 )
+Document::Document( TQObject *tqparent, const char *name,
+ const TQStringList &/*args*/ )
+ : TQObject( tqparent, name ), m_wrapper( 0 ), m_formula( 0 ), creationStrategy( 0 )
{
m_contextStyle = new ContextStyle;
setCreationStrategy( "Oasis" );
@@ -98,15 +98,15 @@ Container* Document::createFormula( int pos, bool registerMe )
}
-QPtrListIterator<Container> Document::formulas()
+TQPtrListIterator<Container> Document::formulas()
{
- return QPtrListIterator<Container>( formulae );
+ return TQPtrListIterator<Container>( formulae );
}
int Document::formulaPos( Container* formula )
{
- return formulae.find( formula );
+ return formulae.tqfind( formula );
}
@@ -122,12 +122,12 @@ int Document::formulaCount()
}
-bool Document::loadXML( const QDomDocument& doc )
+bool Document::loadXML( const TQDomDocument& doc )
{
setCreationStrategy( "Ordinary" );
//clear();
- QDomElement root = doc.documentElement();
+ TQDomElement root = doc.documentElement();
// backward compatibility
if ( root.tagName() == "FORMULA" ) {
@@ -135,9 +135,9 @@ bool Document::loadXML( const QDomDocument& doc )
return formula->load( root );
}
- QDomNode node = root.firstChild();
+ TQDomNode node = root.firstChild();
if ( node.isElement() ) {
- QDomElement element = node.toElement();
+ TQDomElement element = node.toElement();
if ( element.tagName() == "FORMULASETTINGS" ) {
if ( !loadDocumentPart( element ) ) {
return false;
@@ -148,7 +148,7 @@ bool Document::loadXML( const QDomDocument& doc )
uint number = 0;
while ( !node.isNull() ) {
if ( node.isElement() ) {
- QDomElement element = node.toElement();
+ TQDomElement element = node.toElement();
Container* formula = newFormula( number );
if ( !formula->load( element ) ) {
return false;
@@ -160,7 +160,7 @@ bool Document::loadXML( const QDomDocument& doc )
return formulae.count() > 0;
}
-bool Document::loadOasis( const QDomDocument& doc )
+bool Document::loadOasis( const TQDomDocument& doc )
{
// ### TODO: not finished!
setCreationStrategy( "Oasis" );
@@ -168,15 +168,15 @@ bool Document::loadOasis( const QDomDocument& doc )
return formula->loadMathML( doc, true );
}
-bool Document::loadDocumentPart( QDomElement /*node*/ )
+bool Document::loadDocumentPart( TQDomElement /*node*/ )
{
return true;
}
-QDomDocument Document::saveXML()
+TQDomDocument Document::saveXML()
{
- QDomDocument doc = createDomDocument();
- QDomElement root = doc.documentElement();
+ TQDomDocument doc = createDomDocument();
+ TQDomElement root = doc.documentElement();
root.appendChild( saveDocumentPart( doc ) );
uint count = formulae.count();
for ( uint i=0; i<count; ++i ) {
@@ -186,30 +186,30 @@ QDomDocument Document::saveXML()
}
-QDomElement Document::saveDocumentPart( QDomDocument& doc )
+TQDomElement Document::saveDocumentPart( TQDomDocument& doc )
{
- QDomElement settings = doc.createElement( "FORMULASETTINGS" );
+ TQDomElement settings = doc.createElement( "FORMULASETTINGS" );
return settings;
}
-QDomDocument Document::createDomDocument()
+TQDomDocument Document::createDomDocument()
{
return KoDocument::createDomDocument( "kformula", "KFORMULA",
CURRENT_DTD_VERSION );
}
/**
- * Create a MathML Dom Document, deprecates KFO Dom Document for internal layout
+ * Create a MathML Dom Document, deprecates KFO Dom Document for internal tqlayout
* TODO: Shouldn't this go to KoDocument ?
*/
-QDomDocument Document::createMathMLDomDocument()
+TQDomDocument Document::createMathMLDomDocument()
{
- QDomDocumentType dt =
- QDomImplementation().createDocumentType( "math",
+ TQDomDocumentType dt =
+ TQDomImplementation().createDocumentType( "math",
"-//W3C//DTD MathML 2.0//EN",
"http://www.w3.org/TR/MathML2/dtd/mathml2.dtd");
- QDomDocument doc( dt );
+ TQDomDocument doc( dt );
doc.insertBefore( doc.createProcessingInstruction( "xml",
"version=\"1.0\" encoding=\"UTF-8\"" ),
doc.documentElement() );
@@ -222,7 +222,7 @@ QDomDocument Document::createMathMLDomDocument()
*
* @param strategy -- "Ordinary" for old Kformula, "Oasis" for MathML/ODF
*/
-void Document::setCreationStrategy( QString strategy )
+void Document::setCreationStrategy( TQString strategy )
{
if ( !creationStrategy || creationStrategy->type() != strategy ) {
delete creationStrategy;
@@ -442,225 +442,225 @@ void DocumentWrapper::createActions( KActionCollection* collection )
m_addNegThinSpaceAction = new KAction( i18n( "Add Negative Thin Space" ),
0,
- this, SLOT( addNegThinSpace() ),
+ this, TQT_SLOT( addNegThinSpace() ),
collection, "formula_addnegthinspace") ;
m_addThinSpaceAction = new KAction( i18n( "Add Thin Space" ),
0,
- this, SLOT( addThinSpace() ),
+ this, TQT_SLOT( addThinSpace() ),
collection, "formula_addthinspace") ;
m_addMediumSpaceAction = new KAction( i18n( "Add Medium Space" ),
0,
- this, SLOT( addMediumSpace() ),
+ this, TQT_SLOT( addMediumSpace() ),
collection, "formula_addmediumspace" );
m_addThickSpaceAction = new KAction( i18n( "Add Thick Space" ),
0,
- this, SLOT( addThickSpace() ),
+ this, TQT_SLOT( addThickSpace() ),
collection, "formula_addthickspace" );
m_addQuadSpaceAction = new KAction( i18n( "Add Quad Space" ),
0,
- this, SLOT( addQuadSpace() ),
+ this, TQT_SLOT( addQuadSpace() ),
collection, "formula_addquadspace" );
m_addIntegralAction = new KAction(i18n("Add Integral"),
"int",
0,
- this, SLOT(addIntegral()),
+ this, TQT_SLOT(addIntegral()),
collection, "formula_addintegral");
m_addSumAction = new KAction(i18n("Add Sum"),
"sum",
0,
- this, SLOT(addSum()),
+ this, TQT_SLOT(addSum()),
collection, "formula_addsum");
m_addProductAction = new KAction(i18n("Add Product"),
"prod",
0,
- this, SLOT(addProduct()),
+ this, TQT_SLOT(addProduct()),
collection, "formula_addproduct");
m_addRootAction = new KAction(i18n("Add Root"),
"sqrt",
0,
- this, SLOT(addRoot()),
+ this, TQT_SLOT(addRoot()),
collection, "formula_addroot");
m_addFractionAction = new KAction(i18n("Add Fraction"),
"frac",
0,
- this, SLOT(addFraction()),
+ this, TQT_SLOT(addFraction()),
collection, "formula_addfrac");
m_addBracketAction = new KAction(i18n("Add Bracket"),
"paren",
0,
- this, SLOT(addDefaultBracket()),
+ this, TQT_SLOT(addDefaultBracket()),
collection,"formula_addbra");
m_addSBracketAction = new KAction(i18n("Add Square Bracket"),
"brackets",
0,
- this, SLOT(addSquareBracket()),
+ this, TQT_SLOT(addSquareBracket()),
collection,"formula_addsqrbra");
m_addCBracketAction = new KAction(i18n("Add Curly Bracket"),
"math_brace",
0,
- this, SLOT(addCurlyBracket()),
+ this, TQT_SLOT(addCurlyBracket()),
collection,"formula_addcurbra");
m_addAbsAction = new KAction(i18n("Add Abs"),
"abs",
0,
- this, SLOT(addLineBracket()),
+ this, TQT_SLOT(addLineBracket()),
collection,"formula_addabsbra");
m_addMatrixAction = new KAction(i18n("Add Matrix..."),
"matrix",
0,
- this, SLOT(addMatrix()),
+ this, TQT_SLOT(addMatrix()),
collection, "formula_addmatrix");
m_addOneByTwoMatrixAction = new KAction(i18n("Add 1x2 Matrix"),
"onetwomatrix",
0,
- this, SLOT(addOneByTwoMatrix()),
+ this, TQT_SLOT(addOneByTwoMatrix()),
collection, "formula_add_one_by_two_matrix");
m_addUpperLeftAction = new KAction(i18n("Add Upper Left Index"),
"lsup",
0,
- this, SLOT(addUpperLeftIndex()),
+ this, TQT_SLOT(addUpperLeftIndex()),
collection, "formula_addupperleft");
m_addLowerLeftAction = new KAction(i18n("Add Lower Left Index"),
"lsub",
0,
- this, SLOT(addLowerLeftIndex()),
+ this, TQT_SLOT(addLowerLeftIndex()),
collection, "formula_addlowerleft");
m_addUpperRightAction = new KAction(i18n("Add Upper Right Index"),
"rsup",
0,
- this, SLOT(addUpperRightIndex()),
+ this, TQT_SLOT(addUpperRightIndex()),
collection, "formula_addupperright");
m_addLowerRightAction = new KAction(i18n("Add Lower Right Index"),
"rsub",
0,
- this, SLOT(addLowerRightIndex()),
+ this, TQT_SLOT(addLowerRightIndex()),
collection, "formula_addlowerright");
m_addGenericUpperAction = new KAction(i18n("Add Upper Index"),
"gsup",
/*CTRL + Key_U*/0,
- this, SLOT(addGenericUpperIndex()),
+ this, TQT_SLOT(addGenericUpperIndex()),
collection, "formula_addupperindex");
m_addGenericLowerAction = new KAction(i18n("Add Lower Index"),
"gsub",
0,
- this, SLOT(addGenericLowerIndex()),
+ this, TQT_SLOT(addGenericLowerIndex()),
collection, "formula_addlowerindex");
m_addOverlineAction = new KAction(i18n("Add Overline"),
"over",
0,
- this, SLOT(addOverline()),
+ this, TQT_SLOT(addOverline()),
collection, "formula_addoverline");
m_addUnderlineAction = new KAction(i18n("Add Underline"),
"under",
0,
- this, SLOT(addUnderline()),
+ this, TQT_SLOT(addUnderline()),
collection, "formula_addunderline");
m_addMultilineAction = new KAction(i18n("Add Multiline"),
"multiline",
0,
- this, SLOT(addMultiline()),
+ this, TQT_SLOT(addMultiline()),
collection, "formula_addmultiline");
m_removeEnclosingAction = new KAction(i18n("Remove Enclosing Element"),
0,
- this, SLOT(removeEnclosing()),
+ this, TQT_SLOT(removeEnclosing()),
collection, "formula_removeenclosing");
m_makeGreekAction = new KAction(i18n("Convert to Greek"),
0,
- this, SLOT(makeGreek()),
+ this, TQT_SLOT(makeGreek()),
collection, "formula_makegreek");
m_appendColumnAction = new KAction( i18n( "Append Column" ),
"inscol",
0,
- this, SLOT( appendColumn() ),
+ this, TQT_SLOT( appendColumn() ),
collection, "formula_appendcolumn" );
m_insertColumnAction = new KAction( i18n( "Insert Column" ),
"inscol",
0,
- this, SLOT( insertColumn() ),
+ this, TQT_SLOT( insertColumn() ),
collection, "formula_insertcolumn" );
m_removeColumnAction = new KAction( i18n( "Remove Column" ),
"remcol",
0,
- this, SLOT( removeColumn() ),
+ this, TQT_SLOT( removeColumn() ),
collection, "formula_removecolumn" );
m_appendRowAction = new KAction( i18n( "Append Row" ),
"insrow",
0,
- this, SLOT( appendRow() ),
+ this, TQT_SLOT( appendRow() ),
collection, "formula_appendrow" );
m_insertRowAction = new KAction( i18n( "Insert Row" ),
"insrow",
0,
- this, SLOT( insertRow() ),
+ this, TQT_SLOT( insertRow() ),
collection, "formula_insertrow" );
m_removeRowAction = new KAction( i18n( "Remove Row" ),
"remrow",
0,
- this, SLOT( removeRow() ),
+ this, TQT_SLOT( removeRow() ),
collection, "formula_removerow" );
m_syntaxHighlightingAction = new KToggleAction(i18n("Syntax Highlighting"),
0,
- this, SLOT(toggleSyntaxHighlighting()),
+ this, TQT_SLOT(toggleSyntaxHighlighting()),
collection, "formula_syntaxhighlighting");
//m_syntaxHighlightingAction->setChecked( m_contextStyle->syntaxHighlighting() );
m_formatBoldAction = new KToggleAction( i18n( "&Bold" ), "text_bold",
0, //CTRL + Key_B,
- this, SLOT( textBold() ),
+ this, TQT_SLOT( textBold() ),
collection, "formula_format_bold" );
m_formatItalicAction = new KToggleAction( i18n( "&Italic" ), "text_italic",
0, //CTRL + Key_I,
- this, SLOT( textItalic() ),
+ this, TQT_SLOT( textItalic() ),
collection, "formula_format_italic" );
m_formatBoldAction->setEnabled( false );
m_formatItalicAction->setEnabled( false );
- QStringList delimiter;
- delimiter.append(QString("("));
- delimiter.append(QString("["));
- delimiter.append(QString("{"));
- delimiter.append(QString("<"));
- delimiter.append(QString("/"));
- delimiter.append(QString("\\"));
- delimiter.append(QString("|"));
- delimiter.append(QString(" "));
- delimiter.append(QString(")"));
- delimiter.append(QString("]"));
- delimiter.append(QString("}"));
- delimiter.append(QString(">"));
+ TQStringList delimiter;
+ delimiter.append(TQString("("));
+ delimiter.append(TQString("["));
+ delimiter.append(TQString("{"));
+ delimiter.append(TQString("<"));
+ delimiter.append(TQString("/"));
+ delimiter.append(TQString("\\"));
+ delimiter.append(TQString("|"));
+ delimiter.append(TQString(" "));
+ delimiter.append(TQString(")"));
+ delimiter.append(TQString("]"));
+ delimiter.append(TQString("}"));
+ delimiter.append(TQString(">"));
m_leftBracket = new KSelectAction(i18n("Left Delimiter"),
- 0, this, SLOT(delimiterLeft()),
+ 0, this, TQT_SLOT(delimiterLeft()),
collection, "formula_typeleft");
m_leftBracket->setItems(delimiter);
//leftBracket->setCurrentItem(0);
delimiter.clear();
- delimiter.append(QString(")"));
- delimiter.append(QString("]"));
- delimiter.append(QString("}"));
- delimiter.append(QString(">"));
- delimiter.append(QString("/"));
- delimiter.append(QString("\\"));
- delimiter.append(QString("|"));
- delimiter.append(QString(" "));
- delimiter.append(QString("("));
- delimiter.append(QString("["));
- delimiter.append(QString("{"));
- delimiter.append(QString("<"));
+ delimiter.append(TQString(")"));
+ delimiter.append(TQString("]"));
+ delimiter.append(TQString("}"));
+ delimiter.append(TQString(">"));
+ delimiter.append(TQString("/"));
+ delimiter.append(TQString("\\"));
+ delimiter.append(TQString("|"));
+ delimiter.append(TQString(" "));
+ delimiter.append(TQString("("));
+ delimiter.append(TQString("["));
+ delimiter.append(TQString("{"));
+ delimiter.append(TQString("<"));
m_rightBracket = new KSelectAction(i18n("Right Delimiter"),
- 0, this, SLOT(delimiterRight()),
+ 0, this, TQT_SLOT(delimiterRight()),
collection, "formula_typeright");
m_rightBracket->setItems(delimiter);
//rightBracket->setCurrentItem(0);
@@ -668,30 +668,30 @@ void DocumentWrapper::createActions( KActionCollection* collection )
m_insertSymbolAction = new KAction(i18n("Insert Symbol"),
"key_enter",
/*CTRL + Key_I*/0,
- this, SLOT(insertSymbol()),
+ this, TQT_SLOT(insertSymbol()),
collection, "formula_insertsymbol");
m_symbolNamesAction = new SymbolAction(i18n("Symbol Names"),
- 0, this, SLOT(symbolNames()),
+ 0, this, TQT_SLOT(symbolNames()),
collection, "formula_symbolnames");
- QStringList ff;
+ TQStringList ff;
ff.append( i18n( "Normal" ) );
ff.append( i18n( "Script" ) );
ff.append( i18n( "Fraktur" ) );
ff.append( i18n( "Double Struck" ) );
m_fontFamily = new KSelectAction(i18n("Font Family"),
- 0, this, SLOT(fontFamily()),
+ 0, this, TQT_SLOT(fontFamily()),
collection, "formula_fontfamily");
m_fontFamily->setItems( ff );
m_fontFamily->setEnabled( false );
- QStringList et;
+ TQStringList et;
et.append( i18n( "Identifier" ) );
et.append( i18n( "Operator" ) );
et.append( i18n( "Number" ) );
et.append( i18n( "Text" ) );
m_tokenElement = new KSelectAction( i18n( "Token Type" ),
- 0, this, SLOT( tokenElement() ),
+ 0, this, TQT_SLOT( tokenElement() ),
collection, "formula_tokenelement" );
m_tokenElement->setItems( et );
// m_tokenElements->setEnabled( true );
@@ -760,7 +760,7 @@ void DocumentWrapper::addThickSpace()
void DocumentWrapper::addQuadSpace()
{
if (hasFormula()) {
- SpaceRequest r( QUAD );
+ SpaceRequest r( TQUAD );
formula()->performRequest( &r );
}
}
@@ -968,9 +968,9 @@ void DocumentWrapper::makeGreek()
void DocumentWrapper::insertSymbol()
{
if ( hasFormula() &&
- m_document->m_contextStyle->symbolTable().contains( m_selectedName ) ) {
- QChar ch = m_document->m_contextStyle->symbolTable().unicode( m_selectedName );
- if ( ch != QChar::null ) {
+ m_document->m_contextStyle->symbolTable().tqcontains( m_selectedName ) ) {
+ TQChar ch = m_document->m_contextStyle->symbolTable().tqunicode( m_selectedName );
+ if ( ch != TQChar::null ) {
TextCharRequest r( ch, true );
formula()->performRequest( &r );
}
@@ -981,12 +981,12 @@ void DocumentWrapper::insertSymbol()
}
}
-void DocumentWrapper::insertSymbol( QString name )
+void DocumentWrapper::insertSymbol( TQString name )
{
if ( hasFormula() ) {
- if ( m_document->m_contextStyle->symbolTable().contains( name ) ) {
- QChar ch = m_document->m_contextStyle->symbolTable().unicode( name );
- if ( ch != QChar::null ) {
+ if ( m_document->m_contextStyle->symbolTable().tqcontains( name ) ) {
+ TQChar ch = m_document->m_contextStyle->symbolTable().tqunicode( name );
+ if ( ch != TQChar::null ) {
TextCharRequest r( ch, true );
formula()->performRequest( &r );
return;
@@ -1074,8 +1074,8 @@ void DocumentWrapper::textItalic()
void DocumentWrapper::delimiterLeft()
{
- QString left = m_leftBracket->currentText();
- switch ( left.at(0).latin1() ) {
+ TQString left = m_leftBracket->currentText();
+ switch ( left.tqat(0).latin1() ) {
case '[':
case ']':
case '{':
@@ -1086,7 +1086,7 @@ void DocumentWrapper::delimiterLeft()
case ')':
case '/':
case '\\':
- m_leftBracketChar = static_cast<SymbolType>( left.at(0).latin1() );
+ m_leftBracketChar = static_cast<SymbolType>( left.tqat(0).latin1() );
break;
case '|':
m_leftBracketChar = LeftLineBracket;
@@ -1099,8 +1099,8 @@ void DocumentWrapper::delimiterLeft()
void DocumentWrapper::delimiterRight()
{
- QString right = m_rightBracket->currentText();
- switch ( right.at(0).latin1() ) {
+ TQString right = m_rightBracket->currentText();
+ switch ( right.tqat(0).latin1() ) {
case '[':
case ']':
case '{':
@@ -1111,7 +1111,7 @@ void DocumentWrapper::delimiterRight()
case ')':
case '/':
case '\\':
- m_rightBracketChar = static_cast<SymbolType>( right.at(0).latin1() );
+ m_rightBracketChar = static_cast<SymbolType>( right.tqat(0).latin1() );
break;
case '|':
m_rightBracketChar = RightLineBracket;
@@ -1166,15 +1166,15 @@ void DocumentWrapper::initSymbolNamesAction()
{
if ( m_hasActions ) {
const SymbolTable& st = m_document->m_contextStyle->symbolTable();
- QStringList names = st.allNames();
- QFont font( m_document->m_contextStyle->getFontStyle() );
- QMemArray<QChar> chars( names.count() );
+ TQStringList names = st.allNames();
+ TQFont font( m_document->m_contextStyle->getFontStyle() );
+ TQMemArray<TQChar> chars( names.count() );
uint i = 0;
- for ( QStringList::Iterator it = names.begin();
+ for ( TQStringList::Iterator it = names.begin();
it != names.end();
++it, ++i ) {
- chars[ i ] = st.unicode( *it );
+ chars[ i ] = st.tqunicode( *it );
}
m_symbolNamesAction->setSymbols( names, m_document->m_contextStyle->getMathFont(), chars );
m_selectedName = names[0];