diff options
Diffstat (limited to 'quanta/components/tableeditor')
-rw-r--r-- | quanta/components/tableeditor/tableeditor.cpp | 230 | ||||
-rw-r--r-- | quanta/components/tableeditor/tableeditor.h | 54 | ||||
-rw-r--r-- | quanta/components/tableeditor/tableitem.cpp | 46 | ||||
-rw-r--r-- | quanta/components/tableeditor/tableitem.h | 20 |
4 files changed, 175 insertions, 175 deletions
diff --git a/quanta/components/tableeditor/tableeditor.cpp b/quanta/components/tableeditor/tableeditor.cpp index 970828a2..bb581859 100644 --- a/quanta/components/tableeditor/tableeditor.cpp +++ b/quanta/components/tableeditor/tableeditor.cpp @@ -25,16 +25,16 @@ #include <ktexteditor/editinterface.h> //qt includes -#include <qcheckbox.h> -#include <qiconset.h> -#include <qlineedit.h> -#include <qobject.h> -#include <qpoint.h> -#include <qrect.h> -#include <qspinbox.h> -#include <qstring.h> -#include <qtabwidget.h> -#include <qvaluevector.h> +#include <tqcheckbox.h> +#include <tqiconset.h> +#include <tqlineedit.h> +#include <tqobject.h> +#include <tqpoint.h> +#include <tqrect.h> +#include <tqspinbox.h> +#include <tqstring.h> +#include <tqtabwidget.h> +#include <tqvaluevector.h> //own includes #include "tagdialog.h" @@ -48,25 +48,25 @@ int newNum; -TableEditor::TableEditor(QWidget* parent, const char* name) +TableEditor::TableEditor(TQWidget* parent, const char* name) : TableEditorS(parent, name) { m_popup = new KPopupMenu(); - m_cellEditId = m_popup->insertItem(i18n("&Edit Cell Properties"), this ,SLOT(slotEditCell())); - m_rowEditId = m_popup->insertItem(i18n("Edit &Row Properties"), this ,SLOT(slotEditRow())); - // m_colEditId = m_popup->insertItem(i18n("Edit &Column Properties"), this ,SLOT(slotEditCol())); + m_cellEditId = m_popup->insertItem(i18n("&Edit Cell Properties"), this ,TQT_SLOT(slotEditCell())); + m_rowEditId = m_popup->insertItem(i18n("Edit &Row Properties"), this ,TQT_SLOT(slotEditRow())); + // m_colEditId = m_popup->insertItem(i18n("Edit &Column Properties"), this ,TQT_SLOT(slotEditCol())); m_mergeSeparatorId = m_popup->insertSeparator(); - m_mergeCellsId = m_popup->insertItem(i18n("Merge Cells"), this, SLOT(slotMergeCells())); - m_unmergeCellsId = m_popup->insertItem(i18n("Break Merging"), this, SLOT(slotUnmergeCells())); + m_mergeCellsId = m_popup->insertItem(i18n("Merge Cells"), this, TQT_SLOT(slotMergeCells())); + m_unmergeCellsId = m_popup->insertItem(i18n("Break Merging"), this, TQT_SLOT(slotUnmergeCells())); m_popup->insertSeparator(); - m_popup->insertItem(i18n("&Insert Row"), this, SLOT(slotInsertRow())); - m_popup->insertItem(i18n("Insert Co&lumn"), this, SLOT(slotInsertCol())); - m_popup->insertItem(i18n("Remove Row"), this, SLOT(slotRemoveRow())); - m_popup->insertItem(i18n("Remove Column"), this, SLOT(slotRemoveCol())); + m_popup->insertItem(i18n("&Insert Row"), this, TQT_SLOT(slotInsertRow())); + m_popup->insertItem(i18n("Insert Co&lumn"), this, TQT_SLOT(slotInsertCol())); + m_popup->insertItem(i18n("Remove Row"), this, TQT_SLOT(slotRemoveRow())); + m_popup->insertItem(i18n("Remove Column"), this, TQT_SLOT(slotRemoveCol())); m_popup->insertSeparator(); - m_popup->insertItem(i18n("Edit &Table Properties"), this, SLOT(slotEditTable())); - m_editChildId = m_popup->insertItem(i18n("Edit Child Table"), this, SLOT(slotEditChildTable())); + m_popup->insertItem(i18n("Edit &Table Properties"), this, TQT_SLOT(slotEditTable())); + m_editChildId = m_popup->insertItem(i18n("Edit Child Table"), this, TQT_SLOT(slotEditChildTable())); buttonOk->setIconSet(SmallIconSet("button_ok")); buttonCancel->setIconSet(SmallIconSet("button_cancel")); @@ -79,38 +79,38 @@ TableEditor::TableEditor(QWidget* parent, const char* name) m_table = 0L; m_dtd = 0L; m_write = 0L; - m_tableDataTags = new QValueList<QValueList<TableNode> >; - m_tableHeaderTags = new QValueList<QValueList<TableNode> >; - m_tableFooterTags = new QValueList<QValueList<TableNode> >; + m_tableDataTags = new TQValueList<TQValueList<TableNode> >; + m_tableHeaderTags = new TQValueList<TQValueList<TableNode> >; + m_tableFooterTags = new TQValueList<TQValueList<TableNode> >; m_tableTags = 0L; - m_tableDataRows = new QValueList<TableNode>; - m_tableHeaderRows = new QValueList<TableNode>; - m_tableFooterRows = new QValueList<TableNode>; + m_tableDataRows = new TQValueList<TableNode>; + m_tableHeaderRows = new TQValueList<TableNode>; + m_tableFooterRows = new TQValueList<TableNode>; m_tableRows = 0L; m_createNodes = true; newNum += 7; - connect(headerColSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveCol(int))); - connect(headerRowSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveRow(int))); - connect(rowSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveRow(int))); - connect(colSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveCol(int))); - connect(footerRowSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveRow(int))); - connect(footerColSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveCol(int))); - connect(tableData, SIGNAL(contextMenuRequested(int,int,const QPoint&)), - SLOT(slotContextMenuRequested(int,int,const QPoint&))); - connect(pushButton7, SIGNAL(clicked()), SLOT(slotEditTable())); - connect(pushButton7_2, SIGNAL(clicked()), SLOT(slotEditTableBody())); - connect(pushButton7_3, SIGNAL(clicked()), SLOT(slotEditTableHeader())); - connect(pushButton7_4, SIGNAL(clicked()), SLOT(slotEditTableFooter())); - connect(headerTableData, SIGNAL(contextMenuRequested(int,int,const QPoint&)), - SLOT(slotContextMenuRequested(int,int,const QPoint&))); - connect(footerTableData, SIGNAL(contextMenuRequested(int,int,const QPoint&)), - SLOT(slotContextMenuRequested(int,int,const QPoint&))); - connect(tabWidget, SIGNAL(currentChanged(QWidget*)), SLOT(slotTabChanged(QWidget*))); - connect(buttonHelp, SIGNAL(clicked()), SLOT(slotHelpInvoked())); - connect(tableData, SIGNAL(valueChanged(int,int)), SLOT(slotEditCellText(int,int))); - connect(headerTableData, SIGNAL(valueChanged(int,int)), SLOT(slotEditCellText(int,int))); - connect(footerTableData, SIGNAL(valueChanged(int,int)), SLOT(slotEditCellText(int,int))); + connect(headerColSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotAddRemoveCol(int))); + connect(headerRowSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotAddRemoveRow(int))); + connect(rowSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotAddRemoveRow(int))); + connect(colSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotAddRemoveCol(int))); + connect(footerRowSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotAddRemoveRow(int))); + connect(footerColSpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotAddRemoveCol(int))); + connect(tableData, TQT_SIGNAL(contextMenuRequested(int,int,const TQPoint&)), + TQT_SLOT(slotContextMenuRequested(int,int,const TQPoint&))); + connect(pushButton7, TQT_SIGNAL(clicked()), TQT_SLOT(slotEditTable())); + connect(pushButton7_2, TQT_SIGNAL(clicked()), TQT_SLOT(slotEditTableBody())); + connect(pushButton7_3, TQT_SIGNAL(clicked()), TQT_SLOT(slotEditTableHeader())); + connect(pushButton7_4, TQT_SIGNAL(clicked()), TQT_SLOT(slotEditTableFooter())); + connect(headerTableData, TQT_SIGNAL(contextMenuRequested(int,int,const TQPoint&)), + TQT_SLOT(slotContextMenuRequested(int,int,const TQPoint&))); + connect(footerTableData, TQT_SIGNAL(contextMenuRequested(int,int,const TQPoint&)), + TQT_SLOT(slotContextMenuRequested(int,int,const TQPoint&))); + connect(tabWidget, TQT_SIGNAL(currentChanged(TQWidget*)), TQT_SLOT(slotTabChanged(TQWidget*))); + connect(buttonHelp, TQT_SIGNAL(clicked()), TQT_SLOT(slotHelpInvoked())); + connect(tableData, TQT_SIGNAL(valueChanged(int,int)), TQT_SLOT(slotEditCellText(int,int))); + connect(headerTableData, TQT_SIGNAL(valueChanged(int,int)), TQT_SLOT(slotEditCellText(int,int))); + connect(footerTableData, TQT_SIGNAL(valueChanged(int,int)), TQT_SLOT(slotEditCellText(int,int))); } TableEditor::~TableEditor() @@ -130,7 +130,7 @@ TableEditor::~TableEditor() kdDebug(24000) << "Undeleted new: " << newNum << endl; } -void TableEditor::slotContextMenuRequested( int row, int col, const QPoint & pos ) +void TableEditor::slotContextMenuRequested( int row, int col, const TQPoint & pos ) { m_row = row; m_col = col; @@ -149,9 +149,9 @@ void TableEditor::slotContextMenuRequested( int row, int col, const QPoint & pos m_popup->setItemVisible(m_unmergeCellsId, true); m_popup->setItemVisible(m_mergeSeparatorId, true); } - QTableSelection selection = m_dataTable->selection(m_dataTable->currentSelection()); - QRect rect(QPoint(selection.topRow(), selection.leftCol()) , - QPoint(selection.bottomRow(), selection.rightCol())); + TQTableSelection selection = m_dataTable->selection(m_dataTable->currentSelection()); + TQRect rect(TQPoint(selection.topRow(), selection.leftCol()) , + TQPoint(selection.bottomRow(), selection.rightCol())); if (rect.isValid() && (rect.width() > 1 || rect.height() > 1) && rect.contains(m_row, m_col)) { m_popup->setItemVisible(m_mergeCellsId, true); m_popup->setItemVisible(m_mergeSeparatorId, true); @@ -257,8 +257,8 @@ bool TableEditor::setTableArea( int bLine, int bCol, int eLine, int eCol, Parser m_rowSpin = 0L; m_colSpin = 0L; m_dataTable = 0L; - QValueList<TableNode> tableRowTags; - QValueVector< QValueVector<TableNode> > mergeMatrix; + TQValueList<TableNode> tableRowTags; + TQValueVector< TQValueVector<TableNode> > mergeMatrix; mergeMatrix.resize(pInitialTableSize); for (uint i = 0; i < pInitialTableSize; i++) mergeMatrix[i].resize(pInitialTableSize); @@ -266,7 +266,7 @@ bool TableEditor::setTableArea( int bLine, int bCol, int eLine, int eCol, Parser Node *n = node; while (n != lastNode->nextSibling()) { - QString tagName = n->tag->name.lower(); + TQString tagName = n->tag->name.lower(); if (tagName == "table") { if (m_table && m_dataTable && nRow > 0 && nCol > 0) //nested table! @@ -283,7 +283,7 @@ bool TableEditor::setTableArea( int bLine, int bCol, int eLine, int eCol, Parser table.node = n; table.nestedData = m_write->text(table.bLine, table.bCol, table.eLine, table.eCol); m_nestedTables.append(table); - m_dataTable->item(nRow -1, nCol -1)->setPixmap(QIconSet(UserIcon("quick_table")).pixmap()); + m_dataTable->item(nRow -1, nCol -1)->setPixmap(TQIconSet(UserIcon("quick_table")).pixmap()); m_dataTable->updateCell(nRow - 1, nCol - 1); } n = n->next; @@ -482,7 +482,7 @@ bool TableEditor::setTableArea( int bLine, int bCol, int eLine, int eCol, Parser tableNode.merged = false; tableRowTags.append(tableNode); } - QString colspanValue = n->tag->attributeValue("colspan", true); + TQString colspanValue = n->tag->attributeValue("colspan", true); int colValue = 1; int lastCol = nCol; if (!colspanValue.isEmpty()) @@ -510,7 +510,7 @@ bool TableEditor::setTableArea( int bLine, int bCol, int eLine, int eCol, Parser } else colValue = 1; } - QString rowspanValue = n->tag->attributeValue("rowspan", true); + TQString rowspanValue = n->tag->attributeValue("rowspan", true); if (!rowspanValue.isEmpty()) { bool ok; @@ -602,7 +602,7 @@ void TableEditor::slotEditTableFooter() } -void TableEditor::slotTabChanged( QWidget *w) +void TableEditor::slotTabChanged( TQWidget *w) { int i = tabWidget->indexOf(w); switch (i) @@ -636,9 +636,9 @@ void TableEditor::slotTabChanged( QWidget *w) } -QString TableEditor::readModifiedTable() +TQString TableEditor::readModifiedTable() { - QString tableString; + TQString tableString; tableString = m_table->toString(); if (!captionText->text().isEmpty()) { tableString += indent(2); @@ -646,7 +646,7 @@ QString TableEditor::readModifiedTable() tableString += captionText->text(); tableString += "</" + QuantaCommon::tagCase("caption") + ">"; } - for (QValueList<Tag*>::Iterator it = m_colTags.begin(); it != m_colTags.end(); ++it) { + for (TQValueList<Tag*>::Iterator it = m_colTags.begin(); it != m_colTags.end(); ++it) { tableString += indent(2); tableString += (*it)->toString(); } @@ -701,23 +701,23 @@ QString TableEditor::readModifiedTable() } -QString TableEditor::indent( int n ) +TQString TableEditor::indent( int n ) { - QString str; + TQString str; str.fill(' ', n); str.prepend('\n'); return str; } -QString TableEditor::cellValue( int row, int col ) +TQString TableEditor::cellValue( int row, int col ) { if (!m_dataTable) - return QString::null; - QString str; + return TQString::null; + TQString str; Node *node = (*m_tableTags)[row][col].node; if (!node) - return QString::null; + return TQString::null; str = node->tag->toString(); str += m_dataTable->text(row, col); str += "</" + QuantaCommon::tagCase(node->tag->name) + ">"; @@ -725,9 +725,9 @@ QString TableEditor::cellValue( int row, int col ) } -QString TableEditor::tableToString() +TQString TableEditor::tableToString() { - QString tableStr; + TQString tableStr; for (int i = 0; i < m_dataTable->numRows(); i++) { tableStr += indent(4); Node *node = (*m_tableRows)[i].node; @@ -755,11 +755,11 @@ QString TableEditor::tableToString() } -QString TableEditor::tagContent(Node *node) +TQString TableEditor::tagContent(Node *node) { if (!node) - return QString::null; - QString content; + return TQString::null; + TQString content; int bl, bc, el, ec; node->tag->endPos(bl, bc); bc++; @@ -775,7 +775,7 @@ QString TableEditor::tagContent(Node *node) n->tag->beginPos(el, ec); ec--; } else { - return QString::null; + return TQString::null; } } content = m_write->text(bl, bc, el, ec); @@ -798,12 +798,12 @@ void TableEditor::slotInsertRow() tableNode.node->tag = new Tag(); tableNode.node->tag->setDtd(m_dtd); tableNode.node->tag->parse("<tr>", m_write); - QValueList<TableNode>::Iterator rowIt = m_tableRows->at(num); + TQValueList<TableNode>::Iterator rowIt = m_tableRows->at(num); if (rowIt != m_tableRows->end()) m_tableRows->insert(rowIt, tableNode); else m_tableRows->append(tableNode); - QValueList<TableNode> tableRowTags; + TQValueList<TableNode> tableRowTags; for (int i = 0; i < m_dataTable->numCols(); i++) { tableNode.merged = false; tableNode.node = new Node(0L); @@ -818,7 +818,7 @@ void TableEditor::slotInsertRow() tableRowTags.append(tableNode); setCellText(m_dataTable, num, i, ""); } - QValueList<QValueList<TableNode> >::Iterator it = m_tableTags->at(num); + TQValueList<TQValueList<TableNode> >::Iterator it = m_tableTags->at(num); if (it != m_tableTags->end()) m_tableTags->insert(it, tableRowTags); else @@ -838,7 +838,7 @@ void TableEditor::slotInsertCol() if (m_createNodes) { TableNode tableNode; int i = 0; - for (QValueList<QValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { + for (TQValueList<TQValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { tableNode.merged = false; tableNode.node = new Node(0L); newNum++; @@ -899,9 +899,9 @@ void TableEditor::slotRemoveRow() m_row = m_dataTable->numRows() - 1; int i = 0; int j = 0; - for (QValueList<QValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { + for (TQValueList<TQValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { j = 0; - for (QValueList<TableNode>::Iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2) { + for (TQValueList<TableNode>::Iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2) { if ((*it2).merged && (*it2).mergedRow == m_row) { (*it2).merged = false; setCellText(m_dataTable, i, j, tagContent((*it2).node)); @@ -913,9 +913,9 @@ void TableEditor::slotRemoveRow() } i++; } - QValueList<TableNode*> updatedMainNodes; - QValueList<QValueList<TableNode> >::Iterator it2 = m_tableTags->at(m_row); - for (QValueList<TableNode>::Iterator it3 = (*it2).begin(); it3 != (*it2).end(); ++it3) { + TQValueList<TableNode*> updatedMainNodes; + TQValueList<TQValueList<TableNode> >::Iterator it2 = m_tableTags->at(m_row); + for (TQValueList<TableNode>::Iterator it3 = (*it2).begin(); it3 != (*it2).end(); ++it3) { if ((*it3).merged) { TableNode *mainTableNode = &((*m_tableTags)[(*it3).mergedRow][(*it3).mergedCol]); @@ -924,7 +924,7 @@ void TableEditor::slotRemoveRow() int rowspan = mainTableNode->node->tag->attributeValue("rowspan", true).toInt(); rowspan--; if (rowspan > 1) - mainTableNode->node->tag->editAttribute("rowspan", QString("%1").arg(rowspan)); + mainTableNode->node->tag->editAttribute("rowspan", TQString("%1").arg(rowspan)); else mainTableNode->node->tag->deleteAttribute("rowspan"); updatedMainNodes.append(mainTableNode); @@ -936,7 +936,7 @@ void TableEditor::slotRemoveRow() } m_tableTags->erase(it2); m_dataTable->removeRow(m_row); - QValueList<TableNode>::Iterator it = m_tableRows->at(m_row); + TQValueList<TableNode>::Iterator it = m_tableRows->at(m_row); Node::deleteNode((*it).node); newNum--; m_tableRows->erase(it); @@ -948,9 +948,9 @@ void TableEditor::slotRemoveCol() { int i = 0; int j = 0; - for (QValueList<QValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { + for (TQValueList<TQValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { j = 0; - for (QValueList<TableNode>::Iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2) { + for (TQValueList<TableNode>::Iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2) { if ((*it2).merged && (*it2).mergedCol == m_col) { (*it2).merged = false; setCellText(m_dataTable, i, j, tagContent((*it2).node)); @@ -964,9 +964,9 @@ void TableEditor::slotRemoveCol() } if (m_col == -1) m_col = m_dataTable->numCols() - 1; - QValueList<TableNode*> updatedMainNodes; - for (QValueList<QValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { - QValueList<TableNode>::Iterator it2 = (*it).at(m_col); + TQValueList<TableNode*> updatedMainNodes; + for (TQValueList<TQValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { + TQValueList<TableNode>::Iterator it2 = (*it).at(m_col); if ((*it2).merged) { TableNode *mainTableNode = &((*m_tableTags)[(*it2).mergedRow][(*it2).mergedCol]); @@ -975,7 +975,7 @@ void TableEditor::slotRemoveCol() int colspan = mainTableNode->node->tag->attributeValue("colspan", true).toInt(); colspan--; if (colspan > 1) - mainTableNode->node->tag->editAttribute("colspan", QString("%1").arg(colspan)); + mainTableNode->node->tag->editAttribute("colspan", TQString("%1").arg(colspan)); else mainTableNode->node->tag->deleteAttribute("colspan"); updatedMainNodes.append(mainTableNode); @@ -1018,9 +1018,9 @@ void TableEditor::createNewTable(Document *write, const DTDStruct *dtd) } -void TableEditor::deleteList( QValueList<TableNode> *table ) +void TableEditor::deleteList( TQValueList<TableNode> *table ) { - for (QValueList<TableNode>::Iterator it = table->begin(); it != table->end(); ++it) { + for (TQValueList<TableNode>::Iterator it = table->begin(); it != table->end(); ++it) { Node::deleteNode((*it).node); newNum--; } @@ -1029,10 +1029,10 @@ void TableEditor::deleteList( QValueList<TableNode> *table ) } -void TableEditor::deleteMatrix( QValueList<QValueList<TableNode> > *matrix ) +void TableEditor::deleteMatrix( TQValueList<TQValueList<TableNode> > *matrix ) { - for (QValueList<QValueList<TableNode> >::Iterator it = matrix->begin(); it != matrix->end(); ++it) { - for (QValueList<TableNode>::Iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2) { + for (TQValueList<TQValueList<TableNode> >::Iterator it = matrix->begin(); it != matrix->end(); ++it) { + for (TQValueList<TableNode>::Iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2) { Node::deleteNode((*it2).node); newNum--; } @@ -1046,7 +1046,7 @@ void TableEditor::slotMergeCells() { slotUnmergeCells(); //first unmerge all cells from the selection - QTableSelection selection = m_dataTable->selection(m_dataTable->currentSelection()); + TQTableSelection selection = m_dataTable->selection(m_dataTable->currentSelection()); int tRow, bRow, lCol, rCol; tRow = selection.topRow(); bRow = selection.bottomRow(); @@ -1054,9 +1054,9 @@ void TableEditor::slotMergeCells() rCol = selection.rightCol(); TableNode *mainTableNode = &((*m_tableTags)[tRow][lCol]); if (rCol - lCol > 0) - mainTableNode->node->tag->editAttribute("colspan", QString("%1").arg(rCol - lCol + 1)); + mainTableNode->node->tag->editAttribute("colspan", TQString("%1").arg(rCol - lCol + 1)); if (bRow - tRow > 0) - mainTableNode->node->tag->editAttribute("rowspan", QString("%1").arg(bRow - tRow + 1)); + mainTableNode->node->tag->editAttribute("rowspan", TQString("%1").arg(bRow - tRow + 1)); for (int i = 0; i < bRow - tRow + 1; i++) for (int j = 0; j < rCol - lCol + 1; j++) { if (i != 0 || j != 0) { @@ -1080,7 +1080,7 @@ void TableEditor::slotUnmergeCells() int tRow, bRow, lCol, rCol; int selectionNum = m_dataTable->currentSelection(); if (selectionNum != -1) { - QTableSelection selection = m_dataTable->selection(selectionNum); + TQTableSelection selection = m_dataTable->selection(selectionNum); tRow = selection.topRow(); bRow = selection.bottomRow(); lCol = selection.leftCol(); @@ -1099,9 +1099,9 @@ void TableEditor::slotUnmergeCells() TableNode newTableNode; int i = 0; int j = 0; - for (QValueList<QValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { + for (TQValueList<TQValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) { j = 0; - QValueList<TableNode>::Iterator it2 = (*it).begin(); + TQValueList<TableNode>::Iterator it2 = (*it).begin(); while (it2 != (*it).end()) { if ((*it2).merged && tableNode.mergedRow == (*it2).mergedRow && @@ -1138,8 +1138,8 @@ void TableEditor::slotUnmergeCells() newTableNode.node = new Node(0L); newNum++; newTableNode.node->tag = new Tag(*(tmpNode.node->tag)); - QValueList<QValueList<TableNode> >::Iterator iter1 = m_tableTags->at(tableNode.mergedRow); - QValueList<TableNode>::Iterator iter2 = (*iter1).at(tableNode.mergedCol); + TQValueList<TQValueList<TableNode> >::Iterator iter1 = m_tableTags->at(tableNode.mergedRow); + TQValueList<TableNode>::Iterator iter2 = (*iter1).at(tableNode.mergedCol); iter2 = (*iter1).erase(iter2); (*iter1).insert(iter2, newTableNode); Node::deleteNode(tmpNode.node); @@ -1153,16 +1153,16 @@ void TableEditor::slotEditChildTable() { bool tempDocCreated = false; bool error = false; - QValueList<NestedTable>::Iterator errorIt; + TQValueList<NestedTable>::Iterator errorIt; Parser *localParser = 0L; Document *w = 0L; Node *savedBaseNode = 0L; NestedTable table; - for (QValueList<NestedTable>::Iterator it = m_nestedTables.begin(); it != m_nestedTables.end(); ++it) { + for (TQValueList<NestedTable>::Iterator it = m_nestedTables.begin(); it != m_nestedTables.end(); ++it) { table = *it; if (table.row == m_row && table.col == m_col) { - QString cellData = m_dataTable->text(table.row, table.col); + TQString cellData = m_dataTable->text(table.row, table.col); int pos = cellData.find(table.nestedData); if (pos == -1) { KMessageBox::error(this, i18n("Cannot edit the child table; you probably modified the cell containing the table manually."), i18n("Cannot Read Table")); @@ -1174,7 +1174,7 @@ void TableEditor::slotEditChildTable() KTextEditor::Document *doc = KTextEditor::createDocument ("libkatepart", 0L, "KTextEditor::Document"); w = new Document(doc, 0L); - QString tableData = readModifiedTable(); + TQString tableData = readModifiedTable(); w->editIf->insertText(0, 0, tableData); localParser = new Parser(); savedBaseNode = baseNode; //we must save it as it's deleted in the localParser->parse(); @@ -1228,7 +1228,7 @@ void TableEditor::slotEditChildTable() //cleanup on error if (error) { m_nestedTables.erase(errorIt); - m_dataTable->item(table.row, table.col)->setPixmap(QPixmap()); + m_dataTable->item(table.row, table.col)->setPixmap(TQPixmap()); m_dataTable->updateCell(table.row, table.col); if (tempDocCreated) { Node::deleteNode(baseNode); @@ -1245,7 +1245,7 @@ void TableEditor::slotHelpInvoked() kapp->invokeHelp("table-editor","quanta"); } -void TableEditor::configureTable( QTable * table ) +void TableEditor::configureTable( TQTable * table ) { if (!table) return; @@ -1259,9 +1259,9 @@ void TableEditor::configureTable( QTable * table ) table->setRowMovingEnabled(true); } -void TableEditor::setCellText( QTable * table, int row, int col, const QString & text ) +void TableEditor::setCellText( TQTable * table, int row, int col, const TQString & text ) { - table->setItem(row, col, new TableItem(table, QTableItem::OnTyping, text)); + table->setItem(row, col, new TableItem(table, TQTableItem::OnTyping, text)); } void TableEditor::configureCell(int row, int col, Node * node) @@ -1273,7 +1273,7 @@ void TableEditor::configureCell(int row, int col, Node * node) item->setHeader(node->tag->name.lower() == "th"); // Horizontal alignment Qt::AlignmentFlags flags; - QString align = node->tag->attributeValue("align", true); + TQString align = node->tag->attributeValue("align", true); if (align == "right") flags = Qt::AlignRight; else if (align == "center") @@ -1286,7 +1286,7 @@ void TableEditor::configureCell(int row, int col, Node * node) flags = Qt::AlignLeft; item->setAlignment(flags); // Vertical alignment - QString valign = node->tag->attributeValue("valign", true); + TQString valign = node->tag->attributeValue("valign", true); if (valign == "top") flags = Qt::AlignTop; else if (valign == "bottom") diff --git a/quanta/components/tableeditor/tableeditor.h b/quanta/components/tableeditor/tableeditor.h index b1df7b48..15393b9c 100644 --- a/quanta/components/tableeditor/tableeditor.h +++ b/quanta/components/tableeditor/tableeditor.h @@ -16,7 +16,7 @@ #define TABLEEDITOR_H #include <kurl.h> -#include <qvaluelist.h> +#include <tqvaluelist.h> #include "tableeditors.h" #include "document.h" @@ -40,7 +40,7 @@ public: -typedef struct NestedTable{ Node *node; int row; int col; int bLine; int bCol; int eLine; int eCol; QString nestedData;}; +typedef struct NestedTable{ Node *node; int row; int col; int bLine; int bCol; int eLine; int eCol; TQString nestedData;}; class Parser; @@ -49,21 +49,21 @@ class TableEditor : public TableEditorS Q_OBJECT public: - TableEditor( QWidget* parent = 0, const char* name = 0 ); + TableEditor( TQWidget* parent = 0, const char* name = 0 ); ~TableEditor(); virtual bool setTableArea( int bLine, int bCol, int eLine, int eCol, Parser * docParser ); virtual void setBaseURL( const KURL & url ); - virtual QString readModifiedTable(); + virtual TQString readModifiedTable(); virtual void createNewTable( Document * write, const DTDStruct * dtd ); // Set defaults for table: enable word wrap, fit content, allow swapping col/rows with D&D - virtual void configureTable( QTable * table ); - virtual void setCellText( QTable * table, int row, int col, const QString & text ); + virtual void configureTable( TQTable * table ); + virtual void setCellText( TQTable * table, int row, int col, const TQString & text ); // Configure TableItem from tag attributes virtual void configureCell( int row, int col, Node * node ); public slots: - virtual void slotContextMenuRequested( int row, int col, const QPoint & pos ); + virtual void slotContextMenuRequested( int row, int col, const TQPoint & pos ); virtual void slotEditCell(); // Wrapper for setText to use TableItem instead of QTableItem virtual void slotEditCellText( int r, int ); @@ -73,7 +73,7 @@ public slots: virtual void slotEditTableBody(); virtual void slotEditTableHeader(); virtual void slotEditTableFooter(); - virtual void slotTabChanged( QWidget * w ); + virtual void slotTabChanged( TQWidget * w ); virtual void slotInsertRow(); virtual void slotInsertCol(); virtual void slotAddRemoveRow( int num ); @@ -86,17 +86,17 @@ public slots: virtual void slotHelpInvoked(); protected: - QValueList<Tag*> m_colTags; + TQValueList<Tag*> m_colTags; int m_unmergeCellsId; int m_mergeSeparatorId; int m_mergeCellsId; bool m_createNodes; - QValueList<QValueList<TableNode> > *m_tableTags; - QValueList<QValueList<TableNode> > *m_tableFooterTags; - QValueList<QValueList<TableNode> > *m_tableHeaderTags; - QValueList<TableNode> *m_tableFooterRows; - QValueList<TableNode> *m_tableHeaderRows; - QValueList<TableNode> *m_tableRows; + TQValueList<TQValueList<TableNode> > *m_tableTags; + TQValueList<TQValueList<TableNode> > *m_tableFooterTags; + TQValueList<TQValueList<TableNode> > *m_tableHeaderTags; + TQValueList<TableNode> *m_tableFooterRows; + TQValueList<TableNode> *m_tableHeaderRows; + TQValueList<TableNode> *m_tableRows; Document* m_write; Tag *m_table; Tag *m_tfoot; @@ -111,21 +111,21 @@ protected: KPopupMenu *m_popup; KURL m_baseURL; const DTDStruct *m_dtd; - QValueList<QValueList<TableNode> > *m_tableDataTags; - QValueList<TableNode> *m_tableDataRows; - QTable *m_dataTable; - QSpinBox *m_rowSpin; - QSpinBox *m_colSpin; + TQValueList<TQValueList<TableNode> > *m_tableDataTags; + TQValueList<TableNode> *m_tableDataRows; + TQTable *m_dataTable; + TQSpinBox *m_rowSpin; + TQSpinBox *m_colSpin; int m_bLine, m_bCol, m_eLine, m_eCol; - QValueList<NestedTable> m_nestedTables; + TQValueList<NestedTable> m_nestedTables; int m_editChildId; - virtual QString indent( int n ); - virtual QString cellValue( int row, int col ); - virtual QString tableToString(); - virtual QString tagContent( Node * node ); - virtual void deleteList( QValueList<TableNode> * table ); - virtual void deleteMatrix( QValueList<QValueList<TableNode> > * matrix ); + virtual TQString indent( int n ); + virtual TQString cellValue( int row, int col ); + virtual TQString tableToString(); + virtual TQString tagContent( Node * node ); + virtual void deleteList( TQValueList<TableNode> * table ); + virtual void deleteMatrix( TQValueList<TQValueList<TableNode> > * matrix ); }; diff --git a/quanta/components/tableeditor/tableitem.cpp b/quanta/components/tableeditor/tableitem.cpp index 96d7d37c..6d3da1ac 100644 --- a/quanta/components/tableeditor/tableitem.cpp +++ b/quanta/components/tableeditor/tableitem.cpp @@ -14,66 +14,66 @@ * * ***************************************************************************/ -#include <qtextedit.h> -#include <qpainter.h> +#include <tqtextedit.h> +#include <tqpainter.h> #include "tableitem.h" -TableItem::TableItem(QTable* table, EditType et) : QTableItem(table, et) +TableItem::TableItem(TQTable* table, EditType et) : TQTableItem(table, et) { setReplaceable(false); m_halign = Qt::AlignLeft; m_valign = Qt::AlignVCenter; } -TableItem::TableItem(QTable* table, EditType et, const QString& text) : QTableItem(table, et, text) +TableItem::TableItem(TQTable* table, EditType et, const TQString& text) : TQTableItem(table, et, text) { setReplaceable(false); m_halign = Qt::AlignLeft; m_valign = Qt::AlignVCenter; } -TableItem::TableItem (QTable* table, EditType et, const QString& text, const QPixmap& p) : - QTableItem(table, et, text, p) +TableItem::TableItem (TQTable* table, EditType et, const TQString& text, const TQPixmap& p) : + TQTableItem(table, et, text, p) { setReplaceable(false); m_halign = Qt::AlignLeft; m_valign = Qt::AlignVCenter; } -QWidget* TableItem::createEditor() const +TQWidget* TableItem::createEditor() const { - QTextEdit* Editor = new QTextEdit(table()->viewport()); - Editor->setTextFormat(QTextEdit::PlainText); - Editor->setHScrollBarMode(QScrollView::AlwaysOff); - Editor->setVScrollBarMode(QScrollView::AlwaysOff); + TQTextEdit* Editor = new TQTextEdit(table()->viewport()); + Editor->setTextFormat(TQTextEdit::PlainText); + Editor->setHScrollBarMode(TQScrollView::AlwaysOff); + Editor->setVScrollBarMode(TQScrollView::AlwaysOff); Editor->setBold(m_header); Editor->setText(text()); - QObject::connect(Editor, SIGNAL(textChanged()), table(), SLOT(doValueChanged())); + TQObject::connect(Editor, TQT_SIGNAL(textChanged()), table(), TQT_SLOT(doValueChanged())); return Editor; } -void TableItem::setContentFromEditor(QWidget *w) +void TableItem::setContentFromEditor(TQWidget *w) { - if (w->inherits( "QTextEdit" )) - setText(((QTextEdit*)w)->text()); + if (w->inherits( "TQTextEdit" )) + setText(((TQTextEdit*)w)->text()); else - QTableItem::setContentFromEditor(w); + TQTableItem::setContentFromEditor(w); } -void TableItem::paint(QPainter* p, const QColorGroup& cg, const QRect& cr, bool selected) +void TableItem::paint(TQPainter* p, const TQColorGroup& cg, const TQRect& cr, bool selected) { if (m_header) { - QFont editFont = p->font(); + TQFont editFont = p->font(); editFont.setBold(true); p->setFont(editFont); } - QRect cr0(0, 0, cr.width(), cr.height()); + TQRect cr0(0, 0, cr.width(), cr.height()); if (selected) { - p->fillRect(cr0, cg.brush(QColorGroup::Highlight)); + p->fillRect(cr0, cg.brush(TQColorGroup::Highlight)); p->setPen(cg.highlightedText()); } else { - p->fillRect(cr0, cg.brush(QColorGroup::Base)); + p->fillRect(cr0, cg.brush(TQColorGroup::Base)); p->setPen(cg.text()); } if (!pixmap().isNull()) { @@ -84,9 +84,9 @@ void TableItem::paint(QPainter* p, const QColorGroup& cg, const QRect& cr, bool p->drawText(4, 4, cr0.width()-8, cr0.height()-8, m_halign | m_valign | WordBreak, text()); } -QSize TableItem::sizeHint() const +TQSize TableItem::sizeHint() const { - QSize size = QTableItem::sizeHint(); + TQSize size = TQTableItem::sizeHint(); size.setWidth(size.width()+8); size.setHeight(size.height()+8); return size; diff --git a/quanta/components/tableeditor/tableitem.h b/quanta/components/tableeditor/tableitem.h index 1eff7f59..88c94e20 100644 --- a/quanta/components/tableeditor/tableitem.h +++ b/quanta/components/tableeditor/tableitem.h @@ -17,7 +17,7 @@ #ifndef TABLEITEM_H #define TABLEITEM_H -#include <qtable.h> +#include <tqtable.h> #include <kdeversion.h> class TableItem : public QTableItem @@ -28,17 +28,17 @@ private: bool m_header; public: // Standard constructors copied from QTableItem - TableItem(QTable* table, EditType et); - TableItem(QTable* table, EditType et, const QString& text); - TableItem (QTable* table, EditType et, const QString& text, const QPixmap& p); - // Use QTextEdit instead of standard QLineEdit - virtual QWidget* createEditor() const; + TableItem(TQTable* table, EditType et); + TableItem(TQTable* table, EditType et, const TQString& text); + TableItem (TQTable* table, EditType et, const TQString& text, const TQPixmap& p); + // Use TQTextEdit instead of standard QLineEdit + virtual TQWidget* createEditor() const; // Get text from QTextEdit - virtual void setContentFromEditor(QWidget *w); + virtual void setContentFromEditor(TQWidget *w); // Paint cell - handle alignment (horizontal and vertical) and bold for header - virtual void paint(QPainter* p, const QColorGroup& cg, const QRect& cr, bool selected); - // Return A bit larger sizeHint because QTextEdit has some margin around - virtual QSize sizeHint() const; + virtual void paint(TQPainter* p, const TQColorGroup& cg, const TQRect& cr, bool selected); + // Return A bit larger sizeHint because TQTextEdit has some margin around + virtual TQSize sizeHint() const; // Get and set vertical aligment Qt::AlignmentFlags vAlignment() {return m_valign;} void setVAlignment(Qt::AlignmentFlags flags) {m_valign = flags;} |