00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef KFORMULAVIEW_H
00022
#define KFORMULAVIEW_H
00023
00024
#include <qevent.h>
00025
#include <qobject.h>
00026
#include <qrect.h>
00027
00028
#include "kformuladefs.h"
00029
#include "contextstyle.h"
00030
00031
class QColorGroup;
00032
00033 KFORMULA_NAMESPACE_BEGIN
00034
00035
class BasicElement;
00036
class FormulaCursor;
00037
class FormulaElement;
00038
class Container;
00039
00040
00050 class View :
public QObject {
00051 Q_OBJECT
00052
00053
public:
00054
00055
View(
Container*);
00056
virtual ~
View();
00057
00061
QPoint getCursorPoint()
const;
00062
00066
void setReadOnly(
bool ro);
00067
00068
void mousePressEvent(
QMouseEvent* event);
00069
void mouseReleaseEvent(
QMouseEvent* event);
00070
void mouseDoubleClickEvent(
QMouseEvent* event);
00071
void mouseMoveEvent(
QMouseEvent* event);
00072
void wheelEvent(
QWheelEvent* event);
00073
00074
00075
void mousePressEvent(
QMouseEvent* event,
const PtPoint& pos );
00076
void mouseReleaseEvent(
QMouseEvent* event,
const PtPoint& pos );
00077
void mouseDoubleClickEvent(
QMouseEvent* event,
const PtPoint& pos );
00078
void mouseMoveEvent(
QMouseEvent* event,
const PtPoint& pos );
00079
void wheelEvent(
QWheelEvent* event,
const PtPoint& pos );
00080
00081
00082
void mousePressEvent(
QMouseEvent* event,
const LuPixelPoint& pos );
00083
void mouseReleaseEvent(
QMouseEvent* event,
const LuPixelPoint& pos );
00084
void mouseDoubleClickEvent(
QMouseEvent* event,
const LuPixelPoint& pos );
00085
void mouseMoveEvent(
QMouseEvent* event,
const LuPixelPoint& pos );
00086
void wheelEvent(
QWheelEvent* event,
const LuPixelPoint& pos );
00087
00088
void keyPressEvent(
QKeyEvent* event);
00089
virtual void focusInEvent(
QFocusEvent* event);
00090
virtual void focusOutEvent(
QFocusEvent* event);
00091
00092
void calcCursor();
00093
00094
void draw(
QPainter& painter,
const QRect& rect,
const QColorGroup& cg);
00095
void draw(
QPainter& painter,
const QRect& rect);
00096
00100 virtual Container*
getDocument()
const {
return container(); }
00101
00105 FormulaCursor*
getCursor()
const {
return cursor(); }
00106
00107
void setSmallCursor(
bool small);
00108
00109
00110
00111
void moveLeft(
int flag = NormalMovement );
00112
void moveRight(
int flag = NormalMovement );
00113
void moveUp(
int flag = NormalMovement );
00114
void moveDown(
int flag = NormalMovement );
00115
00116
void moveHome(
int flag = NormalMovement );
00117
void moveEnd(
int flag = NormalMovement );
00118
00120
bool isHome() const;
00121
00123
bool isEnd() const;
00124
00125
void eraseSelection( Direction direction = beforeCursor );
00126
void addText(
QString str );
00127
00128 signals:
00129
00133
void cursorChanged(
bool visible,
bool selecting);
00134
00135 public slots:
00136
00137
void slotSelectAll();
00138
00139 protected slots:
00140
00145
void slotCursorMoved(
FormulaCursor* cursor);
00146
00150
void slotFormulaLoaded(
FormulaElement*);
00151
00156
void slotElementWillVanish(
BasicElement*);
00157
00158 protected:
00159
00160 virtual
bool cursorVisible();
00161
00162 private:
00163
00167
void emitCursorChanged();
00168
00169
bool& cursorHasChanged();
00170
bool& smallCursor();
00171
Container* container() const;
00172 const
ContextStyle& contextStyle() const;
00173
FormulaCursor* cursor() const;
00174
00175 struct View_Impl;
00176 View_Impl* impl;
00177 };
00178
00179 KFORMULA_NAMESPACE_END
00180
00181 #endif