1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
1999-11-15 12:01:38 +00:00
|
|
|
* ======================================================
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
1999-10-07 18:44:17 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-1999 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 "lyxrow.h"
|
|
|
|
#include "undo.h"
|
|
|
|
#include "lyxcursor.h"
|
1999-11-04 01:40:20 +00:00
|
|
|
#include "lyxparagraph.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
class Buffer;
|
|
|
|
class BufferParams;
|
|
|
|
class LyXScreen;
|
|
|
|
|
|
|
|
/**
|
|
|
|
This class holds the mapping between buffer paragraphs and screen rows.
|
|
|
|
*/
|
|
|
|
class LyXText {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
enum text_status {
|
|
|
|
///
|
|
|
|
UNCHANGED,
|
|
|
|
///
|
|
|
|
NEED_LITTLE_REFRESH,
|
|
|
|
///
|
|
|
|
NEED_MORE_REFRESH,
|
|
|
|
///
|
|
|
|
NEED_VERY_LITTLE_REFRESH
|
|
|
|
};
|
|
|
|
|
|
|
|
/// points to Buffer.params
|
1999-11-04 01:40:20 +00:00
|
|
|
BufferParams * parameters;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// points to Buffer
|
1999-11-04 01:40:20 +00:00
|
|
|
Buffer * params;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int number_of_rows;
|
|
|
|
///
|
|
|
|
long height;
|
|
|
|
/// the current font settings
|
|
|
|
LyXFont current_font;
|
|
|
|
/// the current font
|
|
|
|
LyXFont real_current_font;
|
|
|
|
|
|
|
|
/// Constructor
|
|
|
|
LyXText(int paperwidth, Buffer *);
|
|
|
|
|
|
|
|
/// Destructor
|
|
|
|
~LyXText();
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXFont GetFont(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetCharFont(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos,
|
|
|
|
LyXFont font);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// returns a pointer to the very first LyXParagraph
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * FirstParagraph();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// what you expect when pressing <enter> at cursor position
|
|
|
|
void BreakParagraph(char keep_layout = 0);
|
|
|
|
|
|
|
|
/** set layout over selection and make a total rebreak of
|
|
|
|
those paragraphs
|
|
|
|
*/
|
|
|
|
void SetLayout(char layout);
|
|
|
|
|
|
|
|
/// used in setlayout
|
1999-11-04 01:40:20 +00:00
|
|
|
void MakeFontEntriesLayoutSpecific(LyXParagraph * par);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** increment depth over selection and make a total rebreak of those
|
|
|
|
paragraphs
|
|
|
|
*/
|
|
|
|
void IncDepth();
|
|
|
|
|
|
|
|
/** decrement depth over selection and make a total rebreak of those
|
|
|
|
paragraphs */
|
|
|
|
void DecDepth();
|
|
|
|
|
|
|
|
/** Get the depth at current cursor position
|
|
|
|
*/
|
|
|
|
int GetDepth() { return cursor.par->GetDepth(); }
|
|
|
|
|
|
|
|
/** set font over selection and make a total rebreak of those
|
|
|
|
paragraphs.
|
|
|
|
toggleall defaults to false.
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetFont(LyXFont font, bool toggleall = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** deletes and inserts again all paragaphs between the cursor
|
|
|
|
and the specified par .The Cursor is needed to set the refreshing
|
|
|
|
parameters.
|
|
|
|
This function is needed after SetLayout and SetFont etc.
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
void RedoParagraphs(LyXCursor cursor, LyXParagraph * end_par);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void RedoParagraph();
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void ToggleFree(LyXFont font, bool toggleall = false);
|
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
|
|
|
|
has changed.
|
|
|
|
*/
|
|
|
|
void RedoHeightOfParagraph(LyXCursor cursor);
|
|
|
|
|
|
|
|
/** forces the redrawing of a paragraph. Needed when manipulating a
|
|
|
|
right address box
|
|
|
|
*/
|
|
|
|
void RedoDrawingOfParagraph(LyXCursor cursor);
|
|
|
|
|
|
|
|
/** insert a character, moves all the following breaks in the
|
|
|
|
same Paragraph one to the right and make a little rebreak
|
|
|
|
*/
|
|
|
|
void InsertChar(char c);
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void InsertInset(Inset * inset);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// completes the insertion with a full rebreak
|
|
|
|
int FullRebreak();
|
1999-11-22 16:19:48 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
LyXParagraph::footnote_flag GetFootnoteFlag(int row);
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
Row * need_break_row;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
long refresh_y;
|
|
|
|
///
|
|
|
|
int refresh_height;
|
|
|
|
///
|
|
|
|
int refresh_width;
|
|
|
|
///
|
|
|
|
int refresh_x;
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
Row * refresh_row;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int refresh_pos;
|
|
|
|
|
|
|
|
/** wether the screen needs a refresh,
|
|
|
|
starting with refresh_y
|
|
|
|
*/
|
|
|
|
text_status status;
|
|
|
|
|
|
|
|
/** 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
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
Row * GetRowNearY(long & y);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** returns the column near the specified x-coordinate of the row
|
|
|
|
x is set to the real beginning of this column
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
int GetColumnNearX(Row * row, int & x);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** returns a pointer to a specified row. y is set to the beginning
|
|
|
|
of the row
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
Row * GetRow(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos, long & y);
|
1999-09-27 18:44:28 +00:00
|
|
|
/** returns the height of a default row, needed for scrollbar
|
|
|
|
*/
|
|
|
|
int DefaultHeight();
|
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
|
|
|
LyXCursor cursor;
|
|
|
|
|
|
|
|
/* the selection cursor */
|
|
|
|
///
|
|
|
|
bool selection;
|
|
|
|
///
|
|
|
|
bool mark_set;
|
|
|
|
|
|
|
|
///
|
|
|
|
LyXCursor sel_cursor;
|
|
|
|
///
|
|
|
|
LyXCursor sel_start_cursor;
|
|
|
|
///
|
|
|
|
LyXCursor sel_end_cursor;
|
|
|
|
/// needed for the toggling
|
|
|
|
LyXCursor last_sel_cursor;
|
|
|
|
///
|
|
|
|
LyXCursor toggle_cursor;
|
|
|
|
///
|
|
|
|
LyXCursor toggle_end_cursor;
|
|
|
|
|
|
|
|
/// need the selection cursor:
|
|
|
|
void SetSelection();
|
|
|
|
///
|
|
|
|
void ClearSelection();
|
|
|
|
|
|
|
|
/// just selects the word the cursor is in
|
|
|
|
void SelectWord();
|
|
|
|
|
|
|
|
/** '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.
|
|
|
|
With SelectSelectedWord can this be highlighted really
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
char * SelectNextWord(float & value);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void SelectSelectedWord();
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetCursor(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetCursorIntern(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void SetCursorFromCoordinates(int x, long y);
|
|
|
|
///
|
|
|
|
void CursorUp();
|
|
|
|
///
|
|
|
|
void CursorDown();
|
|
|
|
///
|
|
|
|
void CursorLeft();
|
|
|
|
///
|
|
|
|
void CursorRight();
|
|
|
|
///
|
|
|
|
void CursorLeftOneWord();
|
|
|
|
///
|
|
|
|
void CursorRightOneWord();
|
|
|
|
///
|
|
|
|
void CursorUpParagraph();
|
|
|
|
///
|
|
|
|
void CursorDownParagraph();
|
|
|
|
///
|
|
|
|
void CursorHome();
|
|
|
|
///
|
|
|
|
void CursorEnd();
|
|
|
|
///
|
|
|
|
void CursorTab();
|
|
|
|
///
|
|
|
|
void CursorTop();
|
|
|
|
///
|
|
|
|
void CursorBottom();
|
|
|
|
///
|
|
|
|
void Delete();
|
|
|
|
///
|
|
|
|
void Backspace();
|
|
|
|
///
|
|
|
|
void DeleteWordForward();
|
|
|
|
///
|
|
|
|
void DeleteWordBackward();
|
|
|
|
///
|
|
|
|
void DeleteLineForward();
|
|
|
|
///
|
|
|
|
int SelectWordWhenUnderCursor();
|
1999-11-22 16:19:48 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
enum TextCase {
|
|
|
|
text_lowercase = 0,
|
|
|
|
text_capitalization = 1,
|
|
|
|
text_uppercase = 2
|
|
|
|
};
|
1999-11-22 16:19:48 +00:00
|
|
|
/// Change the case of the word at cursor position.
|
1999-11-04 01:40:20 +00:00
|
|
|
void ChangeWordCase(TextCase action);
|
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.
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
void GetVisibleRow(LyXScreen & scr, int offset,
|
|
|
|
Row * row_ptr, long y);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/* footnotes: */
|
|
|
|
///
|
|
|
|
void ToggleFootnote();
|
|
|
|
///
|
|
|
|
void OpenStuff();
|
|
|
|
///
|
|
|
|
void OpenFootnotes();
|
|
|
|
///
|
|
|
|
void OpenFootnote();
|
|
|
|
///
|
|
|
|
void CloseFootnotes();
|
|
|
|
///
|
|
|
|
void CloseFootnote();
|
|
|
|
|
|
|
|
/** turn the selection into a new environment. If there is no
|
|
|
|
selection, create an empty environment
|
|
|
|
*/
|
|
|
|
void InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind);
|
|
|
|
///
|
|
|
|
void MeltFootnoteEnvironment();
|
|
|
|
///
|
|
|
|
void CutSelection(bool = true);
|
|
|
|
///
|
|
|
|
void CopySelection();
|
|
|
|
///
|
|
|
|
void PasteSelection();
|
|
|
|
///
|
|
|
|
void copyEnvironmentType();
|
|
|
|
///
|
|
|
|
void pasteEnvironmentType();
|
|
|
|
///
|
|
|
|
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
|
|
|
|
last. When a paragraph is broken, the top settings rest, the bottom
|
|
|
|
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! )
|
|
|
|
*/
|
|
|
|
void SetParagraph(bool line_top, bool line_bottom,
|
|
|
|
bool pagebreak_top, bool pagebreak_bottom,
|
|
|
|
VSpace space_top, VSpace space_bottom,
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXAlignment align,
|
1999-10-02 16:21:10 +00:00
|
|
|
string labelwidthstring,
|
1999-09-27 18:44:28 +00:00
|
|
|
bool noindent);
|
|
|
|
void SetParagraphExtraOpt(int type,
|
1999-11-04 01:40:20 +00:00
|
|
|
char const * width,
|
|
|
|
char const * widthp,
|
1999-09-27 18:44:28 +00:00
|
|
|
int alignment, bool hfill,
|
|
|
|
bool start_minipage);
|
|
|
|
|
|
|
|
/* these things are for search and replace */
|
|
|
|
|
|
|
|
/** returns true if the specified string is at the specified
|
|
|
|
position
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
bool IsStringInText(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos,
|
|
|
|
char const * str);
|
1999-09-27 18:44:28 +00:00
|
|
|
/** sets the selection over the number of characters of string,
|
|
|
|
no check!!
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetSelectionOverString(char const * str);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** simple replacing. The font of the first selected character
|
|
|
|
is used
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
void ReplaceSelectionWithString(char const * string);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** if the string can be found: return true and set the cursor to
|
|
|
|
the new position */
|
1999-11-04 01:40:20 +00:00
|
|
|
bool SearchForward(char const * string);
|
|
|
|
bool SearchBackward(char const * string);
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// needed to insert the selection
|
1999-11-04 01:40:20 +00:00
|
|
|
void InsertStringA(LyXParagraph::TextContainer const & text);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// needed to insert the selection
|
1999-11-04 01:40:20 +00:00
|
|
|
void InsertStringB(LyXParagraph::TextContainer const & text);
|
|
|
|
/// needed to insert the selection
|
|
|
|
void InsertStringA(char const * string);
|
|
|
|
/// needed to insert the selection
|
|
|
|
void InsertStringB(char const * string);
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// usefull when texing from within LyX
|
|
|
|
bool GotoNextError();
|
|
|
|
|
|
|
|
/// just another feature :)
|
|
|
|
bool GotoNextNote();
|
|
|
|
|
|
|
|
/** needed to switch between different classes this works
|
|
|
|
for a list of paragraphs beginning with the specified par
|
|
|
|
return value is the number of wrong conversions
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
int SwitchLayoutsBetweenClasses(char class1, char class2,
|
|
|
|
LyXParagraph * par);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/* for the greater insets */
|
|
|
|
|
|
|
|
/// returns 0 if inset wasn't found
|
1999-11-04 01:40:20 +00:00
|
|
|
int UpdateInset(Inset * inset);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void CheckParagraph(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos);
|
|
|
|
///
|
|
|
|
int NumberOfCell(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos);
|
1999-09-27 18:44:28 +00:00
|
|
|
/* table stuff -- begin*/
|
|
|
|
|
|
|
|
/** all table features of the text-class are put together in
|
|
|
|
this function. Possible values of feature are defined in table.h
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
void TableFeatures(int feature, string val);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void TableFeatures(int feature);
|
|
|
|
|
|
|
|
/** pos points at the beginning of the next cell (if there is one)
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
int WidthOfCell(LyXParagraph * par, LyXParagraph::size_type & pos);
|
|
|
|
///
|
|
|
|
void CheckParagraphInTable(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void InsertCharInTable(char c);
|
|
|
|
///
|
|
|
|
void BackspaceInTable();
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
bool HitInTable(Row * row, int x);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
bool MouseHitInTable(int x, long y);
|
|
|
|
/* table stuff -- end*/
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * GetParFromID(int id);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// undo functions
|
|
|
|
/// returns false if no undo possible
|
|
|
|
bool TextUndo();
|
|
|
|
/// returns false if no redo possible
|
|
|
|
bool TextRedo();
|
|
|
|
/// used by TextUndo/TextRedo
|
1999-11-04 01:40:20 +00:00
|
|
|
bool TextHandleUndo(Undo * undo);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// makes sure the next operation will be stored
|
|
|
|
void FinishUndo();
|
|
|
|
/// this is dangerous and for internal use only
|
|
|
|
void FreezeUndo();
|
|
|
|
/// this is dangerous and for internal use only
|
|
|
|
void UnFreezeUndo();
|
|
|
|
/// the flag used by FinishUndo();
|
|
|
|
bool undo_finished;
|
|
|
|
/// a flag
|
|
|
|
bool undo_frozen;
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetUndo(Undo::undo_kind kind, LyXParagraph * before,
|
|
|
|
LyXParagraph * end);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetRedo(Undo::undo_kind kind, LyXParagraph * before,
|
|
|
|
LyXParagraph * end);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
Undo * CreateUndo(Undo::undo_kind kind, LyXParagraph * before,
|
|
|
|
LyXParagraph * end);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// for external use in lyx_cb.C
|
|
|
|
void SetCursorParUndo();
|
|
|
|
///
|
|
|
|
void CursorLeftIntern();
|
|
|
|
///
|
|
|
|
void CursorRightIntern();
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void RemoveTableRow(LyXCursor * cursor);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
bool IsEmptyTableRow(LyXCursor * cursor) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
bool IsEmptyTableCell() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void toggleAppendix();
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
Row * firstrow;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
Row * lastrow;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Copybuffer for copy environment type
|
|
|
|
Asger has learned that this should be a buffer-property instead
|
|
|
|
Lgb has learned that 'char' is a lousy type for non-characters
|
|
|
|
*/
|
|
|
|
char copylayouttype;
|
|
|
|
|
|
|
|
/// the currentrow is needed to access rows faster*/
|
1999-11-04 01:40:20 +00:00
|
|
|
Row * currentrow; /* pointer to the current row */
|
1999-09-27 18:44:28 +00:00
|
|
|
/// position in the text
|
|
|
|
long currentrow_y;
|
|
|
|
/// width of the paper
|
|
|
|
unsigned short paperwidth;
|
|
|
|
|
|
|
|
/** inserts a new row behind the specified row, increments
|
|
|
|
* the touched counters */
|
1999-11-04 01:40:20 +00:00
|
|
|
void InsertRow(Row * row, LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos );
|
1999-09-27 18:44:28 +00:00
|
|
|
/** removes the row and reset the touched counters */
|
1999-11-04 01:40:20 +00:00
|
|
|
void RemoveRow(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** remove all following rows of the paragraph of the specified row. */
|
1999-11-04 01:40:20 +00:00
|
|
|
void RemoveParagraph(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** insert the specified paragraph behind the specified row */
|
1999-11-04 01:40:20 +00:00
|
|
|
void InsertParagraph(LyXParagraph * par, Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** appends the implizit specified paragraph behind the specified row,
|
|
|
|
* start at the implizit given position */
|
1999-11-04 01:40:20 +00:00
|
|
|
void AppendParagraph(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void BreakAgain(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void BreakAgainOneRow(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetHeightOfRow(Row * row_ptr); /* calculate and set the height
|
1999-09-27 18:44:28 +00:00
|
|
|
* of the row */
|
|
|
|
|
|
|
|
/** this calculates the specified parameters. needed when setting
|
|
|
|
* the cursor and when creating a visible row */
|
1999-11-04 01:40:20 +00:00
|
|
|
void PrepareToPrint(Row * row, float & x, float & fill_separator,
|
|
|
|
float & fill_hfill, float & fill_label_hfill);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void DeleteEmptyParagraphMechanism(LyXCursor old_cursor);
|
|
|
|
|
|
|
|
/** Updates all counters starting BEHIND the row. Changed paragraphs
|
|
|
|
* with a dynamic left margin will be rebroken. */
|
1999-11-04 01:40:20 +00:00
|
|
|
void UpdateCounters(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetCounter(LyXParagraph * par);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* some low level functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
int SingleWidth(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
int SingleWidth(LyXParagraph * par,
|
|
|
|
LyXParagraph::size_type pos, char c);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void Draw(Row * row, LyXParagraph::size_type & pos,
|
|
|
|
LyXScreen & scr,
|
|
|
|
int offset, float & x);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// get the next breakpoint in a given paragraph
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph::size_type NextBreakPoint(Row * row,
|
|
|
|
int width);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// returns the minimum space a row needs on the screen in pixel
|
1999-11-04 01:40:20 +00:00
|
|
|
int Fill(Row * row, int paperwidth);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** returns the minimum space a manual label needs on the
|
|
|
|
screen in pixel */
|
1999-11-04 01:40:20 +00:00
|
|
|
int LabelFill(Row * row);
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
LyXParagraph::size_type BeginningOfMainBody(LyXParagraph * par) const;
|
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.
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
int LeftMargin(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
int RightMargin(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
int LabelEnd (Row * row);
|
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
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
int NumberOfSeparators(Row * row);
|
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!
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
int NumberOfHfills(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// like NumberOfHfills, but only those in the manual label!
|
1999-11-04 01:40:20 +00:00
|
|
|
int NumberOfLabelHfills(Row * row);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** returns true, if a expansion is needed. Rules are given by
|
|
|
|
LaTeX
|
1999-11-04 01:40:20 +00:00
|
|
|
*/
|
|
|
|
bool HfillExpansion(Row * row_ptr,
|
|
|
|
LyXParagraph::size_type pos);
|
1999-09-27 18:44:28 +00:00
|
|
|
/** returns the paragraph position of the last character in the
|
|
|
|
specified row
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph::size_type RowLast(Row * row);
|
1999-12-13 00:05:34 +00:00
|
|
|
///
|
|
|
|
void charInserted();
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|