kspread

KSpread::Selection Class Reference

Manages the selection of cells. More...

#include <Selection.h>

Inheritance diagram for KSpread::Selection:

List of all members.

Classes

class  Point
 This Point is extended by an color attribute. More...
class  Range
 This Range is extended by an color attribute. More...

Public Types

enum  Editor { EmbeddedEditor, ExternalEditor }
enum  Mode { SingleCell = 0, MultipleCells = 1 }

Signals

void aboutToModify (const Region &region)
void activeSheetChanged (Sheet *sheet)
void changed (const Region &region)
void closeEditor (bool saveChanges, bool expandMatrix)
void documentReadWriteToggled (bool readWrite)
void modified (const Region &region)
void refreshSheetViews ()
void requestFocusEditor ()
void sheetProtectionToggled (bool protect)
void visibleSheetRequested (Sheet *sheet)

Public Member Functions

 Selection (const Selection &selection)
 Selection (KoCanvasBase *canvasBase)
virtual ~Selection ()
ElementactiveElement () const
SheetactiveSheet () const
QString activeSubRegionName () const
const QPointanchor () const
KoCanvasBasecanvas () const
virtual void clear ()
void clearSubRegion ()
const QList< QColor > & colors () const
const QPointcursor () const
void emitAboutToModify ()
void emitCloseEditor (bool saveChanges, bool expandMatrix=false)
void emitModified ()
void emitRefreshSheetViews ()
void emitRequestFocusEditor ()
void emitVisibleSheetRequested (Sheet *sheet)
void endReferenceSelection ()
virtual Elementeor (const QPoint &point, Sheet *sheet=0)
void extend (const Region &region)
void extend (const QRect &range, Sheet *sheet=0)
void extend (const QPoint &point, Sheet *sheet=0)
QRect extendToMergedAreas (const QRect &area) const
void fixSubRegionDimension ()
void initialize (const Region &region, Sheet *sheet=0)
void initialize (const QRect &range, Sheet *sheet=0)
void initialize (const QPoint &point, Sheet *sheet=0)
bool isSingular () const
Editor lastEditorWithFocus () const
const QPointmarker () const
QString name (Sheet *originSheet=0) const
SheetoriginSheet () const
bool referenceSelection () const
bool referenceSelectionMode () const
void selectAll ()
QRectF selectionHandleArea (const KoViewConverter *viewConverter) const
void setActiveElement (int number)
void setActiveElement (const QPoint &point, CellEditor *cellEditor)
void setActiveSheet (Sheet *sheet)
void setActiveSubRegion (uint start, uint length)
void setLastEditorWithFocus (Editor type)
void setOriginSheet (Sheet *sheet)
void setReferenceSelectionMode (bool enable)
void setSelectionMode (Mode mode)
void startReferenceSelection (const Region &region=Region())
void update (const QPoint &point)
void update ()

Protected Member Functions

virtual Region::PointcreatePoint (const Region::Point &) const
virtual Region::PointcreatePoint (const QString &) const
virtual Region::PointcreatePoint (const QPoint &) const
virtual Region::RangecreateRange (const Region::Range &) const
virtual Region::RangecreateRange (const QString &) const
virtual Region::RangecreateRange (const QRect &) const
void dump () const
void emitChanged (const Region &changedRegion)

Detailed Description

Manages the selection of cells.

Represents cell selections for general operations and for cell references used in formulaes.

Author:
Torben Weis <weis@kde.org>
Stefan Nikolaus <stefan.nikolaus@kdemail.net>

Definition at line 49 of file Selection.h.


Member Enumeration Documentation

The editor type.

Enumerator:
EmbeddedEditor 

the embedded editor appearing in a cell

ExternalEditor 

the external editor located in the tool options

Definition at line 67 of file Selection.h.

The selection mode.

Enumerator:
SingleCell 

single cell selection mode

MultipleCells 

multiple cell selection mode

Definition at line 58 of file Selection.h.


Constructor & Destructor Documentation

Selection::Selection ( KoCanvasBase canvasBase  )  [explicit]

Constructor.

Creates a new selection with (1,1) as initial location.

Parameters:
canvasBase the canvas interface

Definition at line 101 of file Selection.cpp.

Selection::Selection ( const Selection selection  ) 

Copy Constructor.

Creates a copy of selection

Parameters:
selection the Selection to copy

Definition at line 111 of file Selection.cpp.

Selection::~Selection (  )  [virtual]

