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 /kspread/selection.cc | |
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 'kspread/selection.cc')
-rw-r--r-- | kspread/selection.cc | 238 |
1 files changed, 119 insertions, 119 deletions
diff --git a/kspread/selection.cc b/kspread/selection.cc index 177cbafc..3a0346b6 100644 --- a/kspread/selection.cc +++ b/kspread/selection.cc @@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qregexp.h> +#include <tqregexp.h> #include <kdebug.h> @@ -48,18 +48,18 @@ public: { view = v; sheet = 0; - anchor = QPoint(1,1); - cursor = QPoint(1,1); - marker = QPoint(1,1); - - colors.push_back(Qt::red); - colors.push_back(Qt::blue); - colors.push_back(Qt::magenta); - colors.push_back(Qt::darkRed); - colors.push_back(Qt::darkGreen); - colors.push_back(Qt::darkMagenta); - colors.push_back(Qt::darkCyan); - colors.push_back(Qt::darkYellow); + anchor = TQPoint(1,1); + cursor = TQPoint(1,1); + marker = TQPoint(1,1); + + colors.push_back(TQt::red); + colors.push_back(TQt::blue); + colors.push_back(TQt::magenta); + colors.push_back(TQt::darkRed); + colors.push_back(TQt::darkGreen); + colors.push_back(TQt::darkMagenta); + colors.push_back(TQt::darkCyan); + colors.push_back(TQt::darkYellow); multipleSelection = false; @@ -70,10 +70,10 @@ public: View* view; Sheet* sheet; - QPoint anchor; - QPoint cursor; - QPoint marker; - QValueList<QColor> colors; + TQPoint anchor; + TQPoint cursor; + TQPoint marker; + TQValueList<TQColor> colors; bool multipleSelection : 1; @@ -88,7 +88,7 @@ public: namespace KSpread { Selection::Selection(View *view) - : QObject(view), Region(1,1) + : TQObject(view), Region(1,1) { d = new Private(view); d->activeSubRegionStart = 0; @@ -96,7 +96,7 @@ Selection::Selection(View *view) } Selection::Selection(const Selection& selection) - : QObject(selection.d->view), Region() + : TQObject(selection.d->view), Region() { /* kdDebug() << k_funcinfo << endl;*/ d = new Private(selection.d->view); @@ -110,7 +110,7 @@ Selection::~Selection() delete d; } -void Selection::initialize(const QPoint& point, Sheet* sheet) +void Selection::initialize(const TQPoint& point, Sheet* sheet) { if (!util_isPointValid(point)) return; @@ -131,14 +131,14 @@ void Selection::initialize(const QPoint& point, Sheet* sheet) } Region changedRegion(*this); - changedRegion.add(extendToMergedAreas(QRect(d->anchor,d->marker))); + changedRegion.add(extendToMergedAreas(TQRect(d->anchor,d->marker))); - QPoint topLeft(point); + TQPoint topLeft(point); Cell* cell = d->view->activeSheet()->cellAt(point); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - topLeft = QPoint(cell->column(), cell->row()); + topLeft = TQPoint(cell->column(), cell->row()); } d->anchor = topLeft; @@ -178,9 +178,9 @@ void Selection::initialize(const QPoint& point, Sheet* sheet) emit changed(changedRegion); } -void Selection::initialize(const QRect& range, Sheet* sheet) +void Selection::initialize(const TQRect& range, Sheet* sheet) { - if (!util_isRectValid(range) || ( range == QRect(0,0,1,1) )) + if (!util_isRectValid(range) || ( range == TQRect(0,0,1,1) )) return; if (!sheet) @@ -196,22 +196,22 @@ void Selection::initialize(const QRect& range, Sheet* sheet) } Region changedRegion(*this); - changedRegion.add(extendToMergedAreas(QRect(d->anchor,d->marker))); + changedRegion.add(extendToMergedAreas(TQRect(d->anchor,d->marker))); - QPoint topLeft(range.topLeft()); + TQPoint topLeft(range.topLeft()); Cell* cell = d->view->activeSheet()->cellAt(topLeft); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - topLeft = QPoint(cell->column(), cell->row()); + topLeft = TQPoint(cell->column(), cell->row()); } - QPoint bottomRight(range.bottomRight()); + TQPoint bottomRight(range.bottomRight()); cell = d->view->activeSheet()->cellAt(bottomRight); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - bottomRight = QPoint(cell->column(), cell->row()); + bottomRight = TQPoint(cell->column(), cell->row()); } d->anchor = topLeft; @@ -220,7 +220,7 @@ void Selection::initialize(const QRect& range, Sheet* sheet) fixSubRegionDimension(); // TODO remove this sanity check Iterator it = cells().begin() += d->activeSubRegionStart + d->activeSubRegionLength; - if (it != insert(it, QRect(topLeft, bottomRight), sheet/*, true*/)) + if (it != insert(it, TQRect(topLeft, bottomRight), sheet/*, true*/)) { // if the range was inserted clearSubRegion(); @@ -246,7 +246,7 @@ void Selection::initialize(const QRect& range, Sheet* sheet) { return; } - changedRegion.add(QRect(topLeft, bottomRight), sheet); + changedRegion.add(TQRect(topLeft, bottomRight), sheet); emit changed(changedRegion); } @@ -269,7 +269,7 @@ void Selection::initialize(const Region& region, Sheet* sheet) } Region changedRegion(*this); - changedRegion.add(extendToMergedAreas(QRect(d->anchor,d->marker))); + changedRegion.add(extendToMergedAreas(TQRect(d->anchor,d->marker))); // TODO Stefan: handle subregion insertion // TODO Stefan: handle obscured cells correctly @@ -286,20 +286,20 @@ void Selection::initialize(const Region& region, Sheet* sheet) range->setColor(d->colors[cells().size() % d->colors.size()]); } - QPoint topLeft(cells().last()->rect().normalize().topLeft()); + TQPoint topLeft(cells().last()->rect().normalize().topLeft()); Cell* cell = d->view->activeSheet()->cellAt(topLeft); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - topLeft = QPoint(cell->column(), cell->row()); + topLeft = TQPoint(cell->column(), cell->row()); } - QPoint bottomRight(cells().last()->rect().normalize().bottomRight()); + TQPoint bottomRight(cells().last()->rect().normalize().bottomRight()); cell = d->view->activeSheet()->cellAt(bottomRight); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - bottomRight = QPoint(cell->column(), cell->row()); + bottomRight = TQPoint(cell->column(), cell->row()); } d->anchor = topLeft; @@ -324,7 +324,7 @@ void Selection::update() emit changed(*this); } -void Selection::update(const QPoint& point) +void Selection::update(const TQPoint& point) { uint count = cells().count(); @@ -348,12 +348,12 @@ void Selection::update(const QPoint& point) return; } - QPoint topLeft(point); + TQPoint topLeft(point); Cell* cell = d->view->activeSheet()->cellAt(point); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - topLeft = QPoint(cell->column(), cell->row()); + topLeft = TQPoint(cell->column(), cell->row()); } if (topLeft == d->marker) @@ -361,8 +361,8 @@ void Selection::update(const QPoint& point) return; } - QRect area1 = (*d->activeElement)->rect().normalize(); - QRect newRange = extendToMergedAreas(QRect(d->anchor, topLeft)); + TQRect area1 = (*d->activeElement)->rect().normalize(); + TQRect newRange = extendToMergedAreas(TQRect(d->anchor, topLeft)); Element* oldElement = *d->activeElement; // returns iterator to the next element or end @@ -381,7 +381,7 @@ void Selection::update(const QPoint& point) d->activeElement--; } - QRect area2 = (*d->activeElement)->rect().normalize(); + TQRect area2 = (*d->activeElement)->rect().normalize(); Region changedRegion; bool newLeft = area1.left() != area2.left(); @@ -390,60 +390,60 @@ void Selection::update(const QPoint& point) bool newBottom = area1.bottom() != area2.bottom(); /* first, calculate some numbers that we'll use a few times */ - int farLeft = QMIN(area1.left(), area2.left()); - int innerLeft = QMAX(area1.left(), area2.left()); + int farLeft = TQMIN(area1.left(), area2.left()); + int innerLeft = TQMAX(area1.left(), area2.left()); - int farTop = QMIN(area1.top(), area2.top()); - int innerTop = QMAX(area1.top(), area2.top()); + int farTop = TQMIN(area1.top(), area2.top()); + int innerTop = TQMAX(area1.top(), area2.top()); - int farRight = QMAX(area1.right(), area2.right()); - int innerRight = QMIN(area1.right(), area2.right()); + int farRight = TQMAX(area1.right(), area2.right()); + int innerRight = TQMIN(area1.right(), area2.right()); - int farBottom = QMAX(area1.bottom(), area2.bottom()); - int innerBottom = QMIN(area1.bottom(), area2.bottom()); + int farBottom = TQMAX(area1.bottom(), area2.bottom()); + int innerBottom = TQMIN(area1.bottom(), area2.bottom()); if (newLeft) { - changedRegion.add(QRect(QPoint(farLeft, innerTop), - QPoint(innerLeft-1, innerBottom))); + changedRegion.add(TQRect(TQPoint(farLeft, innerTop), + TQPoint(innerLeft-1, innerBottom))); if (newTop) { - changedRegion.add(QRect(QPoint(farLeft, farTop), - QPoint(innerLeft-1, innerTop-1))); + changedRegion.add(TQRect(TQPoint(farLeft, farTop), + TQPoint(innerLeft-1, innerTop-1))); } if (newBottom) { - changedRegion.add(QRect(QPoint(farLeft, innerBottom+1), - QPoint(innerLeft-1, farBottom))); + changedRegion.add(TQRect(TQPoint(farLeft, innerBottom+1), + TQPoint(innerLeft-1, farBottom))); } } if (newTop) { - changedRegion.add(QRect(QPoint(innerLeft, farTop), - QPoint(innerRight, innerTop-1))); + changedRegion.add(TQRect(TQPoint(innerLeft, farTop), + TQPoint(innerRight, innerTop-1))); } if (newRight) { - changedRegion.add(QRect(QPoint(innerRight+1, innerTop), - QPoint(farRight, innerBottom))); + changedRegion.add(TQRect(TQPoint(innerRight+1, innerTop), + TQPoint(farRight, innerBottom))); if (newTop) { - changedRegion.add(QRect(QPoint(innerRight+1, farTop), - QPoint(farRight, innerTop-1))); + changedRegion.add(TQRect(TQPoint(innerRight+1, farTop), + TQPoint(farRight, innerTop-1))); } if (newBottom) { - changedRegion.add(QRect(QPoint(innerRight+1, innerBottom+1), - QPoint(farRight, farBottom))); + changedRegion.add(TQRect(TQPoint(innerRight+1, innerBottom+1), + TQPoint(farRight, farBottom))); } } if (newBottom) { - changedRegion.add(QRect(QPoint(innerLeft, innerBottom+1), - QPoint(innerRight, farBottom))); + changedRegion.add(TQRect(TQPoint(innerLeft, innerBottom+1), + TQPoint(innerRight, farBottom))); } d->marker = topLeft; @@ -452,7 +452,7 @@ void Selection::update(const QPoint& point) emit changed(changedRegion); } -void Selection::extend(const QPoint& point, Sheet* sheet) +void Selection::extend(const TQPoint& point, Sheet* sheet) { if (!util_isPointValid(point)) return; @@ -480,14 +480,14 @@ void Selection::extend(const QPoint& point, Sheet* sheet) } } - Region changedRegion = Region(extendToMergedAreas(QRect(d->marker,d->marker))); + Region changedRegion = Region(extendToMergedAreas(TQRect(d->marker,d->marker))); - QPoint topLeft(point); + TQPoint topLeft(point); Cell* cell = d->view->activeSheet()->cellAt(point); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - topLeft = QPoint(cell->column(), cell->row()); + topLeft = TQPoint(cell->column(), cell->row()); } uint count = cells().count(); @@ -512,10 +512,10 @@ void Selection::extend(const QPoint& point, Sheet* sheet) emit changed(changedRegion); } -void Selection::extend(const QRect& range, Sheet* sheet) +void Selection::extend(const TQRect& range, Sheet* sheet) { - //See comment in Selection::initialize(const QRect& range, Sheet* sheet) - if (!util_isRectValid(range) || (range == QRect(0,0,1,1))) + //See comment in Selection::initialize(const TQRect& range, Sheet* sheet) + if (!util_isRectValid(range) || (range == TQRect(0,0,1,1))) return; if (isEmpty()) @@ -541,20 +541,20 @@ void Selection::extend(const QRect& range, Sheet* sheet) } } - QPoint topLeft(range.topLeft()); + TQPoint topLeft(range.topLeft()); Cell* cell = d->view->activeSheet()->cellAt(topLeft); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - topLeft = QPoint(cell->column(), cell->row()); + topLeft = TQPoint(cell->column(), cell->row()); } - QPoint bottomRight(range.bottomRight()); + TQPoint bottomRight(range.bottomRight()); cell = d->view->activeSheet()->cellAt(bottomRight); if (cell->isObscured() && cell->isPartOfMerged()) { cell = cell->obscuringCells().first(); - bottomRight = QPoint(cell->column(), cell->row()); + bottomRight = TQPoint(cell->column(), cell->row()); } d->anchor = topLeft; @@ -565,12 +565,12 @@ void Selection::extend(const QRect& range, Sheet* sheet) Element* element; if (d->multipleSelection) { - d->activeElement = insert(++d->activeElement, extendToMergedAreas(QRect(topLeft, bottomRight)).normalize(), sheet, false); + d->activeElement = insert(++d->activeElement, extendToMergedAreas(TQRect(topLeft, bottomRight)).normalize(), sheet, false); element = (d->activeElement == cells().end()) ? 0 : *d->activeElement; } else { - element = add(extendToMergedAreas(QRect(topLeft, bottomRight)).normalize(), sheet); + element = add(extendToMergedAreas(TQRect(topLeft, bottomRight)).normalize(), sheet); d->activeElement = --cells().end(); } if (element && element->type() == Element::Point) @@ -616,7 +616,7 @@ void Selection::extend(const Region& region) emit changed(*this); } -Selection::Element* Selection::eor(const QPoint& point, Sheet* sheet) +Selection::Element* Selection::eor(const TQPoint& point, Sheet* sheet) { if (isSingular()) { @@ -625,17 +625,17 @@ Selection::Element* Selection::eor(const QPoint& point, Sheet* sheet) return Region::eor(point, sheet); } -const QPoint& Selection::anchor() const +const TQPoint& Selection::anchor() const { return d->anchor; } -const QPoint& Selection::cursor() const +const TQPoint& Selection::cursor() const { return d->cursor; } -const QPoint& Selection::marker() const +const TQPoint& Selection::marker() const { return d->marker; } @@ -645,7 +645,7 @@ bool Selection::isSingular() const return Region::isSingular(); } -QRect Selection::selectionHandleArea() const +TQRect Selection::selectionHandleArea() const { int column, row; @@ -667,17 +667,17 @@ QRect Selection::selectionHandleArea() const double width = cell->dblWidth( column ); double height = cell->dblHeight( row ); - QPoint rightBottom( d->view->doc()->zoomItX( xpos + width ), + TQPoint rightBottom( d->view->doc()->zoomItX( xpos + width ), d->view->doc()->zoomItY( ypos + height ) ); - QRect handle( ( rightBottom.x() - 2 ), + TQRect handle( ( rightBottom.x() - 2 ), ( rightBottom.y() - 2 ), ( 5 ), ( 5 ) ); return handle; } -QString Selection::name(Sheet* sheet) const +TQString Selection::name(Sheet* sheet) const { return Region::name(sheet ? sheet : d->sheet); } @@ -692,13 +692,13 @@ Sheet* Selection::sheet() const return d->sheet; } -void Selection::setActiveElement(const QPoint& point) +void Selection::setActiveElement(const TQPoint& point) { uint counter = 0; Iterator end = cells().end(); for (Iterator it = cells().begin(); it != end; ++it) { - QRect range = (*it)->rect(); + TQRect range = (*it)->rect(); if (range.topLeft() == point || range.bottomRight() == point) { d->anchor = range.topLeft(); @@ -726,7 +726,7 @@ void Selection::setActiveElement(uint pos) } Iterator it = cells().begin() += pos; - QRect range = (*it)->rect(); + TQRect range = (*it)->rect(); d->anchor = range.topLeft(); d->cursor = range.bottomRight(); d->marker = range.bottomRight(); @@ -796,13 +796,13 @@ void Selection::setActiveSubRegion(uint start, uint length) d->activeElement = cells().begin() += d->activeSubRegionStart; } -QString Selection::activeSubRegionName() const +TQString Selection::activeSubRegionName() const { // kdDebug() << k_funcinfo << endl; // kdDebug() << *this << endl; // kdDebug() << "start = " << d->activeSubRegionStart << ", len = " << d->activeSubRegionLength << endl; - QStringList names; + TQStringList names; Iterator it = cells().begin(); it += d->activeSubRegionStart; Iterator end = it; @@ -820,24 +820,24 @@ void Selection::setMultipleSelection(bool state) d->multipleSelection = state; } -const QValueList<QColor>& Selection::colors() const +const TQValueList<TQColor>& Selection::colors() const { return d->colors; } -QRect Selection::lastRange(bool extend) const +TQRect Selection::lastRange(bool extend) const { - QRect selection = QRect(d->anchor, d->marker).normalize(); + TQRect selection = TQRect(d->anchor, d->marker).normalize(); return extend ? extendToMergedAreas(selection) : selection; } -QRect Selection::selection(bool extend) const +TQRect Selection::selection(bool extend) const { - QRect selection = QRect(d->anchor, d->marker).normalize(); + TQRect selection = TQRect(d->anchor, d->marker).normalize(); return extend ? extendToMergedAreas(selection) : selection; } -QRect Selection::extendToMergedAreas(QRect area) const +TQRect Selection::extendToMergedAreas(TQRect area) const { if (!d->view->activeSheet()) return area; @@ -873,16 +873,16 @@ QRect Selection::extendToMergedAreas(QRect area) const cell = d->view->activeSheet()->cellAt( x, y ); if( cell->doesMergeCells()) { - right=QMAX(right,cell->mergedXCells()+x); - bottom=QMAX(bottom,cell->mergedYCells()+y); + right=TQMAX(right,cell->mergedXCells()+x); + bottom=TQMAX(bottom,cell->mergedYCells()+y); } else if ( cell->isObscured() && cell->isPartOfMerged() ) { cell = cell->obscuringCells().first(); - left=QMIN(left,cell->column()); - top=QMIN(top,cell->row()); - bottom=QMAX(bottom,cell->row() + cell->mergedYCells()); - right=QMAX(right,cell->column() + cell->mergedXCells()); + left=TQMIN(left,cell->column()); + top=TQMIN(top,cell->row()); + bottom=TQMAX(bottom,cell->row() + cell->mergedYCells()); + right=TQMAX(right,cell->column() + cell->mergedXCells()); } } @@ -891,12 +891,12 @@ QRect Selection::extendToMergedAreas(QRect area) const return area; } -Selection::Region::Point* Selection::createPoint(const QPoint& point) const +Selection::Region::Point* Selection::createPoint(const TQPoint& point) const { return new Point(point); } -Selection::Region::Point* Selection::createPoint(const QString& string) const +Selection::Region::Point* Selection::createPoint(const TQString& string) const { return new Point(string); } @@ -906,12 +906,12 @@ Selection::Region::Point* Selection::createPoint(const Point& point) const return new Point(point); } -Selection::Region::Range* Selection::createRange(const QRect& rect) const +Selection::Region::Range* Selection::createRange(const TQRect& rect) const { return new Range(rect); } -Selection::Region::Range* Selection::createRange(const QString& string) const +Selection::Region::Range* Selection::createRange(const TQString& string) const { return new Range(string); } @@ -925,17 +925,17 @@ Selection::Region::Range* Selection::createRange(const Range& range) const class Point ****************************************************************************/ -Selection::Point::Point(const QPoint& point) +Selection::Point::Point(const TQPoint& point) : Region::Point(point), - m_color(Qt::black), + m_color(TQt::black), m_columnFixed(false), m_rowFixed(false) { } -Selection::Point::Point(const QString& string) +Selection::Point::Point(const TQString& string) : Region::Point(string), - m_color(Qt::black), + m_color(TQt::black), m_columnFixed(false), m_rowFixed(false) { @@ -952,7 +952,7 @@ Selection::Point::Point(const QString& string) } //search for the first character != text - int result = string.find( QRegExp("[^A-Za-z]+"), p ); + int result = string.tqfind( TQRegExp("[^A-Za-z]+"), p ); if (string[result] == '$') { m_rowFixed = true; @@ -963,9 +963,9 @@ Selection::Point::Point(const QString& string) class Range ****************************************************************************/ -Selection::Range::Range(const QRect& range) +Selection::Range::Range(const TQRect& range) : Region::Range(range), - m_color(Qt::black), + m_color(TQt::black), m_leftFixed(false), m_rightFixed(false), m_topFixed(false), @@ -973,9 +973,9 @@ Selection::Range::Range(const QRect& range) { } -Selection::Range::Range(const QString& string) +Selection::Range::Range(const TQString& string) : Region::Range(string), - m_color(Qt::black), + m_color(TQt::black), m_leftFixed(false), m_rightFixed(false), m_topFixed(false), @@ -986,7 +986,7 @@ Selection::Range::Range(const QString& string) return; } - int delimiterPos = string.find(':'); + int delimiterPos = string.tqfind(':'); if (delimiterPos == -1) { return; |