kspread

KSpread::Region Class Reference

The one for all class for points and ranges. More...

#include <Region.h>

Inheritance diagram for KSpread::Region:

List of all members.

Classes

class  Element
 Base class for region elements, which can be points or ranges. More...
class  Point
 A point in a region. More...
class  Range
 A range in a region. More...

Public Types

typedef QList< Element * >
::ConstIterator 
ConstIterator
typedef QList< Element * >
::Iterator 
Iterator

Public Member Functions

 Region (int col, int row, int width, int height, Sheet *sheet=0)
 Region (int col, int row, Sheet *sheet=0)
 Region (const Region &region)
 Region (const QString &expression, const Map *map=0, Sheet *sheet=0)
 Region (const QRect &range, Sheet *sheet=0)
 Region (const QPoint &point, Sheet *sheet=0)
 Region ()
virtual ~Region ()
Elementadd (const Region &region, Sheet *sheet=0)
Elementadd (const QRect &range, Sheet *sheet=0)
Elementadd (const QPoint &point, Sheet *sheet=0)
QRect boundingRect () const
virtual void clear ()
QSet< int > columnsAffected () const
QSet< int > columnsSelected () const
ConstIterator constBegin () const
ConstIterator constEnd () const
bool contains (const QPoint &point, Sheet *sheet=0) const
virtual Elementeor (const QPoint &point, Sheet *sheet=0)
SheetfilterSheetName (QString &sRegion)
QRect firstRange () const
SheetfirstSheet () const
Region intersected (const Region &region)
bool isAllSelected () const
bool isColumnOrRowSelected () const
bool isColumnSelected (uint col=0) const
bool isContiguous () const
bool isEmpty () const
bool isRowSelected (uint row=0) const
bool isSingular () const
bool isValid () const
QRect lastRange () const
SheetlastSheet () const
const Mapmap () const
QString name (Sheet *originSheet=0) const
bool operator!= (const Region &region) const
void operator= (const Region &region)
bool operator== (const Region &region) const
QVector< QRectrects () const
QSet< int > rowsAffected () const
QSet< int > rowsSelected () const
QString saveOdf () const
void setMap (const Map *)
void sub (const Region &region)
void sub (const QRect &range, Sheet *sheet)
void sub (const QPoint &point, Sheet *sheet)

Static Public Member Functions

static bool isValid (const QRect &rect)
static bool isValid (const QPoint &point)
static QString loadOdf (const QString &expression)
static QRect normalized (const QRect &rect)
static QString saveOdf (const QString &expression)

Protected Member Functions

QList< Element * > & cells () const
virtual PointcreatePoint (const Point &) const
virtual PointcreatePoint (const QString &) const
virtual PointcreatePoint (const QPoint &) const
virtual RangecreateRange (const Range &) const
virtual RangecreateRange (const QString &) const
virtual RangecreateRange (const QRect &) const
Elementinsert (int index, const QRect &range, Sheet *sheet, bool multi=true)
Elementinsert (int index, const QPoint &point, Sheet *sheet, bool multi=true)

Detailed Description

The one for all class for points and ranges.

Author:
Stefan Nikolaus <stefan.nikolaus@kdemail.net>
Since:
1.5

Definition at line 50 of file Region.h.


Member Typedef Documentation

Definition at line 324 of file Region.h.

Definition at line 323 of file Region.h.


Constructor & Destructor Documentation

KSpread::Region::Region (  ) 

Constructor.

Creates an empty region.

Definition at line 54 of file Region.cpp.

KSpread::Region::Region ( const QPoint point,
Sheet sheet = 0 
) [explicit]

Constructor.

Creates a region consisting of a point.

Parameters:
point the point's location
sheet the sheet the point belongs to

Definition at line 137 of file Region.cpp.

KSpread::Region::Region ( const QRect range,
Sheet sheet = 0 
) [explicit]

Constructor.

Creates a region consisting of a range.

Parameters:
range the range's location
sheet the sheet the range belongs to

Definition at line 125 of file Region.cpp.

KSpread::Region::Region ( const QString expression,
const Map map = 0,
Sheet sheet = 0 
) [explicit]

Constructor.

Creates a region consisting of the region defined in expression .

Parameters:
expression a string representing the region (e.g. "A1:B3")
map used to determine the sheet, if it's named in the string
sheet the fallback sheet, if expression does not contain one

Definition at line 59 of file Region.cpp.

KSpread::Region::Region ( const Region region  ) 

Copy Constructor.

Creates a copy of the region.

Parameters:
region the region to copy

Definition at line 149 of file Region.cpp.

KSpread::Region::Region ( int  col,
int  row,
Sheet sheet = 0 
)

Constructor.

Creates a region consisting of a point.

Parameters:
col the column of the point
row the row of the point
sheet the sheet the point belongs to

Definition at line 167 of file Region.cpp.

KSpread::Region::Region ( int  col,
int  row,
int  width,
int  height,
Sheet sheet = 0 
)

Constructor.

Creates a region consisting of a range at the location

