kspread
KSpread::Canvas Class Reference
#include <kspread_canvas.h>
Inherits QWidget.
Detailed Description
The canvas builds a part of the GUI of KSpread.It contains the borders, scrollbars, editwidget and of course it displays the sheet. Especially most of the user interface logic is implemented here. That means that this class knows what to do when a key is pressed or if the mouse button was clicked.
Definition at line 89 of file kspread_canvas.h.
Public Types | |
enum | MouseActions { NoAction, Mark, ResizeCell, AutoFill, ResizeSelection } |
enum | EditorType { CellEditor, EditWidget } |
Public Slots | |
void | slotScrollVert (int _value) |
void | slotScrollHorz (int _value) |
void | slotMaxColumn (int _max_column) |
void | slotMaxRow (int _max_row) |
Signals | |
void | objectSelectedChanged () |
void | objectSizeChanged () |
Public Member Functions | |
Canvas (View *_view) | |
View * | view () const |
Doc * | doc () const |
KSpread::EditWidget * | editWidget () const |
KSpread::CellEditor * | editor () const |
Selection * | selectionInfo () const |
Selection * | choice () const |
QRect | selection () const |
QPoint | marker () const |
int | markerColumn () const |
int | markerRow () const |
const QPen & | defaultGridPen () const |
double | zoom () const |
double | xOffset () const |
double | yOffset () const |
void | setXOffset (double _xOffset) |
void | setYOffset (double _yOffset) |
QRect | visibleCells () const |
Sheet * | activeSheet () const |
Sheet * | findSheet (const QString &_name) const |
void | validateSelection () |
void | paintUpdates () |
void | scrollToCell (QPoint location) const |
void | createEditor (bool captureArrowKeys=false) |
bool | createEditor (EditorType type, bool addFocus=true, bool captureArrowKeys=false) |
void | deleteEditor (bool saveChanges, bool array=false) |
void | setLastEditorWithFocus (EditorType type) |
void | startChoose () |
void | startChoose (const QRect &selection) |
void | endChoose () |
void | setChooseMode (bool state) |
bool | chooseMode () const |
void | equalizeRow () |
void | equalizeColumn () |
void | updatePosWidget () |
void | closeEditor () |
void | setEditWidget (KSpread::EditWidget *ew) |
virtual bool | focusNextPrevChild (bool) |
double | autoScrollAccelerationX (int offset) |
double | autoScrollAccelerationY (int offset) |
EmbeddedObject * | getObject (const QPoint &pos, Sheet *_sheet) |
void | selectAllObjects () |
void | deselectAllObjects () |
void | selectObject (EmbeddedObject *) |
void | deselectObject (EmbeddedObject *) |
void | setMouseSelectedObject (bool b) |
bool | isObjectSelected () |
void | moveObjectsByMouse (KoPoint &pos, bool keepXorYunchanged) |
void | resizeObject (ModifyType _modType, const KoPoint &point, bool keepRatio) |
void | finishResizeObject (const QString &name, bool layout=true) |
void | raiseObject (EmbeddedObject *object) |
void | lowerObject () |
void | displayObjectList (QPtrList< EmbeddedObject > &list) |
KoRect | objectRect (bool all) const |
void | repaintObject (EmbeddedObject *obj) |
void | copyOasisObjects () |
Protected Member Functions | |
virtual void | keyPressEvent (QKeyEvent *_ev) |
virtual void | paintEvent (QPaintEvent *_ev) |
virtual void | mousePressEvent (QMouseEvent *_ev) |
virtual void | mouseReleaseEvent (QMouseEvent *_ev) |
virtual void | mouseMoveEvent (QMouseEvent *_ev) |
virtual void | mouseDoubleClickEvent (QMouseEvent *) |
virtual void | wheelEvent (QWheelEvent *) |
virtual void | focusInEvent (QFocusEvent *) |
virtual void | focusOutEvent (QFocusEvent *) |
virtual void | resizeEvent (QResizeEvent *_ev) |
virtual void | dragMoveEvent (QDragMoveEvent *_ev) |
virtual void | dropEvent (QDropEvent *_ev) |
virtual void | dragLeaveEvent (QDragLeaveEvent *_ev) |
bool | highlightRangeSizeGripAt (double x, double y) |
Friends | |
class | HBorder |
class | VBorder |
class | View |
Member Enumeration Documentation
The current action associated with the mouse.
Default is 'NoAction'.
- Enumerator:
-
NoAction No mouse action (default). Mark Marking action. ResizeCell Merging cell. AutoFill Autofilling. ResizeSelection Resizing the selection.
Definition at line 101 of file kspread_canvas.h.
Member Function Documentation
Selection * Canvas::selectionInfo | ( | ) | const |
Selection * Canvas::choice | ( | ) | const |
QRect Canvas::selection | ( | ) | const |
- Deprecated:
- use selectionInfo() Selections are no longer contiguous in general.
- See also:
- Selection::lastRange()
Selection::activeElement()
Definition at line 397 of file kspread_canvas.cc.
QPoint Canvas::marker | ( | ) | const |
convenience function.
- Returns:
- selection's marker
- See also:
- Selection::marker()
Definition at line 402 of file kspread_canvas.cc.
int Canvas::markerColumn | ( | ) | const |
convenience function.
- Returns:
- selection's marker's column
- See also:
- Selection::marker()
Definition at line 407 of file kspread_canvas.cc.
int Canvas::markerRow | ( | ) | const |
convenience function.
- Returns:
- selection's marker's row
- See also:
- Selection::marker()
Definition at line 412 of file kspread_canvas.cc.
const QPen & Canvas::defaultGridPen | ( | ) | const |
- Returns:
- the pen, the default grid is painted with (light gray)
Definition at line 333 of file kspread_canvas.cc.
double Canvas::zoom | ( | ) | const |
double Canvas::xOffset | ( | ) | const |
- Returns:
- the width of the columns before the current screen
Definition at line 313 of file kspread_canvas.cc.
double Canvas::yOffset | ( | ) | const |
- Returns:
- the height of the rows before the current screen
Definition at line 318 of file kspread_canvas.cc.
void Canvas::setXOffset | ( | double | _xOffset | ) |
Sets the width of the columns before the current screen.
Definition at line 323 of file kspread_canvas.cc.
void Canvas::setYOffset | ( | double | _yOffset | ) |
Sets the height of the rows before the current screen.
Definition at line 328 of file kspread_canvas.cc.
QRect Canvas::visibleCells | ( | ) | const |
- Returns:
- a rect indicating which cell range is currently visible onscreen
Definition at line 4038 of file kspread_canvas.cc.
Sheet * Canvas::activeSheet | ( | ) | const |
Sheet * Canvas::findSheet | ( | const QString & | _name | ) | const |
void Canvas::validateSelection | ( | ) |
void Canvas::paintUpdates | ( | ) |
Paint all visible cells that have a paint dirty flag set.
Definition at line 4051 of file kspread_canvas.cc.
void Canvas::scrollToCell | ( | QPoint | location | ) | const |
Makes sure a cell is visible onscreen by scrolling up/down and left/right.
- Parameters:
-
location the cell coordinates to scroll to
Definition at line 609 of file kspread_canvas.cc.
void Canvas::createEditor | ( | bool | captureArrowKeys = false |
) |
Chooses the correct EditorType by looking at the current cells value.
By default CellEditor is chosen.
Definition at line 3704 of file kspread_canvas.cc.
void Canvas::deleteEditor | ( | bool | saveChanges, | |
bool | array = false | |||
) |
Deletes the current cell editor.
- See also:
- createEditor
editor
- Parameters:
-
saveChanges if true, the edited text is stored in the cell. if false, the changes are discarded. array if true, array formula was entered
Definition at line 3659 of file kspread_canvas.cc.
void Canvas::setLastEditorWithFocus | ( | Canvas::EditorType | type | ) |
Called from EditWidget and CellEditor if they loose the focus because the user started a "choose selection".
This is done because the editor wants to get its focus back afterwards. But somehow Canvas must know whether the EditWidget or the CellEditor lost the focus when the user clicked on the canvas.
Definition at line 338 of file kspread_canvas.cc.
void Canvas::startChoose | ( | ) |
Switches to choose mode and sets the initial selection to the position returned by marker().
Clears the choice.
Definition at line 432 of file kspread_canvas.cc.
void Canvas::startChoose | ( | const QRect & | selection | ) |
Switches to choose mode and sets the initial selection
.
Definition at line 444 of file kspread_canvas.cc.
void Canvas::endChoose | ( | ) |
void Canvas::setChooseMode | ( | bool | state | ) |
Switches the choose mode on and off.
Does not clear the choice.
Definition at line 422 of file kspread_canvas.cc.
bool Canvas::chooseMode | ( | ) | const |
- Returns:
true
if choose mode is enabled,false
otherwise
Definition at line 427 of file kspread_canvas.cc.
void Canvas::updatePosWidget | ( | ) |
void Canvas::closeEditor | ( | ) |
Close the cell editor and saves changes.
- See also:
- deleteEditor()
Definition at line 3905 of file kspread_canvas.cc.
double Canvas::autoScrollAccelerationX | ( | int | offset | ) |
Depending on the offset in "zoomed" screen pixels for the horizontal direction, the function returns the steps in unzoomed points for the autoscroll acceleration.
Definition at line 3258 of file kspread_canvas.cc.
double Canvas::autoScrollAccelerationY | ( | int | offset | ) |
Depending on the offset in "zoomed" screen pixels for the vertical direction, the function returns the steps in unzoomed points for the autoscroll acceleration.
Definition at line 3270 of file kspread_canvas.cc.
void Canvas::moveObjectsByMouse | ( | KoPoint & | pos, | |
bool | keepXorYunchanged | |||
) |
Move object by mouse.
- Parameters:
-
pos The position of the mouse keepXorYunchanged if true keep x or y position unchanged
Definition at line 3370 of file kspread_canvas.cc.
void Canvas::resizeObject | ( | ModifyType | _modType, | |
const KoPoint & | point, | |||
bool | keepRatio | |||
) |
void Canvas::finishResizeObject | ( | const QString & | name, | |
bool | layout = true | |||
) |
void Canvas::raiseObject | ( | EmbeddedObject * | object | ) |
Display object above the other objects in editiong mode.
This is used to bring a single slected object to front, so it is easier to modify.
- Parameters:
-
object which should be displayed above the other objects
Definition at line 3611 of file kspread_canvas.cc.
void Canvas::lowerObject | ( | ) |
void Canvas::displayObjectList | ( | QPtrList< EmbeddedObject > & | list | ) |
Get the list of objects in the order they should be displayed.
This takes into acount the object set in raiseObject so that it is the last one in the list returned (the one that is displayed above all the others).
- Returns:
- List of objects
Definition at line 3630 of file kspread_canvas.cc.
void Canvas::copyOasisObjects | ( | ) |
This is intended to copy the selected objects to the clipboard so that they can be pasted into other applications.
However, until at least KWord, KSpread, KPresenter, KChart and KFormula have consistant support for copying and pasting of OASIS objects the selected objects will just be copied in the form of raster graphics
Definition at line 3846 of file kspread_canvas.cc.
bool Canvas::highlightRangeSizeGripAt | ( | double | x, | |
double | y | |||
) | [protected] |
Checks to see if there is a size grip for a highlight range at a given position.
Note that both X and Y coordinates are UNZOOMED. To translate from a zoomed coordinate (eg. position of a mouse event) to an unzoomed coordinate, use Doc::unzoomItX and Doc::unzoomItY. The document object can be accessed via view()->doc()
- Parameters:
-
x Unzoomed x coordinate to check y Unzoomed y coordinate to check
- Returns:
true
if there is a size grip at the specified position,false
otherwise.
Definition at line 1281 of file kspread_canvas.cc.
The documentation for this class was generated from the following files: