summaryrefslogtreecommitdiffstats
path: root/kspread/region.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 /kspread/region.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 'kspread/region.cc')
-rw-r--r--kspread/region.cc164
1 files changed, 82 insertions, 82 deletions
diff --git a/kspread/region.cc b/kspread/region.cc
index 84fe3ce3..4b31554c 100644
--- a/kspread/region.cc
+++ b/kspread/region.cc
@@ -16,8 +16,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <qregexp.h>
-#include <qstringlist.h>
+#include <tqregexp.h>
+#include <tqstringlist.h>
#include <kdebug.h>
@@ -43,7 +43,7 @@ public:
}
View* view;
- QValueList<Element*> cells;
+ TQValueList<Element*> cells;
};
@@ -56,7 +56,7 @@ Region::Region()
d = new Private();
}
-Region::Region(View* view, const QString& string, Sheet* sheet)
+Region::Region(View* view, const TQString& string, Sheet* sheet)
{
d = new Private();
d->view = view;
@@ -65,17 +65,17 @@ Region::Region(View* view, const QString& string, Sheet* sheet)
{
return;
}
- QStringList substrings = QStringList::split(';', string);
- QStringList::ConstIterator end = substrings.constEnd();
- for (QStringList::ConstIterator it = substrings.constBegin(); it != end; ++it)
+ TQStringList substrings = TQStringList::split(';', string);
+ TQStringList::ConstIterator end = substrings.constEnd();
+ for (TQStringList::ConstIterator it = substrings.constBegin(); it != end; ++it)
{
- QString sRegion = *it;
+ TQString sRegion = *it;
if (!sheet)
{
sheet = filterSheetName(sRegion);
}
- int delimiterPos = sRegion.find(':');
+ int delimiterPos = sRegion.tqfind(':');
if (delimiterPos > -1)
{
// range
@@ -111,25 +111,25 @@ Region::Region(View* view, const QString& string, Sheet* sheet)
}
}
-Region::Region(const QRect& rect, Sheet* sheet)
+Region::Region(const TQRect& rect, Sheet* sheet)
{
d = new Private();
if (rect.isNull())
{
- kdError(36001) << "Region::Region(const QRect&): QRect is empty!" << endl;
+ kdError(36001) << "Region::Region(const TQRect&): TQRect is empty!" << endl;
return;
}
add(rect, sheet);
}
-Region::Region(const QPoint& point, Sheet* sheet)
+Region::Region(const TQPoint& point, Sheet* sheet)
{
d = new Private();
if (point.isNull())
{
- kdError(36001) << "Region::Region(const QPoint&): QPoint is empty!" << endl;
+ kdError(36001) << "Region::Region(const TQPoint&): TQPoint is empty!" << endl;
return;
}
add(point, sheet);
@@ -166,7 +166,7 @@ Region::Region(int x, int y, Sheet* sheet)
kdError(36001) << "Region::Region(int x, int y): Coordinates are invalid!" << endl;
return;
}
- add(QPoint(x,y), sheet);
+ add(TQPoint(x,y), sheet);
}
Region::Region(int x, int y, int width, int height, Sheet* sheet)
@@ -178,7 +178,7 @@ Region::Region(int x, int y, int width, int height, Sheet* sheet)
kdError(36001) << "Region::Region(int x, int y, int width, int height): Dimensions are invalid!" << endl;
return;
}
- add(QRect(x,y,width,height), sheet);
+ add(TQRect(x,y,width,height), sheet);
}
@@ -230,9 +230,9 @@ bool Region::isContiguous() const
return true;
}
-QString Region::name(Sheet* originSheet) const
+TQString Region::name(Sheet* originSheet) const
{
- QStringList names;
+ TQStringList names;
ConstIterator endOfList(d->cells.constEnd());
for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
{
@@ -242,7 +242,7 @@ QString Region::name(Sheet* originSheet) const
return names.isEmpty() ? "" : names.join(";");
}
-Region::Element* Region::add(const QPoint& point, Sheet* sheet)
+Region::Element* Region::add(const TQPoint& point, Sheet* sheet)
{
// kdDebug() << k_funcinfo << endl;
if (point.x() < 1 || point.y() < 1)
@@ -253,13 +253,13 @@ Region::Element* Region::add(const QPoint& point, Sheet* sheet)
return (it == d->cells.end()) ? 0 : *it;
}
-Region::Element* Region::add(const QRect& range, Sheet* sheet)
+Region::Element* Region::add(const TQRect& range, Sheet* sheet)
{
if (range.normalize().width() == 0 || range.normalize().height() == 0)
{
return 0;
}
- if (range.size() == QSize(1,1))
+ if (range.size() == TQSize(1,1))
{
return add(range.topLeft(), sheet);
}
@@ -277,14 +277,14 @@ Region::Element* Region::add(const Region& region)
return d->cells.isEmpty() ? 0 : d->cells.last();
}
-void Region::sub(const QPoint& point)
+void Region::sub(const TQPoint& point)
{
// TODO Stefan: Improve!
Iterator endOfList(d->cells.end());
for (Iterator it = d->cells.begin(); it != endOfList; ++it)
{
Element *element = *it;
- if (element->rect() == QRect(point,point))
+ if (element->rect() == TQRect(point,point))
{
delete element;
d->cells.remove(element);
@@ -293,7 +293,7 @@ void Region::sub(const QPoint& point)
}
}
-void Region::sub(const QRect& range)
+void Region::sub(const TQRect& range)
{
// TODO Stefan: Improve!
Iterator endOfList(d->cells.end());
@@ -327,7 +327,7 @@ void Region::sub(const Region& region)
}
}
-Region::Element* Region::eor(const QPoint& point, Sheet* sheet)
+Region::Element* Region::eor(const TQPoint& point, Sheet* sheet)
{
bool containsPoint = false;
@@ -335,7 +335,7 @@ Region::Element* Region::eor(const QPoint& point, Sheet* sheet)
Iterator endOfList = cells().end();
while (it != endOfList)
{
- if (!(*it)->contains(point))
+ if (!(*it)->tqcontains(point))
{
++it;
continue;
@@ -343,7 +343,7 @@ Region::Element* Region::eor(const QPoint& point, Sheet* sheet)
containsPoint = true;
int x = point.x();
int y = point.y();
- QRect fullRange = (*it)->rect().normalize();
+ TQRect fullRange = (*it)->rect().normalize();
delete *it;
it = cells().remove(it);
@@ -354,34 +354,34 @@ Region::Element* Region::eor(const QPoint& point, Sheet* sheet)
int height = y - top;
if (height > 0)
{
- insert(it, QRect(left, top, width, height), sheet);
+ insert(it, TQRect(left, top, width, height), sheet);
}
// left range
left = fullRange.left();
top = y;
- width = QMAX(0, x - left);
+ width = TQMAX(0, x - left);
height = 1;
if (width > 0)
{
- insert(it, QRect(left, top, width, height), sheet);
+ insert(it, TQRect(left, top, width, height), sheet);
}
// right range
- left = QMIN(x+1, fullRange.right());
+ left = TQMIN(x+1, fullRange.right());
top = y;
- width = QMAX(0, fullRange.right() - x);
+ width = TQMAX(0, fullRange.right() - x);
height = 1;
if (width > 0)
{
- insert(it, QRect(left, top, width, height), sheet);
+ insert(it, TQRect(left, top, width, height), sheet);
}
// bottom range
left = fullRange.left();
top = y+1;
width = fullRange.width();
- height = QMAX(0, fullRange.bottom() - y);
+ height = TQMAX(0, fullRange.bottom() - y);
if (height > 0)
{
- insert(it, QRect(left, top, width, height), sheet);
+ insert(it, TQRect(left, top, width, height), sheet);
}
return *it;
}
@@ -393,7 +393,7 @@ Region::Element* Region::eor(const QPoint& point, Sheet* sheet)
return 0;
}
-Region::Iterator Region::insert(Region::Iterator pos, const QPoint& point, Sheet* sheet, bool multi)
+Region::Iterator Region::insert(Region::Iterator pos, const TQPoint& point, Sheet* sheet, bool multi)
{
if (point.x() < 1 || point.y() < 1)
{
@@ -402,7 +402,7 @@ Region::Iterator Region::insert(Region::Iterator pos, const QPoint& point, Sheet
bool containsPoint = false;
// bool adjacentPoint = false;
-// QRect neighbour;
+// TQRect neighbour;
// we don't have to check for occurences?
if (multi)
@@ -420,7 +420,7 @@ Region::Iterator Region::insert(Region::Iterator pos, const QPoint& point, Sheet
{
continue;
}
- if (element->contains(point))
+ if (element->tqcontains(point))
{
containsPoint = true;
break;
@@ -428,9 +428,9 @@ Region::Iterator Region::insert(Region::Iterator pos, const QPoint& point, Sheet
/* else
{
neighbour = element->rect().normalize();
- neighbour.setTopLeft(neighbour.topLeft() - QPoint(1,1));
- neighbour.setBottomRight(neighbour.bottomRight() + QPoint(1,1));
- if (neighbour.contains(point))
+ neighbour.setTopLeft(neighbour.topLeft() - TQPoint(1,1));
+ neighbour.setBottomRight(neighbour.bottomRight() + TQPoint(1,1));
+ if (neighbour.tqcontains(point))
{
adjacentPoint = true; // TODO Stefan: Implement!
break;
@@ -446,9 +446,9 @@ Region::Iterator Region::insert(Region::Iterator pos, const QPoint& point, Sheet
return pos;
}
-Region::Iterator Region::insert(Region::Iterator pos, const QRect& range, Sheet* sheet, bool multi)
+Region::Iterator Region::insert(Region::Iterator pos, const TQRect& range, Sheet* sheet, bool multi)
{
- if (range.size() == QSize(1,1))
+ if (range.size() == TQSize(1,1))
{
return insert(pos, range.topLeft(), sheet);
}
@@ -471,11 +471,11 @@ Region::Iterator Region::insert(Region::Iterator pos, const QRect& range, Sheet*
++it;
continue;
}
- if ((*it)->contains(range))
+ if ((*it)->tqcontains(range))
{
containsRange = true;
}
- else if (range.contains((*it)->rect()))
+ else if (range.tqcontains((*it)->rect()))
{
delete *it;
it = d->cells.remove(it);
@@ -498,7 +498,7 @@ bool Region::isColumnAffected(uint col) const
for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
{
Element *element = *it;
- QRect normalizedRegion = element->rect().normalize();
+ TQRect normalizedRegion = element->rect().normalize();
if ((int)col >= normalizedRegion.left() && (int)col <= normalizedRegion.right())
{
return true;
@@ -513,7 +513,7 @@ bool Region::isRowAffected(uint row) const
for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
{
Element *element = *it;
- QRect normalizedRegion = element->rect().normalize();
+ TQRect normalizedRegion = element->rect().normalize();
if ((int)row >= normalizedRegion.top() && (int)row <= normalizedRegion.bottom())
{
return true;
@@ -528,7 +528,7 @@ bool Region::isColumnSelected(uint col) const
for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
{
Element *element = *it;
- QRect region = element->rect().normalize();
+ TQRect region = element->rect().normalize();
if ((col == 0 || ((int)col >= region.left() && (int)col <= region.right())) &&
region.top() == 1 && region.bottom() == KS_rowMax)
{
@@ -544,7 +544,7 @@ bool Region::isRowSelected(uint row) const
for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
{
Element *element = *it;
- QRect region = element->rect().normalize();
+ TQRect region = element->rect().normalize();
if ((row == 0 || ((int)row >= region.top() && (int)row <= region.bottom())) &&
region.left() == 1 && region.right() == KS_colMax)
{
@@ -560,7 +560,7 @@ bool Region::isColumnOrRowSelected() const
for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
{
Element *element = *it;
- QRect region = element->rect().normalize();
+ TQRect region = element->rect().normalize();
if ((region.top() == 1 && region.bottom() == KS_rowMax) ||
(region.left() == 1 && region.right() == KS_colMax))
{
@@ -570,7 +570,7 @@ bool Region::isColumnOrRowSelected() const
return false;
}
-bool Region::contains(const QPoint& point, Sheet* sheet) const
+bool Region::tqcontains(const TQPoint& point, Sheet* sheet) const
{
if (d->cells.isEmpty())
{
@@ -580,7 +580,7 @@ bool Region::contains(const QPoint& point, Sheet* sheet) const
for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
{
Element *element = *it;
- if (element->contains(point))
+ if (element->tqcontains(point))
{
if (sheet && element->sheet() != sheet)
{
@@ -606,7 +606,7 @@ void Region::clear()
}
}
-QRect Region::boundingRect() const
+TQRect Region::boundingRect() const
{
int left = KS_colMax;
int right = 1;
@@ -615,7 +615,7 @@ QRect Region::boundingRect() const
Region::ConstIterator endOfList = cells().constEnd();
for (Region::ConstIterator it = cells().constBegin(); it != endOfList; ++it)
{
- QRect range = (*it)->rect().normalize();
+ TQRect range = (*it)->rect().normalize();
if (range.left() < left)
{
left = range.left();
@@ -633,7 +633,7 @@ QRect Region::boundingRect() const
bottom = range.bottom();
}
}
- return QRect(left, top, right-left+1, bottom-top+1);
+ return TQRect(left, top, right-left+1, bottom-top+1);
}
Region::ConstIterator Region::constBegin() const
@@ -646,7 +646,7 @@ Region::ConstIterator Region::constEnd() const
return d->cells.constEnd();
}
-QValueList<Region::Element*>& Region::cells() const
+TQValueList<Region::Element*>& Region::cells() const
{
return d->cells;
}
@@ -688,13 +688,13 @@ void Region::operator=(const Region& other)
}
}
-Sheet* Region::filterSheetName(QString& sRegion)
+Sheet* Region::filterSheetName(TQString& sRegion)
{
Sheet* sheet = 0;
- int delimiterPos = sRegion.find( '!' );
+ int delimiterPos = sRegion.tqfind( '!' );
if (delimiterPos > -1)
{
- QString sheetName = sRegion.left(delimiterPos);
+ TQString sheetName = sRegion.left(delimiterPos);
// remove the '!'
sRegion = sRegion.right(sRegion.length() - delimiterPos - 1);
sheet = d->view->doc()->map()->findSheet(sheetName);
@@ -707,12 +707,12 @@ Sheet* Region::filterSheetName(QString& sRegion)
return sheet;
}
-Region::Point* Region::createPoint(const QPoint& point) const
+Region::Point* Region::createPoint(const TQPoint& point) const
{
return new Point(point);
}
-Region::Point* Region::createPoint(const QString& string) const
+Region::Point* Region::createPoint(const TQString& string) const
{
return new Point(string);
}
@@ -722,12 +722,12 @@ Region::Point* Region::createPoint(const Point& point) const
return new Point(point);
}
-Region::Range* Region::createRange(const QRect& rect) const
+Region::Range* Region::createRange(const TQRect& rect) const
{
return new Range(rect);
}
-Region::Range* Region::createRange(const QString& string) const
+Region::Range* Region::createRange(const TQString& string) const
{
return new Range(string);
}
@@ -755,13 +755,13 @@ Region::Element::~Element()
class Point
****************************************************************************/
-Region::Point::Point(const QPoint& point)
+Region::Point::Point(const TQPoint& point)
: Region::Element(),
m_point(point)
{
}
-Region::Point::Point(const QString& sCell)
+Region::Point::Point(const TQString& sCell)
: Region::Element(),
m_point()
{
@@ -773,7 +773,7 @@ Region::Point::Point(const QString& sCell)
return;
}
- QString string = sCell;//Region::filterSheetName(sCell);
+ TQString string = sCell;//Region::filterSheetName(sCell);
uint p = 0;
@@ -801,7 +801,7 @@ Region::Point::Point(const QString& sCell)
//default is error
int x = -1;
//search for the first character != text
- int result = string.find( QRegExp("[^A-Za-z]+"), p );
+ int result = string.tqfind( TQRegExp("[^A-Za-z]+"), p );
//get the colomn number for the character between actual position and the first non text charakter
if ( result != -1 )
@@ -843,7 +843,7 @@ Region::Point::Point(const QString& sCell)
uint p2 = p;
while ( p < length )
{
- if (!QChar(string[p++]).isDigit())
+ if (!TQChar(string[p++]).isDigit())
{
kdDebug(36001) << "Region::Point::init: no number" << endl;
return;
@@ -868,16 +868,16 @@ Region::Point::Point(const QString& sCell)
return;
}
- m_point = QPoint(x, y);
+ m_point = TQPoint(x, y);
}
Region::Point::~Point()
{
}
-QString Region::Point::name(Sheet* originSheet) const
+TQString Region::Point::name(Sheet* originSheet) const
{
- QString name = "";
+ TQString name = "";
if (m_sheet && m_sheet != originSheet)
{
name = m_sheet->sheetName() + "!";
@@ -885,12 +885,12 @@ QString Region::Point::name(Sheet* originSheet) const
return name + Cell::name(m_point.x(), m_point.y());
}
-bool Region::Point::contains(const QPoint& point) const
+bool Region::Point::tqcontains(const TQPoint& point) const
{
return (m_point == point);
}
-bool Region::Point::contains(const QRect& range) const
+bool Region::Point::tqcontains(const TQRect& range) const
{
return (range.width() == 1) && (range.height() == 1) && (range.topLeft() == m_point);
}
@@ -900,17 +900,17 @@ bool Region::Point::contains(const QRect& range) const
class Range
****************************************************************************/
-Region::Range::Range(const QRect& rect)
+Region::Range::Range(const TQRect& rect)
: Region::Element(),
m_range(rect)
{
}
-Region::Range::Range(const QString& sRange)
+Region::Range::Range(const TQString& sRange)
: Region::Element(),
m_range()
{
- int delimiterPos = sRange.find(':');
+ int delimiterPos = sRange.tqfind(':');
if (delimiterPos == -1)
{
return;
@@ -925,16 +925,16 @@ Region::Range::Range(const QString& sRange)
{
return;
}
- m_range = QRect(ul.pos(), lr.pos());
+ m_range = TQRect(ul.pos(), lr.pos());
}
Region::Range::~Range()
{
}
-QString Region::Range::name(Sheet* originSheet) const
+TQString Region::Range::name(Sheet* originSheet) const
{
- QString name = "";
+ TQString name = "";
if (m_sheet && m_sheet != originSheet)
{
name = m_sheet->sheetName() + "!";
@@ -943,14 +943,14 @@ QString Region::Range::name(Sheet* originSheet) const
Cell::name(m_range.right(), m_range.bottom() );
}
-bool Region::Range::contains(const QPoint& point) const
+bool Region::Range::tqcontains(const TQPoint& point) const
{
- return m_range.normalize().contains(point);
+ return m_range.normalize().tqcontains(point);
}
-bool Region::Range::contains(const QRect& range) const
+bool Region::Range::tqcontains(const TQRect& range) const
{
- return m_range.normalize().contains(range.normalize());
+ return m_range.normalize().tqcontains(range.normalize());
}
} // namespace KSpread