1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
* ======================================================
|
|
|
|
*
|
1999-09-27 18:44:28 +00:00
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
1999-10-07 18:44:17 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
1999-11-15 12:01:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
#ifndef LYXTEXT_H
|
|
|
|
#define LYXTEXT_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "lyxfont.h"
|
|
|
|
#include "lyxcursor.h"
|
2000-02-03 19:51:27 +00:00
|
|
|
#include "layout.h"
|
2001-07-24 10:13:19 +00:00
|
|
|
#include "LColor.h"
|
2001-11-26 16:42:04 +00:00
|
|
|
#include "insets/inset.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
class Buffer;
|
|
|
|
class BufferParams;
|
2000-02-10 17:53:36 +00:00
|
|
|
class BufferView;
|
2000-06-21 15:07:57 +00:00
|
|
|
class InsetText;
|
2001-11-26 16:42:04 +00:00
|
|
|
class Paragraph;
|
|
|
|
class Row;
|
|
|
|
class Spacing;
|
|
|
|
class UpdatableInset;
|
|
|
|
class VSpace;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-04-26 13:57:28 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/**
|
|
|
|
This class holds the mapping between buffer paragraphs and screen rows.
|
|
|
|
*/
|
|
|
|
class LyXText {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
enum text_status {
|
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
UNCHANGED = 0,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
CHANGED_IN_DRAW = 1,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
NEED_VERY_LITTLE_REFRESH = 2,
|
2000-07-07 08:24:42 +00:00
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
NEED_MORE_REFRESH = 3
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
2001-06-27 14:10:35 +00:00
|
|
|
///
|
|
|
|
enum word_location {
|
2001-07-27 16:07:33 +00:00
|
|
|
// the word around the cursor, only if the cursor is
|
|
|
|
//not at a boundary
|
|
|
|
WHOLE_WORD_STRICT,
|
|
|
|
// the word around the cursor
|
2001-06-27 14:10:35 +00:00
|
|
|
WHOLE_WORD,
|
|
|
|
/// the word begining from the cursor position
|
|
|
|
PARTIAL_WORD,
|
2001-07-27 16:07:33 +00:00
|
|
|
/// the word around the cursor or before the cursor
|
|
|
|
PREVIOUS_WORD,
|
2001-06-27 14:10:35 +00:00
|
|
|
/// the next word (not yet used)
|
|
|
|
NEXT_WORD
|
|
|
|
};
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-04-10 21:40:13 +00:00
|
|
|
/// Constructor
|
2000-06-12 11:27:15 +00:00
|
|
|
LyXText(BufferView *);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
LyXText(InsetText *);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-04-10 21:40:13 +00:00
|
|
|
/// Destructor
|
|
|
|
~LyXText();
|
|
|
|
|
2001-07-20 14:18:48 +00:00
|
|
|
void init(BufferView *, bool reinit = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-01-13 16:28:54 +00:00
|
|
|
mutable int number_of_rows;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-29 18:44:07 +00:00
|
|
|
mutable int height;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-26 15:10:49 +00:00
|
|
|
mutable unsigned int width;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// the current font settings
|
2000-01-13 16:28:54 +00:00
|
|
|
mutable LyXFont current_font;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// the current font
|
2000-01-13 16:28:54 +00:00
|
|
|
mutable LyXFont real_current_font;
|
2000-06-22 14:55:46 +00:00
|
|
|
/// first visible pixel-row is set from LyXScreen!!!
|
2000-10-19 09:11:39 +00:00
|
|
|
// unsigned is wrong here for text-insets!
|
2002-03-03 20:25:07 +00:00
|
|
|
int first_y;
|
2000-06-22 14:55:46 +00:00
|
|
|
///
|
|
|
|
BufferView * bv_owner;
|
|
|
|
///
|
|
|
|
InsetText * inset_owner;
|
2000-10-03 13:55:48 +00:00
|
|
|
///
|
|
|
|
UpdatableInset * the_locking_inset;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-02-19 16:01:31 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
int getRealCursorX(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
LyXFont const getFont(Buffer const *, Paragraph * par,
|
|
|
|
lyx::pos_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-08-03 18:28:11 +00:00
|
|
|
LyXFont const getLayoutFont(Buffer const *, Paragraph * par) const;
|
|
|
|
///
|
|
|
|
LyXFont const getLabelFont(Buffer const *, Paragraph * par) const;
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void setCharFont(Buffer const *, Paragraph * par,
|
2002-03-21 17:27:08 +00:00
|
|
|
lyx::pos_type pos, LyXFont const & font);
|
2001-06-25 00:06:33 +00:00
|
|
|
void setCharFont(BufferView *, Paragraph * par,
|
2002-03-21 17:27:08 +00:00
|
|
|
lyx::pos_type pos, LyXFont const & font, bool toggleall);
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// what you expect when pressing <enter> at cursor position
|
2001-06-25 00:06:33 +00:00
|
|
|
void breakParagraph(BufferView *, char keep_layout = 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** set layout over selection and make a total rebreak of
|
|
|
|
those paragraphs
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
Paragraph * setLayout(BufferView *, LyXCursor & actual_cursor,
|
2002-03-02 16:39:54 +00:00
|
|
|
LyXCursor & selection_start,
|
|
|
|
LyXCursor & selection_end,
|
|
|
|
string const & layout);
|
2001-11-26 16:42:04 +00:00
|
|
|
///
|
2002-03-02 16:39:54 +00:00
|
|
|
void setLayout(BufferView *, string const & layout);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// used in setlayout
|
2001-06-25 00:06:33 +00:00
|
|
|
void makeFontEntriesLayoutSpecific(Buffer const *, Paragraph * par);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
/** increment depth over selection and make a total rebreak of those
|
1999-09-27 18:44:28 +00:00
|
|
|
paragraphs
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void incDepth(BufferView *);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
/** decrement depth over selection and make a total rebreak of those
|
1999-09-27 18:44:28 +00:00
|
|
|
paragraphs */
|
2001-06-25 00:06:33 +00:00
|
|
|
void decDepth(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Get the depth at current cursor position
|
|
|
|
*/
|
2001-11-26 16:42:04 +00:00
|
|
|
int getDepth() const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** set font over selection and make a total rebreak of those
|
|
|
|
paragraphs.
|
|
|
|
toggleall defaults to false.
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void setFont(BufferView *, LyXFont const &, bool toggleall = false);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** deletes and inserts again all paragaphs between the cursor
|
2000-01-13 16:28:54 +00:00
|
|
|
and the specified par. The Cursor is needed to set the refreshing
|
2002-03-21 17:27:08 +00:00
|
|
|
parameters.
|
1999-09-27 18:44:28 +00:00
|
|
|
This function is needed after SetLayout and SetFont etc.
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void redoParagraphs(BufferView *, LyXCursor const & cursor,
|
|
|
|
Paragraph const * end_par) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void redoParagraph(BufferView *) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void toggleFree(BufferView *, LyXFont const &, bool toggleall = false);
|
2001-07-30 10:50:37 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
string getStringToIndex(BufferView *);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** recalculates the heights of all previous rows of the
|
|
|
|
specified paragraph. needed, if the last characters font
|
2002-03-21 17:27:08 +00:00
|
|
|
has changed.
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void redoHeightOfParagraph(BufferView *, LyXCursor const & cursor);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
/** forces the redrawing of a paragraph. Needed when manipulating a
|
1999-09-27 18:44:28 +00:00
|
|
|
right address box
|
2002-03-21 17:27:08 +00:00
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void redoDrawingOfParagraph(BufferView *, LyXCursor const & cursor);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
/** insert a character, moves all the following breaks in the
|
1999-09-27 18:44:28 +00:00
|
|
|
same Paragraph one to the right and make a little rebreak
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void insertChar(BufferView *, char c);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void insertInset(BufferView *, Inset * inset);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-05-01 22:17:09 +00:00
|
|
|
/** Completes the insertion with a full rebreak. */
|
|
|
|
void fullRebreak(BufferView *);
|
1999-11-22 16:19:48 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-08-02 14:55:06 +00:00
|
|
|
mutable Row * need_break_row;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-29 18:44:07 +00:00
|
|
|
mutable int refresh_y;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int refresh_height;
|
|
|
|
///
|
|
|
|
int refresh_width;
|
|
|
|
///
|
|
|
|
int refresh_x;
|
|
|
|
///
|
2000-01-13 16:28:54 +00:00
|
|
|
mutable Row * refresh_row;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type refresh_pos;
|
2001-07-06 15:57:54 +00:00
|
|
|
|
|
|
|
/// give and set the LyXText status
|
|
|
|
text_status status() const;
|
2001-07-30 11:56:00 +00:00
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
void status(BufferView *, text_status) const;
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
private:
|
1999-09-27 18:44:28 +00:00
|
|
|
/** wether the screen needs a refresh,
|
|
|
|
starting with refresh_y
|
|
|
|
*/
|
2001-07-06 15:57:54 +00:00
|
|
|
mutable text_status status_;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-07-06 15:57:54 +00:00
|
|
|
public:
|
1999-09-27 18:44:28 +00:00
|
|
|
/** returns a pointer to the row near the specified y-coordinate
|
|
|
|
(relative to the whole text). y is set to the real beginning
|
|
|
|
of this row
|
2002-03-21 17:27:08 +00:00
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
Row * getRowNearY(int & y) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
/** returns the column near the specified x-coordinate of the row
|
1999-09-27 18:44:28 +00:00
|
|
|
x is set to the real beginning of this column
|
2002-03-21 17:27:08 +00:00
|
|
|
*/
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type getColumnNearX(BufferView *, Row * row,
|
2001-10-16 14:47:10 +00:00
|
|
|
int & x, bool & boundary) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** returns a pointer to a specified row. y is set to the beginning
|
|
|
|
of the row
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
Row * getRow(Paragraph * par,
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos, int & y) const;
|
2001-11-29 13:43:12 +00:00
|
|
|
/** returns the firstrow, this could be done with the above too but
|
|
|
|
IMO it's stupid to have to allocate a dummy y all the time I need
|
|
|
|
the first row
|
|
|
|
*/
|
|
|
|
Row * firstRow() { return firstrow; }
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** returns the height of a default row, needed for scrollbar
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
int defaultHeight() const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** The cursor.
|
|
|
|
Later this variable has to be removed. There should be now internal
|
|
|
|
cursor in a text (and thus not in a buffer). By keeping this it is
|
|
|
|
(I think) impossible to have several views with the same buffer, but
|
|
|
|
the cursor placed at different places.
|
2000-01-06 02:44:26 +00:00
|
|
|
[later]
|
|
|
|
Since the LyXText now has been moved from Buffer to BufferView
|
|
|
|
it should not be absolutely needed to move the cursor...
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
2001-09-24 08:59:31 +00:00
|
|
|
mutable LyXCursor cursor; // actual cursor position
|
2001-05-31 02:23:46 +00:00
|
|
|
|
2001-09-27 09:52:06 +00:00
|
|
|
/** The structure that keeps track of the selections set. */
|
2001-05-31 02:23:46 +00:00
|
|
|
struct Selection {
|
2002-03-21 17:27:08 +00:00
|
|
|
Selection()
|
2001-07-06 15:41:17 +00:00
|
|
|
: set_(false), mark_(false)
|
|
|
|
{}
|
2001-05-31 02:23:46 +00:00
|
|
|
bool set() const {
|
|
|
|
return set_;
|
|
|
|
}
|
|
|
|
void set(bool s) {
|
|
|
|
set_ = s;
|
|
|
|
}
|
|
|
|
bool mark() const {
|
|
|
|
return mark_;
|
|
|
|
}
|
|
|
|
void mark(bool m) {
|
|
|
|
mark_ = m;
|
|
|
|
}
|
2001-09-24 08:59:31 +00:00
|
|
|
LyXCursor cursor; // temporary cursor to hold a cursor position
|
2002-03-21 17:27:08 +00:00
|
|
|
// until setSelection is called!
|
2001-09-24 08:59:31 +00:00
|
|
|
LyXCursor start; // start of a REAL selection
|
|
|
|
LyXCursor end; // end of a REAL selection
|
2001-05-31 02:23:46 +00:00
|
|
|
private:
|
|
|
|
bool set_; // former selection
|
|
|
|
bool mark_; // former mark_set
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-05-31 02:23:46 +00:00
|
|
|
};
|
|
|
|
mutable Selection selection;
|
2002-03-20 10:36:03 +00:00
|
|
|
// this is used to handle XSelection events in the right manner
|
|
|
|
mutable Selection xsel_cache;
|
2001-06-27 14:10:35 +00:00
|
|
|
|
2001-09-27 09:52:06 +00:00
|
|
|
/// needed for the toggling (cursor position on last selection made)
|
2002-03-21 17:27:08 +00:00
|
|
|
mutable LyXCursor last_sel_cursor;
|
2001-09-27 09:52:06 +00:00
|
|
|
/// 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;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// need the selection cursor:
|
2001-06-25 00:06:33 +00:00
|
|
|
void setSelection(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-08-01 15:42:53 +00:00
|
|
|
void clearSelection() const;
|
2000-05-20 21:37:05 +00:00
|
|
|
///
|
2001-09-12 10:41:25 +00:00
|
|
|
string const selectionAsString(Buffer const *, bool label) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-06-27 14:10:35 +00:00
|
|
|
/// select the word we need depending on word_location
|
2002-03-21 17:27:08 +00:00
|
|
|
void getWord(LyXCursor & from, LyXCursor & to,
|
2001-07-23 09:11:14 +00:00
|
|
|
word_location const) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// just selects the word the cursor is in
|
2001-07-27 16:07:33 +00:00
|
|
|
void selectWord(BufferView *, word_location const);
|
2001-07-19 08:52:59 +00:00
|
|
|
/// returns the inset at cursor (if it exists), 0 otherwise
|
|
|
|
Inset * getInset() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
/** 'selects" the next word, where the cursor is not in
|
|
|
|
and returns this word as string. THe cursor will be moved
|
|
|
|
to the beginning of this word.
|
1999-09-27 18:44:28 +00:00
|
|
|
With SelectSelectedWord can this be highlighted really
|
2002-03-21 17:27:08 +00:00
|
|
|
*/
|
2001-09-21 16:21:23 +00:00
|
|
|
string const selectNextWordToSpellcheck(BufferView *, float & value) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void selectSelectedWord(BufferView *);
|
2002-01-12 21:03:30 +00:00
|
|
|
/// returns true if par was empty and was removed
|
|
|
|
bool setCursor(BufferView *, Paragraph * par,
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos,
|
2000-05-30 19:31:11 +00:00
|
|
|
bool setfont = true,
|
|
|
|
bool boundary = false) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void setCursor(BufferView *, LyXCursor &, Paragraph * par,
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos,
|
2000-05-30 19:31:11 +00:00
|
|
|
bool boundary = false) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void setCursorIntern(BufferView *, Paragraph * par,
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos,
|
2000-05-30 19:31:11 +00:00
|
|
|
bool setfont = true,
|
|
|
|
bool boundary = false) const;
|
|
|
|
///
|
2002-04-12 15:59:03 +00:00
|
|
|
float getCursorX(BufferView *, Row *, lyx::pos_type pos,
|
|
|
|
lyx::pos_type last, bool boundary) const;
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void setCurrentFont(BufferView *) const;
|
2000-05-30 19:31:11 +00:00
|
|
|
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
bool isBoundary(Buffer const *, Paragraph * par,
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos) const;
|
2000-05-30 19:31:11 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
bool isBoundary(Buffer const *, Paragraph * par,
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos,
|
2000-05-30 19:31:11 +00:00
|
|
|
LyXFont const & font) const;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void setCursorFromCoordinates(BufferView *, int x, int y) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void setCursorFromCoordinates(BufferView *, LyXCursor &,
|
2000-09-29 18:44:07 +00:00
|
|
|
int x, int y) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2002-04-17 08:34:59 +00:00
|
|
|
void cursorUp(BufferView *, bool selecting = false) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2002-04-17 08:34:59 +00:00
|
|
|
void cursorDown(BufferView *, bool selecting = false) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorLeft(BufferView *, bool internal = true) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorRight(BufferView *, bool internal = true) const;
|
2000-05-30 19:31:11 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorLeftOneWord(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-27 14:10:35 +00:00
|
|
|
void cursorLeftOneWord(LyXCursor &) const;
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorRightOneWord(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorUpParagraph(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorDownParagraph(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorHome(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorEnd(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorTab(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorTop(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void cursorBottom(BufferView *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
void Delete(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void backspace(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void deleteWordForward(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void deleteWordBackward(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void deleteLineForward(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2002-03-21 17:27:08 +00:00
|
|
|
bool selectWordWhenUnderCursor(BufferView *,
|
2001-07-27 16:07:33 +00:00
|
|
|
word_location const);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
enum TextCase {
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
text_lowercase = 0,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
text_capitalization = 1,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
text_uppercase = 2
|
|
|
|
};
|
1999-11-22 16:19:48 +00:00
|
|
|
/// Change the case of the word at cursor position.
|
2001-06-27 14:10:35 +00:00
|
|
|
void changeCase(BufferView *, TextCase action);
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-06-28 13:02:03 +00:00
|
|
|
void changeRegionCase(BufferView * bview,
|
2001-06-27 15:33:55 +00:00
|
|
|
LyXCursor const & from,
|
|
|
|
LyXCursor const & to,
|
|
|
|
LyXText::TextCase action);
|
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
void transposeChars(BufferView &);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** returns a printed row in a pixmap. The y value is needed to
|
|
|
|
decide, wether it is selected text or not. This is a strange
|
|
|
|
solution but faster.
|
2000-02-10 17:53:36 +00:00
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void getVisibleRow(BufferView *, int y_offset, int x_offset,
|
2000-09-29 18:44:07 +00:00
|
|
|
Row * row_ptr, int y, bool cleared=false);
|
2000-04-03 11:36:35 +00:00
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
///
|
2001-07-19 08:52:59 +00:00
|
|
|
void toggleInset(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-08-08 14:36:56 +00:00
|
|
|
void cutSelection(BufferView *, bool doclear = true, bool realcut = true);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void copySelection(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void pasteSelection(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void copyEnvironmentType();
|
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
void pasteEnvironmentType(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** the DTP switches for paragraphs. LyX will store the top settings
|
|
|
|
always in the first physical paragraph, the bottom settings in the
|
2002-03-21 17:27:08 +00:00
|
|
|
last. When a paragraph is broken, the top settings rest, the bottom
|
1999-09-27 18:44:28 +00:00
|
|
|
settings are given to the new one. So I can make shure, they do not
|
|
|
|
duplicate themself (and you cannnot make dirty things with them! )
|
2002-03-21 17:27:08 +00:00
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void setParagraph(BufferView *,
|
2000-06-12 11:27:15 +00:00
|
|
|
bool line_top, bool line_bottom,
|
1999-09-27 18:44:28 +00:00
|
|
|
bool pagebreak_top, bool pagebreak_bottom,
|
2000-01-13 16:28:54 +00:00
|
|
|
VSpace const & space_top,
|
|
|
|
VSpace const & space_bottom,
|
2001-08-16 10:14:48 +00:00
|
|
|
Spacing const & spacing,
|
2002-03-21 17:27:08 +00:00
|
|
|
LyXAlignment align,
|
1999-10-02 16:21:10 +00:00
|
|
|
string labelwidthstring,
|
1999-09-27 18:44:28 +00:00
|
|
|
bool noindent);
|
2001-05-03 14:31:33 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/* these things are for search and replace */
|
|
|
|
|
|
|
|
/** sets the selection over the number of characters of string,
|
|
|
|
no check!!
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void setSelectionOverString(BufferView *, string const & str);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** simple replacing. The font of the first selected character
|
|
|
|
is used
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
void replaceSelectionWithString(BufferView *, string const & str);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// needed to insert the selection
|
2001-06-25 00:06:33 +00:00
|
|
|
void insertStringAsLines(BufferView *, string const & str);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// needed to insert the selection
|
2001-06-25 00:06:33 +00:00
|
|
|
void insertStringAsParagraphs(BufferView *, string const & str);
|
1999-11-04 01:40:20 +00:00
|
|
|
|
2001-01-15 18:54:31 +00:00
|
|
|
/// Find next inset of some specified type.
|
2001-06-25 00:06:33 +00:00
|
|
|
bool gotoNextInset(BufferView *, std::vector<Inset::Code> const & codes,
|
2001-01-15 18:54:31 +00:00
|
|
|
string const & contents = string()) const;
|
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/* for the greater insets */
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-06-21 15:07:57 +00:00
|
|
|
/// returns false if inset wasn't found
|
2001-06-25 00:06:33 +00:00
|
|
|
bool updateInset(BufferView *, Inset *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
void checkParagraph(BufferView *, Paragraph * par, lyx::pos_type pos);
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
int numberOfCell(Paragraph * par, lyx::pos_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void removeTableRow(LyXCursor & cursor) const;
|
2000-02-25 12:06:15 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
bool isEmptyTableCell() const;
|
2000-02-25 12:06:15 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
void toggleAppendix(BufferView *);
|
2000-01-06 02:44:26 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
int workWidth(BufferView *) const;
|
2000-05-30 19:31:11 +00:00
|
|
|
///
|
2001-10-18 16:49:29 +00:00
|
|
|
int workWidth(BufferView *, Inset * inset) const;
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void computeBidiTables(Buffer const *, Row * row) const;
|
2000-05-30 19:31:11 +00:00
|
|
|
|
|
|
|
/// Maps positions in the visual string to positions in logical string.
|
|
|
|
inline
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type log2vis(lyx::pos_type pos) const {
|
2000-05-30 19:31:11 +00:00
|
|
|
if (bidi_start == -1)
|
|
|
|
return pos;
|
|
|
|
else
|
|
|
|
return log2vis_list[pos-bidi_start];
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Maps positions in the logical string to positions in visual string.
|
|
|
|
inline
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type vis2log(lyx::pos_type pos) const {
|
2000-05-30 19:31:11 +00:00
|
|
|
if (bidi_start == -1)
|
|
|
|
return pos;
|
|
|
|
else
|
|
|
|
return vis2log_list[pos-bidi_start];
|
|
|
|
}
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-05-30 19:31:11 +00:00
|
|
|
inline
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type bidi_level(lyx::pos_type pos) const {
|
2000-05-30 19:31:11 +00:00
|
|
|
if (bidi_start == -1)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return bidi_levels[pos-bidi_start];
|
2002-03-21 17:27:08 +00:00
|
|
|
}
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-05-30 19:31:11 +00:00
|
|
|
inline
|
2001-11-27 10:34:16 +00:00
|
|
|
bool bidi_InRange(lyx::pos_type pos) const {
|
2000-05-30 19:31:11 +00:00
|
|
|
return bidi_start == -1 ||
|
|
|
|
(bidi_start <= pos && pos <= bidi_end);
|
|
|
|
}
|
2001-11-29 13:43:12 +00:00
|
|
|
private:
|
2000-06-12 11:27:15 +00:00
|
|
|
///
|
2000-01-13 16:28:54 +00:00
|
|
|
mutable Row * firstrow;
|
2002-03-03 20:25:07 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-01-13 16:28:54 +00:00
|
|
|
mutable Row * lastrow;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
/** Copybuffer for copy environment type.
|
1999-09-27 18:44:28 +00:00
|
|
|
Asger has learned that this should be a buffer-property instead
|
|
|
|
Lgb has learned that 'char' is a lousy type for non-characters
|
|
|
|
*/
|
2002-03-02 16:39:54 +00:00
|
|
|
string copylayouttype;
|
1999-09-27 18:44:28 +00:00
|
|
|
/** inserts a new row behind the specified row, increments
|
2000-08-07 20:58:24 +00:00
|
|
|
the touched counters */
|
2001-11-27 10:34:16 +00:00
|
|
|
void insertRow(Row * row, Paragraph * par, lyx::pos_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/** removes the row and reset the touched counters */
|
2001-06-25 00:06:33 +00:00
|
|
|
void removeRow(Row * row) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** remove all following rows of the paragraph of the specified row. */
|
2001-06-25 00:06:33 +00:00
|
|
|
void removeParagraph(Row * row) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** insert the specified paragraph behind the specified row */
|
2001-06-25 00:06:33 +00:00
|
|
|
void insertParagraph(BufferView *,
|
|
|
|
Paragraph * par, Row * row) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** appends the implizit specified paragraph behind the specified row,
|
|
|
|
* start at the implizit given position */
|
2001-06-25 00:06:33 +00:00
|
|
|
void appendParagraph(BufferView *, Row * row) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void breakAgain(BufferView *, Row * row) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void breakAgainOneRow(BufferView *, Row * row);
|
2000-01-13 16:28:54 +00:00
|
|
|
/// Calculate and set the height of the row
|
2001-06-25 00:06:33 +00:00
|
|
|
void setHeightOfRow(BufferView *, Row * row_ptr) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** this calculates the specified parameters. needed when setting
|
2002-03-21 17:27:08 +00:00
|
|
|
* the cursor and when creating a visible row */
|
2001-06-25 00:06:33 +00:00
|
|
|
void prepareToPrint(BufferView *, Row * row, float & x,
|
2002-03-21 17:27:08 +00:00
|
|
|
float & fill_separator,
|
2000-01-13 16:28:54 +00:00
|
|
|
float & fill_hfill,
|
2000-02-03 19:51:27 +00:00
|
|
|
float & fill_label_hfill,
|
|
|
|
bool bidi = true) const;
|
2000-05-30 15:41:16 +00:00
|
|
|
|
2001-11-09 13:44:48 +00:00
|
|
|
/// A struct used for drawing routines
|
|
|
|
struct DrawRowParams {
|
|
|
|
// the bufferview
|
2002-03-21 17:27:08 +00:00
|
|
|
BufferView * bv;
|
2001-11-09 13:44:48 +00:00
|
|
|
// the row
|
|
|
|
Row * row;
|
|
|
|
// the painter to use
|
2002-03-21 17:27:08 +00:00
|
|
|
Painter * pain;
|
2001-11-09 13:44:48 +00:00
|
|
|
// has the background been cleared
|
|
|
|
bool cleared;
|
2001-12-04 16:32:15 +00:00
|
|
|
/// x offset (e.g. for insets)
|
2001-11-09 13:44:48 +00:00
|
|
|
int xo;
|
2001-12-04 16:32:15 +00:00
|
|
|
/// y offset (e.g. for insets)
|
2001-11-09 13:44:48 +00:00
|
|
|
int yo;
|
|
|
|
/// FIXME
|
|
|
|
float x;
|
|
|
|
/// FIXME
|
|
|
|
int y;
|
|
|
|
/// the inset/view full width
|
|
|
|
int width;
|
|
|
|
/// hfill size
|
|
|
|
float hfill;
|
|
|
|
/// label hfill size
|
|
|
|
float label_hfill;
|
|
|
|
/// fill separator size
|
|
|
|
float separator;
|
|
|
|
};
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-11-09 13:44:48 +00:00
|
|
|
/// paint the background
|
|
|
|
bool paintRowBackground(DrawRowParams & p);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
/// paint the selection background
|
2001-11-09 13:44:48 +00:00
|
|
|
void paintRowSelection(DrawRowParams & p);
|
|
|
|
|
|
|
|
/// paint appendix marker
|
|
|
|
void paintRowAppendix(DrawRowParams & p);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
/// paint env depth bar
|
2001-11-09 13:44:48 +00:00
|
|
|
void paintRowDepthBar(DrawRowParams & p);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-05 23:21:26 +00:00
|
|
|
/// get the on-screen size of the length marker
|
|
|
|
int getLengthMarkerHeight(BufferView * bv, VSpace const & vsp) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-05 23:21:26 +00:00
|
|
|
/// paint an added space marker
|
|
|
|
int drawLengthMarker(DrawRowParams & p, string const & str,
|
2002-03-21 17:27:08 +00:00
|
|
|
VSpace const & vsp, int start);
|
|
|
|
|
2001-11-09 13:44:48 +00:00
|
|
|
/// paint a first row in a paragraph
|
|
|
|
void paintFirstRow(DrawRowParams & p);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-11-09 13:44:48 +00:00
|
|
|
/// paint a last row in a paragraph
|
|
|
|
void paintLastRow(DrawRowParams & p);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-11-09 13:44:48 +00:00
|
|
|
/// paint text
|
|
|
|
void paintRowText(DrawRowParams & p);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-09-27 09:52:06 +00:00
|
|
|
// 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;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
/// delete double space (false) or empty paragraphs (true) around old_cursor
|
2002-01-12 21:03:30 +00:00
|
|
|
bool deleteEmptyParagraphMechanism(BufferView *,
|
2000-06-12 11:27:15 +00:00
|
|
|
LyXCursor const & old_cursor) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-07-06 15:57:54 +00:00
|
|
|
public:
|
1999-09-27 18:44:28 +00:00
|
|
|
/** Updates all counters starting BEHIND the row. Changed paragraphs
|
2002-03-21 17:27:08 +00:00
|
|
|
* with a dynamic left margin will be rebroken. */
|
2001-06-25 00:06:33 +00:00
|
|
|
void updateCounters(BufferView *, Row * row) const;
|
2001-07-06 15:57:54 +00:00
|
|
|
private:
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void setCounter(Buffer const *, Paragraph * par) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/*
|
|
|
|
* some low level functions
|
|
|
|
*/
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
int singleWidth(BufferView *, Paragraph * par,
|
|
|
|
lyx::pos_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
int singleWidth(BufferView *, Paragraph * par,
|
|
|
|
lyx::pos_type pos, char c) const;
|
2001-12-04 16:32:15 +00:00
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-04 16:32:15 +00:00
|
|
|
/// draw normal chars
|
|
|
|
void drawChars(DrawRowParams & p, lyx::pos_type & vpos,
|
|
|
|
bool hebrew, bool arabic);
|
|
|
|
/// draw from arabic composed char
|
|
|
|
void drawArabicComposeChar(DrawRowParams & p, lyx::pos_type & vpos);
|
|
|
|
/// draw from hebrew composed char
|
|
|
|
void drawHebrewComposeChar(DrawRowParams & p, lyx::pos_type & vpos);
|
|
|
|
/// draw a mark for foreign language, starting from orig_x
|
|
|
|
void drawForeignMark(DrawRowParams & p, float const orig_x, LyXFont const & orig_font);
|
2002-03-21 17:27:08 +00:00
|
|
|
/// draw an inset
|
2002-05-03 09:22:07 +00:00
|
|
|
bool drawInset(DrawRowParams & p, lyx::pos_type const pos);
|
2001-12-04 16:32:15 +00:00
|
|
|
/// draw new line marker
|
|
|
|
void drawNewline(DrawRowParams & p, lyx::pos_type const pos);
|
|
|
|
/// draw text
|
2002-05-03 09:22:07 +00:00
|
|
|
bool draw(DrawRowParams & p, lyx::pos_type & vpos);
|
2000-02-17 19:59:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// get the next breakpoint in a given paragraph
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type nextBreakPoint(BufferView *, Row const * row, int width) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// returns the minimum space a row needs on the screen in pixel
|
2001-06-25 00:06:33 +00:00
|
|
|
int fill(BufferView *, Row * row, int workwidth) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** returns the minimum space a manual label needs on the
|
2002-03-21 17:27:08 +00:00
|
|
|
screen in pixel */
|
2001-06-25 00:06:33 +00:00
|
|
|
int labelFill(BufferView *, Row const * row) const;
|
1999-11-04 01:40:20 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type beginningOfMainBody(Buffer const *, Paragraph const * par) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** Returns the left beginning of the text.
|
|
|
|
This information cannot be taken from the layouts-objekt, because
|
|
|
|
in LaTeX the beginning of the text fits in some cases
|
|
|
|
(for example sections) exactly the label-width.
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
int leftMargin(BufferView *, Row const * row) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
int rightMargin(Buffer const *, Row const * row) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
int labelEnd (BufferView *, Row const * row) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** returns the number of separators in the specified row.
|
|
|
|
The separator on the very last column doesnt count
|
2002-03-21 17:27:08 +00:00
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
int numberOfSeparators(Buffer const *, Row const * row) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** returns the number of hfills in the specified row. The
|
|
|
|
LyX-Hfill is a LaTeX \hfill so that the hfills at the
|
|
|
|
beginning and at the end were ignored. This is {\em MUCH}
|
|
|
|
more usefull than not to ignore!
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
int numberOfHfills(Buffer const *, Row const * row) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// like NumberOfHfills, but only those in the manual label!
|
2001-06-25 00:06:33 +00:00
|
|
|
int numberOfLabelHfills(Buffer const *, Row const * row) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
/** returns true, if a expansion is needed. Rules are given by
|
1999-09-27 18:44:28 +00:00
|
|
|
LaTeX
|
1999-11-04 01:40:20 +00:00
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
bool hfillExpansion(Buffer const *, Row const * row_ptr,
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
///
|
2001-07-24 10:13:19 +00:00
|
|
|
LColor::color backgroundColor();
|
2000-02-03 19:51:27 +00:00
|
|
|
|
2000-04-26 13:57:28 +00:00
|
|
|
|
2000-02-03 19:51:27 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
mutable std::vector<lyx::pos_type> log2vis_list;
|
2000-02-03 19:51:27 +00:00
|
|
|
|
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
mutable std::vector<lyx::pos_type> vis2log_list;
|
2000-02-03 19:51:27 +00:00
|
|
|
|
2000-04-10 21:40:13 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
mutable std::vector<lyx::pos_type> bidi_levels;
|
2000-04-10 21:40:13 +00:00
|
|
|
|
2000-02-03 19:51:27 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
mutable lyx::pos_type bidi_start;
|
2000-02-03 19:51:27 +00:00
|
|
|
|
2000-04-03 11:36:35 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
mutable lyx::pos_type bidi_end;
|
2000-04-03 11:36:35 +00:00
|
|
|
|
2000-02-03 19:51:27 +00:00
|
|
|
///
|
2000-05-30 19:31:11 +00:00
|
|
|
mutable bool bidi_same_direction;
|
2000-04-10 21:40:13 +00:00
|
|
|
|
2000-03-10 13:22:20 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
unsigned char transformChar(unsigned char c, Paragraph * par,
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos) const;
|
2000-03-10 13:22:20 +00:00
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
/** returns the paragraph position of the last character in the
|
1999-09-27 18:44:28 +00:00
|
|
|
specified row
|
|
|
|
*/
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type rowLast(Row const * row) const;
|
2000-04-10 21:40:13 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type rowLastPrintable(Row const * row) const;
|
2000-04-10 21:40:13 +00:00
|
|
|
|
1999-12-13 00:05:34 +00:00
|
|
|
///
|
|
|
|
void charInserted();
|
2001-07-06 15:57:54 +00:00
|
|
|
public:
|
2000-08-07 20:58:24 +00:00
|
|
|
//
|
|
|
|
// special owner functions
|
2000-06-12 11:27:15 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
Paragraph * ownerParagraph() const;
|
2000-08-07 20:58:24 +00:00
|
|
|
//
|
2001-10-18 16:17:46 +00:00
|
|
|
void ownerParagraph(Paragraph *) const;
|
2001-07-06 15:57:54 +00:00
|
|
|
// set it searching first for the right owner using the paragraph id
|
2001-10-18 16:17:46 +00:00
|
|
|
void ownerParagraph(int id, Paragraph *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|