kspread

KSpread::Canvas Class Reference

#include <kspread_canvas.h>

List of all members.


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)
Viewview () const
Docdoc () const
KSpread::EditWidgeteditWidget () const
KSpread::CellEditoreditor () const
SelectionselectionInfo () const
Selectionchoice () 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
SheetactiveSheet () const
SheetfindSheet (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)
EmbeddedObjectgetObject (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

enum KSpread::Canvas::MouseActions
 

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

Sheet* KSpread::Canvas::activeSheet  )  const
 

Returns:
a pointer to the active sheet

double KSpread::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.

double KSpread::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.

Selection* KSpread::Canvas::choice  )  const
 

Returns:
a selection of cells used in formulas

bool KSpread::Canvas::chooseMode  )  const
 

Returns:
true if choose mode is enabled, false otherwise

void KSpread::Canvas::closeEditor  ) 
 

Close the cell editor and saves changes.

See also:
deleteEditor()

void KSpread::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

void KSpread::Canvas::createEditor bool  captureArrowKeys = false  ) 
 

Chooses the correct EditorType by looking at the current cells value.

By default CellEditor is chosen.

const QPen& KSpread::Canvas::defaultGridPen  )  const
 

Returns:
the pen, the default grid is painted with (light gray)

void KSpread::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

void KSpread::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

void KSpread::Canvas::endChoose  ) 
 

Switches to selection mode.

Clear the choice.

Sheet* KSpread::Canvas::findSheet const QString &  _name  )  const
 

convenience function

See also:
Map::findSheet()

void KSpread::Canvas::finishResizeObject const QString &  name,
bool  layout = true
 

create KPrResizeCmd

bool KSpread::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.

void KSpread::Canvas::lowerObject  ) 
 

Don't display an object above the others.

QPoint KSpread::Canvas::marker  )  const
 

convenience function.

Returns:
selection's marker
See also:
Selection::marker()

int KSpread::Canvas::markerColumn  )  const
 

convenience function.

Returns:
selection's marker's column
See also:
Selection::marker()

int KSpread::Canvas::markerRow  )  const
 

convenience function.

Returns:
selection's marker's row
See also:
Selection::marker()

void KSpread::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

void KSpread::Canvas::paintUpdates  ) 
 

Paint all visible cells that have a paint dirty flag set.

void KSpread::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

void KSpread::Canvas::resizeObject ModifyType  _modType,
const KoPoint &  point,
bool  keepRatio
 

resize the m_resizeObject

void KSpread::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

QRect KSpread::Canvas::selection  )  const
 

Deprecated:
use selectionInfo() Selections are no longer contiguous in general.
See also:
Selection::lastRange()

Selection::activeElement()

Selection* KSpread::Canvas::selectionInfo  )  const
 

Returns:
the usual selection of cells

void KSpread::Canvas::setChooseMode bool  state  ) 
 

Switches the choose mode on and off.

Does not clear the choice.

void KSpread::Canvas::setLastEditorWithFocus 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.

void KSpread::Canvas::setXOffset double  _xOffset  ) 
 

Sets the width of the columns before the current screen.

void KSpread::Canvas::setYOffset double  _yOffset  ) 
 

Sets the height of the rows before the current screen.

void KSpread::Canvas::startChoose const QRect &  selection  ) 
 

Switches to choose mode and sets the initial selection.

void KSpread::Canvas::startChoose  ) 
 

Switches to choose mode and sets the initial selection to the position returned by marker().

Clears the choice.

void KSpread::Canvas::updatePosWidget  ) 
 

Updates the position widget.

void KSpread::Canvas::validateSelection  ) 
 

Validates the selected cell.

QRect KSpread::Canvas::visibleCells  )  const
 

Returns:
a rect indicating which cell range is currently visible onscreen

double KSpread::Canvas::xOffset  )  const
 

Returns:
the width of the columns before the current screen

double KSpread::Canvas::yOffset  )  const
 

Returns:
the height of the rows before the current screen

double KSpread::Canvas::zoom  )  const
 

convenience function

See also:
View::zoom()

The documentation for this class was generated from the following file:
KDE Home | KDE Accessibility Home | Description of Access Keys