kformula/flake
FormulaCursor.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef FORMULACURSOR_H
00024 #define FORMULACURSOR_H
00025
00026 #include "kformula_export.h"
00027 #include <QString>
00028 #include <QPair>
00029 #include "FormulaData.h"
00030
00031 class BasicElement;
00032 class QString;
00033 class QPainter;
00034 class QPointF;
00035 class QRectF;
00036 class QUndoCommand;
00037
00038 enum CursorDirection {
00039 MoveRight,
00040 MoveLeft,
00041 MoveUp,
00042 MoveDown,
00043 NoDirection
00044 };
00045
00046
00056 class KOFORMULA_EXPORT FormulaCursor {
00057 public:
00058 FormulaCursor(BasicElement* element, bool selecting, int position, int mark);
00059 FormulaCursor(BasicElement* element, int position);
00060 FormulaCursor();
00061 FormulaCursor(const FormulaCursor& other);
00062
00067 void paint( QPainter &painter ) const;
00068
00070 bool isHome() const;
00071
00073 bool isEnd() const;
00074
00076 BasicElement* currentElement() const;
00077
00079 int position() const;
00080
00082 void setPosition(int position);
00083
00085 void setCurrentElement(BasicElement* element);
00086
00088 CursorDirection direction() const;
00089
00094 void setSelecting( bool selecting );
00095
00097 bool isSelecting() const;
00098
00100 bool hasSelection() const;
00101
00103 void setMark(int position);
00104
00106 int mark() const;
00107
00109 void selectElement(BasicElement* element);
00110
00112 QPair<int,int> selection() const;
00113
00115 bool isAccepted() const;
00116
00118 void move( CursorDirection direction );
00119
00120 void moveTo( const FormulaCursor& pos);
00121
00122 void moveTo(BasicElement* element, int position);
00123
00124 void moveTo(BasicElement* element);
00125
00127 bool moveCloseTo( BasicElement* element, FormulaCursor& cursor);
00128
00130 void moveHome();
00131
00133 void moveEnd();
00134
00136 QPointF getCursorPosition();
00137
00139 void setCursorTo( const QPointF& point );
00140
00142 bool insideToken() const;
00143
00145 bool insideInferredRow() const;
00146
00148 bool insideFixedElement() const;
00149
00150 bool performMovement( FormulaCursor& oldcursor );
00151
00152 FormulaCursor& operator+=(int step);
00153
00154 int offset();
00155
00156 private:
00158 BasicElement* m_currentElement;
00159
00161 int m_position;
00162
00164 int m_mark;
00165
00167 bool m_selecting;
00168
00169 CursorDirection m_direction;
00170 };
00171
00172 #endif // FORMULACURSOR_H
|