Reindent files with tab-stops (instead of 4 spaces). It is allowed to change

now the indent in files owned by myself to tabstops if I did miss some!
(but please set your tab-width to 4 ;)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1872 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-04-02 14:02:58 +00:00
parent 9a75180e35
commit 63d5070bc3
9 changed files with 3985 additions and 4009 deletions

View File

@ -24,9 +24,9 @@ src/frontends/controllers/ControlInclude.C
src/frontends/controllers/ControlPreamble.C
src/frontends/controllers/ControlPrint.C
src/frontends/controllers/ControlSearch.C
src/frontends/controllers/ControlToc.C
src/frontends/controllers/helper_funcs.C
src/frontends/gnome/FormCitation.C
src/frontends/gnome/FormCopyright.C
src/frontends/gnome/FormError.C
src/frontends/gnome/FormIndex.C
src/frontends/gnome/FormPrint.C

View File

@ -34,199 +34,198 @@ using std::max;
InsetCollapsable::InsetCollapsable()
: UpdatableInset()
{
inset.setOwner(this);
collapsed = false;
label = "Label";
autocollapse = true;
inset.SetAutoBreakRows(true);
inset.SetDrawFrame(0, InsetText::ALWAYS);
inset.SetFrameColor(0, LColor::footnoteframe);
button_length = button_top_y = button_bottom_y = 0;
setInsetName("Collapsable");
widthCollapsed = oldWidth = 0;
need_update = FULL;
inset.setOwner(this);
collapsed = false;
label = "Label";
autocollapse = true;
inset.SetAutoBreakRows(true);
inset.SetDrawFrame(0, InsetText::ALWAYS);
inset.SetFrameColor(0, LColor::footnoteframe);
button_length = button_top_y = button_bottom_y = 0;
setInsetName("Collapsable");
widthCollapsed = oldWidth = 0;
need_update = FULL;
}
Inset * InsetCollapsable::Clone(Buffer const &) const
{
InsetCollapsable * result = new InsetCollapsable();
result->inset.init(&inset);
result->inset.setOwner(result);
InsetCollapsable * result = new InsetCollapsable();
result->inset.init(&inset);
result->inset.setOwner(result);
result->collapsed = collapsed;
return result;
result->collapsed = collapsed;
return result;
}
bool InsetCollapsable::InsertInset(BufferView * bv, Inset * in)
{
if (!InsertInsetAllowed(in)) {
lyxerr << "InsetCollapsable::InsertInset: "
"Unable to insert inset." << endl;
return false;
}
return inset.InsertInset(bv, in);
if (!InsertInsetAllowed(in)) {
lyxerr << "InsetCollapsable::InsertInset: "
"Unable to insert inset." << endl;
return false;
}
return inset.InsertInset(bv, in);
}
void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
{
os << "collapsed " << tostr(collapsed) << "\n";
inset.WriteParagraphData(buf, os);
os << "collapsed " << tostr(collapsed) << "\n";
inset.WriteParagraphData(buf, os);
}
void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
{
if (lex.IsOK()) {
lex.next();
string const token = lex.GetString();
if (token == "collapsed") {
lex.next();
collapsed = lex.GetBool();
} else {
lyxerr << "InsetCollapsable::Read: Missing collapsed!"
<< endl;
if (lex.IsOK()) {
lex.next();
string const token = lex.GetString();
if (token == "collapsed") {
lex.next();
collapsed = lex.GetBool();
} else {
lyxerr << "InsetCollapsable::Read: Missing collapsed!"
<< endl;
}
}
}
inset.Read(buf, lex);
inset.Read(buf, lex);
}
int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
{
int width = 0;
int ascent = 0;
int descent = 0;
pain.buttonText(0, 0, label, labelfont, false,
width, ascent, descent);
return ascent;
int width = 0;
int ascent = 0;
int descent = 0;
pain.buttonText(0, 0, label, labelfont, false,
width, ascent, descent);
return ascent;
}
int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
{
int width = 0;
int ascent = 0;
int descent = 0;
pain.buttonText(0, 0, label, labelfont, false,
width, ascent, descent);
return descent;
int width = 0;
int ascent = 0;
int descent = 0;
pain.buttonText(0, 0, label, labelfont, false,
width, ascent, descent);
return descent;
}
int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const
{
int width;
int ascent;
int descent;
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false,
width, ascent, descent);
return width + (2*TEXT_TO_INSET_OFFSET);
int width;
int ascent;
int descent;
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false,
width, ascent, descent);
return width + (2*TEXT_TO_INSET_OFFSET);
}
int InsetCollapsable::ascent(BufferView * bv, LyXFont const & font) const
{
return ascent_collapsed(bv->painter(), font);
return ascent_collapsed(bv->painter(), font);
}
int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
{
if (collapsed)
return descent_collapsed(bv->painter(), font);
if (collapsed)
return descent_collapsed(bv->painter(), font);
return descent_collapsed(bv->painter(), font) + inset.descent(bv, font) +
inset.ascent(bv, font) + TEXT_TO_BOTTOM_OFFSET;
return descent_collapsed(bv->painter(), font) + inset.descent(bv, font) +
inset.ascent(bv, font) + TEXT_TO_BOTTOM_OFFSET;
}
int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
{
if (collapsed)
return widthCollapsed;
if (collapsed)
return widthCollapsed;
return (inset.width(bv, font) > widthCollapsed) ?
inset.width(bv, font) : widthCollapsed;
return (inset.width(bv, font) > widthCollapsed) ?
inset.width(bv, font) : widthCollapsed;
}
void InsetCollapsable::draw_collapsed(Painter & pain, LyXFont const &,
int baseline, float & x) const
int baseline, float & x) const
{
int width = 0;
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
baseline, label, labelfont, true, width);
x += width + TEXT_TO_INSET_OFFSET;
int width = 0;
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
baseline, label, labelfont, true, width);
x += width + TEXT_TO_INSET_OFFSET;
}
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const
int baseline, float & x, bool cleared) const
{
Painter & pain = bv->painter();
Painter & pain = bv->painter();
button_length = widthCollapsed;
button_top_y = -ascent(bv, f);
button_bottom_y = -ascent(bv, f) + ascent_collapsed(pain,f) +
button_length = widthCollapsed;
button_top_y = -ascent(bv, f);
button_bottom_y = -ascent(bv, f) + ascent_collapsed(pain,f) +
descent_collapsed(pain, f);
if (collapsed) {
draw_collapsed(pain, f, baseline, x);
x += TEXT_TO_INSET_OFFSET;
return;
}
if (collapsed) {
draw_collapsed(pain, f, baseline, x);
x += TEXT_TO_INSET_OFFSET;
return;
}
if (!cleared && ((inset.need_update == InsetText::FULL) ||
(inset.need_update == InsetText::INIT) ||
(top_x != int(x)) || (top_baseline != baseline))) {
int w = owner() ? width(bv, f) : pain.paperWidth();
int h = ascent(bv, f) + descent(bv, f);
int tx = (needFullRow() && !owner()) ? 0 : int(x);
int ty = max(0, baseline - ascent(bv, f));
if (!cleared && ((inset.need_update == InsetText::FULL) ||
(inset.need_update == InsetText::INIT) ||
(top_x != int(x)) || (top_baseline != baseline))) {
int w = owner() ? width(bv, f) : pain.paperWidth();
int h = ascent(bv, f) + descent(bv, f);
int tx = (needFullRow() && !owner()) ? 0 : int(x);
int ty = max(0, baseline - ascent(bv, f));
if ((ty + h) > pain.paperHeight())
h = pain.paperHeight();
if ((top_x + w) > pain.paperWidth())
w = pain.paperWidth();
if (baseline < 0)
h += (baseline - ascent(bv, f));
pain.fillRectangle(tx, ty - 1, w, h + 2);
cleared = true;
}
if ((ty + h) > pain.paperHeight())
h = pain.paperHeight();
if ((top_x + w) > pain.paperWidth())
w = pain.paperWidth();
if (baseline < 0)
h += (baseline - ascent(bv, f));
pain.fillRectangle(tx, ty - 1, w, h + 2);
cleared = true;
}
top_x = int(x);
top_baseline = baseline;
top_x = int(x);
top_baseline = baseline;
float dummy = x;
int bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f);
float dummy = x;
int bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f);
draw_collapsed(pain, f, bl, dummy);
inset.draw(bv, f,
bl + descent_collapsed(pain, f) + inset.ascent(bv, f),
x, cleared);
need_update = NONE;
draw_collapsed(pain, f, bl, dummy);
inset.draw(bv, f,
bl + descent_collapsed(pain, f) + inset.ascent(bv, f),
x, cleared);
need_update = NONE;
}
void InsetCollapsable::Edit(BufferView * bv, int xp, int yp, unsigned int button)
{
UpdatableInset::Edit(bv, xp, yp, button);
UpdatableInset::Edit(bv, xp, yp, button);
if (collapsed && autocollapse) {
collapsed = false;
if (!bv->lockInset(this))
return;
bv->updateInset(this, false);
inset.Edit(bv, 0, 0, button);
} else if (!collapsed) {
if (!bv->lockInset(this))
return;
inset.Edit(bv, xp, yp+(top_baseline - inset.y()), button);
}
if (collapsed && autocollapse) {
collapsed = false;
if (!bv->lockInset(this))
return;
bv->updateInset(this, false);
inset.Edit(bv, 0, 0, button);
} else if (!collapsed) {
if (!bv->lockInset(this))
return;
inset.Edit(bv, xp, yp+(top_baseline - inset.y()), button);
}
}
@ -240,107 +239,107 @@ Inset::EDITABLE InsetCollapsable::Editable() const
void InsetCollapsable::InsetUnlock(BufferView * bv)
{
if (autocollapse) {
collapsed = true;
}
inset.InsetUnlock(bv);
bv->updateInset(this, false);
if (autocollapse) {
collapsed = true;
}
inset.InsetUnlock(bv);
bv->updateInset(this, false);
}
void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button)
{
if (!collapsed && (y > button_bottom_y)) {
inset.InsetButtonPress(bv, x, y+(top_baseline - inset.y()), button);
}
if (!collapsed && (y > button_bottom_y)) {
inset.InsetButtonPress(bv, x, y+(top_baseline - inset.y()), button);
}
}
void InsetCollapsable::InsetButtonRelease(BufferView * bv,
int x, int y, int button)
{
if ((x >= 0) && (x < button_length) &&
(y >= button_top_y) && (y <= button_bottom_y)) {
if (collapsed) {
collapsed = false;
inset.InsetButtonRelease(bv, 0, 0, button);
bv->updateInset(this, false);
} else {
collapsed = true;
bv->unlockInset(this);
bv->updateInset(this, false);
if ((x >= 0) && (x < button_length) &&
(y >= button_top_y) && (y <= button_bottom_y)) {
if (collapsed) {
collapsed = false;
inset.InsetButtonRelease(bv, 0, 0, button);
bv->updateInset(this, false);
} else {
collapsed = true;
bv->unlockInset(this);
bv->updateInset(this, false);
}
} else if (!collapsed && (y > button_top_y)) {
inset.InsetButtonRelease(bv, x, y+(top_baseline-inset.y()), button);
}
} else if (!collapsed && (y > button_top_y)) {
inset.InsetButtonRelease(bv, x, y+(top_baseline-inset.y()), button);
}
}
void InsetCollapsable::InsetMotionNotify(BufferView * bv,
int x, int y, int state)
{
if (x > button_bottom_y) {
inset.InsetMotionNotify(bv, x, y+(top_baseline - inset.y()), state);
}
if (x > button_bottom_y) {
inset.InsetMotionNotify(bv, x, y+(top_baseline - inset.y()), state);
}
}
void InsetCollapsable::InsetKeyPress(XKeyEvent * xke)
{
inset.InsetKeyPress(xke);
inset.InsetKeyPress(xke);
}
int InsetCollapsable::Latex(Buffer const * buf, ostream & os,
bool fragile, bool free_spc) const
bool fragile, bool free_spc) const
{
return inset.Latex(buf, os, fragile, free_spc);
return inset.Latex(buf, os, fragile, free_spc);
}
int InsetCollapsable::getMaxWidth(BufferView * bv,
UpdatableInset const * inset) const
{
int const w = UpdatableInset::getMaxWidth(bv, inset);
int const w = UpdatableInset::getMaxWidth(bv, inset);
if (w < 0) {
// What does a negative max width signify? (Lgb)
// Use the max width of the draw-area (Jug)
return w;
}
// should be at least 30 pixels !!!
return max(30, w - widthCollapsed);
if (w < 0) {
// What does a negative max width signify? (Lgb)
// Use the max width of the draw-area (Jug)
return w;
}
// should be at least 30 pixels !!!
return max(30, w - widthCollapsed);
}
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
bool reinit)
bool reinit)
{
if (reinit) {
need_update = FULL;
if (owner())
owner()->update(bv, font, true);
return;
}
if (!widthCollapsed) {
widthCollapsed = width_collapsed(bv->painter(), font);
inset.resizeLyXText(bv);
need_update = FULL;
if (owner()) {
owner()->update(bv, font);
if (reinit) {
need_update = FULL;
if (owner())
owner()->update(bv, font, true);
return;
}
}
if (oldWidth != width(bv, font)) {
oldWidth = width(bv, font);
inset.resizeLyXText(bv);
need_update = FULL;
if (owner()) {
owner()->update(bv, font);
return;
if (!widthCollapsed) {
widthCollapsed = width_collapsed(bv->painter(), font);
inset.resizeLyXText(bv);
need_update = FULL;
if (owner()) {
owner()->update(bv, font);
return;
}
}
}
inset.update(bv, font);
if (oldWidth != width(bv, font)) {
oldWidth = width(bv, font);
inset.resizeLyXText(bv);
need_update = FULL;
if (owner()) {
owner()->update(bv, font);
return;
}
}
inset.update(bv, font);
}
@ -348,110 +347,110 @@ UpdatableInset::RESULT
InsetCollapsable::LocalDispatch(BufferView * bv, kb_action action,
string const & arg)
{
UpdatableInset::RESULT result = inset.LocalDispatch(bv, action, arg);
if (result == FINISHED)
bv->unlockInset(this);
return result;
UpdatableInset::RESULT result = inset.LocalDispatch(bv, action, arg);
if (result == FINISHED)
bv->unlockInset(this);
return result;
}
bool InsetCollapsable::LockInsetInInset(BufferView * bv, UpdatableInset * in)
{
if (&inset == in)
return true;
return inset.LockInsetInInset(bv, in);
if (&inset == in)
return true;
return inset.LockInsetInInset(bv, in);
}
bool InsetCollapsable::UnlockInsetInInset(BufferView * bv, UpdatableInset * in,
bool lr)
{
if (&inset == in) {
bv->unlockInset(this);
return true;
}
return inset.UnlockInsetInInset(bv, in, lr);
if (&inset == in) {
bv->unlockInset(this);
return true;
}
return inset.UnlockInsetInInset(bv, in, lr);
}
bool InsetCollapsable::UpdateInsetInInset(BufferView * bv, Inset *in)
{
if (&inset == in)
return true;
return inset.UpdateInsetInInset(bv, in);
if (&inset == in)
return true;
return inset.UpdateInsetInInset(bv, in);
}
unsigned int InsetCollapsable::InsetInInsetY()
{
return inset.InsetInInsetY() - (top_baseline - inset.y());
return inset.InsetInInsetY() - (top_baseline - inset.y());
}
void InsetCollapsable::Validate(LaTeXFeatures & features) const
{
inset.Validate(features);
inset.Validate(features);
}
void InsetCollapsable::GetCursorPos(BufferView * bv, int & x, int & y) const
{
inset.GetCursorPos(bv, x , y);
inset.GetCursorPos(bv, x , y);
}
void InsetCollapsable::ToggleInsetCursor(BufferView * bv)
{
inset.ToggleInsetCursor(bv);
inset.ToggleInsetCursor(bv);
}
UpdatableInset * InsetCollapsable::GetLockingInset()
{
UpdatableInset * in = inset.GetLockingInset();
if (&inset == in)
return this;
return in;
UpdatableInset * in = inset.GetLockingInset();
if (&inset == in)
return this;
return in;
}
UpdatableInset * InsetCollapsable::GetFirstLockingInsetOfType(Inset::Code c)
{
if (c == LyxCode())
return this;
return inset.GetFirstLockingInsetOfType(c);
if (c == LyxCode())
return this;
return inset.GetFirstLockingInsetOfType(c);
}
void InsetCollapsable::SetFont(BufferView * bv,
LyXFont const & font, bool toggleall)
LyXFont const & font, bool toggleall)
{
inset.SetFont(bv, font, toggleall);
inset.SetFont(bv, font, toggleall);
}
bool InsetCollapsable::doClearArea() const
{
return inset.doClearArea();
return inset.doClearArea();
}
LyXText * InsetCollapsable::getLyXText(BufferView const * bv,
bool const recursive) const
bool const recursive) const
{
return inset.getLyXText(bv, recursive);
return inset.getLyXText(bv, recursive);
}
void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
{
inset.deleteLyXText(bv, recursive);
inset.deleteLyXText(bv, recursive);
}
void InsetCollapsable::resizeLyXText(BufferView * bv) const
{
inset.resizeLyXText(bv);
LyXFont font(LyXFont::ALL_SANE);
oldWidth = width(bv, font);
inset.resizeLyXText(bv);
LyXFont font(LyXFont::ALL_SANE);
oldWidth = width(bv, font);
}

