#include "layout.h"
#include "lyxrow.h"
#include "vspace.h"
+#include "Spacing.h"
+#include "LColor.h"
class Buffer;
class BufferParams;
};
///
enum word_location {
- /// the word around the cursor
+ // the word around the cursor, only if the cursor is
+ //not at a boundary
+ WHOLE_WORD_STRICT,
+ // the word around the cursor
WHOLE_WORD,
/// the word begining from the cursor position
PARTIAL_WORD,
+ /// the word around the cursor or before the cursor
+ PREVIOUS_WORD,
/// the next word (not yet used)
NEXT_WORD
};
/// Destructor
~LyXText();
- void init(BufferView *);
+ void init(BufferView *, bool reinit = false);
///
mutable int number_of_rows;
///
LyXFont const getFont(Buffer const *, Paragraph * par,
Paragraph::size_type pos) const;
///
+ LyXFont const getLayoutFont(Buffer const *, Paragraph * par) const;
+ ///
+ LyXFont const getLabelFont(Buffer const *, Paragraph * par) const;
+ ///
void setCharFont(Buffer const *, Paragraph * par,
Paragraph::size_type pos, LyXFont const & font);
void setCharFont(BufferView *, Paragraph * par,
///
void toggleFree(BufferView *, LyXFont const &, bool toggleall = false);
+
+ ///
+ string getStringToIndex(BufferView *);
/** recalculates the heights of all previous rows of the
specified paragraph. needed, if the last characters font
/** Completes the insertion with a full rebreak.
Returns true if something was broken. */
- bool fullRebreak(BufferView *);
+ bool fullRebreak(BufferView *);
///
- Row * need_break_row;
+ mutable Row * need_break_row;
///
mutable int refresh_y;
///
///
mutable Row * refresh_row;
///
- int refresh_pos;
+ Paragraph::size_type refresh_pos;
/// give and set the LyXText status
text_status status() const;
+ ///
void status(BufferView *, text_status) const;
private:
/** returns the column near the specified x-coordinate of the row
x is set to the real beginning of this column
*/
- int getColumnNearX(BufferView *, Row * row,
- int & x, bool & boundary) const;
+ Paragraph::size_type getColumnNearX(BufferView *, Row * row,
+ int & x, bool & boundary) const;
/** returns a pointer to a specified row. y is set to the beginning
of the row
Since the LyXText now has been moved from Buffer to BufferView
it should not be absolutely needed to move the cursor...
*/
- mutable LyXCursor cursor;
+ mutable LyXCursor cursor; // actual cursor position
- /** The structrue that keeps track of the selections set. */
+ /** The structure that keeps track of the selections set. */
struct Selection {
Selection()
: set_(false), mark_(false)
void mark(bool m) {
mark_ = m;
}
- LyXCursor cursor;
- LyXCursor start;
- LyXCursor end;
+ LyXCursor cursor; // temporary cursor to hold a cursor position
+ // until setSelection is called!
+ LyXCursor start; // start of a REAL selection
+ LyXCursor end; // end of a REAL selection
private:
bool set_; // former selection
bool mark_; // former mark_set
};
mutable Selection selection;
- /// needed for the toggling
- LyXCursor last_sel_cursor;
- ///
- LyXCursor toggle_cursor;
- ///
- LyXCursor toggle_end_cursor;
+ /// needed for the toggling (cursor position on last selection made)
+ mutable LyXCursor last_sel_cursor;
+ /// needed for toggling the selection in screen.C
+ mutable LyXCursor toggle_cursor;
+ /// needed for toggling the selection in screen.C
+ mutable LyXCursor toggle_end_cursor;
/// need the selection cursor:
void setSelection(BufferView *);
///
- void clearSelection(BufferView *) const;
+ void clearSelection() const;
///
- string const selectionAsString(Buffer const *) const;
+ string const selectionAsString(Buffer const *, bool label) const;
/// select the word we need depending on word_location
- void getWord(LyXCursor & from, LyXCursor & to, word_location) const;
+ void getWord(LyXCursor & from, LyXCursor & to,
+ word_location const) const;
/// just selects the word the cursor is in
- void selectWord(BufferView *);
+ void selectWord(BufferView *, word_location const);
/// returns the inset at cursor (if it exists), 0 otherwise
Inset * getInset() const;
to the beginning of this word.
With SelectSelectedWord can this be highlighted really
*/
- string const selectNextWord(BufferView *, float & value) const;
+ string const selectNextWordToSpellcheck(BufferView *, float & value) const;
///
void selectSelectedWord(BufferView *);
///
///
void deleteLineForward(BufferView *);
///
- bool selectWordWhenUnderCursor(BufferView *);
+ bool selectWordWhenUnderCursor(BufferView *,
+ word_location const);
///
enum TextCase {
///
///
void toggleInset(BufferView *);
///
- void cutSelection(BufferView *, bool = true);
+ void cutSelection(BufferView *, bool doclear = true, bool realcut = true);
///
void copySelection(BufferView *);
///
void copyEnvironmentType();
///
void pasteEnvironmentType(BufferView *);
- ///
- void insertFootnote();
- ///
- void insertMarginpar();
- ///
- void insertFigure();
- ///
- void insertTabular();
/** the DTP switches for paragraphs. LyX will store the top settings
always in the first physical paragraph, the bottom settings in the
bool pagebreak_top, bool pagebreak_bottom,
VSpace const & space_top,
VSpace const & space_bottom,
+ Spacing const & spacing,
LyXAlignment align,
string labelwidthstring,
bool noindent);
///
int workWidth(BufferView *) const;
///
+ int workWidth(BufferView *, Inset * inset) const;
+ ///
void computeBidiTables(Buffer const *, Row * row) const;
/// Maps positions in the visual string to positions in logical string.
float & fill_label_hfill,
bool bidi = true) const;
+ // fix the cursor `cur' after a characters has been deleted at `where'
+ // position. Called by deleteEmptyParagraphMechanism
+ void fixCursorAfterDelete(BufferView * bview,
+ LyXCursor & cur,
+ LyXCursor const & where) const;
+
///
void deleteEmptyParagraphMechanism(BufferView *,
LyXCursor const & old_cursor) const;
*/
bool hfillExpansion(Buffer const *, Row const * row_ptr,
Paragraph::size_type pos) const;
+ ///
+ LColor::color backgroundColor();
///
///
Paragraph * ownerParagraph() const;
//
- Paragraph * ownerParagraph(Paragraph *) const;
+ void ownerParagraph(Paragraph *) const;
// set it searching first for the right owner using the paragraph id
- Paragraph * ownerParagraph(int id, Paragraph *) const;
+ void ownerParagraph(int id, Paragraph *) const;
};