kspread

#include <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
TQRect selection () const
TQPoint marker () const
int markerColumn () const
int markerRow () const
const TQPen & defaultGridPen () const
double zoom () const
double xOffset () const
double yOffset () const
void setXOffset (double _xOffset)
void setYOffset (double _yOffset)
TQRect visibleCells () const
Sheet * activeSheet () const
Sheet * findSheet (const TQString &_name) const
void validateSelection ()
void paintUpdates ()
void scrollToCell (TQPoint 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 TQRect &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 TQPoint &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 TQString &name, bool layout=true)
void raiseObject (EmbeddedObject *object)
void lowerObject ()
void displayObjectList (TQPtrList< EmbeddedObject > &list)
KoRect objectRect (bool all) const
void repaintObject (EmbeddedObject *obj)
void copyOasisObjects ()

Protected Member Functions

virtual void keyPressEvent (TQKeyEvent *_ev)
virtual void paintEvent (TQPaintEvent *_ev)
virtual void mousePressEvent (TQMouseEvent *_ev)
virtual void mouseReleaseEvent (TQMouseEvent *_ev)
virtual void mouseMoveEvent (TQMouseEvent *_ev)
virtual void mouseDoubleClickEvent (TQMouseEvent *)
virtual void wheelEvent (TQWheelEvent *)
virtual void focusInEvent (TQFocusEvent *)
virtual void focusOutEvent (TQFocusEvent *)
virtual void resizeEvent (TQResizeEvent *_ev)
virtual void dragMoveEvent (TQDragMoveEvent *_ev)
virtual void dropEvent (TQDropEvent *_ev)
virtual void dragLeaveEvent (TQDragLeaveEvent *_ev)
bool highlightRangeSizeGripAt (double x, double y)

Friends

class HBorder
class VBorder
class View

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.

Member Enumeration Documentation

◆ EditorType

enum KSpread::Canvas::EditorType

Definition at line 115 of file kspread_canvas.h.

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

Constructor & Destructor Documentation

◆ Canvas()

Canvas::Canvas ( View * _view)

Definition at line 207 of file kspread_canvas.cpp.

◆ ~Canvas()

Canvas::~Canvas ( )

Definition at line 281 of file kspread_canvas.cpp.

Member Function Documentation

◆ activeSheet()

Sheet * Canvas::activeSheet ( ) const
Returns
a pointer to the active sheet

Definition at line 504 of file kspread_canvas.cpp.

◆ autoScrollAccelerationX()

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.cpp.

◆ autoScrollAccelerationY()

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.cpp.

◆ choice()

Selection * Canvas::choice ( ) const
Returns
a selection of cells used in formulas

Definition at line 392 of file kspread_canvas.cpp.

◆ chooseMode()

bool Canvas::chooseMode ( ) const
Returns
true if choose mode is enabled, false otherwise

Definition at line 427 of file kspread_canvas.cpp.

◆ closeEditor()

void Canvas::closeEditor ( )

Close the cell editor and saves changes.

See also
deleteEditor()

Definition at line 3905 of file kspread_canvas.cpp.

◆ copyOasisObjects()

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.cpp.

◆ createEditor() [1/2]

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.cpp.

◆ createEditor() [2/2]

bool Canvas::createEditor ( EditorType type,
bool addFocus = true,
bool captureArrowKeys = false )

Definition at line 3717 of file kspread_canvas.cpp.

◆ defaultGridPen()

const TQPen & Canvas::defaultGridPen ( ) const
Returns
the pen, the default grid is painted with (light gray)

Definition at line 333 of file kspread_canvas.cpp.

◆ deleteEditor()

void Canvas::deleteEditor ( bool saveChanges,
bool array = false )

Deletes the current cell editor.

See also
createEditor
#editor
Parameters
saveChangesif true, the edited text is stored in the cell. if false, the changes are discarded.
arrayif true, array formula was entered

Definition at line 3659 of file kspread_canvas.cpp.

◆ deselectAllObjects()

void Canvas::deselectAllObjects ( )

Definition at line 3341 of file kspread_canvas.cpp.

◆ deselectObject()

void Canvas::deselectObject ( EmbeddedObject * obj)

Definition at line 3317 of file kspread_canvas.cpp.

◆ displayObjectList()