View File

@ -33,146 +33,146 @@ class LyXText;
*/
class InsetCollapsable : public UpdatableInset {
public:
///
enum UpdateCodes {
///
enum UpdateCodes {
NONE = 0,
FULL
};
///
static int const TEXT_TO_TOP_OFFSET = 2;
///
static int const TEXT_TO_BOTTOM_OFFSET = 2;
///
InsetCollapsable();
///
Inset * Clone(Buffer const &) const;
///
void Read(Buffer const *, LyXLex &);
///
void Write(Buffer const *, std::ostream &) const;
///
int ascent(BufferView *, LyXFont const &) const;
///
int descent(BufferView *, LyXFont const &) const;
///
int width(BufferView *, LyXFont const & f) const;
///
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
///
void update(BufferView *, LyXFont const &, bool =false);
///
void Edit(BufferView *, int, int, unsigned int);
///
EDITABLE Editable() const;
///
bool InsertInset(BufferView *, Inset * inset);
///
bool IsTextInset() const { return true; }
///
bool doClearArea() const;
///
void InsetUnlock(BufferView *);
///
bool needFullRow() const { return !collapsed; }
///
bool LockInsetInInset(BufferView *, UpdatableInset *);
///
bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false);
///
bool UpdateInsetInInset(BufferView *, Inset *);
///
unsigned int InsetInInsetY();
///
void InsetButtonRelease(BufferView *, int, int, int);
///
void InsetButtonPress(BufferView *, int, int, int);
///
void InsetMotionNotify(BufferView *, int, int, int);
///
void InsetKeyPress(XKeyEvent *);
///
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action,
};
///
static int const TEXT_TO_TOP_OFFSET = 2;
///
static int const TEXT_TO_BOTTOM_OFFSET = 2;
///
InsetCollapsable();
///
Inset * Clone(Buffer const &) const;
///
void Read(Buffer const *, LyXLex &);
///
void Write(Buffer const *, std::ostream &) const;
///
int ascent(BufferView *, LyXFont const &) const;
///
int descent(BufferView *, LyXFont const &) const;
///
int width(BufferView *, LyXFont const & f) const;
///
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
///
void update(BufferView *, LyXFont const &, bool =false);
///
void Edit(BufferView *, int, int, unsigned int);
///
EDITABLE Editable() const;
///
bool InsertInset(BufferView *, Inset * inset);
///
bool IsTextInset() const { return true; }
///
bool doClearArea() const;
///
void InsetUnlock(BufferView *);
///
bool needFullRow() const { return !collapsed; }
///
bool LockInsetInInset(BufferView *, UpdatableInset *);
///
bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false);
///
bool UpdateInsetInInset(BufferView *, Inset *);
///
unsigned int InsetInInsetY();
///
void InsetButtonRelease(BufferView *, int, int, int);
///
void InsetButtonPress(BufferView *, int, int, int);
///
void InsetMotionNotify(BufferView *, int, int, int);
///
void InsetKeyPress(XKeyEvent *);
///
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action,
string const &);
///
int Latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
///
int Ascii(Buffer const *, std::ostream &, int) const { return 0; }
///
int Linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///
int DocBook(Buffer const *, std::ostream &) const { return 0; }
///
void Validate(LaTeXFeatures & features) const;
///
void GetCursorPos(BufferView *, int & x, int & y) const;
///
void ToggleInsetCursor(BufferView *);
///
UpdatableInset * GetLockingInset();
///
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
void setLabel(string const & l) { label = l; }
///
void setLabelFont(LyXFont & f) { labelfont = f; }
///
void setAutoCollapse(bool f) { autocollapse = f; }
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
LyXText * getLyXText(BufferView const *, bool const recursive) const;
///
void deleteLyXText(BufferView *, bool recursive=true) const;
///
void resizeLyXText(BufferView *) const;
///
int Latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
///
int Ascii(Buffer const *, std::ostream &, int) const { return 0; }
///
int Linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///
int DocBook(Buffer const *, std::ostream &) const { return 0; }
///
void Validate(LaTeXFeatures & features) const;
///
void GetCursorPos(BufferView *, int & x, int & y) const;
///
void ToggleInsetCursor(BufferView *);
///
UpdatableInset * GetLockingInset();
///
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
void setLabel(string const & l) { label = l; }
///
void setLabelFont(LyXFont & f) { labelfont = f; }
///
void setAutoCollapse(bool f) { autocollapse = f; }
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
LyXText * getLyXText(BufferView const *, bool const recursive) const;
///
void deleteLyXText(BufferView *, bool recursive=true) const;
///
void resizeLyXText(BufferView *) const;
protected:
///
int ascent_collapsed(Painter &, LyXFont const &) const;
///
int descent_collapsed(Painter &, LyXFont const &) const;
///
int width_collapsed(Painter &, LyXFont const & f) const;
///
void draw_collapsed(Painter & pain, const LyXFont &, int , float &) const;
///
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
///
int ascent_collapsed(Painter &, LyXFont const &) const;
///
int descent_collapsed(Painter &, LyXFont const &) const;
///
int width_collapsed(Painter &, LyXFont const & f) const;
///
void draw_collapsed(Painter & pain, const LyXFont &, int , float &) const;
///
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
///
bool collapsed;
///
LColor::color framecolor;
///
LyXFont labelfont;
///
bool collapsed;
///
LColor::color framecolor;
///
LyXFont labelfont;
#ifdef NEW_INSETS
public:
#endif
///
InsetText inset;
///
InsetText inset;
protected:
///
mutable int button_length;
///
mutable int button_top_y;
///
mutable int button_bottom_y;
///
mutable int button_length;
///
mutable int button_top_y;
///
mutable int button_bottom_y;
private:
///
string label;
///
bool autocollapse;
///
int widthCollapsed;
///
mutable int oldWidth;
///
mutable int topx;
mutable int topbaseline;
mutable UpdateCodes need_update;
///
string label;
///
bool autocollapse;
///
int widthCollapsed;
///
mutable int oldWidth;
///
mutable int topx;
mutable int topbaseline;
mutable UpdateCodes need_update;
};
#endif

