1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-04-03 00:36:31 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file lyxtext.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-04-03 00:36:31 +00:00
|
|
|
|
* \author unknown
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-04-03 00:36:31 +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
|
|
|
|
|
2003-09-07 01:45:40 +00:00
|
|
|
|
#include "bufferview_funcs.h"
|
2003-10-23 13:28:49 +00:00
|
|
|
|
#include "Bidi.h"
|
2000-02-03 19:51:27 +00:00
|
|
|
|
#include "layout.h"
|
2003-09-07 01:45:40 +00:00
|
|
|
|
#include "lyxfont.h"
|
2003-11-25 17:23:36 +00:00
|
|
|
|
#include "lyxtextclass.h"
|
2003-09-06 12:36:58 +00:00
|
|
|
|
#include "ParagraphList_fwd.h"
|
2003-09-07 01:45:40 +00:00
|
|
|
|
#include "RowList_fwd.h"
|
2003-06-27 11:53:41 +00:00
|
|
|
|
#include "textcursor.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-09-07 01:45:40 +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;
|
2003-09-07 01:45:40 +00:00
|
|
|
|
class Dimension;
|
2003-09-18 11:48:11 +00:00
|
|
|
|
class LColor_color;
|
2000-06-21 15:07:57 +00:00
|
|
|
|
class InsetText;
|
2003-09-04 03:54:04 +00:00
|
|
|
|
class LyXCursor;
|
2003-09-07 01:45:40 +00:00
|
|
|
|
class MetricsInfo;
|
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
|
|
|
|
/**
|
2003-08-15 10:24:39 +00:00
|
|
|
|
This class used to hold the mapping between buffer paragraphs and
|
|
|
|
|
screen rows. Nowadays, the Paragraphs take care of their rows
|
2003-08-28 07:41:31 +00:00
|
|
|
|
themselves and this contains just most of the code for manipulating
|
|
|
|
|
them and interaction with the Cursor.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*/
|
2003-06-27 11:53:41 +00:00
|
|
|
|
|
|
|
|
|
// The inheritance from TextCursor should go. It's just there to ease
|
|
|
|
|
// transition...
|
|
|
|
|
class LyXText : public TextCursor {
|
2003-11-22 14:44:59 +00:00
|
|
|
|
// Public Functions
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2000-04-10 21:40:13 +00:00
|
|
|
|
/// Constructor
|
2003-11-10 09:06:48 +00:00
|
|
|
|
LyXText(BufferView *, InsetText *, bool ininset, ParagraphList & plist);
|
2003-11-25 11:17:27 +00:00
|
|
|
|
///
|
2003-07-15 08:26:17 +00:00
|
|
|
|
void init(BufferView *);
|
2003-11-22 14:44:59 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-11-25 11:17:27 +00:00
|
|
|
|
/// update y coordinate cache of all paragraphs
|
|
|
|
|
void updateParPositions();
|
2001-02-19 16:01:31 +00:00
|
|
|
|
///
|
2003-07-27 21:59:06 +00:00
|
|
|
|
LyXFont getFont(ParagraphList::iterator pit, lyx::pos_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-07-27 21:59:06 +00:00
|
|
|
|
LyXFont getLayoutFont(ParagraphList::iterator pit) const;
|
2001-08-03 18:28:11 +00:00
|
|
|
|
///
|
2003-07-27 21:59:06 +00:00
|
|
|
|
LyXFont getLabelFont(ParagraphList::iterator pit) const;
|
2001-08-03 18:28:11 +00:00
|
|
|
|
///
|
2003-07-27 21:59:06 +00:00
|
|
|
|
void setCharFont(ParagraphList::iterator pit,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
lyx::pos_type pos, LyXFont const & font);
|
2003-04-10 12:10:04 +00:00
|
|
|
|
void setCharFont(ParagraphList::iterator pit,
|
|
|
|
|
lyx::pos_type pos,
|
|
|
|
|
LyXFont const & font, bool toggleall);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// what you expect when pressing <enter> at cursor position
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void breakParagraph(ParagraphList & paragraphs, char keep_layout = 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/** set layout over selection and make a total rebreak of
|
|
|
|
|
those paragraphs
|
|
|
|
|
*/
|
2003-04-10 21:07:55 +00:00
|
|
|
|
ParagraphList::iterator
|
|
|
|
|
setLayout(LyXCursor & actual_cursor,
|
|
|
|
|
LyXCursor & selection_start,
|
|
|
|
|
LyXCursor & selection_end,
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & layout);
|
2001-11-26 16:42:04 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void setLayout(std::string const & layout);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-26 09:48:21 +00:00
|
|
|
|
/// Increase or decrease the nesting depth of the selected paragraph(s)
|
|
|
|
|
void changeDepth(bv_funcs::DEPTH_CHANGE type);
|
|
|
|
|
|
|
|
|
|
/// Returns whether something would be changed by changeDepth
|
|
|
|
|
bool changeDepthAllowed(bv_funcs::DEPTH_CHANGE type);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-08-19 15:39:25 +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.
|
|
|
|
|
*/
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void setFont(LyXFont const &, bool toggleall = false);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-08-01 11:22:13 +00:00
|
|
|
|
/// rebreaks all paragaphs between the given pars.
|
2003-10-23 08:15:57 +00:00
|
|
|
|
void redoParagraphs(ParagraphList::iterator begin,
|
2003-08-01 11:22:13 +00:00
|
|
|
|
ParagraphList::iterator end);
|
|
|
|
|
/// rebreaks the given par
|
|
|
|
|
void redoParagraph(ParagraphList::iterator pit);
|
2003-08-25 10:24:26 +00:00
|
|
|
|
|
2003-08-01 11:22:13 +00:00
|
|
|
|
/// rebreaks the cursor par
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void redoParagraph();
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void toggleFree(LyXFont const &, bool toggleall = false);
|
2001-07-30 10:50:37 +00:00
|
|
|
|
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string getStringToIndex();
|
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
|
|
|
|
|
*/
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void insertChar(char c);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-07-25 21:20:24 +00:00
|
|
|
|
void insertInset(InsetOld * inset);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-06-27 09:44:26 +00:00
|
|
|
|
/// a full rebreak of the whole text
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void fullRebreak();
|
2003-07-22 10:12:24 +00:00
|
|
|
|
/// compute text metrics
|
|
|
|
|
void metrics(MetricsInfo & mi, Dimension & dim);
|
1999-11-22 16:19:48 +00:00
|
|
|
|
|
2002-08-19 15:39:25 +00:00
|
|
|
|
///
|
2003-10-29 10:47:21 +00:00
|
|
|
|
DispatchResult dispatch(FuncRequest const & cmd);
|
2002-08-19 15:39:25 +00:00
|
|
|
|
|
2003-03-17 16:25:00 +00:00
|
|
|
|
BufferView * bv();
|
|
|
|
|
|
|
|
|
|
BufferView * bv() const;
|
|
|
|
|
|
2003-03-17 01:34:36 +00:00
|
|
|
|
friend class LyXScreen;
|
|
|
|
|
|
2003-10-09 10:52:12 +00:00
|
|
|
|
/// returns an iterator pointing to a cursor paragraph
|
|
|
|
|
ParagraphList::iterator getPar(LyXCursor const & cursor) const;
|
|
|
|
|
///
|
|
|
|
|
ParagraphList::iterator getPar(lyx::paroffset_type par) const;
|
|
|
|
|
///
|
|
|
|
|
int parOffset(ParagraphList::iterator pit) const;
|
|
|
|
|
/// convenience
|
|
|
|
|
ParagraphList::iterator cursorPar() const;
|
2003-10-24 09:45:07 +00:00
|
|
|
|
///
|
|
|
|
|
RowList::iterator cursorRow() const;
|
2003-06-28 01:23:11 +00:00
|
|
|
|
|
2003-11-25 11:17:27 +00:00
|
|
|
|
/** returns an iterator pointing 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
|
|
|
|
*/
|
2003-08-25 10:24:26 +00:00
|
|
|
|
RowList::iterator getRowNearY(int y,
|
2003-08-15 08:03:54 +00:00
|
|
|
|
ParagraphList::iterator & pit) 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
|
|
|
|
*/
|
2003-08-14 08:34:13 +00:00
|
|
|
|
lyx::pos_type getColumnNearX(ParagraphList::iterator pit,
|
2003-10-17 10:31:47 +00:00
|
|
|
|
Row const & row, int & x, bool & boundary) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// need the selection cursor:
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void setSelection();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void clearSelection();
|
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
|
2003-07-01 11:51:20 +00:00
|
|
|
|
void getWord(LyXCursor & from, LyXCursor & to, lyx::word_location const);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// just selects the word the cursor is in
|
2003-07-01 11:51:20 +00:00
|
|
|
|
void selectWord(lyx::word_location loc);
|
2001-07-19 08:52:59 +00:00
|
|
|
|
/// returns the inset at cursor (if it exists), 0 otherwise
|
2003-07-25 21:20:24 +00:00
|
|
|
|
InsetOld * getInset() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/// accept selected change
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void acceptChange();
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
2003-03-04 09:27:27 +00:00
|
|
|
|
/// reject selected change
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void rejectChange();
|
2003-03-04 09:27:27 +00:00
|
|
|
|
|
2003-08-11 09:09:01 +00:00
|
|
|
|
/// re-computes the cached coordinates in the cursor
|
|
|
|
|
void redoCursor();
|
2003-10-09 10:52:12 +00:00
|
|
|
|
///
|
|
|
|
|
void setCursor(ParagraphList::iterator pit, lyx::pos_type pos);
|
2002-01-12 21:03:30 +00:00
|
|
|
|
/// returns true if par was empty and was removed
|
2003-10-17 10:31:47 +00:00
|
|
|
|
bool setCursor(lyx::paroffset_type par, lyx::pos_type pos,
|
|
|
|
|
bool setfont = true, bool boundary = false);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-10-09 10:52:12 +00:00
|
|
|
|
void setCursor(LyXCursor &, lyx::paroffset_type par,
|
2003-10-17 10:31:47 +00:00
|
|
|
|
lyx::pos_type pos, bool boundary = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-17 10:31:47 +00:00
|
|
|
|
void setCursorIntern(lyx::paroffset_type par, lyx::pos_type pos,
|
|
|
|
|
bool setfont = true, bool boundary = false);
|
2000-05-30 19:31:11 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void setCurrentFont();
|
2000-05-30 19:31:11 +00:00
|
|
|
|
|
2003-10-13 10:59:31 +00:00
|
|
|
|
///
|
|
|
|
|
void recUndo(lyx::paroffset_type first, lyx::paroffset_type last) const;
|
|
|
|
|
///
|
|
|
|
|
void recUndo(lyx::paroffset_type first) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void setCursorFromCoordinates(int x, int y);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-10-17 10:31:47 +00:00
|
|
|
|
void setCursorFromCoordinates(LyXCursor &, int x, int y);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorUp(bool selecting = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorDown(bool selecting = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-11-17 14:28:18 +00:00
|
|
|
|
bool cursorLeft(bool internal = true);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-11-17 14:28:18 +00:00
|
|
|
|
bool cursorRight(bool internal = true);
|
2000-05-30 19:31:11 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorLeftOneWord();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorRightOneWord();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorUpParagraph();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorDownParagraph();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorHome();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorEnd();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void cursorPrevious();
|
2002-10-11 10:45:28 +00:00
|
|
|
|
///
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void cursorNext();
|
2002-10-11 10:45:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorTop();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void cursorBottom();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void Delete();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void backspace();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-07-01 11:51:20 +00:00
|
|
|
|
bool selectWordWhenUnderCursor(lyx::word_location);
|
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.
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void changeCase(TextCase action);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
|
|
///
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void toggleInset();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void cutSelection(bool doclear = true, bool realcut = true);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void copySelection();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-06-17 15:33:49 +00:00
|
|
|
|
void pasteSelection(size_t sel_index = 0);
|
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
|
2003-10-27 12:41:26 +00:00
|
|
|
|
settings are given to the new one.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*/
|
2003-10-27 12:41:26 +00:00
|
|
|
|
void setParagraph(
|
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,
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & 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 */
|
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* Sets the selection from the current cursor position to length
|
|
|
|
|
* characters to the right. No safety checks.
|
|
|
|
|
*/
|
2003-03-17 16:25:00 +00:00
|
|
|
|
void setSelectionRange(lyx::pos_type length);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/** simple replacing. The font of the first selected character
|
|
|
|
|
is used
|
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void replaceSelectionWithString(std::string const & str);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// needed to insert the selection
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void insertStringAsLines(std::string const & str);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// needed to insert the selection
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void insertStringAsParagraphs(std::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.
|
2003-07-25 21:20:24 +00:00
|
|
|
|
bool gotoNextInset(std::vector<InsetOld::Code> const & codes,
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & contents = std::string());
|
2001-01-15 18:54:31 +00:00
|
|
|
|
///
|
2003-07-25 21:20:24 +00:00
|
|
|
|
void gotoInset(std::vector<InsetOld::Code> const & codes,
|
2003-03-17 16:25:00 +00:00
|
|
|
|
bool same_content);
|
2002-08-27 12:32:04 +00:00
|
|
|
|
///
|
2003-07-25 21:20:24 +00:00
|
|
|
|
void gotoInset(InsetOld::Code code, bool same_content);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-25 11:17:27 +00:00
|
|
|
|
/// current max text width
|
|
|
|
|
int textWidth() const;
|
2003-03-21 23:53:26 +00:00
|
|
|
|
|
2003-11-25 11:17:27 +00:00
|
|
|
|
/// updates all counters
|
2003-03-18 13:05:08 +00:00
|
|
|
|
void updateCounters();
|
2003-11-25 11:17:27 +00:00
|
|
|
|
/// Returns an inset if inset was hit, or 0 if not.
|
2003-11-10 18:15:55 +00:00
|
|
|
|
InsetOld * checkInsetHit(int x, int y);
|
2002-08-28 12:09:19 +00:00
|
|
|
|
|
2003-02-26 17:04:10 +00:00
|
|
|
|
///
|
2003-07-22 11:54:39 +00:00
|
|
|
|
int singleWidth(ParagraphList::iterator pit, lyx::pos_type pos) const;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
///
|
2003-04-09 21:34:31 +00:00
|
|
|
|
int singleWidth(ParagraphList::iterator pit,
|
2003-08-22 07:49:57 +00:00
|
|
|
|
lyx::pos_type pos, char c, LyXFont const & Font) const;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
|
|
|
|
|
/// return the color of the canvas
|
2003-09-18 11:48:11 +00:00
|
|
|
|
LColor_color backgroundColor() const;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the left beginning of the text.
|
|
|
|
|
* This information cannot be taken from the layout object, because
|
|
|
|
|
* in LaTeX the beginning of the text fits in some cases
|
|
|
|
|
* (for example sections) exactly the label-width.
|
|
|
|
|
*/
|
2003-11-25 11:17:27 +00:00
|
|
|
|
int leftMargin(ParagraphList::iterator pit, lyx::pos_type pos) const;
|
|
|
|
|
int leftMargin(ParagraphList::iterator pit) const;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
///
|
2003-11-25 11:17:27 +00:00
|
|
|
|
int rightMargin(Paragraph const & par) const;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
|
|
|
|
|
/** this calculates the specified parameters. needed when setting
|
|
|
|
|
* the cursor and when creating a visible row */
|
2003-10-22 09:56:22 +00:00
|
|
|
|
void prepareToPrint(ParagraphList::iterator pit, Row & row) const;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
//
|
|
|
|
|
// special owner functions
|
2000-06-12 11:27:15 +00:00
|
|
|
|
///
|
2003-04-02 17:11:38 +00:00
|
|
|
|
ParagraphList & ownerParagraphs() const;
|
2003-02-14 00:41:44 +00:00
|
|
|
|
|
2003-03-17 16:25:00 +00:00
|
|
|
|
/// return true if this is owned by an inset.
|
2003-02-26 17:04:10 +00:00
|
|
|
|
bool isInInset() const;
|
2003-06-27 11:53:41 +00:00
|
|
|
|
|
2003-11-22 14:44:59 +00:00
|
|
|
|
///
|
|
|
|
|
ParagraphList::iterator firstPar() const;
|
|
|
|
|
///
|
|
|
|
|
ParagraphList::iterator lastPar() const;
|
|
|
|
|
///
|
|
|
|
|
ParagraphList::iterator endPar() const;
|
|
|
|
|
|
2003-08-14 11:16:31 +00:00
|
|
|
|
/// return first row of text
|
|
|
|
|
RowList::iterator firstRow() const;
|
2003-08-14 14:10:13 +00:00
|
|
|
|
/// return last row of text
|
2003-08-14 11:16:31 +00:00
|
|
|
|
RowList::iterator lastRow() const;
|
2003-08-14 14:10:13 +00:00
|
|
|
|
/// return row "behind" last row of text
|
|
|
|
|
RowList::iterator endRow() const;
|
2003-08-14 11:16:31 +00:00
|
|
|
|
/// return next row crossing paragraph boundaries
|
2003-08-15 08:03:54 +00:00
|
|
|
|
void nextRow(ParagraphList::iterator & pit,
|
|
|
|
|
RowList::iterator & rit) const;
|
2003-08-14 11:16:31 +00:00
|
|
|
|
/// return previous row crossing paragraph boundaries
|
2003-08-15 08:03:54 +00:00
|
|
|
|
void previousRow(ParagraphList::iterator & pit,
|
|
|
|
|
RowList::iterator & rit) const;
|
|
|
|
|
|
2003-10-23 08:15:57 +00:00
|
|
|
|
/// is this row the last in the text?
|
|
|
|
|
bool isLastRow(ParagraphList::iterator pit, Row const & row) const;
|
|
|
|
|
/// is this row the first in the text?
|
|
|
|
|
bool isFirstRow(ParagraphList::iterator pit, Row const & row) const;
|
|
|
|
|
|
2003-10-09 10:52:12 +00:00
|
|
|
|
///
|
|
|
|
|
std::string selectionAsString(Buffer const & buffer, bool label) const;
|
2003-10-28 11:18:40 +00:00
|
|
|
|
///
|
|
|
|
|
double spacing(Paragraph const &) const;
|
2003-11-11 10:08:35 +00:00
|
|
|
|
///
|
|
|
|
|
void cursorLeftOneWord(LyXCursor &);
|
|
|
|
|
///
|
|
|
|
|
void cursorRightOneWord(LyXCursor &);
|
|
|
|
|
|
2003-11-17 14:28:18 +00:00
|
|
|
|
///
|
|
|
|
|
DispatchResult moveRight();
|
|
|
|
|
///
|
|
|
|
|
DispatchResult moveLeft();
|
|
|
|
|
///
|
|
|
|
|
DispatchResult moveRightIntern(bool front,
|
|
|
|
|
bool activate_inset, bool selecting);
|
|
|
|
|
///
|
|
|
|
|
DispatchResult moveLeftIntern(bool front,
|
|
|
|
|
bool activate_inset, bool selecting);
|
|
|
|
|
///
|
|
|
|
|
DispatchResult moveUp();
|
|
|
|
|
///
|
|
|
|
|
DispatchResult moveDown();
|
|
|
|
|
///
|
|
|
|
|
bool checkAndActivateInset(bool front);
|
|
|
|
|
|
2003-11-22 14:44:59 +00:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
int height;
|
|
|
|
|
///
|
|
|
|
|
unsigned int width;
|
2003-11-25 11:17:27 +00:00
|
|
|
|
///
|
|
|
|
|
int textwidth_;
|
2003-11-22 14:44:59 +00:00
|
|
|
|
/// the current font settings
|
|
|
|
|
LyXFont current_font;
|
|
|
|
|
/// the current font
|
|
|
|
|
LyXFont real_current_font;
|
|
|
|
|
/// our buffer's default layout font
|
|
|
|
|
LyXFont defaultfont_;
|
|
|
|
|
///
|
|
|
|
|
InsetText * inset_owner;
|
|
|
|
|
|
|
|
|
|
/// only the top-level LyXText has this non-zero
|
|
|
|
|
BufferView * bv_owner;
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
mutable Bidi bidi;
|
|
|
|
|
///
|
|
|
|
|
bool in_inset_;
|
|
|
|
|
///
|
|
|
|
|
ParagraphList * paragraphs_;
|
|
|
|
|
|
|
|
|
|
/// absolute document pixel coordinates of this LyXText
|
|
|
|
|
int xo_;
|
|
|
|
|
int yo_;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/// rebreaks the given par
|
|
|
|
|
void redoParagraphInternal(ParagraphList::iterator pit);
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
float getCursorX(ParagraphList::iterator pit,
|
|
|
|
|
Row const & row, lyx::pos_type pos, bool boundary) const;
|
|
|
|
|
/// used in setlayout
|
|
|
|
|
void makeFontEntriesLayoutSpecific(BufferParams const &, Paragraph & par);
|
|
|
|
|
|
|
|
|
|
/// Calculate and set the height of the row
|
|
|
|
|
void setHeightOfRow(ParagraphList::iterator, Row & row);
|
|
|
|
|
|
|
|
|
|
// fix the cursor `cur' after a characters has been deleted at `where'
|
|
|
|
|
// position. Called by deleteEmptyParagraphMechanism
|
|
|
|
|
void fixCursorAfterDelete(LyXCursor & cur, LyXCursor const & where);
|
|
|
|
|
|
|
|
|
|
/// delete double space (false) or empty paragraphs (true) around old_cursor
|
|
|
|
|
bool deleteEmptyParagraphMechanism(LyXCursor const & old_cursor);
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void setCounter(Buffer const &, ParagraphList::iterator pit);
|
|
|
|
|
///
|
|
|
|
|
void deleteWordForward();
|
|
|
|
|
///
|
|
|
|
|
void deleteWordBackward();
|
|
|
|
|
///
|
|
|
|
|
void deleteLineForward();
|
|
|
|
|
|
|
|
|
|
/// sets row.end to the pos value *after* which a row should break.
|
|
|
|
|
/// for example, the pos after which isNewLine(pos) == true
|
|
|
|
|
void rowBreakPoint(ParagraphList::iterator pit, Row & row) const;
|
|
|
|
|
|
|
|
|
|
/// sets row.witdh to the minimum space a row needs on the screen in pixel
|
|
|
|
|
void fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* returns the minimum space a manual label needs on the
|
|
|
|
|
* screen in pixels
|
|
|
|
|
*/
|
|
|
|
|
int labelFill(ParagraphList::iterator pit, Row const & row) const;
|
|
|
|
|
|
|
|
|
|
/// FIXME
|
2003-11-25 11:17:27 +00:00
|
|
|
|
int labelEnd(ParagraphList::iterator pit) const;
|
2003-11-22 14:44:59 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void charInserted();
|
|
|
|
|
/// set 'number' font property
|
|
|
|
|
void number();
|
|
|
|
|
/// is the cursor paragraph right-to-left?
|
|
|
|
|
bool rtl() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-02-14 00:41:44 +00:00
|
|
|
|
/// return the default height of a row in pixels, considering font zoom
|
|
|
|
|
extern int defaultRowHeight();
|
|
|
|
|
|
2003-11-25 17:23:36 +00:00
|
|
|
|
///
|
|
|
|
|
std::string expandLabel(LyXTextClass const & textclass,
|
|
|
|
|
LyXLayout_ptr const & layout, bool appendix);
|
|
|
|
|
|
2003-02-14 00:41:44 +00:00
|
|
|
|
#endif // LYXTEXT_H
|