Destructor.

Definition at line 123 of file Selection.cpp.


Member Function Documentation

void KSpread::Selection::aboutToModify ( const Region region  )  [signal]

An operation on the selection is about to happen.

KSpread::Region::Element * Selection::activeElement (  )  const
Returns:
the active element

Definition at line 799 of file Selection.cpp.

Sheet * Selection::activeSheet (  )  const
Returns:
the selection's active sheet

Definition at line 749 of file Selection.cpp.

void KSpread::Selection::activeSheetChanged ( Sheet sheet  )  [signal]
QString Selection::activeSubRegionName (  )  const

Definition at line 852 of file Selection.cpp.

const QPoint & Selection::anchor (  )  const

The anchor is the starting point of a range.

For points marker and anchor are the same

Definition at line 677 of file Selection.cpp.

KoCanvasBase * Selection::canvas (  )  const
Returns:
the canvas this selection works for.

Definition at line 128 of file Selection.cpp.

void KSpread::Selection::changed ( const Region region  )  [signal]

Emitted when the Selection was changed.

Parameters:
region the changed part of the Selection
void Selection::clear (  )  [virtual]

Deletes all elements of the region.

The result is an empty region.

Reimplemented from KSpread::Region.

Definition at line 804 of file Selection.cpp.

void Selection::clearSubRegion (  ) 

Clears the elements of the subregion.

Definition at line 812 of file Selection.cpp.

void KSpread::Selection::closeEditor ( bool  saveChanges,
bool  expandMatrix 
) [signal]
const QList< QColor > & Selection::colors (  )  const

Definition at line 868 of file Selection.cpp.

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

For internal use only.

used to create derived Points

Reimplemented from KSpread::Region.

Definition at line 1055 of file Selection.cpp.

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

For internal use only.

used to create derived Points

Reimplemented from KSpread::Region.

Definition at line 1050 of file Selection.cpp.

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

For internal use only.

used to create derived Points

Reimplemented from KSpread::Region.

Definition at line 1045 of file Selection.cpp.

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

For internal use only.

used to create derived Ranges

Reimplemented from KSpread::Region.

Definition at line 1070 of file Selection.cpp.

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

For internal use only.

used to create derived Ranges

Reimplemented from KSpread::Region.

Definition at line 1065 of file Selection.cpp.

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

For internal use only.

used to create derived Ranges

Reimplemented from KSpread::Region.

Definition at line 1060 of file Selection.cpp.

const QPoint & Selection::cursor (  )  const

The cursor represents the cursor position.

This is needed for merged cells

Definition at line 682 of file Selection.cpp.

void KSpread::Selection::documentReadWriteToggled ( bool  readWrite  )  [signal]
void Selection::dump (  )  const [protected]

For internal use only.

Definition at line 1157 of file Selection.cpp.

void Selection::emitAboutToModify (  ) 

Definition at line 961 of file Selection.cpp.

void Selection::emitChanged ( const Region changedRegion  )  [protected]

Dilates the region and emits the changed() signal.

For internal use only.

Definition at line 1075 of file Selection.cpp.

void Selection::emitCloseEditor ( bool  saveChanges,
bool  expandMatrix = false 
)

Definition at line 981 of file Selection.cpp.

void Selection::emitModified (  ) 

Definition at line 966 of file Selection.cpp.

void Selection::emitRefreshSheetViews (  ) 

Definition at line 971 of file Selection.cpp.

void Selection::emitRequestFocusEditor (  ) 

Definition at line 986 of file Selection.cpp.

void Selection::emitVisibleSheetRequested ( Sheet sheet  ) 

Definition at line 976 of file Selection.cpp.

void Selection::endReferenceSelection (  ) 

End using reference selection.

Definition at line 921 of file Selection.cpp.

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

Reimplemented from KSpread::Region.

Definition at line 668 of file Selection.cpp.

void Selection::extend ( const Region region  ) 

Extends the current selection with the Region region.

Parameters:
region the region's locations

Definition at line 641 of file Selection.cpp.

void Selection::extend ( const QRect range,
Sheet sheet = 0 
)

Extends the current selection with the Range range.

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

Definition at line 563 of file Selection.cpp.

void Selection::extend ( const QPoint point,
Sheet sheet = 0 
)

Extends the current selection with the Point point.

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

Definition at line 499 of file Selection.cpp.

QRect Selection::extendToMergedAreas ( const QRect area  )  const

