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-11-04 01:40:20 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
2000-02-04 09:38:32 +00:00
|
|
|
* Copyright 1995-2000 The LyX Team.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
1999-11-04 01:40:20 +00:00
|
|
|
* ====================================================== */
|
1999-10-02 16:21:10 +00:00
|
|
|
|
|
|
|
#ifndef LYXPARAGRAPH_H
|
|
|
|
#define LYXPARAGRAPH_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-01-11 01:59:00 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <list>
|
|
|
|
|
1999-12-13 07:33:00 +00:00
|
|
|
#include "insets/lyxinset.h"
|
|
|
|
#include "table.h"
|
|
|
|
#include "vspace.h"
|
|
|
|
#include "layout.h"
|
|
|
|
#include "support/block.h"
|
2000-03-17 10:14:46 +00:00
|
|
|
#include "language.h"
|
1999-11-04 01:40:20 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
class BufferParams;
|
|
|
|
class LyXBuffer;
|
|
|
|
class TexRow;
|
|
|
|
struct LaTeXFeatures;
|
2000-02-18 22:22:42 +00:00
|
|
|
class InsetBibKey;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// A LyXParagraph holds all text, attributes and insets in a text paragraph
|
|
|
|
class LyXParagraph {
|
|
|
|
public:
|
1999-11-15 12:01:38 +00:00
|
|
|
///
|
|
|
|
enum PEXTRA_TYPE {
|
|
|
|
///
|
|
|
|
PEXTRA_NONE,
|
|
|
|
///
|
|
|
|
PEXTRA_INDENT,
|
|
|
|
///
|
|
|
|
PEXTRA_MINIPAGE,
|
|
|
|
///
|
|
|
|
PEXTRA_FLOATFLT
|
|
|
|
};
|
|
|
|
///
|
|
|
|
enum MINIPAGE_ALIGNMENT {
|
|
|
|
///
|
|
|
|
MINIPAGE_ALIGN_TOP,
|
|
|
|
///
|
|
|
|
MINIPAGE_ALIGN_MIDDLE,
|
|
|
|
///
|
|
|
|
MINIPAGE_ALIGN_BOTTOM
|
|
|
|
};
|
|
|
|
///
|
|
|
|
enum META_KIND {
|
|
|
|
///
|
|
|
|
META_FOOTNOTE = 1,
|
|
|
|
///
|
|
|
|
META_MARGIN,
|
|
|
|
///
|
|
|
|
META_FIG,
|
|
|
|
///
|
|
|
|
META_TAB,
|
|
|
|
///
|
|
|
|
META_ALGORITHM,
|
|
|
|
///
|
|
|
|
META_WIDE_FIG,
|
|
|
|
///
|
|
|
|
META_WIDE_TAB,
|
|
|
|
///
|
|
|
|
META_HFILL,
|
|
|
|
///
|
|
|
|
META_NEWLINE,
|
|
|
|
///
|
2000-02-29 02:19:17 +00:00
|
|
|
//META_PROTECTED_SEPARATOR,
|
1999-11-15 12:01:38 +00:00
|
|
|
///
|
|
|
|
META_INSET
|
|
|
|
};
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// The footnoteflag
|
|
|
|
enum footnote_flag {
|
|
|
|
///
|
|
|
|
NO_FOOTNOTE,
|
|
|
|
///
|
|
|
|
OPEN_FOOTNOTE,
|
|
|
|
///
|
|
|
|
CLOSED_FOOTNOTE
|
|
|
|
};
|
|
|
|
|
|
|
|
/// The footnotekinds
|
|
|
|
enum footnote_kind {
|
|
|
|
///
|
|
|
|
FOOTNOTE,
|
|
|
|
///
|
|
|
|
MARGIN,
|
|
|
|
///
|
|
|
|
FIG,
|
|
|
|
///
|
|
|
|
TAB,
|
|
|
|
///
|
|
|
|
ALGORITHM, // Bernhard, 970807
|
|
|
|
///
|
|
|
|
WIDE_FIG, // CFO-G, 971106
|
|
|
|
///
|
|
|
|
WIDE_TAB // CFO-G, 971106
|
|
|
|
};
|
|
|
|
|
2000-02-04 09:38:32 +00:00
|
|
|
///
|
|
|
|
typedef char value_type;
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
typedef std::vector<value_type> TextContainer;
|
2000-02-04 09:38:32 +00:00
|
|
|
///
|
|
|
|
typedef int size_type;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
LyXParagraph();
|
|
|
|
/// this konstruktor inserts the new paragraph in a list
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph(LyXParagraph * par);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// the destruktors removes the new paragraph from the list
|
|
|
|
~LyXParagraph();
|
|
|
|
|
2000-03-17 10:14:46 +00:00
|
|
|
///
|
|
|
|
Language const * getParLanguage() const;
|
|
|
|
///
|
2000-04-10 21:40:13 +00:00
|
|
|
bool isRightToLeftPar() const;
|
2000-02-04 09:38:32 +00:00
|
|
|
///
|
2000-04-10 21:40:13 +00:00
|
|
|
void ChangeLanguage(Language const * from, Language const * to);
|
2000-02-04 09:38:32 +00:00
|
|
|
///
|
2000-04-10 21:40:13 +00:00
|
|
|
bool isMultiLingual();
|
2000-05-19 16:46:01 +00:00
|
|
|
///
|
|
|
|
string String(bool label);
|
2000-05-20 21:37:05 +00:00
|
|
|
///
|
|
|
|
string String(size_type beg, size_type end);
|
2000-02-04 09:38:32 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
void writeFile(std::ostream &, BufferParams const &, char, char) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-04 09:38:32 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
int id() const {
|
|
|
|
return id_;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
void id(int id_arg) {
|
|
|
|
id_ = id_arg;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
1999-11-04 01:40:20 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void read();
|
2000-01-06 02:44:26 +00:00
|
|
|
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
LyXParagraph * TeXOnePar(std::ostream &, TexRow & texrow,
|
2000-05-05 10:17:05 +00:00
|
|
|
bool moving_arg,
|
2000-04-04 00:19:15 +00:00
|
|
|
std::ostream & foot, TexRow & foot_texrow,
|
2000-03-06 02:42:40 +00:00
|
|
|
int & foot_count);
|
|
|
|
///
|
2000-05-05 10:17:05 +00:00
|
|
|
bool SimpleTeXOnePar(std::ostream &, TexRow & texrow, bool moving_arg);
|
2000-03-06 02:42:40 +00:00
|
|
|
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
LyXParagraph * TeXEnvironment(std::ostream &, TexRow & texrow,
|
|
|
|
std::ostream & foot, TexRow & foot_texrow,
|
2000-03-06 02:42:40 +00:00
|
|
|
int & foot_count);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
LyXParagraph * Clone() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-02-04 09:38:32 +00:00
|
|
|
bool HasSameLayout(LyXParagraph const * par) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
void MakeSameLayout(LyXParagraph const * par);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Is it the first par with same depth and layout?
|
1999-11-22 16:19:48 +00:00
|
|
|
bool IsFirstInSequence() const {
|
|
|
|
LyXParagraph const * dhook = DepthHook(GetDepth());
|
1999-09-27 18:44:28 +00:00
|
|
|
return (dhook == this
|
|
|
|
|| dhook->GetLayout() != GetLayout()
|
|
|
|
|| dhook->GetDepth() != GetDepth());
|
|
|
|
}
|
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
/** Check if the current paragraph is the last paragraph in a
|
|
|
|
proof environment */
|
2000-03-10 13:22:20 +00:00
|
|
|
int GetEndLabel() const;
|
2000-04-10 21:40:13 +00:00
|
|
|
///
|
2000-04-10 14:29:05 +00:00
|
|
|
Inset * InInset() { return inset_owner; }
|
2000-04-10 21:40:13 +00:00
|
|
|
///
|
|
|
|
void SetInsetOwner(Inset * i) { inset_owner = i; }
|
2000-03-16 04:29:22 +00:00
|
|
|
private:
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
TextContainer text;
|
2000-04-10 14:29:05 +00:00
|
|
|
///
|
|
|
|
Inset * inset_owner;
|
|
|
|
|
2000-03-16 04:29:22 +00:00
|
|
|
public:
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
size_type size() const { return text.size(); }
|
2000-03-16 04:29:22 +00:00
|
|
|
///
|
|
|
|
void fitToSize() {
|
|
|
|
text.resize(text.size());
|
|
|
|
}
|
|
|
|
void setContentsFromPar(LyXParagraph * par) {
|
|
|
|
text = par->text;
|
|
|
|
}
|
|
|
|
void clearContents() {
|
|
|
|
text.clear();
|
|
|
|
}
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
VSpace added_space_top;
|
|
|
|
|
|
|
|
///
|
|
|
|
VSpace added_space_bottom;
|
2000-04-11 22:55:29 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
Spacing spacing;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXTextClass::LayoutList::size_type layout;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
\begin{itemize}
|
|
|
|
\item no footnote, closed footnote,
|
|
|
|
\item open footnote, where footnote
|
|
|
|
\item means footnote-environment
|
|
|
|
\end{itemize}
|
|
|
|
*/
|
|
|
|
footnote_flag footnoteflag;
|
|
|
|
|
|
|
|
/// footnote, margin, fig, tab
|
|
|
|
footnote_kind footnotekind;
|
|
|
|
|
|
|
|
//@Man: the LyX- DTP-switches
|
|
|
|
//@{
|
|
|
|
///
|
|
|
|
bool line_top;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool line_bottom;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool pagebreak_top;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool pagebreak_bottom;
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXAlignment align;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
char depth;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool noindent;
|
|
|
|
|
|
|
|
private:
|
1999-11-22 16:19:48 +00:00
|
|
|
block<int, 10> counter_;
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
void setCounter(int i, int v) { counter_[i] = v; }
|
|
|
|
int getCounter(int i) const { return counter_[i]; }
|
|
|
|
void incCounter(int i) { counter_[i]++; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
bool start_of_appendix;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool appendix;
|
|
|
|
|
|
|
|
///
|
|
|
|
char enumdepth;
|
|
|
|
|
|
|
|
///
|
|
|
|
char itemdepth;
|
|
|
|
|
|
|
|
/* This is for the paragraph extra stuff */
|
|
|
|
///
|
|
|
|
int pextra_type;
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pextra_width;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string pextra_widthp;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int pextra_alignment;
|
|
|
|
///
|
|
|
|
bool pextra_hfill;
|
|
|
|
///
|
|
|
|
bool pextra_start_minipage;
|
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string labelstring;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string labelwidthstring;
|
1999-09-27 18:44:28 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * next;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * previous;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/* table stuff -- begin*/
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXTable * table;
|
1999-09-27 18:44:28 +00:00
|
|
|
/* table stuff -- end*/
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
InsetBibKey * bibkey; // ale970302
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** these function are able to hide closed footnotes
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * Next();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * Previous();
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
|
|
|
LyXParagraph const * Previous() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** these function are able to hide open and closed footnotes
|
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * NextAfterFootnote();
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
LyXParagraph const * NextAfterFootnote() const;
|
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * PreviousBeforeFootnote();
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * LastPhysicalPar();
|
2000-03-10 13:22:20 +00:00
|
|
|
///
|
|
|
|
LyXParagraph const * LastPhysicalPar() const;
|
1999-11-22 16:19:48 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * FirstPhysicalPar();
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
|
|
|
LyXParagraph const * FirstPhysicalPar() const;
|
1999-11-04 01:40:20 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// returns the physical paragraph
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * ParFromPos(size_type pos);
|
|
|
|
/// returns the position in the physical par
|
1999-11-22 16:19:48 +00:00
|
|
|
int PositionInParFromPos(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// for the environments
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXParagraph * DepthHook(int depth);
|
1999-11-22 16:19:48 +00:00
|
|
|
/// for the environments
|
|
|
|
LyXParagraph const * DepthHook(int depth) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
int BeginningOfMainBody() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
string GetLabelstring() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// the next two functions are for the manual labels
|
1999-11-22 16:19:48 +00:00
|
|
|
string GetLabelWidthString() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetLabelWidthString(string const & s);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
LyXTextClass::LayoutList::size_type GetLayout() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
char GetAlign() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
char GetDepth() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetLayout(LyXTextClass::LayoutList::size_type new_layout);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
int GetFirstCounter(int i) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
size_type Last() const;
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
void Erase(size_type pos);
|
|
|
|
/** the flag determines wether the layout should be copied
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
1999-11-04 01:40:20 +00:00
|
|
|
void BreakParagraph(size_type pos, int flag);
|
|
|
|
///
|
|
|
|
void BreakParagraphConservative(size_type pos);
|
|
|
|
/** Get unistantiated font setting. Returns the difference
|
|
|
|
between the characters font and the layoutfont.
|
|
|
|
This is what is stored in the fonttable
|
|
|
|
*/
|
1999-11-22 16:19:48 +00:00
|
|
|
LyXFont GetFontSettings(size_type pos) const;
|
2000-03-17 10:14:46 +00:00
|
|
|
///
|
|
|
|
LyXFont GetFirstFontSettings() const;
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Get fully instantiated font. If pos == -1, use the layout
|
|
|
|
font attached to this paragraph.
|
|
|
|
If pos == -2, use the label font of the layout attached here.
|
|
|
|
In all cases, the font is instantiated, i.e. does not have any
|
|
|
|
attributes with values LyXFont::INHERIT, LyXFont::IGNORE or
|
|
|
|
LyXFont::TOGGLE.
|
|
|
|
*/
|
1999-11-22 16:19:48 +00:00
|
|
|
LyXFont getFont(size_type pos) const;
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
char GetChar(size_type pos);
|
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
char GetChar(size_type pos) const;
|
2000-03-16 04:29:22 +00:00
|
|
|
/// The position must already exist.
|
|
|
|
void SetChar(size_type pos, char c) {
|
|
|
|
text[pos] = c;
|
|
|
|
}
|
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetFont(size_type pos, LyXFont const & font);
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
string GetWord(size_type &) const;
|
1999-11-04 01:40:20 +00:00
|
|
|
/// Returns the height of the highest font in range
|
1999-11-15 12:01:38 +00:00
|
|
|
LyXFont::FONT_SIZE HighestFontInRange(size_type startpos,
|
|
|
|
size_type endpos) const;
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
void InsertChar(size_type pos, char c);
|
|
|
|
///
|
|
|
|
void InsertInset(size_type pos, Inset * inset);
|
|
|
|
///
|
2000-04-10 14:29:05 +00:00
|
|
|
bool InsertInsetAllowed(Inset * inset);
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
Inset * GetInset(size_type pos);
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
Inset const * GetInset(size_type pos) const;
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void OpenFootnote(size_type pos);
|
|
|
|
///
|
|
|
|
void CloseFootnote(size_type pos);
|
|
|
|
/// important for cut and paste
|
1999-11-22 16:19:48 +00:00
|
|
|
void CopyIntoMinibuffer(size_type pos) const;
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
void CutIntoMinibuffer(size_type pos);
|
|
|
|
///
|
2000-04-10 14:29:05 +00:00
|
|
|
bool InsertFromMinibuffer(size_type pos);
|
1999-11-15 12:01:38 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsHfill(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsInset(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsFloat(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsNewline(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsSeparator(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsLineSeparator(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsKomma(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Used by the spellchecker
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsLetter(size_type pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
bool IsWord(size_type pos) const;
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** This one resets all layout and dtp switches but not the font
|
|
|
|
of the single characters
|
|
|
|
*/
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
/** paste this paragraph with the next one
|
|
|
|
be carefull, this doesent make any check at all
|
|
|
|
*/
|
|
|
|
void PasteParagraph();
|
|
|
|
|
|
|
|
/// used to remove the error messages
|
|
|
|
int AutoDeleteInsets();
|
|
|
|
|
|
|
|
/// returns -1 if inset not found
|
1999-11-22 16:19:48 +00:00
|
|
|
int GetPositionOfInset(Inset * inset) const;
|
1999-11-04 01:40:20 +00:00
|
|
|
|
|
|
|
/// ok and now some footnote functions
|
|
|
|
void OpenFootnotes();
|
|
|
|
|
|
|
|
///
|
|
|
|
void CloseFootnotes();
|
|
|
|
|
|
|
|
///
|
|
|
|
LyXParagraph * FirstSelfrowPar();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-02-04 09:38:32 +00:00
|
|
|
int ClearParagraph() {
|
1999-11-04 01:40:20 +00:00
|
|
|
int i = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
if (!IsDummy() && !table){
|
|
|
|
while (Last()
|
|
|
|
&& (IsNewline(0)
|
|
|
|
|| IsLineSeparator(0))){
|
|
|
|
Erase(0);
|
2000-01-24 18:34:46 +00:00
|
|
|
++i;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** A paragraph following a footnote is a "dummy". A paragraph
|
|
|
|
with a footnote in it is stored as three paragraphs:
|
|
|
|
First a paragraph with the text up to the footnote, then
|
|
|
|
one (or more) paragraphs with the footnote, and finally
|
|
|
|
the a paragraph with the text after the footnote. Only the
|
|
|
|
first paragraph keeps information about layoutparameters, */
|
2000-04-04 00:19:15 +00:00
|
|
|
bool IsDummy() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE
|
|
|
|
I have to set it on each of it's elements */
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void SetPExtraType(int type, char const * width, char const * widthp);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void UnsetPExtraType();
|
2000-02-29 02:19:17 +00:00
|
|
|
#if 0
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
bool RoffContTableRows(std::ostream &, size_type i, int actcell);
|
2000-02-29 02:19:17 +00:00
|
|
|
#endif
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
2000-03-06 02:42:40 +00:00
|
|
|
bool linuxDocConvertChar(char c, string & sgml_string);
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
void DocBookContTableRows(std::ostream &, string & extra,
|
2000-03-28 02:18:55 +00:00
|
|
|
int & desc_on, size_type i,
|
1999-11-04 01:40:20 +00:00
|
|
|
int current_cell_number, int & column);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
void SimpleDocBookOneTablePar(std::ostream &, string & extra,
|
2000-03-06 02:42:40 +00:00
|
|
|
int & desc_on, int depth);
|
2000-04-10 21:40:13 +00:00
|
|
|
private:
|
2000-04-06 09:17:40 +00:00
|
|
|
///
|
|
|
|
struct InsetTable {
|
|
|
|
///
|
|
|
|
size_type pos;
|
|
|
|
///
|
|
|
|
Inset * inset;
|
|
|
|
///
|
|
|
|
InsetTable(size_type p, Inset * i) { pos = p; inset = i;}
|
|
|
|
};
|
2000-04-10 21:40:13 +00:00
|
|
|
///
|
2000-05-05 08:44:11 +00:00
|
|
|
friend struct matchIT;
|
|
|
|
///
|
2000-04-10 21:40:13 +00:00
|
|
|
struct matchIT {
|
|
|
|
/// used by lower_bound
|
|
|
|
inline
|
|
|
|
int operator()(LyXParagraph::InsetTable const & a,
|
|
|
|
LyXParagraph::size_type pos) const {
|
|
|
|
return a.pos < pos;
|
|
|
|
}
|
|
|
|
/// used by upper_bound
|
|
|
|
inline
|
|
|
|
int operator()(LyXParagraph::size_type pos,
|
|
|
|
LyXParagraph::InsetTable const & a) const {
|
|
|
|
return pos < a.pos;
|
|
|
|
}
|
|
|
|
};
|
1999-09-27 18:44:28 +00:00
|
|
|
/** A font entry covers a range of positions. Notice that the
|
|
|
|
entries in the list are inserted in random order.
|
|
|
|
I don't think it's worth the effort to implement a more effective
|
|
|
|
datastructure, because the number of different fonts in a paragraph
|
|
|
|
is limited. (Asger)
|
|
|
|
*/
|
|
|
|
struct FontTable {
|
1999-11-04 01:40:20 +00:00
|
|
|
/// Start position of paragraph this font attribute covers
|
|
|
|
size_type pos;
|
|
|
|
/// Ending position of paragraph this font attribute covers
|
|
|
|
size_type pos_end;
|
1999-09-27 18:44:28 +00:00
|
|
|
/** Font. Interpretation of the font values:
|
|
|
|
If a value is LyXFont::INHERIT_*, it means that the font
|
|
|
|
attribute is inherited from either the layout of this
|
|
|
|
paragraph or, in the case of nested paragraphs, from the
|
|
|
|
layout in the environment one level up until completely
|
|
|
|
resolved.
|
|
|
|
The values LyXFont::IGNORE_* and LyXFont::TOGGLE are NOT
|
|
|
|
allowed in these font tables.
|
|
|
|
*/
|
|
|
|
LyXFont font;
|
|
|
|
};
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
typedef std::list<FontTable> FontList;
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
FontList fontlist;
|
2000-01-11 01:59:00 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
typedef std::vector<InsetTable> InsetList;
|
2000-01-11 01:59:00 +00:00
|
|
|
///
|
|
|
|
InsetList insetlist;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
LyXParagraph * TeXDeeper(std::ostream &, TexRow & texrow,
|
|
|
|
std::ostream & foot, TexRow & foot_texrow,
|
2000-03-06 02:42:40 +00:00
|
|
|
int & foot_count);
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
LyXParagraph * TeXFootnote(std::ostream &, TexRow & texrow,
|
|
|
|
std::ostream & foot, TexRow & foot_texrow,
|
2000-03-06 02:42:40 +00:00
|
|
|
int & foot_count,
|
2000-04-10 21:40:13 +00:00
|
|
|
bool parent_is_rtl);
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
bool SimpleTeXOneTablePar(std::ostream &, TexRow & texrow);
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
bool TeXContTableRows(std::ostream &, size_type i,
|
2000-03-06 02:42:40 +00:00
|
|
|
int current_cell_number,
|
|
|
|
int & column, TexRow & texrow);
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
void SimpleTeXBlanks(std::ostream &, TexRow & texrow,
|
2000-03-06 02:42:40 +00:00
|
|
|
size_type const i,
|
|
|
|
int & column, LyXFont const & font,
|
|
|
|
LyXLayout const & style);
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
void SimpleTeXSpecialChars(std::ostream &, TexRow & texrow,
|
2000-05-05 10:17:05 +00:00
|
|
|
bool moving_arg,
|
2000-03-06 02:42:40 +00:00
|
|
|
LyXFont & font, LyXFont & running_font,
|
|
|
|
LyXFont & basefont, bool & open_font,
|
|
|
|
LyXLayout const & style,
|
|
|
|
size_type & i,
|
|
|
|
int & column, char const c);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
unsigned int id_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
static unsigned int paragraph_id;
|
2000-05-19 16:46:01 +00:00
|
|
|
public:
|
|
|
|
class inset_iterator {
|
|
|
|
public:
|
|
|
|
inset_iterator() {}
|
|
|
|
inset_iterator(InsetList::iterator const & iter) : it(iter) {};
|
|
|
|
inset_iterator & operator++() {
|
|
|
|
++it;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
Inset * operator*() { return (*it).inset; }
|
|
|
|
size_type getPos() {return (*it).pos; }
|
|
|
|
bool operator==(inset_iterator const & iter) const {
|
|
|
|
return it == iter.it;
|
|
|
|
}
|
|
|
|
bool operator!=(inset_iterator const & iter) const {
|
|
|
|
return it != iter.it;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
InsetList::iterator it;
|
|
|
|
};
|
|
|
|
///
|
|
|
|
inset_iterator inset_iterator_begin() {
|
|
|
|
return inset_iterator(insetlist.begin());
|
|
|
|
}
|
|
|
|
///
|
|
|
|
inset_iterator inset_iterator_end() {
|
|
|
|
return inset_iterator(insetlist.end());
|
|
|
|
}
|
|
|
|
///
|
|
|
|
inset_iterator InsetIterator(size_type pos);
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
2000-04-03 11:36:35 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|