kspread

region.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2005-2006 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17*/
18
19#include <tqregexp.h>
20#include <tqstringlist.h>
21
22#include <kdebug.h>
23
24#include "kspread_cell.h"
25#include "kspread_doc.h"
26#include "kspread_global.h"
27#include "kspread_map.h"
28#include "kspread_sheet.h"
29#include "kspread_util.h"
30#include "kspread_view.h"
31
32#include "region.h"
33
34namespace KSpread
35{
36
37class Region::Private
38{
39public:
40 Private()
41 {
42 view = 0;
43 }
44
45 View* view;
46 TQValueList<Element*> cells;
47};
48
49
50/***************************************************************************
51 class Region
52****************************************************************************/
53
55{
56 d = new Private();
57}
58
59Region::Region(View* view, const TQString& string, Sheet* sheet)
60{
61 d = new Private();
62 d->view = view;
63
64 if (string.isEmpty())
65 {
66 return;
67 }
68 TQStringList substrings = TQStringList::split(';', string);
69 TQStringList::ConstIterator end = substrings.constEnd();
70 for (TQStringList::ConstIterator it = substrings.constBegin(); it != end; ++it)
71 {
72 TQString sRegion = *it;
73 if (!sheet)
74 {
75 sheet = filterSheetName(sRegion);
76 }
77
78 int delimiterPos = sRegion.find(':');
79 if (delimiterPos > -1)
80 {
81 // range
82 Point ul(sRegion.left(delimiterPos));
83 Point lr(sRegion.mid(delimiterPos + 1));
84
85 if (ul.isValid() && lr.isValid())
86 {
87 Range* range = createRange(sRegion);
88 range->setSheet(sheet);
89 d->cells.append(range);
90 }
91 else if (ul.isValid())
92 {
93 Point* point = createPoint(sRegion.left(delimiterPos));
94 point->setSheet(sheet);
95 d->cells.append(point);
96 }
97 else // lr.isValid()
98 {
99 Point* point = createPoint(sRegion.right(delimiterPos + 1));
100 point->setSheet(sheet);
101 d->cells.append(point);
102 }
103 }
104 else
105 {
106 // single cell
107 Point* point = createPoint(sRegion);
108 point->setSheet(sheet);
109 d->cells.append(point);
110 }
111 }
112}
113
114Region::Region(const TQRect& rect, Sheet* sheet)
115{
116 d = new Private();
117
118 if (rect.isNull())
119 {
120 kdError(36001) << "Region::Region(const TQRect&): TQRect is empty!" << endl;
121 return;
122 }
123 add(rect, sheet);
124}
125
126Region::Region(const TQPoint& point, Sheet* sheet)
127{
128 d = new Private();
129
130 if (point.isNull())
131 {
132 kdError(36001) << "Region::Region(const TQPoint&): TQPoint is empty!" << endl;
133 return;
134 }
135 add(point, sheet);
136}
137
139{
140 d = new Private();
141 d->view = list.d->view;
142
143 ConstIterator end(list.d->cells.constEnd());
144 for (ConstIterator it = list.d->cells.constBegin(); it != end; ++it)
145 {
146 Element *element = *it;
147 if (element->type() == Element::Point)
148 {
149 Point* point = static_cast<Point*>(element);
150 d->cells.append(createPoint(*point));
151 }
152 else
153 {
154 Range* range = static_cast<Range*>(element);
155 d->cells.append(createRange(*range));
156 }
157 }
158}
159
160Region::Region(int x, int y, Sheet* sheet)
161{
162 d = new Private();
163
164 if (x<1 || y<1)
165 {
166 kdError(36001) << "Region::Region(int x, int y): Coordinates are invalid!" << endl;
167 return;
168 }
169 add(TQPoint(x,y), sheet);
170}
171
172Region::Region(int x, int y, int width, int height, Sheet* sheet)
173{
174 d = new Private();
175
176 if (x<1 || y<1 || width<1 || height<1)
177 {
178 kdError(36001) << "Region::Region(int x, int y, int width, int height): Dimensions are invalid!" << endl;
179 return;
180 }
181 add(TQRect(x,y,width,height), sheet);
182}
183
184
186{
187 d->cells.clear();
188 delete d;
189}
190
192{
193 Q_ASSERT(d->view);
194 return d->view;
195}
196
198{
199 d->view = view;
200}
201
202bool Region::isValid() const
203{
204 ConstIterator end = d->cells.constEnd();
205 for (ConstIterator it = d->cells.constBegin(); it != end; ++it)
206 {
207 if (!(*it)->isValid())
208 {
209 return false;
210 }
211 }
212 return true;
213}
214
216{
217 if (d->cells.isEmpty() || d->cells.count() > 1 || (*d->cells.constBegin())->type() != Element::Point)
218 {
219 return false;
220 }
221 return true;
222}
223
225{
226 if (d->cells.count() != 1 || !isValid())
227 {
228 return false;
229 }
230 return true;
231}
232
233TQString Region::name(Sheet* originSheet) const
234{
235 TQStringList names;
236 ConstIterator endOfList(d->cells.constEnd());
237 for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
238 {
239 Element *element = *it;
240 names += element->name(originSheet);
241 }
242 return names.isEmpty() ? "" : names.join(";");
243}
244
245Region::Element* Region::add(const TQPoint& point, Sheet* sheet)
246{
247// kdDebug() << k_funcinfo << endl;
248 if (point.x() < 1 || point.y() < 1)
249 {
250 return 0;
251 }
252 Iterator it = insert(d->cells.end(), point, sheet, false);
253 return (it == d->cells.end()) ? 0 : *it;
254}
255
256Region::Element* Region::add(const TQRect& range, Sheet* sheet)
257{
258 if (range.normalize().width() == 0 || range.normalize().height() == 0)
259 {
260 return 0;
261 }
262 if (range.size() == TQSize(1,1))
263 {
264 return add(range.topLeft(), sheet);
265 }
266 Iterator it = insert(d->cells.end(), range, sheet, false);
267 return (it == d->cells.end()) ? 0 : *it;
268}
269
271{
272 ConstIterator endOfList(region.d->cells.constEnd());
273 for (ConstIterator it = region.d->cells.constBegin(); it != endOfList; ++it)
274 {
275 add((*it)->rect(), (*it)->sheet());
276 }
277 return d->cells.isEmpty() ? 0 : d->cells.last();
278}
279
280void Region::sub(const TQPoint& point)
281{
282 // TODO Stefan: Improve!
283 Iterator endOfList(d->cells.end());
284 for (Iterator it = d->cells.begin(); it != endOfList; ++it)
285 {
286 Element *element = *it;
287 if (element->rect() == TQRect(point,point))
288 {
289 delete element;
290 d->cells.remove(element);
291 break;
292 }
293 }
294}
295
296void Region::sub(const TQRect& range)
297{
298 // TODO Stefan: Improve!
299 Iterator endOfList(d->cells.end());
300 for (Iterator it = d->cells.begin(); it != endOfList; ++it)
301 {
302 Element *element = *it;
303 if (element->rect().normalize() == range.normalize())
304 {
305 delete element;
306 d->cells.remove(element);
307 break;
308 }
309 }
310}
311
312void Region::sub(const Region& region)
313{
314 ConstIterator endOfList(region.constEnd());
315 for (ConstIterator it = region.constBegin(); it != endOfList; ++it)
316 {
317 Element *element = *it;
318 if (element->type() == Element::Point)
319 {
320 Point* point = static_cast<Point*>(element);
321 sub(point->pos());
322 }
323 else
324 {
325 sub(element->rect());
326 }
327 }
328}
329
330Region::Element* Region::eor(const TQPoint& point, Sheet* sheet)
331{
332 bool containsPoint = false;
333
334 Iterator it = cells().begin();
335 Iterator endOfList = cells().end();
336 while (it != endOfList)
337 {
338 if (!(*it)->contains(point))
339 {
340 ++it;
341 continue;
342 }
343 containsPoint = true;
344 int x = point.x();
345 int y = point.y();
346 TQRect fullRange = (*it)->rect().normalize();
347 delete *it;
348 it = cells().remove(it);
349
350 // top range
351 int left = fullRange.left();
352 int top = fullRange.top();
353 int width = fullRange.width();
354 int height = y - top;
355 if (height > 0)
356 {
357 insert(it, TQRect(left, top, width, height), sheet);
358 }
359 // left range
360 left = fullRange.left();
361 top = y;
362 width = TQMAX(0, x - left);
363 height = 1;
364 if (width > 0)
365 {
366 insert(it, TQRect(left, top, width, height), sheet);
367 }
368 // right range
369 left = TQMIN(x+1, fullRange.right());
370 top = y;
371 width = TQMAX(0, fullRange.right() - x);
372 height = 1;
373 if (width > 0)
374 {
375 insert(it, TQRect(left, top, width, height), sheet);
376 }
377 // bottom range
378 left = fullRange.left();
379 top = y+1;
380 width = fullRange.width();
381 height = TQMAX(0, fullRange.bottom() - y);
382 if (height > 0)
383 {
384 insert(it, TQRect(left, top, width, height), sheet);
385 }
386 return *it;
387 }
388
389 if (!containsPoint)
390 {
391 return add(point, sheet);
392 }
393 return 0;
394}
395
396Region::Iterator Region::insert(Region::Iterator pos, const TQPoint& point, Sheet* sheet, bool multi)
397{
398 if (point.x() < 1 || point.y() < 1)
399 {
400 return pos;
401 }
402
403 bool containsPoint = false;
404// bool adjacentPoint = false;
405// TQRect neighbour;
406
407 // we don't have to check for occurences?
408 if (multi)
409 {
410 Point* rpoint = createPoint(point);
411 rpoint->setSheet(sheet);
412 return d->cells.insert(pos, rpoint);
413 }
414
415 ConstIterator endOfList(d->cells.constEnd());
416 for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
417 {
418 Element *element = *it;
419 if (sheet && sheet != element->sheet())
420 {
421 continue;
422 }
423 if (element->contains(point))
424 {
425 containsPoint = true;
426 break;
427 }
428/* else
429 {
430 neighbour = element->rect().normalize();
431 neighbour.setTopLeft(neighbour.topLeft() - TQPoint(1,1));
432 neighbour.setBottomRight(neighbour.bottomRight() + TQPoint(1,1));
433 if (neighbour.contains(point))
434 {
435 adjacentPoint = true; // TODO Stefan: Implement!
436 break;
437 }
438 }*/
439 }
440 if ( !containsPoint )
441 {
442 Point* rpoint = createPoint(point);
443 rpoint->setSheet(sheet);
444 return d->cells.insert(pos, rpoint);
445 }
446 return pos;
447}
448
449Region::Iterator Region::insert(Region::Iterator pos, const TQRect& range, Sheet* sheet, bool multi)
450{
451 if (range.size() == TQSize(1,1))
452 {
453 return insert(pos, range.topLeft(), sheet);
454 }
455
456 if (multi)
457 {
458 Range* rrange = createRange(range);
459 rrange->setSheet(sheet);
460 return d->cells.insert(pos, rrange);
461 }
462
463 bool containsRange = false;
464
465 Iterator it( d->cells.begin() );
466 Iterator endOfList( d->cells.end() );
467 while ( it != endOfList )
468 {
469 if (sheet && sheet != (*it)->sheet())
470 {
471 ++it;
472 continue;
473 }
474 if ((*it)->contains(range))
475 {
476 containsRange = true;
477 }
478 else if (range.contains((*it)->rect()))
479 {
480 delete *it;
481 it = d->cells.remove(it);
482 continue;
483 }
484 ++it;
485 }
486 if ( !containsRange )
487 {
488 Range* rrange = createRange(range);
489 rrange->setSheet(sheet);
490 return d->cells.insert(pos, rrange);
491 }
492 return pos;
493}
494
495bool Region::isColumnAffected(uint col) const
496{
497 ConstIterator endOfList(d->cells.constEnd());
498 for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
499 {
500 Element *element = *it;
501 TQRect normalizedRegion = element->rect().normalize();
502 if ((int)col >= normalizedRegion.left() && (int)col <= normalizedRegion.right())
503 {
504 return true;
505 }
506 }
507 return false;
508}
509
510bool Region::isRowAffected(uint row) const
511{
512 ConstIterator endOfList(d->cells.constEnd());
513 for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
514 {
515 Element *element = *it;
516 TQRect normalizedRegion = element->rect().normalize();
517 if ((int)row >= normalizedRegion.top() && (int)row <= normalizedRegion.bottom())
518 {
519 return true;
520 }
521 }
522 return false;
523}
524
525bool Region::isColumnSelected(uint col) const
526{
527 ConstIterator endOfList(d->cells.constEnd());
528 for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
529 {
530 Element *element = *it;
531 TQRect region = element->rect().normalize();
532 if ((col == 0 || ((int)col >= region.left() && (int)col <= region.right())) &&
533 region.top() == 1 && region.bottom() == KS_rowMax)
534 {
535 return true;
536 }
537 }
538 return false;
539}
540
541bool Region::isRowSelected(uint row) const
542{
543 ConstIterator endOfList(d->cells.constEnd());
544 for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
545 {
546 Element *element = *it;
547 TQRect region = element->rect().normalize();
548 if ((row == 0 || ((int)row >= region.top() && (int)row <= region.bottom())) &&
549 region.left() == 1 && region.right() == KS_colMax)
550 {
551 return true;
552 }
553 }
554 return false;
555}
556
558{
559 ConstIterator endOfList(d->cells.constEnd());
560 for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
561 {
562 Element *element = *it;
563 TQRect region = element->rect().normalize();
564 if ((region.top() == 1 && region.bottom() == KS_rowMax) ||
565 (region.left() == 1 && region.right() == KS_colMax))
566 {
567 return true;
568 }
569 }
570 return false;
571}
572
573bool Region::contains(const TQPoint& point, Sheet* sheet) const
574{
575 if (d->cells.isEmpty())
576 {
577 return false;
578 }
579 ConstIterator endOfList(d->cells.constEnd());
580 for (ConstIterator it = d->cells.constBegin(); it != endOfList; ++it)
581 {
582 Element *element = *it;
583 if (element->contains(point))
584 {
585 if (sheet && element->sheet() != sheet)
586 {
587 return false;
588 }
589 return true;
590 }
591 }
592 return false;
593}
594
595bool Region::isEmpty() const
596{
597 return d->cells.isEmpty();
598}
599
601{
602 Iterator end(d->cells.end());
603 for (Iterator it = d->cells.begin(); it != end; it = d->cells.remove(it))
604 {
605 delete *it;
606 }
607}
608
609TQRect Region::boundingRect() const
610{
611 int left = KS_colMax;
612 int right = 1;
613 int top = KS_rowMax;
614 int bottom = 1;
615 Region::ConstIterator endOfList = cells().constEnd();
616 for (Region::ConstIterator it = cells().constBegin(); it != endOfList; ++it)
617 {
618 TQRect range = (*it)->rect().normalize();
619 if (range.left() < left)
620 {
621 left = range.left();
622 }
623 if (range.right() > right)
624 {
625 right = range.right();
626 }
627 if (range.top() < top)
628 {
629 top = range.top();
630 }
631 if (range.bottom() > bottom)
632 {
633 bottom = range.bottom();
634 }
635 }
636 return TQRect(left, top, right-left+1, bottom-top+1);
637}
638
639Region::ConstIterator Region::constBegin() const
640{
641 return d->cells.constBegin();
642}
643
644Region::ConstIterator Region::constEnd() const
645{
646 return d->cells.constEnd();
647}
648
649TQValueList<Region::Element*>& Region::cells() const
650{
651 return d->cells;
652}
653
654bool Region::operator==(const Region& other) const
655{
656 ConstIterator endOfList(d->cells.constEnd());
657 ConstIterator endOfOtherList(other.d->cells.constEnd());
658 ConstIterator it = d->cells.constBegin();
659 ConstIterator it2 = other.d->cells.constBegin();
660 while (it != endOfList && it2 != endOfOtherList)
661 {
662 if ((*it++)->rect() != (*it2++)->rect())
663 {
664 return false;
665 }
666 }
667 return true;
668}
669
670void Region::operator=(const Region& other)
671{
672 d->view = other.d->view;
673 clear();
674 ConstIterator end(other.d->cells.constEnd());
675 for (ConstIterator it = other.d->cells.constBegin(); it != end; ++it)
676 {
677 Element *element = *it;
678 if (element->type() == Element::Point)
679 {
680 Point* point = static_cast<Point*>(element);
681 d->cells.append(createPoint(*point));
682 }
683 else
684 {
685 Range* range = static_cast<Range*>(element);
686 d->cells.append(createRange(*range));
687 }
688 }
689}
690
691Sheet* Region::filterSheetName(TQString& sRegion)
692{
693 Sheet* sheet = 0;
694 int delimiterPos = sRegion.find( '!' );
695 if (delimiterPos > -1)
696 {
697 TQString sheetName = sRegion.left(delimiterPos);
698 // remove the '!'
699 sRegion = sRegion.right(sRegion.length() - delimiterPos - 1);
700 sheet = d->view->doc()->map()->findSheet(sheetName);
701 if (!sheet)
702 {
703 kdDebug() << "Sheet " << sheetName << " not found. Using active sheet!" << endl;
704 sheet = d->view->activeSheet();
705 }
706 }
707 return sheet;
708}
709
710Region::Point* Region::createPoint(const TQPoint& point) const
711{
712 return new Point(point);
713}
714
715Region::Point* Region::createPoint(const TQString& string) const
716{
717 return new Point(string);
718}
719
720Region::Point* Region::createPoint(const Point& point) const
721{
722 return new Point(point);
723}
724
725Region::Range* Region::createRange(const TQRect& rect) const
726{
727 return new Range(rect);
728}
729
730Region::Range* Region::createRange(const TQString& string) const
731{
732 return new Range(string);
733}
734
735Region::Range* Region::createRange(const Range& range) const
736{
737 return new Range(range);
738}
739
740/***************************************************************************
741 class Element
742****************************************************************************/
743
744Region::Element::Element()
745 : m_sheet(0)
746{
747}
748
749Region::Element::~Element()
750{
751}
752
753
754/***************************************************************************
755 class Point
756****************************************************************************/
757
758Region::Point::Point(const TQPoint& point)
759 : Region::Element(),
760 m_point(point)
761{
762}
763
764Region::Point::Point(const TQString& sCell)
765 : Region::Element(),
766 m_point()
767{
768 uint length = sCell.length();
769
770 if (length == 0)
771 {
772 kdDebug(36001) << "Region::Point::init: length = 0" << endl;
773 return;
774 }
775
776 TQString string = sCell;//Region::filterSheetName(sCell);
777
778 uint p = 0;
779
780 // Fixed ?
781 if (string[0] == '$')
782 {
783 p++;
784 }
785
786 // Malformed ?
787 if (p == length)
788 {
789 kdDebug(36001) << "Region::Point::init: no point after '$' (string: '" << string.mid(p) << "'" << endl;
790 return;
791 }
792
793 if (string[p] < 'A' || string[p] > 'Z')
794 {
795 if (string[p] < 'a' || string[p] > 'z')
796 {
797 kdDebug(36001) << "Region::Point::init: wrong first character in point (string: '" << string.mid(p) << "'" << endl;
798 return;
799 }
800 }
801 //default is error
802 int x = -1;
803 //search for the first character != text
804 int result = string.find( TQRegExp("[^A-Za-z]+"), p );
805
806 //get the colomn number for the character between actual position and the first non text charakter
807 if ( result != -1 )
808 {
809 x = util_decodeColumnLabelText( string.mid( p, result - p ) ); // x is defined now
810 }
811 else // If there isn't any, then this is not a point -> return
812 {
813 kdDebug(36001) << "Region::Point::init: no number in string (string: '" << string.mid( p, result ) << "'" << endl;
814 return;
815 }
816 p = result;
817
818 //limit is KS_colMax
819 if ( x > KS_colMax )
820 {
821 kdDebug(36001) << "Region::Point::init: column value too high (col: " << x << ")" << endl;
822 return;
823 }
824
825 // Malformed ?
826 if (p == length)
827 {
828 kdDebug(36001) << "Region::Point::init: p==length after cols" << endl;
829 return;
830 }
831
832 if (string[p] == '$')
833 {
834 p++;
835 // Malformed ?
836 if ( p == length )
837 {
838 kdDebug(36001) << "Region::Point::init: p==length after $ of row" << endl;
839 return;
840 }
841 }
842
843 uint p2 = p;
844 while ( p < length )
845 {
846 if (!TQChar(string[p++]).isDigit())
847 {
848 kdDebug(36001) << "Region::Point::init: no number" << endl;
849 return;
850 }
851 }
852
853 bool ok;
854 int y = string.mid( p2, p-p2 ).toInt( &ok );
855 if ( !ok )
856 {
857 kdDebug(36001) << "Region::Point::init: Invalid number (string: '" << string.mid( p2, p-p2 ) << "'" << endl;
858 return;
859 }
860 if ( y > KS_rowMax )
861 {
862 kdDebug(36001) << "Region::Point::init: row value too high (row: " << y << ")" << endl;
863 return;
864 }
865 if ( y <= 0 )
866 {
867 kdDebug(36001) << "Region::Point::init: y <= 0" << endl;
868 return;
869 }
870
871 m_point = TQPoint(x, y);
872}
873
874Region::Point::~Point()
875{
876}
877
878TQString Region::Point::name(Sheet* originSheet) const
879{
880 TQString name = "";
881 if (m_sheet && m_sheet != originSheet)
882 {
883 name = m_sheet->sheetName() + "!";
884 }
885 return name + Cell::name(m_point.x(), m_point.y());
886}
887
888bool Region::Point::contains(const TQPoint& point) const
889{
890 return (m_point == point);
891}
892
893bool Region::Point::contains(const TQRect& range) const
894{
895 return (range.width() == 1) && (range.height() == 1) && (range.topLeft() == m_point);
896}
897
898
899/***************************************************************************
900 class Range
901****************************************************************************/
902
903Region::Range::Range(const TQRect& rect)
904 : Region::Element(),
905 m_range(rect)
906{
907}
908
909Region::Range::Range(const TQString& sRange)
910 : Region::Element(),
911 m_range()
912{
913 int delimiterPos = sRange.find(':');
914 if (delimiterPos == -1)
915 {
916 return;
917 }
918
919 //Region::filterSheetName(sRange);
920
921 Region::Point ul(sRange.left(delimiterPos));
922 Region::Point lr(sRange.mid(delimiterPos + 1));
923
924 if (!ul.isValid() || !lr.isValid())
925 {
926 return;
927 }
928 m_range = TQRect(ul.pos(), lr.pos());
929}
930
931Region::Range::~Range()
932{
933}
934
935TQString Region::Range::name(Sheet* originSheet) const
936{
937 TQString name = "";
938 if (m_sheet && m_sheet != originSheet)
939 {
940 name = m_sheet->sheetName() + "!";
941 }
942 return name + Cell::name(m_range.left(), m_range.top()) + ":" +
943 Cell::name(m_range.right(), m_range.bottom() );
944}
945
946bool Region::Range::contains(const TQPoint& point) const
947{
948 return m_range.normalize().contains(point);
949}
950
951bool Region::Range::contains(const TQRect& range) const
952{
953 return m_range.normalize().contains(range.normalize());
954}
955
956} // namespace KSpread
TQString name() const
Returns the name of the cell.
Represents the position of a single cell in a workbook.
Represents a region within a workbook.
Base class for region elements, which can be points or ranges.
Definition region.h:325
A point in a region.
Definition region.h:371
A range in a region.
Definition region.h:411
The one for all class for points and ranges.
Definition region.h:44
void setView(View *)
Sets the view to which this region belongs.
Definition region.cpp:197
bool isColumnAffected(uint col) const
Definition region.cpp:495
void operator=(const Region &region)
Definition region.cpp:670
Element * add(const TQPoint &point, Sheet *sheet=0)
Adds the point point to this region.
Definition region.cpp:245
virtual void clear()
Deletes all elements of the region.
Definition region.cpp:600
bool isRowAffected(uint row) const
Definition region.cpp:510
bool isSingular() const
Definition region.cpp:215
bool isEmpty() const
Definition region.cpp:595
bool isRowSelected(uint row=0) const
Definition region.cpp:541
virtual ~Region()
Destructor.
Definition region.cpp:185
bool isValid() const
Definition region.cpp:202
bool isContiguous() const
Definition region.cpp:224
TQString name(Sheet *originSheet=0) const
Definition region.cpp:233
bool contains(const TQPoint &point, Sheet *sheet=0) const
Definition region.cpp:573
TQValueList< Element * > & cells() const
Definition region.cpp:649
bool isColumnSelected(uint col=0) const
Definition region.cpp:525
bool operator==(const Region &region) const
Definition region.cpp:654
Sheet * filterSheetName(TQString &sRegion)
Definition region.cpp:691
virtual Element * eor(const TQPoint &point, Sheet *sheet=0)
Definition region.cpp:330
Region()
Constructor.
Definition region.cpp:54
View * view() const
Definition region.cpp:191
Iterator insert(Iterator iterator, const TQPoint &point, Sheet *, bool multi=true)
Definition region.cpp:396
bool isColumnOrRowSelected() const
Definition region.cpp:557
void sub(const TQPoint &point)
Substracts the point point from this region.
Definition region.cpp:280
The View class displays a KSpread document.
The KSpread namespace.
Definition commands.h:39
KSPREAD_EXPORT int util_decodeColumnLabelText(const TQString &_col)
Call this function to decode the text of a column label to an integer i.e.