void Canvas::displayObjectList ( TQPtrList< 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.cpp.

◆ doc()

Doc * Canvas::doc ( ) const

Definition at line 293 of file kspread_canvas.cpp.

◆ dragLeaveEvent()

void Canvas::dragLeaveEvent ( TQDragLeaveEvent * _ev)
protectedvirtual

Definition at line 1745 of file kspread_canvas.cpp.

◆ dragMoveEvent()

void Canvas::dragMoveEvent ( TQDragMoveEvent * _ev)
protectedvirtual

Definition at line 1714 of file kspread_canvas.cpp.

◆ dropEvent()

void Canvas::dropEvent ( TQDropEvent * _ev)
protectedvirtual

Definition at line 1751 of file kspread_canvas.cpp.

◆ editor()

CellEditor * Canvas::editor ( ) const

Definition at line 308 of file kspread_canvas.cpp.

◆ editWidget()

KSpread::EditWidget * Canvas::editWidget ( ) const

Definition at line 303 of file kspread_canvas.cpp.

◆ endChoose()

void Canvas::endChoose ( )

Switches to selection mode.

Clear the choice.

Definition at line 456 of file kspread_canvas.cpp.

◆ equalizeColumn()

void Canvas::equalizeColumn ( )

Definition at line 4007 of file kspread_canvas.cpp.

◆ equalizeRow()

void Canvas::equalizeRow ( )

Definition at line 3990 of file kspread_canvas.cpp.

◆ findSheet()

Sheet * Canvas::findSheet ( const TQString & _name) const

convenience function

See also
Map::findSheet()

Definition at line 499 of file kspread_canvas.cpp.

◆ finishResizeObject()

void Canvas::finishResizeObject ( const TQString & name,
bool layout = true )

create KPrResizeCmd

Definition at line 3585 of file kspread_canvas.cpp.

◆ focusInEvent()

void Canvas::focusInEvent ( TQFocusEvent * )
protectedvirtual

Definition at line 1685 of file kspread_canvas.cpp.

◆ focusNextPrevChild()

bool Canvas::focusNextPrevChild ( bool )
virtual

Definition at line 382 of file kspread_canvas.cpp.

◆ focusOutEvent()

void Canvas::focusOutEvent ( TQFocusEvent * )
protectedvirtual

Definition at line 1706 of file kspread_canvas.cpp.

◆ getObject()

KSpread::EmbeddedObject * Canvas::getObject ( const TQPoint & pos,
Sheet * _sheet )

Definition at line 3283 of file kspread_canvas.cpp.

◆ highlightRangeSizeGripAt()

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
xUnzoomed x coordinate to check
yUnzoomed 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.cpp.

◆ isObjectSelected()

bool Canvas::isObjectSelected ( )

Definition at line 3364 of file kspread_canvas.cpp.

◆ keyPressEvent()

void Canvas::keyPressEvent ( TQKeyEvent * _ev)
protectedvirtual

Definition at line 2749 of file kspread_canvas.cpp.

◆ lowerObject()

void Canvas::lowerObject ( )

Don't display an object above the others.

Definition at line 3625 of file kspread_canvas.cpp.

◆ marker()

TQPoint Canvas::marker ( ) const

convenience function.

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

Definition at line 402 of file kspread_canvas.cpp.

◆ markerColumn()

int Canvas::markerColumn ( ) const

convenience function.

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

Definition at line 407 of file kspread_canvas.cpp.

◆ markerRow()

int Canvas::markerRow ( ) const

convenience function.

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

Definition at line 412 of file kspread_canvas.cpp.

◆ mouseDoubleClickEvent()

void Canvas::mouseDoubleClickEvent ( TQMouseEvent * _ev)
protectedvirtual

Definition at line 1599 of file kspread_canvas.cpp.

◆ mouseMoveEvent()

void Canvas::mouseMoveEvent ( TQMouseEvent * _ev)
protectedvirtual

Definition at line 875 of file kspread_canvas.cpp.

◆ mousePressEvent()

void Canvas::mousePressEvent ( TQMouseEvent * _ev)
protectedvirtual

Definition at line 1308 of file kspread_canvas.cpp.

◆ mouseReleaseEvent()

void Canvas::mouseReleaseEvent ( TQMouseEvent * _ev)
protectedvirtual

Definition at line 1158 of file kspread_canvas.cpp.

◆ moveObjectsByMouse()

void Canvas::moveObjectsByMouse ( KoPoint & pos,
bool keepXorYunchanged )

Move object by mouse.

Parameters
posThe position of the mouse
keepXorYunchangedif true keep x or y position unchanged

Definition at line 3370 of file kspread_canvas.cpp.

◆ objectRect()

KoRect Canvas::objectRect ( bool all) const

Definition at line 3654 of file kspread_canvas.cpp.

◆ paintEvent()

void Canvas::paintEvent ( TQPaintEvent * _ev)
protectedvirtual

Definition at line 1639 of file kspread_canvas.cpp.

◆ paintUpdates()

void Canvas::paintUpdates ( )

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

Definition at line 4051 of file kspread_canvas.cpp.

◆ raiseObject()

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
objectwhich should be displayed above the other objects

Definition at line 3611 of file kspread_canvas.cpp.

◆ repaintObject()

void Canvas::repaintObject ( EmbeddedObject * obj)

Definition at line 3820 of file kspread_canvas.cpp.

◆ resizeEvent()

void Canvas::resizeEvent ( TQResizeEvent * _ev)
protectedvirtual

Definition at line 1846 of file kspread_canvas.cpp.

◆ resizeObject()

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

resize the m_resizeObject

Definition at line 3428 of file kspread_canvas.cpp.

◆ scrollToCell()

void Canvas::scrollToCell ( TQPoint location) const

Makes sure a cell is visible onscreen by scrolling up/down and left/right.

Parameters
locationthe cell coordinates to scroll to

Definition at line 609 of file kspread_canvas.cpp.

◆ selectAllObjects()

void Canvas::selectAllObjects ( )

Definition at line 3328 of file kspread_canvas.cpp.

◆ selection()

TQRect 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.cpp.

◆ selectionInfo()

Selection * Canvas::selectionInfo ( ) const
Returns
the usual selection of cells

Definition at line 387 of file kspread_canvas.cpp.

◆ selectObject()

void Canvas::selectObject ( EmbeddedObject * obj)

Definition at line 3305 of file kspread_canvas.cpp.

◆ setChooseMode()

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.cpp.

◆ setEditWidget()

void Canvas::setEditWidget ( KSpread::EditWidget * ew)

Definition at line 298 of file kspread_canvas.cpp.

◆ setLastEditorWithFocus()

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.cpp.

◆ setMouseSelectedObject()

void Canvas::setMouseSelectedObject ( bool b)

Definition at line 3358 of file kspread_canvas.cpp.

◆ setXOffset()

void Canvas::setXOffset ( double _xOffset)

Sets the width of the columns before the current screen.

Definition at line 323 of file kspread_canvas.cpp.

◆ setYOffset()

void Canvas::setYOffset ( double _yOffset)

Sets the height of the rows before the current screen.

Definition at line 328 of file kspread_canvas.cpp.

◆ slotMaxColumn

void Canvas::slotMaxColumn ( int _max_column)
slot

Definition at line 845 of file kspread_canvas.cpp.

◆ slotMaxRow

void Canvas::slotMaxRow ( int _max_row)
slot

Definition at line 862 of file kspread_canvas.cpp.

◆ slotScrollHorz

void Canvas::slotScrollHorz ( int _value)
slot

Definition at line 723 of file kspread_canvas.cpp.

◆ slotScrollVert

void Canvas::slotScrollVert ( int _value)
slot

Definition at line 793 of file kspread_canvas.cpp.

◆ startChoose() [1/2]

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.cpp.

◆ startChoose() [2/2]

void Canvas::startChoose ( const TQRect & selection)

Switches to choose mode and sets the initial selection.

Definition at line 444 of file kspread_canvas.cpp.

◆ updatePosWidget()

void Canvas::updatePosWidget ( )

Updates the position widget.

Definition at line 3945 of file kspread_canvas.cpp.

◆ validateSelection()

void Canvas::validateSelection ( )

Validates the selected cell.

Definition at line 509 of file kspread_canvas.cpp.

◆ view()

KSpread::View * Canvas::view ( ) const

Definition at line 288 of file kspread_canvas.cpp.

◆ visibleCells()

TQRect Canvas::visibleCells ( ) const
Returns
a rect indicating which cell range is currently visible onscreen

Definition at line 4038 of file kspread_canvas.cpp.

◆ wheelEvent()

void Canvas::wheelEvent ( TQWheelEvent * _ev)
protectedvirtual

Definition at line 1626 of file kspread_canvas.cpp.

◆ xOffset()

double Canvas::xOffset ( ) const
Returns
the width of the columns before the current screen

Definition at line 313 of file kspread_canvas.cpp.

◆ yOffset()

double Canvas::yOffset ( ) const
Returns
the height of the rows before the current screen

Definition at line 318 of file kspread_canvas.cpp.

◆ zoom()

double Canvas::zoom ( ) const

convenience function

See also
View::zoom()

Definition at line 417 of file kspread_canvas.cpp.

◆ HBorder

friend class HBorder
friend

Definition at line 91 of file kspread_canvas.h.

◆ VBorder

friend class VBorder
friend

Definition at line 92 of file kspread_canvas.h.

◆ View

friend class View
friend

Definition at line 93 of file kspread_canvas.h.


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