using std::make_pair;
using std::min;
using SigC::slot;
+using lyx::pos_type;
/* the selection possible is needed, that only motion events are
* used, where the bottom press event was on the drawing area too */
///
struct BufferView::Pimpl : public SigC::Object {
- /// position in a paragraph
- typedef lyx::pos_type pos_type;
///
Pimpl(BufferView * i, LyXView * o,
int xpos, int ypos, int width, int height);
/// Cursor paragraph Id
int par_id;
/// Cursor position
- pos_type par_pos;
+ lyx::pos_type par_pos;
///
Position() : par_id(0), par_pos(0) {}
///
- Position(string const & f, int id, pos_type pos)
+ Position(string const & f, int id, lyx::pos_type pos)
: filename(f), par_id(id), par_pos(pos) {}
};
///
+
+2001-11-28 André Pönitz <poenitz@gmx.net>
+
+ * paragraph.C: whitespace changes
+ * files form the 26th: change *::pos_type into lyx::pos_type
+
+
2001-11-27 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (parseSingleLyXformat2Token): Set the language to the
#endif
using std::pair;
+using lyx::pos_type;
extern BufferView * current_view;
// only within one paragraph
if (realcut)
buf = new Paragraph;
- Paragraph::pos_type i = start;
+ pos_type i = start;
if (end > startpar->size())
end = startpar->size();
for (; i < end; ++i) {
textclass = tc;
- if (!endpar ||
- startpar == endpar) {
+ if (!endpar || startpar == endpar) {
// only within one paragraph
buf = new Paragraph;
- Paragraph::pos_type i = start;
+ pos_type i = start;
if (end > startpar->size())
end = startpar->size();
for (; i < end; ++i) {
tmppar2->next(0);
// the buf paragraph is too big
- Paragraph::pos_type tmpi2 = start;
+ pos_type tmpi2 = start;
for (; tmpi2; --tmpi2)
buf->erase(0);
using std::stack;
using std::list;
+using lyx::pos_type;
+
// all these externs should eventually be removed.
extern BufferList bufferlist;
}
// needed to insert the selection
-void Buffer::insertStringAsLines(Paragraph *& par, Paragraph::pos_type & pos,
+void Buffer::insertStringAsLines(Paragraph *& par, pos_type & pos,
LyXFont const & fn,string const & str) const
{
LyXLayout const & layout = textclasslist.Style(params.textclass,
++pos;
space_inserted = true;
} else {
- const Paragraph::pos_type nb = 8 - pos % 8;
- for (Paragraph::pos_type a = 0;
- a < nb ; ++a) {
+ const pos_type nb = 8 - pos % 8;
+ for (pos_type a = 0; a < nb ; ++a) {
par->insertChar(pos, ' ', font);
++pos;
}
lyxerr << "Should this ever happen?" << endl;
}
- for (Paragraph::pos_type i = 0; i < par->size(); ++i) {
+ for (pos_type i = 0; i < par->size(); ++i) {
if (!i && !noparbreak) {
if (linelen > 0)
buffer << "\n\n";
stack<PAR_TAG> tag_state;
// parsing main loop
- for (Paragraph::pos_type i = 0; i < par->size(); ++i) {
+ for (pos_type i = 0; i < par->size(); ++i) {
PAR_TAG tag_close = NONE;
list < PAR_TAG > tag_open;
// os << string(depth,' ');
// parsing main loop
- for (Paragraph::pos_type i = 0;
- i < par->size(); ++i) {
+ for (pos_type i = 0; i < par->size(); ++i) {
LyXFont font = par->getFont(params, i);
// handle <emphasis> tag
}
-Buffer::inset_iterator::inset_iterator(Paragraph * paragraph,
- Paragraph::pos_type pos)
+Buffer::inset_iterator::inset_iterator(Paragraph * paragraph, pos_type pos)
: par(paragraph)
{
it = par->InsetIterator(pos);
Paragraph::depth_type & depth,
LyXFont &);
///
- void insertStringAsLines(Paragraph *&, Paragraph::pos_type &,
+ void insertStringAsLines(Paragraph *&, lyx::pos_type &,
LyXFont const &, string const &) const;
#ifndef NO_COMPABILITY
///
setParagraph();
}
///
- inset_iterator(Paragraph * paragraph,
- Paragraph::pos_type pos);
+ inset_iterator(Paragraph * paragraph, lyx::pos_type pos);
///
inset_iterator & operator++() { // prefix ++
if (par) {
///
Paragraph * getPar() { return par; }
///
- Paragraph::pos_type getPos() const { return it.getPos(); }
+ lyx::pos_type getPos() const { return it.getPos(); }
///
friend
bool operator==(inset_iterator const & iter1,
#include "debug.h"
using std::ostream;
+using lyx::pos_type;
+
void InsetERT::init()
{
labelfont.decSize();
labelfont.setColor(LColor::latex);
setInsetName("ERT");
-
}
font.setColor(LColor::latex);
string::const_iterator cit = contents.begin();
string::const_iterator end = contents.end();
- Paragraph::pos_type pos = 0;
+ pos_type pos = 0;
for (; cit != end; ++cit) {
inset.paragraph()->insertChar(pos++, *cit, font);
}
font.setColor(LColor::latex);
Paragraph * par = inset.paragraph();
while (par) {
- Paragraph::pos_type siz = par->size();
- for (Paragraph::pos_type i = 0; i < siz; ++i) {
+ pos_type siz = par->size();
+ for (pos_type i = 0; i < siz; ++i) {
par->setFont(i, font);
}
par = par->next();
Paragraph * par = inset.paragraph();
while (par) {
os << "\n\\layout " << layout << "\n";
- Paragraph::pos_type siz = par->size();
- for (Paragraph::pos_type i = 0; i < siz; ++i) {
+ pos_type siz = par->size();
+ for (pos_type i = 0; i < siz; ++i) {
Paragraph::value_type c = par->getChar(i);
switch (c) {
case Paragraph::META_INSET:
Paragraph * par = inset.paragraph();
int lines = 0;
while (par) {
- Paragraph::pos_type siz = par->size();
- for (Paragraph::pos_type i = 0; i < siz; ++i) {
+ pos_type siz = par->size();
+ for (pos_type i = 0; i < siz; ++i) {
Paragraph::value_type c = par->getChar(i);
switch (c) {
case Paragraph::META_NEWLINE:
Paragraph * par = inset.paragraph();
int lines = 0;
while (par) {
- Paragraph::pos_type siz = par->size();
- for (Paragraph::pos_type i = 0; i < siz; ++i) {
+ pos_type siz = par->size();
+ for (pos_type i = 0; i < siz; ++i) {
Paragraph::value_type c = par->getChar(i);
switch (c) {
case Paragraph::META_NEWLINE:
Paragraph * par = inset.paragraph();
int lines = 0;
while (par) {
- Paragraph::pos_type siz = par->size();
- for (Paragraph::pos_type i = 0; i < siz; ++i) {
+ pos_type siz = par->size();
+ for (pos_type i = 0; i < siz; ++i) {
Paragraph::value_type c = par->getChar(i);
switch (c) {
case Paragraph::META_NEWLINE:
string const InsetERT::get_new_label() const
{
string la;
- Paragraph::pos_type const max_length = 15;
-
- Paragraph::pos_type const p_siz = inset.paragraph()->size();
- Paragraph::pos_type const n = std::min(max_length, p_siz);
+ pos_type const max_length = 15;
+ pos_type const p_siz = inset.paragraph()->size();
+ pos_type const n = std::min(max_length, p_siz);
int i = 0;
int j = 0;
for(; i < n && j < p_siz; ++j) {
using std::ostream;
+
void InsetNote::init()
{
LyXFont font(LyXFont::ALL_SANE);
init();
Paragraph * par = inset.paragraph();
- Paragraph::pos_type pos = 0;
LyXFont font(LyXFont::ALL_INHERIT, buf->params.language);
// Since XForms doesn't support RTL, we can assume that old notes
if (font.language()->RightToLeft())
font.setLanguage(default_language);
+ lyx::pos_type pos;
buf->insertStringAsLines(par, pos, font, strip(contents, '\n'));
}
using std::make_pair;
using std::vector;
+using lyx::pos_type;
+
extern unsigned char getCurrentTextClass(Buffer *);
extern bool math_insert_greek(BufferView *, char);
extern int greek_kb_flag;
}
-Paragraph::pos_type InsetText::cpos(BufferView * bv) const
+pos_type InsetText::cpos(BufferView * bv) const
{
return getLyXText(bv)->cursor.pos();
}
clear = true;
}
Paragraph * lpar = lt->cursor.par();
- Paragraph::pos_type pos = lt->cursor.pos();
+ pos_type pos = lt->cursor.pos();
if (pos < lpar->size() - 1)
++pos;
else {
///
int cy(BufferView *) const;
///
- Paragraph::pos_type cpos(BufferView *) const;
+ lyx::pos_type cpos(BufferView *) const;
///
Paragraph * cpar(BufferView *) const;
///
///
Paragraph * inset_par;
///
- Paragraph::pos_type inset_pos;
+ lyx::pos_type inset_pos;
///
bool inset_boundary;
///
Paragraph * lpar;
Paragraph * selstartpar;
Paragraph * selendpar;
- Paragraph::pos_type pos;
- Paragraph::pos_type selstartpos;
- Paragraph::pos_type selendpos;
+ lyx::pos_type pos;
+ lyx::pos_type selstartpos;
+ lyx::pos_type selendpos;
bool boundary;
bool selstartboundary;
bool selendboundary;
}
-void LyXCursor::pos(pos_type p)
+void LyXCursor::pos(lyx::pos_type p)
{
pos_ = p;
}
-LyXCursor::pos_type LyXCursor::pos() const
+lyx::pos_type LyXCursor::pos() const
{
return pos_;
}
*/
class LyXCursor {
public:
- /// position in a paragraph
- typedef lyx::pos_type pos_type;
///
LyXCursor();
///
///
Paragraph * par() const;
///
- void pos(pos_type p);
+ void pos(lyx::pos_type p);
///
- pos_type pos() const;
+ lyx::pos_type pos() const;
///
void boundary(bool b);
///
/// The paragraph the cursor is in.
Paragraph * par_;
/// The position inside the paragraph
- pos_type pos_;
+ lyx::pos_type pos_;
///
bool boundary_;
///
#include "buffer.h"
#include "gettext.h"
+using lyx::pos_type;
+
+
///
// locally used enum
///
/// returns true if the specified string is at the specified position
-bool IsStringInText(Paragraph * par, Paragraph::pos_type pos,
+bool IsStringInText(Paragraph * par, pos_type pos,
string const & str, bool const & = true,
bool const & = false);
else {
text = bv->getLyXText();
Paragraph * par = text->cursor.par();
- Paragraph::pos_type pos = text->cursor.pos();
+ pos_type pos = text->cursor.pos();
if (forward) {
if (pos < par->size() - 1)
++pos;
// returns true if the specified string is at the specified position
-bool IsStringInText(Paragraph * par, Paragraph::pos_type pos,
+bool IsStringInText(Paragraph * par, pos_type pos,
string const & str, bool const & cs,
bool const & mw)
{
return false;
string::size_type size = str.length();
- Paragraph::pos_type i = 0;
+ pos_type i = 0;
while (((pos + i) < par->size())
&& (string::size_type(i) < size)
&& (cs ? (str[i] == par->getChar(pos + i))
if (!mw)
return true;
if ((pos <= 0 || !IsLetterCharOrDigit(par->getChar(pos - 1)))
- && (pos + Paragraph::pos_type(size) >= par->size()
+ && (pos + pos_type(size) >= par->size()
|| !IsLetterCharOrDigit(par->getChar(pos + size)))) {
return true;
}
bool const & cs, bool const & mw)
{
Paragraph * par = text->cursor.par();
- Paragraph::pos_type pos = text->cursor.pos();
+ pos_type pos = text->cursor.pos();
UpdatableInset * inset;
while (par && !IsStringInText(par, pos, str, cs, mw)) {
bool const & cs, bool const & mw)
{
Paragraph * par = text->cursor.par();
- Paragraph::pos_type pos = text->cursor.pos();
+ pos_type pos = text->cursor.pos();
do {
if (pos > 0)
}
-void Row::pos(pos_type p)
+void Row::pos(lyx::pos_type p)
{
pos_ = p;
}
-Row::pos_type Row::pos() const
+lyx::pos_type Row::pos() const
{
return pos_;
}
///
class Row {
public:
- /// A position in the row
- typedef lyx::pos_type pos_type;
///
Row();
///
///
Paragraph * par() const;
///
- void pos(pos_type p);
+ void pos(lyx::pos_type p);
///
- pos_type pos() const;
+ lyx::pos_type pos() const;
///
void fill(int f);
///
///
Paragraph * par_;
///
- pos_type pos_;
+ lyx::pos_type pos_;
/** what is missing to a full row can be negative.
Needed for hfills, flushright, block etc. */
mutable int fill_;
*/
class LyXText {
public:
- /// a position in the text
- typedef lyx::pos_type pos_type;
- /// a layout number
- typedef lyx::layout_type layout_type;
///
enum text_status {
///
///
int getRealCursorX(BufferView *) const;
///
- LyXFont const getFont(Buffer const *, Paragraph * par, pos_type pos) const;
+ LyXFont const getFont(Buffer const *, Paragraph * par,
+ lyx::pos_type pos) const;
///
LyXFont const getLayoutFont(Buffer const *, Paragraph * par) const;
///
LyXFont const getLabelFont(Buffer const *, Paragraph * par) const;
///
void setCharFont(Buffer const *, Paragraph * par,
- pos_type pos, LyXFont const & font);
+ lyx::pos_type pos, LyXFont const & font);
void setCharFont(BufferView *, Paragraph * par,
- pos_type pos, LyXFont const & font, bool toggleall);
+ lyx::pos_type pos, LyXFont const & font, bool toggleall);
/// returns a pointer to the very first Paragraph
Paragraph * firstParagraph() const;
Paragraph * setLayout(BufferView *, LyXCursor & actual_cursor,
LyXCursor & selection_start,
LyXCursor & selection_end,
- layout_type layout);
+ lyx::layout_type layout);
///
- void setLayout(BufferView *, layout_type layout);
+ void setLayout(BufferView *, lyx::layout_type layout);
/// used in setlayout
void makeFontEntriesLayoutSpecific(Buffer const *, Paragraph * par);
///
mutable Row * refresh_row;
///
- pos_type refresh_pos;
+ lyx::pos_type refresh_pos;
/// give and set the LyXText status
text_status status() const;
/** returns the column near the specified x-coordinate of the row
x is set to the real beginning of this column
*/
- pos_type getColumnNearX(BufferView *, Row * row,
+ lyx::pos_type getColumnNearX(BufferView *, Row * row,
int & x, bool & boundary) const;
/** returns a pointer to a specified row. y is set to the beginning
of the row
*/
Row * getRow(Paragraph * par,
- pos_type pos, int & y) const;
+ lyx::pos_type pos, int & y) const;
/** returns the height of a default row, needed for scrollbar
*/
void selectSelectedWord(BufferView *);
///
void setCursor(BufferView *, Paragraph * par,
- pos_type pos,
+ lyx::pos_type pos,
bool setfont = true,
bool boundary = false) const;
///
void setCursor(BufferView *, LyXCursor &, Paragraph * par,
- pos_type pos,
+ lyx::pos_type pos,
bool boundary = false) const;
///
void setCursorIntern(BufferView *, Paragraph * par,
- pos_type pos,
+ lyx::pos_type pos,
bool setfont = true,
bool boundary = false) const;
///
///
bool isBoundary(Buffer const *, Paragraph * par,
- pos_type pos) const;
+ lyx::pos_type pos) const;
///
bool isBoundary(Buffer const *, Paragraph * par,
- pos_type pos,
+ lyx::pos_type pos,
LyXFont const & font) const;
///
/// returns false if inset wasn't found
bool updateInset(BufferView *, Inset *);
///
- void checkParagraph(BufferView *, Paragraph * par, pos_type pos);
+ void checkParagraph(BufferView *, Paragraph * par, lyx::pos_type pos);
///
- int numberOfCell(Paragraph * par, pos_type pos) const;
+ int numberOfCell(Paragraph * par, lyx::pos_type pos) const;
///
void removeTableRow(LyXCursor & cursor) const;
///
/// Maps positions in the visual string to positions in logical string.
inline
- pos_type log2vis(pos_type pos) const {
+ lyx::pos_type log2vis(lyx::pos_type pos) const {
if (bidi_start == -1)
return pos;
else
/// Maps positions in the logical string to positions in visual string.
inline
- pos_type vis2log(pos_type pos) const {
+ lyx::pos_type vis2log(lyx::pos_type pos) const {
if (bidi_start == -1)
return pos;
else
}
///
inline
- pos_type bidi_level(pos_type pos) const {
+ lyx::pos_type bidi_level(lyx::pos_type pos) const {
if (bidi_start == -1)
return 0;
else
}
///
inline
- bool bidi_InRange(pos_type pos) const {
+ bool bidi_InRange(lyx::pos_type pos) const {
return bidi_start == -1 ||
(bidi_start <= pos && pos <= bidi_end);
}
Asger has learned that this should be a buffer-property instead
Lgb has learned that 'char' is a lousy type for non-characters
*/
- layout_type copylayouttype;
+ lyx::layout_type copylayouttype;
/** inserts a new row behind the specified row, increments
the touched counters */
- void insertRow(Row * row, Paragraph * par, pos_type pos) const;
+ void insertRow(Row * row, Paragraph * par, lyx::pos_type pos) const;
/** removes the row and reset the touched counters */
void removeRow(Row * row) const;
*/
///
- int singleWidth(BufferView *, Paragraph * par, pos_type pos) const;
+ int singleWidth(BufferView *, Paragraph * par,
+ lyx::pos_type pos) const;
///
- int singleWidth(BufferView *, Paragraph * par, pos_type pos, char c) const;
+ int singleWidth(BufferView *, Paragraph * par,
+ lyx::pos_type pos, char c) const;
///
void draw(BufferView *, Row const * row,
- pos_type & pos, int offset, float & x, bool cleared);
+ lyx::pos_type & pos, int offset, float & x, bool cleared);
/// get the next breakpoint in a given paragraph
- pos_type nextBreakPoint(BufferView *, Row const * row, int width) const;
+ lyx::pos_type nextBreakPoint(BufferView *, Row const * row, int width) const;
/// returns the minimum space a row needs on the screen in pixel
int fill(BufferView *, Row * row, int workwidth) const;
int labelFill(BufferView *, Row const * row) const;
///
- pos_type beginningOfMainBody(Buffer const *, Paragraph const * par) const;
+ lyx::pos_type beginningOfMainBody(Buffer const *, Paragraph const * par) const;
/** Returns the left beginning of the text.
This information cannot be taken from the layouts-objekt, because
LaTeX
*/
bool hfillExpansion(Buffer const *, Row const * row_ptr,
- pos_type pos) const;
+ lyx::pos_type pos) const;
///
LColor::color backgroundColor();
///
- mutable std::vector<pos_type> log2vis_list;
+ mutable std::vector<lyx::pos_type> log2vis_list;
///
- mutable std::vector<pos_type> vis2log_list;
+ mutable std::vector<lyx::pos_type> vis2log_list;
///
- mutable std::vector<pos_type> bidi_levels;
+ mutable std::vector<lyx::pos_type> bidi_levels;
///
- mutable pos_type bidi_start;
+ mutable lyx::pos_type bidi_start;
///
- mutable pos_type bidi_end;
+ mutable lyx::pos_type bidi_end;
///
mutable bool bidi_same_direction;
///
unsigned char transformChar(unsigned char c, Paragraph * par,
- pos_type pos) const;
+ lyx::pos_type pos) const;
/** returns the paragraph position of the last character in the
specified row
*/
- pos_type rowLast(Row const * row) const;
+ lyx::pos_type rowLast(Row const * row) const;
///
- pos_type rowLastPrintable(Row const * row) const;
+ lyx::pos_type rowLastPrintable(Row const * row) const;
///
void charInserted();
using std::upper_bound;
using std::reverse;
+using lyx::pos_type;
+using lyx::layout_type;
+
int tex_code_break_column = 72; // needs non-zero initialization. set later.
// this is a bad idea, but how can Paragraph find its buffer to get
// parameters? (JMarc)
previous_ = 0;
enumdepth = 0;
itemdepth = 0;
- bibkey = 0; // ale970302
+ bibkey = 0; // ale970302
clear();
}
previous_->next_ = this;
// end
- bibkey = 0; // ale970302
-
+ bibkey = 0; // ale970302
+
clear();
}
: pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this, same_ids))
{
for (int i = 0; i < 10; ++i)
- setCounter(i , 0);
+ setCounter(i, 0);
enumdepth = 0;
itemdepth = 0;
- next_ = 0;
+ next_ = 0;
previous_ = 0;
// this is because of the dummy layout of the paragraphs that
// follow footnotes
layout = lp.layout;
- // ale970302
+ // ale970302
if (lp.bibkey) {
bibkey = static_cast<InsetBibKey *>
(lp.bibkey->clone(*current_view->buffer()));
}
// copy everything behind the break-position to the new paragraph
-
insetlist = lp.insetlist;
for (InsetList::iterator it = insetlist.begin();
it != insetlist.end(); ++it)
delete it->inset;
}
- // ale970302
+ // ale970302
delete bibkey;
delete pimpl_;
// then the insets
LyXLayout const & layout =
- textclasslist.Style(bparams.textclass,
- getLayout());
+ textclasslist.Style(bparams.textclass, getLayout());
for (InsetList::const_iterator cit = insetlist.begin();
cit != insetlist.end(); ++cit) {
// Gets uninstantiated font setting at position 0
LyXFont const Paragraph::getFirstFontSettings() const
{
- if (size() > 0) {
- if (!pimpl_->fontlist.empty())
- return pimpl_->fontlist[0].font();
- }
+ if (size() > 0 && !pimpl_->fontlist.empty())
+ return pimpl_->fontlist[0].font();
return LyXFont(LyXFont::ALL_INHERIT);
}
}
}
}
-
+
// Be carefull, this does not make any check at all.
// This method has wrong name, it combined this par with the next par.
{
// copy the next paragraph to this one
Paragraph * the_next = next();
-
+
// first the DTP-stuff
params().lineBottom(the_next->params().lineBottom());
params().spaceBottom(the_next->params().spaceBottom());
if (insertFromMinibuffer(pos_insert + j))
++j;
}
-
+
// delete the next paragraph
Paragraph * ppar = the_next->previous_;
Paragraph * npar = the_next->next_;
Paragraph const * par = this;
depth_type par_depth = getDepth();
while (par) {
- Paragraph::layout_type layout = par->getLayout();
+ layout_type layout = par->getLayout();
int const endlabeltype =
textclasslist.Style(bparams.textclass,
layout).endlabeltype;
Paragraph * Paragraph::depthHook(depth_type depth)
{
Paragraph * newpar = this;
-
+
do {
newpar = newpar->previous();
} while (newpar && newpar->getDepth() > depth);
-
+
if (!newpar) {
if (previous() || getDepth())
lyxerr << "ERROR (Paragraph::DepthHook): "
Paragraph const * Paragraph::depthHook(depth_type depth) const
{
Paragraph const * newpar = this;
-
+
do {
newpar = newpar->previous();
} while (newpar && newpar->getDepth() > depth);
-
+
if (!newpar) {
if (previous() || getDepth())
lyxerr << "ERROR (Paragraph::DepthHook): "
os << params().spaceTop().asLatexCommand(bparams);
further_blank_line = true;
}
-
+
if (params().lineTop()) {
os << "\\lyxline{\\" << getFont(bparams, 0).latexSize() << '}'
<< "\\vspace{-1\\parskip}";
switch (style.latextype) {
case LATEX_ITEM_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT:
- if (next_ && (params().depth() < next_->params().depth())) {
- os << '\n';
- texrow.newline();
- }
+ if (next_ && (params().depth() < next_->params().depth())) {
+ os << '\n';
+ texrow.newline();
+ }
break;
case LATEX_ENVIRONMENT:
// if its the last paragraph of the current environment
&& (next_->layout != layout
|| next_->params().depth() != params().depth()))
break;
+ // fall through possible
default:
// we don't need it for the last paragraph!!!
if (next_) {
os << params().spaceBottom().asLatexCommand(bparams);
further_blank_line = true;
}
-
+
if (params().pagebreakBottom()) {
os << "\\newpage";
further_blank_line = true;
}
-Paragraph::pos_type Paragraph::size() const
+lyx::pos_type Paragraph::size() const
{
return pimpl_->size();
}
}
-Paragraph::layout_type Paragraph::getLayout() const
+layout_type Paragraph::getLayout() const
{
return layout;
}
typedef char value_type;
/// The same as ParameterStruct::depth_type
typedef unsigned int depth_type;
- /// a position in the paragraph
- typedef lyx::pos_type pos_type;
- /// a layout number
- typedef lyx::layout_type layout_type;
///
Paragraph();
///
string const asString(Buffer const *, bool label);
///
- string const asString(Buffer const *, pos_type beg, pos_type end,
+ string const asString(Buffer const *, lyx::pos_type beg, lyx::pos_type end,
bool label);
///
void resizeInsetsLyXText(BufferView *);
///
- pos_type size() const;
+ lyx::pos_type size() const;
///
void setContentsFromPar(Paragraph * par);
///
void clearContents();
///
- layout_type layout;
+ lyx::layout_type layout;
///
void setCounter(int i, int v);
///
void setLabelWidthString(string const & s);
///
- layout_type getLayout() const;
+ lyx::layout_type getLayout() const;
///
char getAlign() const;
///
depth_type getDepth() const;
///
- void setLayout(layout_type new_layout);
+ void setLayout(lyx::layout_type new_layout);
///
- void setOnlyLayout(layout_type new_layout);
+ void setOnlyLayout(lyx::layout_type new_layout);
///
int getFirstCounter(int i) const;
///
- void erase(pos_type pos);
+ void erase(lyx::pos_type pos);
/** the flag determines wether the layout should be copied
*/
- void breakParagraph(BufferParams const &, pos_type pos, int flag);
+ void breakParagraph(BufferParams const &, lyx::pos_type pos, int flag);
///
- void breakParagraphConservative(BufferParams const &, pos_type pos);
+ void breakParagraphConservative(BufferParams const &, lyx::pos_type pos);
/** Get unistantiated font setting. Returns the difference
between the characters font and the layoutfont.
This is what is stored in the fonttable
*/
LyXFont const
- getFontSettings(BufferParams const &, pos_type pos) const;
+ getFontSettings(BufferParams const &, lyx::pos_type pos) const;
///
LyXFont const getFirstFontSettings() const;
attributes with values LyXFont::INHERIT, LyXFont::IGNORE or
LyXFont::TOGGLE.
*/
- LyXFont const getFont(BufferParams const &, pos_type pos) const;
+ LyXFont const getFont(BufferParams const &, lyx::pos_type pos) const;
LyXFont const getLayoutFont(BufferParams const &) const;
LyXFont const getLabelFont(BufferParams const &) const;
///
- value_type getChar(pos_type pos) const;
+ value_type getChar(lyx::pos_type pos) const;
///
- value_type getUChar(BufferParams const &, pos_type pos) const;
+ value_type getUChar(BufferParams const &, lyx::pos_type pos) const;
/// The position must already exist.
- void setChar(pos_type pos, value_type c);
+ void setChar(lyx::pos_type pos, value_type c);
///
- void setFont(pos_type pos, LyXFont const & font);
+ void setFont(lyx::pos_type pos, LyXFont const & font);
/// Returns the height of the highest font in range
- LyXFont::FONT_SIZE highestFontInRange(pos_type startpos,
- pos_type endpos,
+ LyXFont::FONT_SIZE highestFontInRange(lyx::pos_type startpos,
+ lyx::pos_type endpos,
LyXFont::FONT_SIZE const def_size) const;
///
- void insertChar(pos_type pos, value_type c);
+ void insertChar(lyx::pos_type pos, value_type c);
///
- void insertChar(pos_type pos, value_type c, LyXFont const &);
+ void insertChar(lyx::pos_type pos, value_type c, LyXFont const &);
///
bool checkInsertChar(LyXFont &);
///
- void insertInset(pos_type pos, Inset * inset);
+ void insertInset(lyx::pos_type pos, Inset * inset);
///
- void insertInset(pos_type pos, Inset * inset, LyXFont const &);
+ void insertInset(lyx::pos_type pos, Inset * inset, LyXFont const &);
///
bool insetAllowed(Inset::Code code);
///
- Inset * getInset(pos_type pos);
+ Inset * getInset(lyx::pos_type pos);
///
- Inset const * getInset(pos_type pos) const;
+ Inset const * getInset(lyx::pos_type pos) const;
/** important for cut and paste
Temporary change from BufferParams to Buffer. Will revert when we
get rid of the argument to Inset::clone(Buffer const &) */
- void copyIntoMinibuffer(Buffer const &, pos_type pos) const;
+ void copyIntoMinibuffer(Buffer const &, lyx::pos_type pos) const;
///
- void cutIntoMinibuffer(BufferParams const &, pos_type pos);
+ void cutIntoMinibuffer(BufferParams const &, lyx::pos_type pos);
///
- bool insertFromMinibuffer(pos_type pos);
+ bool insertFromMinibuffer(lyx::pos_type pos);
///
- bool isHfill(pos_type pos) const;
+ bool isHfill(lyx::pos_type pos) const;
///
- bool isInset(pos_type pos) const;
+ bool isInset(lyx::pos_type pos) const;
///
- bool isNewline(pos_type pos) const;
+ bool isNewline(lyx::pos_type pos) const;
///
- bool isSeparator(pos_type pos) const;
+ bool isSeparator(lyx::pos_type pos) const;
///
- bool isLineSeparator(pos_type pos) const;
+ bool isLineSeparator(lyx::pos_type pos) const;
///
- bool isKomma(pos_type pos) const;
+ bool isKomma(lyx::pos_type pos) const;
/// Used by the spellchecker
- bool isLetter(pos_type pos) const;
+ bool isLetter(lyx::pos_type pos) const;
///
- bool isWord(pos_type pos) const;
+ bool isWord(lyx::pos_type pos) const;
/** This one resets all layout and dtp switches but not the font
of the single characters
///
struct InsetTable {
///
- pos_type pos;
+ lyx::pos_type pos;
///
Inset * inset;
///
- InsetTable(pos_type p, Inset * i) : pos(p), inset(i) {}
+ InsetTable(lyx::pos_type p, Inset * i) : pos(p), inset(i) {}
};
///
///
Inset * operator*() { return it->inset; }
///
- pos_type getPos() const { return it->pos; }
+ lyx::pos_type getPos() const { return it->pos; }
///
bool operator==(inset_iterator const & iter) const {
return it == iter.it;
///
inset_iterator inset_iterator_end();
///
- inset_iterator InsetIterator(pos_type pos);
+ inset_iterator InsetIterator(lyx::pos_type pos);
private:
/// if anything uses this we don't want it to.
#include "debug.h"
#include "support/LAssert.h"
+using lyx::pos_type;
+
extern int tex_code_break_column;
/// Copy constructor
Pimpl(Pimpl const &, Paragraph * owner, bool same_ids = false);
///
- pos_type size() const {
+ lyx::pos_type size() const {
return text.size();
}
///
///
void setContentsFromPar(Paragraph const * par);
///
- value_type getChar(pos_type pos) const;
+ value_type getChar(lyx::pos_type pos) const;
///
- void setChar(pos_type pos, value_type c);
+ void setChar(lyx::pos_type pos, value_type c);
///
- void insertChar(pos_type pos, value_type c, LyXFont const & font);
+ void insertChar(lyx::pos_type pos, value_type c, LyXFont const & font);
///
- void insertInset(pos_type pos, Inset * inset, LyXFont const & font);
+ void insertInset(lyx::pos_type pos, Inset * inset, LyXFont const & font);
///
- void erase(pos_type pos);
+ void erase(lyx::pos_type pos);
///
LyXFont const realizeFont(LyXFont const & font,
BufferParams const & bparams) const;
*/
struct FontTable {
///
- FontTable(pos_type p, LyXFont const & f)
+ FontTable(lyx::pos_type p, LyXFont const & f)
: pos_(p)
{
font_ = container.get(f);
}
///
- pos_type pos() const { return pos_; }
+ lyx::pos_type pos() const { return pos_; }
///
- void pos(pos_type p) { pos_ = p; }
+ void pos(lyx::pos_type p) { pos_ = p; }
///
LyXFont const & font() const { return *font_; }
///
void font(LyXFont const & f) { font_ = container.get(f);}
private:
/// End position of paragraph this font attribute covers
- pos_type pos_;
+ lyx::pos_type pos_;
/** 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
std::ostream &, TexRow & texrow);
///
void simpleTeXBlanks(std::ostream &, TexRow & texrow,
- pos_type const i,
+ lyx::pos_type const i,
int & column, LyXFont const & font,
LyXLayout const & style);
///
LyXFont & font, LyXFont & running_font,
LyXFont & basefont, bool & open_font,
LyXLayout const & style,
- pos_type & i,
+ lyx::pos_type & i,
int & column, value_type const c);
///
Paragraph * getParFromID(int id) const;
ParagraphParameters params;
private:
/// match a string against a particular point in the paragraph
- bool isTextAt(string const & str, pos_type pos);
+ bool isTextAt(string const & str, lyx::pos_type pos);
/// Who owns us?
Paragraph * owner_;
using std::min;
using std::endl;
using std::pair;
+using lyx::pos_type;
namespace {
// Returns the paragraph position of the last character in the specified row
-LyXText::pos_type LyXText::rowLast(Row const * row) const
+pos_type LyXText::rowLast(Row const * row) const
{
if (row->next() == 0)
return row->par()->size() - 1;
}
-LyXText::pos_type LyXText::rowLastPrintable(Row const * row) const
+pos_type LyXText::rowLastPrintable(Row const * row) const
{
pos_type const last = rowLast(row);
if (last >= row->pos()
// get the next breakpoint in a given paragraph
-LyXText::pos_type
+pos_type
LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
{
Paragraph * par = row->par();
pos_type const pos = row->pos();
-
// position of the last possible breakpoint
// -1 isn't a suitable value, but a flag
pos_type last_separator = -1;
/* returns the column near the specified x-coordinate of the row
* x is set to the real beginning of this column */
-LyXText::pos_type
+pos_type
LyXText::getColumnNearX(BufferView * bview, Row * row, int & x,
bool & boundary) const
{
using std::endl;
using std::find;
using std::pair;
+using lyx::pos_type;
LyXText::LyXText(BufferView * bv)
Paragraph * LyXText::setLayout(BufferView * bview,
LyXCursor & cur, LyXCursor & sstart_cur,
LyXCursor & send_cur,
- layout_type layout)
+ lyx::layout_type layout)
{
Paragraph * endpar = send_cur.par()->next();
Paragraph * undoendpar = endpar;
// set layout over selection and make a total rebreak of those paragraphs
-void LyXText::setLayout(BufferView * bview, layout_type layout)
+void LyXText::setLayout(BufferView * bview, lyx::layout_type layout)
{
LyXCursor tmpcursor = cursor; /* store the current cursor */
}
-LyXText::pos_type LyXText::beginningOfMainBody(Buffer const * buf,
+pos_type LyXText::beginningOfMainBody(Buffer const * buf,
Paragraph const * par) const
{
if (textclasslist.Style(buf->params.textclass,