16 #ifndef _QDOCUMENT_LINE_H_
17 #define _QDOCUMENT_LINE_H_
48 : id(0), role(0), offset(0), length(0)
52 : id(i), role(r), offset(pos), length(len)
73 CollapsedBlockStart = 2,
74 CollapsedBlockEnd = 4,
80 Q_DECLARE_FLAGS(States, State);
113 void operator ++ (
int);
114 void operator -- (
int);
118 int lineNumber()
const;
119 int position()
const;
121 QString text()
const;
124 int lineSpan()
const;
126 int firstChar()
const;
127 int lastChar()
const;
131 int nextNonSpaceChar(
int pos)
const;
132 int previousNonSpaceChar(
int pos)
const;
134 inline QString indentation()
const
135 {
int idx = firstChar();
return idx != -1 ? text().left(idx) : text(); }
137 inline bool isHidden()
const
138 {
return hasFlag(Hidden); }
140 bool hasFlag(State s)
const;
141 bool hasAnyFlag(
int s)
const;
142 void setFlag(State s,
bool y =
true);
149 int xToCursor(
int x)
const;
150 int cursorToX(
int cpos)
const;
152 int wrappedLineForCursor(
int cpos)
const;
154 int documentOffsetToCursor(
int x,
int y)
const;
155 void cursorToDocumentOffset(
int cpos,
int& x,
int& y)
const;
157 QPoint cursorToDocumentOffset(
int cpos)
const;
159 void addMark(
int id);
160 void removeMark(
int id);
161 void toggleMark(
int id);
164 bool hasMark(
int id)
const;
166 bool hasOverlay(
int fid)
const;
169 void clearOverlays();
173 void setFormats(
const QVector<int>& formats);
175 const QVector<QParenthesis>& parentheses()
const;
176 void setParentheses(
const QVector<QParenthesis>& parentheses);
187 Q_DECLARE_OPERATORS_FOR_FLAGS(QDocumentLine::States)