View File

@ -25,52 +25,52 @@ using std::ostream;
InsetERT::InsetERT() : InsetCollapsable()
{
setLabel(_("ERT"));
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
labelfont = LyXFont(LyXFont::ALL_SANE);
labelfont.decSize();
labelfont.decSize();
labelfont.setColor(LColor::ert);
setAutoCollapse(false);
setInsetName("ERT");
setLabel(_("ERT"));
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
labelfont = LyXFont(LyXFont::ALL_SANE);
labelfont.decSize();
labelfont.decSize();
labelfont.setColor(LColor::ert);
setAutoCollapse(false);
setInsetName("ERT");
}
void InsetERT::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os);
os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os);
}
Inset * InsetERT::Clone(Buffer const &) const
{
InsetERT * result = new InsetERT;
result->inset.init(&inset);
InsetERT * result = new InsetERT;
result->inset.init(&inset);
result->collapsed = collapsed;
return result;
result->collapsed = collapsed;
return result;
}
string const InsetERT::EditMessage() const
{
return _("Opened ERT Inset");
return _("Opened ERT Inset");
}
void InsetERT::SetFont(BufferView *, LyXFont const &, bool)
{
WriteAlert(_("Impossible Operation!"),
_("Not permitted to change font-types inside ERT-insets!"),
_("Sorry."));
WriteAlert(_("Impossible Operation!"),
_("Not permitted to change font-types inside ERT-insets!"),
_("Sorry."));
}
void InsetERT::Edit(BufferView * bv, int x, int y, unsigned int button)
{
InsetCollapsable::Edit(bv, x, y, button);
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
InsetCollapsable::Edit(bv, x, y, button);
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
}

View File

@ -29,44 +29,44 @@ using std::ostream;
InsetFoot::InsetFoot()
: InsetFootlike()
{
setLabel(_("foot"));
setInsetName("Foot");
setLabel(_("foot"));
setInsetName("Foot");
}
Inset * InsetFoot::Clone(Buffer const &) const
{
InsetFoot * result = new InsetFoot;
result->inset.init(&inset);
InsetFoot * result = new InsetFoot;
result->inset.init(&inset);
result->collapsed = collapsed;
return result;
result->collapsed = collapsed;
return result;
}
string const InsetFoot::EditMessage() const
{
return _("Opened Footnote Inset");
return _("Opened Footnote Inset");
}
int InsetFoot::Latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
os << "\\footnote{%\n";
os << "\\footnote{%\n";
int const i = inset.Latex(buf, os, fragile, fp);
os << "}%\n";
int const i = inset.Latex(buf, os, fragile, fp);
os << "}%\n";
return i + 2;
return i + 2;
}
bool InsetFoot::InsertInsetAllowed(Inset * in) const
{
if ((in->LyxCode() == Inset::FOOT_CODE) ||
(in->LyxCode() == Inset::MARGIN_CODE)) {
return false;
}
return true;
if ((in->LyxCode() == Inset::FOOT_CODE) ||
(in->LyxCode() == Inset::MARGIN_CODE)) {
return false;
}
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -39,260 +39,260 @@ class LyXScreen;
*/
class InsetText : public UpdatableInset {
public:
///
/// numbers need because of test if codeA < codeB
///
enum UpdateCodes {
///
NONE = 0,
/// numbers need because of test if codeA < codeB
///
CURSOR = 1,
enum UpdateCodes {
///
NONE = 0,
///
CURSOR = 1,
///
CLEAR_FRAME = 2,
///
DRAW_FRAME = 4,
///
SELECTION = 8,
///
CURSOR_PAR = 16,
///
FULL = 32,
///
INIT = 64
};
///
CLEAR_FRAME = 2,
enum DrawFrame {
///
NEVER = 0,
///
LOCKED,
///
ALWAYS
};
///
DRAW_FRAME = 4,
InsetText();
///
SELECTION = 8,
explicit
InsetText(InsetText const &);
///
CURSOR_PAR = 16,
~InsetText();
///
FULL = 32,
Inset * Clone(Buffer const &) const;
///
INIT = 64
};
///
enum DrawFrame {
InsetText & operator=(InsetText const & it);
///
NEVER = 0,
void clear();
///
LOCKED,
void Read(Buffer const *, LyXLex &);
///
ALWAYS
};
///
InsetText();
///
explicit
InsetText(InsetText const &);
///
~InsetText();
///
Inset * Clone(Buffer const &) const;
///
InsetText & operator=(InsetText const & it);
///
void clear();
///
void Read(Buffer const *, LyXLex &);
///
void Write(Buffer const *, std::ostream &) const;
///
int ascent(BufferView *, LyXFont const &) const;
///
int descent(BufferView *, LyXFont const &) const;
///
int width(BufferView *, LyXFont const & f) const;
///
int textWidth(BufferView *) const;
///
void draw(BufferView *, LyXFont const &, int , float &, bool) const;
///
void update(BufferView *, LyXFont const &, bool =false);
///
void SetUpdateStatus(BufferView *, int what);
///
string const EditMessage() const;
///
void Edit(BufferView *, int, int, unsigned int);
///
bool IsTextInset() const { return true; }
///
bool doClearArea() const { return !locked; }
///
void InsetUnlock(BufferView *);
///
bool LockInsetInInset(BufferView *, UpdatableInset *);
///
bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false);
///
bool UpdateInsetInInset(BufferView *, Inset *);
///
void InsetButtonRelease(BufferView *, int, int, int);
///
void InsetButtonPress(BufferView *, int, int, int);
///
void InsetMotionNotify(BufferView *, int, int, int);
///
void InsetKeyPress(XKeyEvent *);
///
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action, string const &);
///
int Latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
///
int Ascii(Buffer const *, std::ostream &, int linelen) const;
///
int Linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///
int DocBook(Buffer const *, std::ostream &) const ;
///
void Validate(LaTeXFeatures & features) const;
///
Inset::Code LyxCode() const { return Inset::TEXT_CODE; }
///
void GetCursorPos(BufferView *, int & x, int & y) const;
///
unsigned int InsetInInsetY();
///
void ToggleInsetCursor(BufferView *);
///
bool InsertInset(BufferView *, Inset *);
///
UpdatableInset * GetLockingInset();
///
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
void init(InsetText const * ins = 0);
///
void WriteParagraphData(Buffer const *, std::ostream &) const;
///
void SetParagraphData(LyXParagraph *);
///
void SetText(string const &);
///
void SetAutoBreakRows(bool);
///
void SetDrawFrame(BufferView *, DrawFrame);
///
void SetFrameColor(BufferView *, LColor::color);
///
LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
///
void deleteLyXText(BufferView *, bool recursive=true) const;
///
void resizeLyXText(BufferView *) const;
///
bool ShowInsetDialog(BufferView *) const;
///
LyXParagraph * par;
///
mutable int need_update;
void Write(Buffer const *, std::ostream &) const;
///
int ascent(BufferView *, LyXFont const &) const;
///
int descent(BufferView *, LyXFont const &) const;
///
int width(BufferView *, LyXFont const & f) const;
///
int textWidth(BufferView *) const;
///
void draw(BufferView *, LyXFont const &, int , float &, bool) const;
///
void update(BufferView *, LyXFont const &, bool =false);
///
void SetUpdateStatus(BufferView *, int what);
///
string const EditMessage() const;
///
void Edit(BufferView *, int, int, unsigned int);
///
bool IsTextInset() const { return true; }
///
bool doClearArea() const { return !locked; }
///
void InsetUnlock(BufferView *);
///
bool LockInsetInInset(BufferView *, UpdatableInset *);
///
bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false);
///
bool UpdateInsetInInset(BufferView *, Inset *);
///
void InsetButtonRelease(BufferView *, int, int, int);
///
void InsetButtonPress(BufferView *, int, int, int);
///
void InsetMotionNotify(BufferView *, int, int, int);
///
void InsetKeyPress(XKeyEvent *);
///
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action, string const &);
///
int Latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
///
int Ascii(Buffer const *, std::ostream &, int linelen) const;
///
int Linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///
int DocBook(Buffer const *, std::ostream &) const ;
///
void Validate(LaTeXFeatures & features) const;
///
Inset::Code LyxCode() const { return Inset::TEXT_CODE; }
///
void GetCursorPos(BufferView *, int & x, int & y) const;
///
unsigned int InsetInInsetY();
///
void ToggleInsetCursor(BufferView *);
///
bool InsertInset(BufferView *, Inset *);
///
UpdatableInset * GetLockingInset();
///
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
void init(InsetText const * ins = 0);
///
void WriteParagraphData(Buffer const *, std::ostream &) const;
///
void SetParagraphData(LyXParagraph *);
///
void SetText(string const &);
///
void SetAutoBreakRows(bool);
///
void SetDrawFrame(BufferView *, DrawFrame);
///
void SetFrameColor(BufferView *, LColor::color);
///
LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
///
void deleteLyXText(BufferView *, bool recursive=true) const;
///
void resizeLyXText(BufferView *) const;
///
bool ShowInsetDialog(BufferView *) const;
///
LyXParagraph * par;
///
mutable int need_update;
protected:
///
void UpdateLocal(BufferView *, int what, bool mark_dirty);
///
mutable int drawTextXOffset;
///
mutable int drawTextYOffset;
///
bool autoBreakRows;
///
DrawFrame drawFrame;
///
LColor::color frame_color;
///
void UpdateLocal(BufferView *, int what, bool mark_dirty);
///
mutable int drawTextXOffset;
///
mutable int drawTextYOffset;
///
bool autoBreakRows;
///
DrawFrame drawFrame;
///
LColor::color frame_color;
private:
///
typedef std::map<BufferView *, LyXText *> Cache;
///
typedef Cache::value_type value_type;
///
int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
///
void ShowInsetCursor(BufferView *, bool show=true);
///
void HideInsetCursor(BufferView *);
///
UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true,
bool selecting = false);
///
UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true,
bool selecting = false);
///
UpdatableInset::RESULT moveRightIntern(BufferView *, bool behind,
bool activate_inset = true,
bool selecting = false);
///
UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind,
bool activate_inset = true,
bool selecting = false);
///
typedef std::map<BufferView *, LyXText *> Cache;
///
typedef Cache::value_type value_type;
///
int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
///
void ShowInsetCursor(BufferView *, bool show=true);
///
void HideInsetCursor(BufferView *);
///
UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true,
bool selecting = false);
///
UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true,
bool selecting = false);
///
UpdatableInset::RESULT moveRightIntern(BufferView *, bool behind,
bool activate_inset = true,
bool selecting = false);
///
UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind,
bool activate_inset = true,
bool selecting = false);
///
UpdatableInset::RESULT moveUp(BufferView *);
///
UpdatableInset::RESULT moveDown(BufferView *);
///
void SetCharFont(Buffer const *, int pos, LyXFont const & font);
///
string const getText(int);
///
bool checkAndActivateInset(BufferView * bv, bool behind);
///
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0);
void removeNewlines();
///
UpdatableInset::RESULT moveUp(BufferView *);
///
UpdatableInset::RESULT moveDown(BufferView *);
///
void SetCharFont(Buffer const *, int pos, LyXFont const & font);
///
string const getText(int);
///
bool checkAndActivateInset(BufferView * bv, bool behind);
///
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0);
void removeNewlines();
///
int cx(BufferView *) const;
///
int cy(BufferView *) const;
///
LyXParagraph::size_type cpos(BufferView *) const;
///
LyXParagraph * cpar(BufferView *) const;
///
bool cboundary(BufferView *) const;
///
Row * crow(BufferView *) const;
///
int cx(BufferView *) const;
///
int cy(BufferView *) const;
///
LyXParagraph::size_type cpos(BufferView *) const;
///
LyXParagraph * cpar(BufferView *) const;
///
bool cboundary(BufferView *) const;
///
Row * crow(BufferView *) const;
/// This instead of a macro
LyXText * TEXT(BufferView * bv) const {
return getLyXText(bv);
}
/// This instead of a macro
LyXText * TEXT(BufferView * bv) const {
return getLyXText(bv);
}
/* Private structures and variables */
///
mutable bool locked;
///
mutable int insetAscent;
///
mutable int insetDescent;
///
mutable int insetWidth;
///
mutable int last_width;
///
mutable int last_height;
///
mutable int top_y;
///
LyXParagraph * inset_par;
///
LyXParagraph::size_type inset_pos;
///
bool inset_boundary;
///
mutable int inset_x;
///
mutable int inset_y;
///
int interline_space;
///
bool no_selection;
///
mutable float xpos;
///
UpdatableInset * the_locking_inset;
///
LyXParagraph * old_par;
/// The cache.
mutable Cache cache;
///
mutable int last_drawn_width;
/* Private structures and variables */
///
mutable bool locked;
///
mutable int insetAscent;
///
mutable int insetDescent;
///
mutable int insetWidth;
///
mutable int last_width;
///
mutable int last_height;
///
mutable int top_y;
///
LyXParagraph * inset_par;
///
LyXParagraph::size_type inset_pos;
///
bool inset_boundary;
///
mutable int inset_x;
///
mutable int inset_y;
///
int interline_space;
///
bool no_selection;
///
mutable float xpos;
///
UpdatableInset * the_locking_inset;
///
LyXParagraph * old_par;
/// The cache.
mutable Cache cache;
///
mutable int last_drawn_width;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -32,485 +32,485 @@ class Buffer;
///
class LyXTabular {
public:
///
enum Feature {
///
APPEND_ROW = 0,
enum Feature {
///
APPEND_ROW = 0,
///
APPEND_COLUMN,
///
DELETE_ROW,
///
DELETE_COLUMN,
///
TOGGLE_LINE_TOP,
///
TOGGLE_LINE_BOTTOM,
///
TOGGLE_LINE_LEFT,
///
TOGGLE_LINE_RIGHT,
///
ALIGN_LEFT,
///
ALIGN_RIGHT,
///
ALIGN_CENTER,
///
VALIGN_TOP,
///
VALIGN_BOTTOM,
///
VALIGN_CENTER,
///
M_TOGGLE_LINE_TOP,
///
M_TOGGLE_LINE_BOTTOM,
///
M_TOGGLE_LINE_LEFT,
///
M_TOGGLE_LINE_RIGHT,
///
M_ALIGN_LEFT,
///
M_ALIGN_RIGHT,
///
M_ALIGN_CENTER,
///
M_VALIGN_TOP,
///
M_VALIGN_BOTTOM,
///
M_VALIGN_CENTER,
///
MULTICOLUMN,
///
SET_ALL_LINES,
///
UNSET_ALL_LINES,
///
SET_LONGTABULAR,
///
UNSET_LONGTABULAR,
///
SET_PWIDTH,
///
SET_MPWIDTH,
///
SET_ROTATE_TABULAR,
///
UNSET_ROTATE_TABULAR,
///
SET_ROTATE_CELL,
///
UNSET_ROTATE_CELL,
///
SET_USEBOX,
///
SET_LTHEAD,
///
SET_LTFIRSTHEAD,
///
SET_LTFOOT,
///
SET_LTLASTFOOT,
///
SET_LTNEWPAGE,
///
SET_SPECIAL_COLUMN,
///
SET_SPECIAL_MULTI,
///
LAST_ACTION
};
///
APPEND_COLUMN,
///
DELETE_ROW,
///
DELETE_COLUMN,
///
TOGGLE_LINE_TOP,
///
TOGGLE_LINE_BOTTOM,
///
TOGGLE_LINE_LEFT,
///
TOGGLE_LINE_RIGHT,
///
ALIGN_LEFT,
///
ALIGN_RIGHT,
///
ALIGN_CENTER,
///
VALIGN_TOP,
///
VALIGN_BOTTOM,
///
VALIGN_CENTER,
///
M_TOGGLE_LINE_TOP,
///
M_TOGGLE_LINE_BOTTOM,
///
M_TOGGLE_LINE_LEFT,
///
M_TOGGLE_LINE_RIGHT,
///
M_ALIGN_LEFT,
///
M_ALIGN_RIGHT,
///
M_ALIGN_CENTER,
///
M_VALIGN_TOP,
///
M_VALIGN_BOTTOM,
///
M_VALIGN_CENTER,
///
MULTICOLUMN,
///
SET_ALL_LINES,
///
UNSET_ALL_LINES,
///
SET_LONGTABULAR,
///
UNSET_LONGTABULAR,
///
SET_PWIDTH,
///
SET_MPWIDTH,
///
SET_ROTATE_TABULAR,
///
UNSET_ROTATE_TABULAR,
///
SET_ROTATE_CELL,
///
UNSET_ROTATE_CELL,
///
SET_USEBOX,
///
SET_LTHEAD,
///
SET_LTFIRSTHEAD,
///
SET_LTFOOT,
///
SET_LTLASTFOOT,
///
SET_LTNEWPAGE,
///
SET_SPECIAL_COLUMN,
///
SET_SPECIAL_MULTI,
///
LAST_ACTION
};
///
enum {
///
CELL_NORMAL = 0,
///
CELL_BEGIN_OF_MULTICOLUMN,
///
CELL_PART_OF_MULTICOLUMN
};
enum {
///
CELL_NORMAL = 0,
///
CELL_BEGIN_OF_MULTICOLUMN,
///
CELL_PART_OF_MULTICOLUMN
};
///
enum VAlignment {
///
LYX_VALIGN_TOP = 0,
enum VAlignment {
///
LYX_VALIGN_TOP = 0,
///
LYX_VALIGN_BOTTOM = 1,
///
LYX_VALIGN_CENTER = 2
};
enum BoxType {
///
BOX_NONE = 0,
///
BOX_PARBOX = 1,
///
BOX_MINIPAGE = 2
};
/* konstruktor */
///
LYX_VALIGN_BOTTOM = 1,
LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
///
LYX_VALIGN_CENTER = 2
};
enum BoxType {
LyXTabular(InsetTabular *, LyXTabular const &);
///
BOX_NONE = 0,
explicit
LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
///
BOX_PARBOX = 1,
LyXTabular & operator=(LyXTabular const &);
///
BOX_MINIPAGE = 2
};
LyXTabular * Clone(InsetTabular *);
/* konstruktor */
///
LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
///
LyXTabular(InsetTabular *, LyXTabular const &);
///
explicit
LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
///
LyXTabular & operator=(LyXTabular const &);
///
LyXTabular * Clone(InsetTabular *);
/// Returns true if there is a topline, returns false if not
bool TopLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not
bool BottomLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not
bool LeftLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not
bool RightLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not
bool TopLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not
bool BottomLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not
bool LeftLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not
bool RightLine(int cell, bool onlycolumn = false) const;
///
bool TopAlreadyDrawed(int cell) const;
///
bool LeftAlreadyDrawed(int cell) const;
///
bool IsLastRow(int cell) const;
///
bool TopAlreadyDrawed(int cell) const;
///
bool LeftAlreadyDrawed(int cell) const;
///
bool IsLastRow(int cell) const;
///
int GetAdditionalHeight(int cell) const;
///
int GetAdditionalWidth(int cell) const;
///
int GetAdditionalHeight(int cell) const;
///
int GetAdditionalWidth(int cell) const;
/* returns the maximum over all rows */
///
int GetWidthOfColumn(int cell) const;
///
int GetWidthOfTabular() const;
///
int GetAscentOfRow(int row) const;
///
int GetDescentOfRow(int row) const;
///
int GetHeightOfTabular() const;
/// Returns true if a complete update is necessary, otherwise false
bool SetAscentOfRow(int row, int height);
/// Returns true if a complete update is necessary, otherwise false
bool SetDescentOfRow(int row, int height);
/// Returns true if a complete update is necessary, otherwise false
bool SetWidthOfCell(int cell, int new_width);
/// Returns true if a complete update is necessary, otherwise false
bool SetAllLines(int cell, bool line);
/// Returns true if a complete update is necessary, otherwise false
bool SetTopLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false
bool SetBottomLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false
bool SetLeftLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false
bool SetRightLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false
bool SetAlignment(int cell, LyXAlignment align, bool onlycolumn = false);
/// Returns true if a complete update is necessary, otherwise false
bool SetVAlignment(int cell, VAlignment align, bool onlycolumn = false);
///
bool SetColumnPWidth(int cell, string const & width);
///
bool SetMColumnPWidth(int cell, string const & width);
///
bool SetAlignSpecial(int cell, string const & special, Feature what);
///
LyXAlignment GetAlignment(int cell, bool onlycolumn = false) const;
///
VAlignment GetVAlignment(int cell, bool onlycolumn = false) const;
///
string const GetPWidth(int cell) const;
///
string const GetColumnPWidth(int cell) const;
///
string const GetMColumnPWidth(int cell) const;
///
string const GetAlignSpecial(int cell, int what) const;
///
int GetWidthOfCell(int cell) const;
///
int GetBeginningOfTextInCell(int cell) const;
///
void AppendRow(int cell);
///
void DeleteRow(int row);
///
void AppendColumn(int cell);
///
void DeleteColumn(int column);
///
bool IsFirstCellInRow(int cell) const;
///
int GetFirstCellInRow(int row) const;
///
bool IsLastCellInRow(int cell) const;
///
int GetLastCellInRow(int row) const;
///
int GetNumberOfCells() const;
///
int NumberOfCellsInRow(int cell) const;
///
void Write(Buffer const *, std::ostream &) const;
///
void Read(Buffer const *, LyXLex &);
///
void OldFormatRead(LyXLex &, string const &);
//
// helper function for Latex returns number of newlines
///
int TeXTopHLine(std::ostream &, int row) const;
///
int TeXBottomHLine(std::ostream &, int row) const;
///
int TeXCellPreamble(std::ostream &, int cell) const;
///
int TeXCellPostamble(std::ostream &, int cell) const;
///
int Latex(Buffer const *, std::ostream &, bool, bool) const;
///
int DocBook(Buffer const * buf, std::ostream & os) const;
///
// helper function for Latex returns number of newlines
///
int AsciiTopHLine(std::ostream &, int row,
std::vector<unsigned int> const &) const;
///
int AsciiBottomHLine(std::ostream &, int row,
std::vector<unsigned int> const &) const;
///
int AsciiPrintCell(Buffer const *, std::ostream &, int cell, int row,
int column, std::vector<unsigned int> const &) const;
///
int Ascii(Buffer const *, std::ostream &) const;
///
bool IsMultiColumn(int cell, bool real = false) const;
///
void SetMultiColumn(int cell, int number);
///
int UnsetMultiColumn(int cell); // returns number of new cells
///
bool IsPartOfMultiColumn(int row, int column) const;
///
int row_of_cell(int cell) const;
///
int column_of_cell(int cell) const;
///
int right_column_of_cell(int cell) const;
///
void SetLongTabular(bool);
///
bool IsLongTabular() const;
///
void SetRotateTabular(bool);
///
bool GetRotateTabular() const;
///
void SetRotateCell(int cell, bool);
///
bool GetRotateCell(int cell) const;
///
bool NeedRotating() const;
///
bool IsLastCell(int cell) const;
///
int GetCellAbove(int cell) const;
///
int GetCellBelow(int cell) const;
///
int GetLastCellAbove(int cell) const;
///
int GetLastCellBelow(int cell) const;
///
int GetCellNumber(int row, int column) const;
///
void SetUsebox(int cell, BoxType);
///
BoxType GetUsebox(int cell) const;
//
// Long Tabular Options
///
void SetLTHead(int cell, bool first);
///
bool GetRowOfLTHead(int cell, int & row) const;
///
bool GetRowOfLTFirstHead(int cell, int & row) const;
///
void SetLTFoot(int cell, bool last);
///
bool GetRowOfLTFoot(int cell, int & row) const;
///
bool GetRowOfLTLastFoot(int cell, int & row) const;
///
void SetLTNewPage(int cell, bool what);
///
bool GetLTNewPage(int cell) const;
///
InsetText * GetCellInset(int cell) const;
///
InsetText * GetCellInset(int row, int column) const;
///
int rows() const { return rows_; }
///
int columns() const { return columns_;}
///
InsetTabular * owner() const { return owner_; }
///
void Validate(LaTeXFeatures &) const;
/* returns the maximum over all rows */
///
int GetWidthOfColumn(int cell) const;
///
int GetWidthOfTabular() const;
///
int GetAscentOfRow(int row) const;
///
int GetDescentOfRow(int row) const;
///
int GetHeightOfTabular() const;
/// Returns true if a complete update is necessary, otherwise false
bool SetAscentOfRow(int row, int height);
/// Returns true if a complete update is necessary, otherwise false
bool SetDescentOfRow(int row, int height);
/// Returns true if a complete update is necessary, otherwise false
bool SetWidthOfCell(int cell, int new_width);
/// Returns true if a complete update is necessary, otherwise false
bool SetAllLines(int cell, bool line);
/// Returns true if a complete update is necessary, otherwise false
bool SetTopLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false
bool SetBottomLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false
bool SetLeftLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false
bool SetRightLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false
bool SetAlignment(int cell, LyXAlignment align, bool onlycolumn = false);
/// Returns true if a complete update is necessary, otherwise false
bool SetVAlignment(int cell, VAlignment align, bool onlycolumn = false);
///
bool SetColumnPWidth(int cell, string const & width);
///
bool SetMColumnPWidth(int cell, string const & width);
///
bool SetAlignSpecial(int cell, string const & special, Feature what);
///
LyXAlignment GetAlignment(int cell, bool onlycolumn = false) const;
///
VAlignment GetVAlignment(int cell, bool onlycolumn = false) const;
///
string const GetPWidth(int cell) const;
///
string const GetColumnPWidth(int cell) const;
///
string const GetMColumnPWidth(int cell) const;
///
string const GetAlignSpecial(int cell, int what) const;
///
int GetWidthOfCell(int cell) const;
///
int GetBeginningOfTextInCell(int cell) const;
///
void AppendRow(int cell);
///
void DeleteRow(int row);
///
void AppendColumn(int cell);
///
void DeleteColumn(int column);
///
bool IsFirstCellInRow(int cell) const;
///
int GetFirstCellInRow(int row) const;
///
bool IsLastCellInRow(int cell) const;
///
int GetLastCellInRow(int row) const;
///
int GetNumberOfCells() const;
///
int NumberOfCellsInRow(int cell) const;
///
void Write(Buffer const *, std::ostream &) const;
///
void Read(Buffer const *, LyXLex &);
///
void OldFormatRead(LyXLex &, string const &);
//
// helper function for Latex returns number of newlines
///
int TeXTopHLine(std::ostream &, int row) const;
///
int TeXBottomHLine(std::ostream &, int row) const;
///
int TeXCellPreamble(std::ostream &, int cell) const;
///
int TeXCellPostamble(std::ostream &, int cell) const;
///
int Latex(Buffer const *, std::ostream &, bool, bool) const;
///
int DocBook(Buffer const * buf, std::ostream & os) const;
///
// helper function for Latex returns number of newlines
///
int AsciiTopHLine(std::ostream &, int row,
std::vector<unsigned int> const &) const;
///
int AsciiBottomHLine(std::ostream &, int row,
std::vector<unsigned int> const &) const;
///
int AsciiPrintCell(Buffer const *, std::ostream &, int cell, int row,
int column, std::vector<unsigned int> const &) const;
///
int Ascii(Buffer const *, std::ostream &) const;
///
bool IsMultiColumn(int cell, bool real = false) const;
///
void SetMultiColumn(int cell, int number);
///
int UnsetMultiColumn(int cell); // returns number of new cells
///
bool IsPartOfMultiColumn(int row, int column) const;
///
int row_of_cell(int cell) const;
///
int column_of_cell(int cell) const;
///
int right_column_of_cell(int cell) const;
///
void SetLongTabular(bool);
///
bool IsLongTabular() const;
///
void SetRotateTabular(bool);
///
bool GetRotateTabular() const;
///
void SetRotateCell(int cell, bool);
///
bool GetRotateCell(int cell) const;
///
bool NeedRotating() const;
///
bool IsLastCell(int cell) const;
///
int GetCellAbove(int cell) const;
///
int GetCellBelow(int cell) const;
///
int GetLastCellAbove(int cell) const;
///
int GetLastCellBelow(int cell) const;
///
int GetCellNumber(int row, int column) const;
///
void SetUsebox(int cell, BoxType);
///
BoxType GetUsebox(int cell) const;
//
// Long Tabular Options
///
void SetLTHead(int cell, bool first);
///
bool GetRowOfLTHead(int cell, int & row) const;
///
bool GetRowOfLTFirstHead(int cell, int & row) const;
///
void SetLTFoot(int cell, bool last);
///
bool GetRowOfLTFoot(int cell, int & row) const;
///
bool GetRowOfLTLastFoot(int cell, int & row) const;
///
void SetLTNewPage(int cell, bool what);
///
bool GetLTNewPage(int cell) const;
///
InsetText * GetCellInset(int cell) const;
///
InsetText * GetCellInset(int row, int column) const;
///
int rows() const { return rows_; }
///
int columns() const { return columns_;}
///
InsetTabular * owner() const { return owner_; }
///
void Validate(LaTeXFeatures &) const;
private: //////////////////////////////////////////////////////////////////
///
struct cellstruct {
///
cellstruct();
struct cellstruct {
///
cellstruct();
///
int cellno;
///
int width_of_cell;
///
int multicolumn;
///
LyXAlignment alignment;
///
VAlignment valignment;
///
bool top_line;
///
bool bottom_line;
///
bool left_line;
///
bool right_line;
///
BoxType usebox;
///
bool rotate;
///
string align_special;
///
string p_width; // this is only set for multicolumn!!!
///
InsetText inset;
};
///
int cellno;
typedef std::vector<cellstruct> cell_vector;
///
int width_of_cell;
typedef std::vector<cell_vector> cell_vvector;
///
int multicolumn;
struct rowstruct {
///
rowstruct();
///
bool top_line;
///
bool bottom_line;
///
int ascent_of_row;
///
int descent_of_row;
/// This are for longtabulars only
bool newpage;
};
///
LyXAlignment alignment;
typedef std::vector<rowstruct> row_vector;
///
VAlignment valignment;
struct columnstruct {
///
columnstruct();
///
LyXAlignment alignment;
///
VAlignment valignment;
///
bool left_line;
///
bool right_line;
///
int width_of_column;
///
string p_width;
///
string align_special;
};
///
bool top_line;
typedef std::vector<columnstruct> column_vector;
///
bool bottom_line;
void ReadNew(Buffer const * buf, std::istream & is,
LyXLex & lex, string const & l);
///
bool left_line;
void ReadOld(Buffer const * buf, std::istream & is,
LyXLex & lex, string const & l);
///
bool right_line;
int rows_;
///
BoxType usebox;
int columns_;
///
int numberofcells;
///
std::vector<int> rowofcell;
///
std::vector<int> columnofcell;
///
row_vector row_info;
///
column_vector column_info;
///
mutable cell_vvector cell_info;
///
int width_of_tabular;
///
bool rotate;
//
// for long tabulars
///
string align_special;
bool is_long_tabular;
/// row of endhead
int endhead;
/// row of endfirsthead
int endfirsthead;
/// row of endfoot
int endfoot;
/// row of endlastfoot
int endlastfoot;
///
string p_width; // this is only set for multicolumn!!!
///
InsetText inset;
};
///
typedef std::vector<cellstruct> cell_vector;
///
typedef std::vector<cell_vector> cell_vvector;
InsetTabular * owner_;
///
struct rowstruct {
///
rowstruct();
void Init(int columns_arg, int rows_arg);
///
bool top_line;
void Reinit();
///
bool bottom_line;
void set_row_column_number_info(bool oldformat = false);
/// Returns true if a complete update is necessary, otherwise false
bool SetWidthOfMulticolCell(int cell, int new_width);
///
int ascent_of_row;
void recalculateMulticolCells(int cell, int new_width);
/// Returns true if change
bool calculate_width_of_column(int column);
///
int descent_of_row;
/// This are for longtabulars only
bool newpage;
};
///
typedef std::vector<rowstruct> row_vector;
///
struct columnstruct {
bool calculate_width_of_column_NMC(int column); // no multi cells
///
columnstruct();
void calculate_width_of_tabular();
///
LyXAlignment alignment;
cellstruct * cellinfo_of_cell(int cell) const;
///
VAlignment valignment;
void delete_column(int column);
///
bool left_line;
int cells_in_multicolumn(int cell) const;
///
bool right_line;
///
int width_of_column;
///
string p_width;
///
string align_special;
};
///
typedef std::vector<columnstruct> column_vector;
///
void ReadNew(Buffer const * buf, std::istream & is,
LyXLex & lex, string const & l);
///
void ReadOld(Buffer const * buf, std::istream & is,
LyXLex & lex, string const & l);
///
int rows_;
///
int columns_;
///
int numberofcells;
///
std::vector<int> rowofcell;
///
std::vector<int> columnofcell;
///
row_vector row_info;
///
column_vector column_info;
///
mutable cell_vvector cell_info;
///
int width_of_tabular;
///
bool rotate;
//
// for long tabulars
///
bool is_long_tabular;
/// row of endhead
int endhead;
/// row of endfirsthead
int endfirsthead;
/// row of endfoot
int endfoot;
/// row of endlastfoot
int endlastfoot;
///
InsetTabular * owner_;
///
void Init(int columns_arg, int rows_arg);
///
void Reinit();
///
void set_row_column_number_info(bool oldformat = false);
/// Returns true if a complete update is necessary, otherwise false
bool SetWidthOfMulticolCell(int cell, int new_width);
///
void recalculateMulticolCells(int cell, int new_width);
/// Returns true if change
bool calculate_width_of_column(int column);
///
bool calculate_width_of_column_NMC(int column); // no multi cells
///
void calculate_width_of_tabular();
///
cellstruct * cellinfo_of_cell(int cell) const;
///
void delete_column(int column);
///
int cells_in_multicolumn(int cell) const;
///
BoxType UseParbox(int cell) const;
BoxType UseParbox(int cell) const;
};
#endif