Parameters:
col the column of the range' starting point
row the row of the range' starting point
width the width of the range
height the height of the range
sheet the sheet the range belongs to

Definition at line 179 of file Region.cpp.

KSpread::Region::~Region (  )  [virtual]

Destructor.

Definition at line 192 of file Region.cpp.


Member Function Documentation

Region::Element * KSpread::Region::add ( const Region region,
Sheet sheet = 0 
)

Adds the region region to this region.

Parameters:
region the region to be added
sheet the fallback sheet used, if an element has no sheet set

Definition at line 273 of file Region.cpp.

Region::Element * KSpread::Region::add ( const QRect range,
Sheet sheet = 0 
)

Adds the range range to this region.

Parameters:
range the range's location
sheet the sheet the range belongs to

Definition at line 261 of file Region.cpp.

Region::Element * KSpread::Region::add ( const QPoint point,
Sheet sheet = 0 
)

Adds the point point to this region.

Parameters:
point the point's location
sheet the sheet the point belongs to

Definition at line 256 of file Region.cpp.

QRect KSpread::Region::boundingRect (  )  const

Definition at line 674 of file Region.cpp.

QList< Region::Element * > & KSpread::Region::cells (  )  const [protected]
Returns:
the list of elements

Definition at line 875 of file Region.cpp.

void KSpread::Region::clear (  )  [virtual]

Deletes all elements of the region.

The result is an empty region.

Reimplemented in KSpread::Selection.

Definition at line 639 of file Region.cpp.

QSet< int > KSpread::Region::columnsAffected (  )  const
Returns:
a set of column numbers, for those columns, that have at least one cell selected

Definition at line 538 of file Region.cpp.

QSet< int > KSpread::Region::columnsSelected (  )  const
Returns:
a set of column numbers, for those columns, that are selected

Definition at line 506 of file Region.cpp.

Region::ConstIterator KSpread::Region::constBegin (  )  const

Definition at line 719 of file Region.cpp.

Region::ConstIterator KSpread::Region::constEnd (  )  const

Definition at line 724 of file Region.cpp.

bool KSpread::Region::contains ( const QPoint point,
Sheet sheet = 0 
) const
Parameters:
point the point's location
sheet the sheet the point belongs to
Returns:
true, if the region contains the point point

Definition at line 616 of file Region.cpp.

Region::Point * KSpread::Region::createPoint ( const Point point  )  const [protected, virtual]

For internal use only.

used to create derived Points

Reimplemented in KSpread::Selection.

Definition at line 943 of file Region.cpp.

Region::Point * KSpread::Region::createPoint ( const QString string  )  const [protected, virtual]

For internal use only.

used to create derived Points

Reimplemented in KSpread::Selection.

Definition at line 938 of file Region.cpp.

Region::Point * KSpread::Region::createPoint ( const QPoint point  )  const [protected, virtual]

For internal use only.

used to create derived Points

Reimplemented in KSpread::Selection.

Definition at line 933 of file Region.cpp.

Region::Range * KSpread::Region::createRange ( const Range range  )  const [protected, virtual]

For internal use only.

used to create derived Ranges

Reimplemented in KSpread::Selection.

Definition at line 958 of file Region.cpp.

Region::Range * KSpread::Region::createRange ( const QString string  )  const [protected, virtual]

For internal use only.

used to create derived Ranges

Reimplemented in KSpread::Selection.

Definition at line 953 of file Region.cpp.

Region::Range * KSpread::Region::createRange ( const QRect rect  )  const [protected, virtual]

For internal use only.

used to create derived Ranges

Reimplemented in KSpread::Selection.

Definition at line 948 of file Region.cpp.

Region::Element * KSpread::Region::eor ( const QPoint point,
Sheet sheet = 0 
) [virtual]
Parameters:
point the point's location
sheet the sheet the point belongs to

Reimplemented in KSpread::Selection.

Definition at line 355 of file Region.cpp.

Sheet * KSpread::Region::filterSheetName ( QString sRegion  ) 
Parameters:
sRegion will be modified, if a valid sheet was found. The sheetname will be removed
Returns:
sheet named in the sRegion or null

Definition at line 914 of file Region.cpp.

QRect KSpread::Region::firstRange (  )  const

Definition at line 646 of file Region.cpp.

Sheet * KSpread::Region::firstSheet (  )  const

Definition at line 660 of file Region.cpp.

Region::Element * KSpread::Region::insert ( int  index,
const QRect range,
Sheet sheet,
bool  multi = true 
) [protected]
Parameters:
index the index of the element in whose front the new range is inserted
range the location of the range to be inserted
sheet the sheet the range belongs to
multi true to allow multiple occurrences of a range
Returns:
the added range, a null pointer, if range is not valid or the element containing range

Definition at line 465 of file Region.cpp.

Region::Element * KSpread::Region::insert ( int  index,
const QPoint point,
Sheet sheet,
bool  multi = true 
) [protected]
Parameters:
index the index of the element in whose front the new point is inserted
point the location of the point to be inserted
sheet the sheet the point belongs to
multi true to allow multiple occurrences of a point
Returns:
the added point, a null pointer, if point is not valid or the element containing point

