kspread Library API Documentation

KSpreadCanvas Class Reference

The canvas builds a part of the GUI of KSpread. More...

#include <kspread_canvas.h>

Inheritance diagram for KSpreadCanvas:

Inheritance graph
[legend]
Collaboration diagram for KSpreadCanvas:

Collaboration graph
[legend]
List of all members.

Public Types

enum  MouseActions { NoAction = 0, Mark = 1, ResizeCell = 2, AutoFill = 3 }
enum  EditorType { CellEditor, FormulaEditor, EditWidget }

Public Slots

void slotScrollVert (int _value)
void slotScrollHorz (int _value)
void slotMaxColumn (int _max_column)
void slotMaxRow (int _max_row)

Public Member Functions

 KSpreadCanvas (KSpreadView *_view)
KSpreadViewview ()
KSpreadDocdoc ()
void init ()
KSpreadEditWidgeteditWidget () const
KSpreadCellEditor * editor () const
int chooseTextLen () const
KSpreadSelection * selectionInfo () const
QRect selection () const
QPoint marker () const
int markerColumn () const
int markerRow () const
void updateCellRect (const QRect &_rect)
void updateSelection (const QRect &oldSelection, const QPoint &oldMarker)
const QPendefaultGridPen () const
double zoom () const
double xOffset () const
double yOffset () const
QRect visibleCells ()
KSpreadSheet * activeSheet () const
KSpreadSheet * findSheet (const QString &_name) const
bool gotoLocation (const KSpreadRange &_range)
bool gotoLocation (const KSpreadPoint &_cell)
void gotoLocation (QPoint const &location, KSpreadSheet *sheet=NULL, bool extendSelection=false)
void gotoLocation (int col, int row, KSpreadSheet *sheet=NULL, bool extendSelection=false)
void paintUpdates ()
void scrollToCell (QPoint location)
void createEditor ()
bool createEditor (EditorType type, bool addFocus=true)
void deleteEditor (bool saveChanges)
void setLastEditorWithFocus (EditorType type)
void startChoose ()
void startChoose (const QRect &selection)
void endChoose ()
bool chooseMode () const
void adjustArea (bool makeUndo=true)
void equalizeRow ()
void equalizeColumn ()
void updatePosWidget ()
void closeEditor ()
void setEditWidget (KSpreadEditWidget *ew)
virtual bool focusNextPrevChild (bool)
bool chooseFormulaArea () const
double autoScrollAccelerationX (int offset)
double autoScrollAccelerationY (int offset)

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)

Friends

class KSpreadHBorder
class KSpreadVBorder
class KSpreadView

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 80 of file kspread_canvas.h.


Member Enumeration Documentation

enum KSpreadCanvas::MouseActions
 

The current action associated with the mouse.

Default is 'NoAction'.

Definition at line 92 of file kspread_canvas.h.


Member Function Documentation

void KSpreadCanvas::init  ) 
 

Called from KSpreadView to complete the construction.

Has to be called before any other method on this object may be invoced.

int KSpreadCanvas::chooseTextLen  )  const
 

If the user chooses some cells during editing a formula, then this function returns the length of the textual representation.

For example the user selects "Sheet1!A1:B2" then this function returns 12.

Definition at line 293 of file kspread_canvas.cc.

double KSpreadCanvas::xOffset  )  const
 

Returns the width of the columns before the current screen.

Definition at line 229 of file kspread_canvas.cc.

Referenced by gotoLocation(), paintUpdates(), scrollToCell(), and visibleCells().

double KSpreadCanvas::yOffset  )  const
 

Returns the height of the rows before the current screen.

Definition at line 234 of file kspread_canvas.cc.

Referenced by gotoLocation(), paintUpdates(), scrollToCell(), and visibleCells().

QRect KSpreadCanvas::visibleCells  ) 
 

Return a rect indicating which cell range is currently visible onscreen.

Definition at line 3378 of file kspread_canvas.cc.

References xOffset(), and yOffset().

Referenced by paintUpdates().

bool KSpreadCanvas::gotoLocation const KSpreadRange &  _range  ) 
 

A convenience function.

Definition at line 404 of file kspread_canvas.cc.

Referenced by gotoLocation().

bool KSpreadCanvas::gotoLocation const KSpreadPoint &  _cell  ) 
 

A convenience function.

Definition at line 426 of file kspread_canvas.cc.

References gotoLocation().

void KSpreadCanvas::gotoLocation QPoint const &  location,
KSpreadSheet *  sheet = NULL,
bool  extendSelection = false
 

Move the cursor to the specified cell.

This may include switching the sheet. In addition KSpreadView::updateEditWidget is called.

Parameters:
location the cell to move to
sheet the sheet to move to. If NULL, the active sheet is used
extendSelection determines wether this move of the marker is part of a selection, that means: The user holds the shift key and moves the cursor keys. In this case the selection is updated accordingly. If this is false, the cell will be the single cell selected, and the selection anchor will be reset to this cell.

Definition at line 447 of file kspread_canvas.cc.

References KSpreadCell::column(), KSpreadCell::dblHeight(), KSpreadCell::dblWidth(), KSpreadCell::getValidity(), KSpreadCell::isObscured(), KSpreadCell::isObscuringForced(), KSpreadCell::obscuringCells(), KSpreadCell::row(), scrollToCell(), xOffset(), and yOffset().

void KSpreadCanvas::gotoLocation int  col,
int  row,
KSpreadSheet *  sheet = NULL,
bool  extendSelection = false
[inline]
 

convenience function

Definition at line 180 of file kspread_canvas.h.

void KSpreadCanvas::paintUpdates  ) 
 

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

Definition at line 3400 of file kspread_canvas.cc.

References KSpreadCell::calc(), KSpreadCell::effBottomBorderPen(), KSpreadCell::effBottomBorderValue(), KSpreadCell::effLeftBorderPen(), KSpreadCell::effLeftBorderValue(), KSpreadCell::effRightBorderPen(), KSpreadCell::effRightBorderValue(), KSpreadCell::effTopBorderPen(), KSpreadCell::effTopBorderValue(), KSpreadCell::isDefault(), KSpreadCell::makeLayout(), KSpreadCell::paintCell(), visibleCells(), xOffset(), and yOffset().

void KSpreadCanvas::scrollToCell QPoint  location  ) 
 

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 588 of file kspread_canvas.cc.

References xOffset(), and yOffset().

Referenced by gotoLocation().

void KSpreadCanvas::createEditor  ) 
 

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

By default CellEditor is chosen.

Definition at line 2891 of file kspread_canvas.cc.

void KSpreadCanvas::deleteEditor bool  saveChanges  ) 
 

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.

Definition at line 2847 of file kspread_canvas.cc.

void KSpreadCanvas::setLastEditorWithFocus EditorType  type  ) 
 

Called from KSpreadEditWidget and KSpreadCellEditor 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 KSpreadCanvas must know whether the EditWidget or the CellEditor lost the focus when the user clicked on the canvas.

Definition at line 244 of file kspread_canvas.cc.

void KSpreadCanvas::startChoose  ) 
 

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

Definition at line 333 of file kspread_canvas.cc.

void KSpreadCanvas::startChoose const QRect selection  ) 
 

Switches to choose mode and sets the initial selection.

Definition at line 345 of file kspread_canvas.cc.

void KSpreadCanvas::adjustArea bool  makeUndo = true  ) 
 

Adjust a area in height and width.

Definition at line 3301 of file kspread_canvas.cc.

double KSpreadCanvas::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 2823 of file kspread_canvas.cc.

double KSpreadCanvas::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 2835 of file kspread_canvas.cc.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kspread Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:43:42 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003