Extends area to include the merged cells, that are not fully covered, completely.

Returns:
the extended area

Definition at line 991 of file Selection.cpp.

void Selection::fixSubRegionDimension (  ) 

fix subregion dimensions

Definition at line 826 of file Selection.cpp.

void Selection::initialize ( const Region region,
Sheet sheet = 0 
)

Sets the selection to region.

Parameters:
region the region's locations
sheet the sheet the region belongs to

Definition at line 285 of file Selection.cpp.

void Selection::initialize ( const QRect range,
Sheet sheet = 0 
)

Sets the selection to range.

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

Definition at line 202 of file Selection.cpp.

void Selection::initialize ( const QPoint point,
Sheet sheet = 0 
)

Sets the selection to point.

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

Definition at line 133 of file Selection.cpp.

bool Selection::isSingular (  )  const

Checks whether the region consists only of one point.

Reimplemented from KSpread::Region.

Definition at line 692 of file Selection.cpp.

Selection::Editor Selection::lastEditorWithFocus (  )  const

Definition at line 890 of file Selection.cpp.

const QPoint & Selection::marker (  )  const

The marker is the end point of a range.

For points marker and anchor are the same

Definition at line 687 of file Selection.cpp.

void KSpread::Selection::modified ( const Region region  )  [signal]

Emitted when the content was modified.

QString Selection::name ( Sheet originSheet = 0  )  const
Returns:
the name of the region (e.g. "A1:A2")

Reimplemented from KSpread::Region.

Definition at line 735 of file Selection.cpp.

Sheet * Selection::originSheet (  )  const
Returns:
the selection's origin sheet

Definition at line 759 of file Selection.cpp.

bool Selection::referenceSelection (  )  const

Are we currently using a reference selection ?

Definition at line 956 of file Selection.cpp.

bool Selection::referenceSelectionMode (  )  const

Are we in reference choosing mode ?

Definition at line 951 of file Selection.cpp.

void KSpread::Selection::refreshSheetViews (  )  [signal]
void KSpread::Selection::requestFocusEditor (  )  [signal]
void Selection::selectAll (  ) 

Definition at line 873 of file Selection.cpp.

QRectF Selection::selectionHandleArea ( const KoViewConverter *  viewConverter  )  const
Returns:
the area that the 'handle' of the selection is located in painting coordinates

Definition at line 697 of file Selection.cpp.

void Selection::setActiveElement ( int  number  ) 

Sets the number 'th element as active.

Definition at line 783 of file Selection.cpp.

void Selection::setActiveElement ( const QPoint point,
CellEditor cellEditor 
)

Sets the element, which has point as anchor, as active.

Definition at line 764 of file Selection.cpp.

void Selection::setActiveSheet ( Sheet sheet  ) 

Sets the selection's active sheet.

For usual selections this is always the origin sheet, but for cell choices used for formulaes it may differ.

Parameters:
sheet the sheet which is currently active

Definition at line 740 of file Selection.cpp.

void Selection::setActiveSubRegion ( uint  start,
uint  length 
)

Sets the starting position and the length of a subregion in a selection which allows multiple occurrences of elements.

Definition at line 843 of file Selection.cpp.

void Selection::setLastEditorWithFocus ( Editor  type  ) 

Definition at line 885 of file Selection.cpp.

void Selection::setOriginSheet ( Sheet sheet  ) 

Sets the selection's origin sheet.

Parameters:
sheet the sheet from which the selection starts

Definition at line 754 of file Selection.cpp.

void Selection::setReferenceSelectionMode ( bool  enable  ) 

Enable/disable reference choosing mode.

Definition at line 944 of file Selection.cpp.

void Selection::setSelectionMode ( Mode  mode  ) 
Parameters:
mode single cell or multiple cell selection

Definition at line 863 of file Selection.cpp.

void KSpread::Selection::sheetProtectionToggled ( bool  protect  )  [signal]
void Selection::startReferenceSelection ( const Region region = Region()  ) 

Start using a reference selection instead of normal one.

Definition at line 895 of file Selection.cpp.

void Selection::update ( const QPoint point  ) 

Update the marker of the selection to point .

Uses the anchor as starting point point the new marker location

Definition at line 367 of file Selection.cpp.

void Selection::update (  ) 

Emits signal changed(const Region&).

Definition at line 362 of file Selection.cpp.

void KSpread::Selection::visibleSheetRequested ( Sheet sheet  )  [signal]

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