Definition at line 412 of file Region.cpp.

Region KSpread::Region::intersected ( const Region region  ) 

Intersects the region region and this region and returns the result of the intersection as a new Region.

Definition at line 331 of file Region.cpp.

bool KSpread::Region::isAllSelected (  )  const
Returns:
true , if all cells in the sheet are selected

Definition at line 608 of file Region.cpp.

bool KSpread::Region::isColumnOrRowSelected (  )  const
Returns:
true , if at least one column or one row is selected

Definition at line 594 of file Region.cpp.

bool KSpread::Region::isColumnSelected ( uint  col = 0  )  const
Parameters:
col The column to check
Returns:
True, if the column col is selected. If column col is not given, it returns true, if at least one column is selected
Note:
If you want to check more than one column for selection, use columnsSelected(). It returns a set of all selected columns at once.

Definition at line 566 of file Region.cpp.

bool KSpread::Region::isContiguous (  )  const
Returns:
true, if this region is contiguous

Definition at line 237 of file Region.cpp.

bool KSpread::Region::isEmpty (  )  const
Returns:
true, if this region contains no elements

Definition at line 634 of file Region.cpp.

bool KSpread::Region::isRowSelected ( uint  row = 0  )  const
Parameters:
row the row to check
Returns:
true , if the row row is selected. If row row is not given, it returns true, if at least one row is selected
Note:
If you want to check more than one row for selection, use rowsSelected(). It returns a set of all selected rows at once.

Definition at line 580 of file Region.cpp.

bool KSpread::Region::isSingular (  )  const
Returns:
true, if this region contains only a single point

Reimplemented in KSpread::Selection.

Definition at line 229 of file Region.cpp.

bool KSpread::Region::isValid ( const QRect rect  )  [static]

Definition at line 738 of file Region.cpp.

bool KSpread::Region::isValid ( const QPoint point  )  [static]

Definition at line 729 of file Region.cpp.

bool KSpread::Region::isValid (  )  const
Returns:
true, if this region contains at least one valid point or one valid range

Definition at line 217 of file Region.cpp.

QRect KSpread::Region::lastRange (  )  const

Definition at line 653 of file Region.cpp.

Sheet * KSpread::Region::lastSheet (  )  const

Definition at line 667 of file Region.cpp.

QString KSpread::Region::loadOdf ( const QString expression  )  [static]

Definition at line 748 of file Region.cpp.

const Map * KSpread::Region::map (  )  const
Returns:
the map to which this region belongs.

Definition at line 206 of file Region.cpp.

QString KSpread::Region::name ( Sheet originSheet = 0  )  const
Parameters:
originSheet The name is created relative to this sheet.
Returns:
the name of the region (e.g. "A1:A2")

Reimplemented in KSpread::Selection.

Definition at line 245 of file Region.cpp.

QRect KSpread::Region::normalized ( const QRect rect  )  [static]

Definition at line 699 of file Region.cpp.

bool KSpread::Region::operator!= ( const Region region  )  const [inline]

Definition at line 301 of file Region.h.

void KSpread::Region::operator= ( const Region region  ) 
Parameters:
region the region to copy

Definition at line 897 of file Region.cpp.

bool KSpread::Region::operator== ( const Region region  )  const
Parameters:
region the region to compare
Returns:
true, if this region equals region region

Definition at line 880 of file Region.cpp.

QVector< QRect > KSpread::Region::rects (  )  const
Returns:
a QRegion that unifies all contained ranges

Definition at line 197 of file Region.cpp.

QSet< int > KSpread::Region::rowsAffected (  )  const
Returns:
a set of row numbers, for those rows, that have at least one cell selected

Definition at line 552 of file Region.cpp.

QSet< int > KSpread::Region::rowsSelected (  )  const
Returns:
a set of row numbers, for those rows, that are selected

Definition at line 522 of file Region.cpp.

QString KSpread::Region::saveOdf (  )  const

Definition at line 870 of file Region.cpp.

QString KSpread::Region::saveOdf ( const QString expression  )  [static]

Definition at line 806 of file Region.cpp.

void KSpread::Region::setMap ( const Map map  ) 

Sets the map to which this region belongs.

Definition at line 212 of file Region.cpp.

void KSpread::Region::sub ( const Region region  ) 

Substracts the region region from this region.

Parameters:
region the region to subtract

Definition at line 317 of file Region.cpp.

void KSpread::Region::sub ( const QRect range,
Sheet sheet 
)

Substracts the range range from this region.

Parameters:
range the range's location
sheet the sheet the range belongs to

Definition at line 299 of file Region.cpp.

void KSpread::Region::sub ( const QPoint point,
Sheet sheet 
)

Substracts the point point from this region.

Parameters:
point the point's location
sheet the sheet the point belongs to

Definition at line 282 of file Region.cpp.


The documentation for this class was generated from the following files: