#include "support/lyxmanip.h"
#include "BufferView.h"
#include "encoding.h"
+#include "ParameterStruct.h"
using std::ostream;
using std::endl;
extern string bibitemWidest(Buffer const *);
// this is a minibuffer
-static char minibuffer_char;
-static LyXFont minibuffer_font;
-static Inset * minibuffer_inset;
+
+namespace {
+
+char minibuffer_char;
+LyXFont minibuffer_font;
+Inset * minibuffer_inset;
+
+} // namespace anon
extern BufferView * current_view;
// declared in lyxparagraph.h
unsigned int LyXParagraph::paragraph_id = 0;
+// Initialize static member.
+ShareContainer<LyXFont> LyXParagraph::FontTable::container;
+
LyXParagraph::LyXParagraph()
{
-#ifndef HAVE_ROPE
text.reserve(500); // is this number too big?
-#endif
for (int i = 0; i < 10; ++i) setCounter(i , 0);
- appendix = false;
enumdepth = 0;
itemdepth = 0;
- next = 0;
- previous = 0;
+ next_ = 0;
+ previous_ = 0;
#ifndef NEW_INSETS
footnoteflag = LyXParagraph::NO_FOOTNOTE;
footnotekind = LyXParagraph::FOOTNOTE; // should not be needed
#endif
- align = LYX_ALIGN_BLOCK;
inset_owner = 0;
id_ = paragraph_id++;
// This konstruktor inserts the new paragraph in a list.
LyXParagraph::LyXParagraph(LyXParagraph * par)
{
-#ifndef HAVE_ROPE
text.reserve(500);
-#endif
par->fitToSize();
for (int i = 0; i < 10; ++i) setCounter(i, 0);
- appendix = false;
enumdepth = 0;
itemdepth = 0;
// double linked list begin
- next = par->next;
- if (next)
- next->previous = this;
- previous = par;
- previous->next = this;
+ next_ = par->next_;
+ if (next_)
+ next_->previous_ = this;
+ previous_ = par;
+ previous_->next_ = this;
// end
#ifndef NEW_INSETS
footnoteflag = LyXParagraph::NO_FOOTNOTE;
void LyXParagraph::writeFile(Buffer const * buf, ostream & os,
- BufferParams const & params,
+ BufferParams const & bparams,
char footflag, char dth) const
{
#ifndef NEW_INSETS
- if (
- footnoteflag != LyXParagraph::NO_FOOTNOTE ||
- !previous
- || previous->footnoteflag == LyXParagraph::NO_FOOTNOTE
- ) {
-#endif
-
-#ifndef NEW_INSETS
+ if (footnoteflag != LyXParagraph::NO_FOOTNOTE ||
+ !previous_
+ || previous_->footnoteflag == LyXParagraph::NO_FOOTNOTE) {
// The beginning or the end of a footnote environment?
if (footflag != footnoteflag) {
footflag = footnoteflag;
}
#endif
// The beginning or end of a deeper (i.e. nested) area?
- if (dth != depth) {
- if (depth > dth) {
- while (depth > dth) {
+ if (dth != params.depth()) {
+ if (params.depth() > dth) {
+ while (params.depth() > dth) {
os << "\n\\begin_deeper ";
++dth;
}
} else {
- while (depth < dth) {
+ while (params.depth() < dth) {
os << "\n\\end_deeper ";
--dth;
}
// First write the layout
os << "\n\\layout "
- << textclasslist.NameOfLayout(params.textclass, layout)
+ << textclasslist.NameOfLayout(bparams.textclass, layout)
<< "\n";
// Maybe some vertical spaces.
- if (added_space_top.kind() != VSpace::NONE)
+ if (params.spaceTop().kind() != VSpace::NONE)
os << "\\added_space_top "
- << added_space_top.asLyXCommand() << " ";
- if (added_space_bottom.kind() != VSpace::NONE)
+ << params.spaceTop().asLyXCommand() << " ";
+ if (params.spaceBottom().kind() != VSpace::NONE)
os << "\\added_space_bottom "
- << added_space_bottom.asLyXCommand() << " ";
+ << params.spaceBottom().asLyXCommand() << " ";
// Maybe the paragraph has special spacing
- spacing.writeFile(os, true);
+ params.spacing().writeFile(os, true);
// The labelwidth string used in lists.
- if (!labelwidthstring.empty())
+ if (!params.labelWidthString().empty())
os << "\\labelwidthstring "
- << labelwidthstring << '\n';
+ << params.labelWidthString() << '\n';
// Lines above or below?
- if (line_top)
+ if (params.lineTop())
os << "\\line_top ";
- if (line_bottom)
+ if (params.lineBottom())
os << "\\line_bottom ";
// Pagebreaks above or below?
- if (pagebreak_top)
+ if (params.pagebreakTop())
os << "\\pagebreak_top ";
- if (pagebreak_bottom)
+ if (params.pagebreakBottom())
os << "\\pagebreak_bottom ";
// Start of appendix?
- if (start_of_appendix)
+ if (params.startOfAppendix())
os << "\\start_of_appendix ";
// Noindent?
- if (noindent)
+ if (params.noindent())
os << "\\noindent ";
// Alignment?
- if (align != LYX_ALIGN_LAYOUT) {
+ if (params.align() != LYX_ALIGN_LAYOUT) {
int h = 0;
- switch (align) {
+ switch (params.align()) {
case LYX_ALIGN_LEFT: h = 1; break;
case LYX_ALIGN_RIGHT: h = 2; break;
case LYX_ALIGN_CENTER: h = 3; break;
}
os << "\\align " << string_align[h] << " ";
}
- if (pextra_type != PEXTRA_NONE) {
- os << "\\pextra_type " << pextra_type;
- if (pextra_type == PEXTRA_MINIPAGE) {
+#ifndef NO_PEXTRA
+ if (params.pextraType() != PEXTRA_NONE) {
+ os << "\\pextra_type " << params.pextraType();
+ if (params.pextraType() == PEXTRA_MINIPAGE) {
os << " \\pextra_alignment "
- << pextra_alignment;
- if (pextra_hfill)
+ << params.pextraAlignment();
+ if (params.pextraHfill())
os << " \\pextra_hfill "
- << pextra_hfill;
- if (pextra_start_minipage)
+ << params.pextraHfill();
+ if (params.pextraStartMinipage())
os << " \\pextra_start_minipage "
- << pextra_start_minipage;
+ << params.pextraStartMinipage();
}
- if (!pextra_width.empty()) {
+ if (!params.pextraWidth().empty()) {
os << " \\pextra_width "
- << VSpace(pextra_width).asLyXCommand();
- } else if (!pextra_widthp.empty()) {
+ << VSpace(params.pextraWidth()).asLyXCommand();
+ } else if (!params.pextraWidthp().empty()) {
os << " \\pextra_widthp "
- << pextra_widthp;
+ << params.pextraWidthp();
}
os << '\n';
}
+#endif
#ifndef NEW_INSETS
} else {
// Dummy layout. This means that a footnote ended.
if (bibkey)
bibkey->Write(buf, os);
- LyXFont font1(LyXFont::ALL_INHERIT, params.language);
+ LyXFont font1(LyXFont::ALL_INHERIT, bparams.language);
int column = 0;
for (size_type i = 0; i < size(); ++i) {
}
// Write font changes
- LyXFont font2 = GetFontSettings(params, i);
+ LyXFont font2 = GetFontSettings(bparams, i);
if (font2 != font1) {
font2.lyxWriteChanges(font1, os);
column = 0;
}
// now write the next paragraph
- if (next)
- next->writeFile(buf, os, params, footflag, dth);
+ if (next_)
+ next_->writeFile(buf, os, bparams, footflag, dth);
}
void LyXParagraph::validate(LaTeXFeatures & features) const
{
- BufferParams const & params = features.bufferParams();
+ BufferParams const & bparams = features.bufferParams();
#ifndef NEW_INSETS
// this will be useful later
LyXLayout const & layout =
- textclasslist.Style(params.textclass,
+ textclasslist.Style(bparams.textclass,
GetLayout());
#endif
// check the params.
- if (line_top || line_bottom)
+ if (params.lineTop() || params.lineBottom())
features.lyxline = true;
- if (!spacing.isDefault())
+ if (!params.spacing().isDefault())
features.setspace = true;
// then the layouts
features.layout[GetLayout()] = true;
// then the fonts
- Language const * doc_language = params.language;
+ Language const * doc_language = bparams.language;
for (FontList::const_iterator cit = fontlist.begin();
cit != fontlist.end(); ++cit) {
- if ((*cit).font.noun() == LyXFont::ON) {
+ if ((*cit).font().noun() == LyXFont::ON) {
lyxerr[Debug::LATEX] << "font.noun: "
- << (*cit).font.noun()
+ << (*cit).font().noun()
<< endl;
features.noun = true;
lyxerr[Debug::LATEX] << "Noun enabled. Font: "
- << (*cit).font.stateText(0)
+ << (*cit).font().stateText(0)
<< endl;
}
- switch ((*cit).font.color()) {
+ switch ((*cit).font().color()) {
case LColor::none:
case LColor::inherit:
case LColor::ignore:
default:
features.color = true;
lyxerr[Debug::LATEX] << "Color enabled. Font: "
- << (*cit).font.stateText(0)
+ << (*cit).font().stateText(0)
<< endl;
}
- Language const * language = (*cit).font.language();
+ Language const * language = (*cit).font().language();
if (language->babel() != doc_language->babel()) {
features.UsedLanguages.insert(language);
lyxerr[Debug::LATEX] << "Found language "
(*cit).inset->Validate(features);
}
- if (pextra_type == PEXTRA_INDENT)
+#ifndef NO_PEXTRA
+ if (params.pextraType() == PEXTRA_INDENT)
features.LyXParagraphIndent = true;
- if (pextra_type == PEXTRA_FLOATFLT)
+ if (params.pextraType() == PEXTRA_FLOATFLT)
features.floatflt = true;
+#endif
#ifndef NEW_INSETS
if (layout.needprotect
- && next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
+ && next_ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE)
features.NeedLyXFootnoteCode = true;
#endif
- if (params.paragraph_separation == BufferParams::PARSEP_INDENT
- && pextra_type == LyXParagraph::PEXTRA_MINIPAGE)
+#ifndef NO_PEXTRA
+ if (bparams.paragraph_separation == BufferParams::PARSEP_INDENT
+ && params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE)
features.NeedLyXMinipageIndent = true;
+#endif
#ifndef NEW_INSETS
if (footnoteflag != NO_FOOTNOTE && footnotekind == ALGORITHM)
features.algorithm = true;
void LyXParagraph::Clear()
{
- line_top = false;
- line_bottom = false;
-
- pagebreak_top = false;
- pagebreak_bottom = false;
-
- added_space_top = VSpace(VSpace::NONE);
- added_space_bottom = VSpace(VSpace::NONE);
- spacing.set(Spacing::Default);
+ params.clear();
- align = LYX_ALIGN_LAYOUT;
- depth = 0;
- noindent = false;
-
- pextra_type = PEXTRA_NONE;
- pextra_width.erase();
- pextra_widthp.erase();
- pextra_alignment = MINIPAGE_ALIGN_TOP;
- pextra_hfill = false;
- pextra_start_minipage = false;
-
- labelstring.erase();
- labelwidthstring.erase();
layout = 0;
bibkey = 0;
-
- start_of_appendix = false;
}
// the destructor removes the new paragraph from the list
LyXParagraph::~LyXParagraph()
{
- if (previous)
- previous->next = next;
- if (next)
- next->previous = previous;
+ if (previous_)
+ previous_->next_ = next_;
+ if (next_)
+ next_->previous_ = previous_;
for (InsetList::iterator it = insetlist.begin();
it != insetlist.end(); ++it) {
// > because last is the next unused position, and you can
// use it if you want
if (pos > size()) {
- if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->Erase(pos - text.size() - 1);
else
lyxerr.debug() << "ERROR (LyXParagraph::Erase): "
insetlist.erase(it);
}
}
-#ifndef HAVE_ROPE
+
text.erase(text.begin() + pos);
-#else
- text.erase(text.mutable_begin() + pos);
-#endif
+
// Erase entries in the tables.
FontTable search_font(pos, LyXFont());
lower_bound(fontlist.begin(),
fontlist.end(),
search_font, matchFT());
- if (it != fontlist.end() && (*it).pos == pos &&
+ if (it != fontlist.end() && (*it).pos() == pos &&
(pos == 0 ||
- (it != fontlist.begin() && (*(it - 1)).pos == pos - 1))) {
+ (it != fontlist.begin() && (*(it - 1)).pos() == pos - 1))) {
// If it is a multi-character font
// entry, we just make it smaller
// (see update below), otherwise we
fontlist.erase(fontlist.begin() + i);
it = fontlist.begin() + i;
if (i > 0 && i < fontlist.size() &&
- fontlist[i - 1].font == fontlist[i].font) {
+ fontlist[i - 1].font() == fontlist[i].font()) {
fontlist.erase(fontlist.begin() + i - 1);
it = fontlist.begin() + i - 1;
}
// Update all other entries.
FontList::iterator fend = fontlist.end();
for (; it != fend; ++it)
- --(*it).pos;
+ (*it).pos((*it).pos() - 1);
// Update the inset table.
InsetTable search_inset(pos, 0);
// > because last is the next unused position, and you can
// use it if you want
if (pos > size()) {
- if (next
- && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_
+ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->InsertChar(pos - text.size() - 1,
c);
else
#else
Assert(pos <= size());
#endif
-#ifndef HAVE_ROPE
text.insert(text.begin() + pos, c);
-#else
- text.insert(pos, c);
-#endif
+
// Update the font table.
FontTable search_font(pos, LyXFont());
for (FontList::iterator it = lower_bound(fontlist.begin(),
fontlist.end(),
search_font, matchFT());
it != fontlist.end(); ++it)
- ++(*it).pos;
+ (*it).pos((*it).pos() + 1);
// Update the inset table.
InsetTable search_inset(pos, 0);
// > because last is the next unused position, and you can
// use it if you want
if (pos > size()) {
- if (next
- && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_
+ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()
->InsertInset(pos - text.size() - 1,
inset, font);
{
#ifndef NEW_INSETS
if (pos >= size()) {
- if (next
- && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_
+ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()
->GetInset(pos - text.size() - 1);
else
{
#ifndef NEW_INSETS
if (pos >= size()) {
- if (next
- && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_
+ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()
->GetInset(pos - text.size() - 1);
else
fontlist.end(),
search_font, matchFT());
if (cit != fontlist.end())
- return (*cit).font;
+ return (*cit).font();
#ifndef NEW_INSETS
}
#endif
// > because last is the next unused position, and you can
// use it if you want
else if (pos > size()) {
- if (next
- && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_
+ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()
->GetFontSettings(bparams,
pos - text.size() - 1);
{
if (size() > 0) {
if (!fontlist.empty())
- return fontlist[0].font;
+ return fontlist[0].font();
}
#ifndef NEW_INSETS
- else if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
+ else if (next_ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE)
return NextAfterFootnote()->GetFirstFontSettings();
#endif
return LyXFont(LyXFont::ALL_INHERIT);
fontlist.end(),
start_search, matchFT());
cit != end_it; ++cit) {
- LyXFont::FONT_SIZE size = (*cit).font.size();
+ LyXFont::FONT_SIZE size = (*cit).font().size();
if (size > maxsize && size <= LyXFont::SIZE_HUGER)
maxsize = size;
}
// > because last is the next unused position, and you can
// use it if you want
else if (pos > size()) {
- if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
+ if (next_ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE)
return NextAfterFootnote()
->GetChar(pos - text.size() - 1);
else
return '\0';
} else {
// We should have a footnote environment.
- if (!next || next->footnoteflag == LyXParagraph::NO_FOOTNOTE) {
+ if (!next_ || next_->footnoteflag == LyXParagraph::NO_FOOTNOTE) {
// Notice that LyX does request the
// last char from time to time. (Asger)
//lyxerr << "ERROR (LyXParagraph::GetChar): "
// "expected footnote." << endl;
return '\0';
}
- switch (next->footnotekind) {
+ switch (next_->footnotekind) {
case LyXParagraph::FOOTNOTE:
return LyXParagraph::META_FOOTNOTE;
case LyXParagraph::MARGIN:
}
+LyXParagraph::value_type
+LyXParagraph::GetUChar(BufferParams const & bparams,
+ LyXParagraph::size_type pos) const
+{
+ value_type c = GetChar(pos);
+ if (!lyxrc.rtl_support)
+ return c;
+
+ value_type uc = c;
+ switch (c) {
+ case '(':
+ uc = ')';
+ break;
+ case ')':
+ uc = '(';
+ break;
+ case '[':
+ uc = ']';
+ break;
+ case ']':
+ uc = '[';
+ break;
+ case '{':
+ uc = '}';
+ break;
+ case '}':
+ uc = '{';
+ break;
+ case '<':
+ uc = '>';
+ break;
+ case '>':
+ uc = '<';
+ break;
+ }
+ if (uc != c && GetFontSettings(bparams, pos).isRightToLeft())
+ return uc;
+ else
+ return c;
+}
+
// return an string of the current word, and the end of the word in lastpos.
string const LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
{
}
-#ifdef NEW_INSETS
-#warning Remember to get rid of this one. (Lgb)
-#endif
+#ifndef NEW_INSETS
LyXParagraph::size_type LyXParagraph::Last() const
{
-#ifndef NEW_INSETS
- if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return text.size() + NextAfterFootnote()->Last() + 1;
// the 1 is the symbol
// for the footnote
else
-#endif
return text.size();
}
+#endif
#ifndef NEW_INSETS
// > because last is the next unused position, and you can
// use it if you want
if (pos > size()) {
- if (next
- && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_
+ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()
->ParFromPos(pos - text.size() - 1);
else
// > because last is the next unused position, and you can
// use it if you want
if (pos > size()) {
- if (next
- && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ if (next_
+ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()
->PositionInParFromPos(pos - text.size() - 1);
else
// > because last is the next unused position, and you can
// use it if you want
if (pos > size()) {
- if (next &&
- next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
+ if (next_ &&
+ next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
NextAfterFootnote()->SetFont(pos - text.size() - 1,
font);
} else
unsigned int i = it - fontlist.begin();
bool notfound = it == fontlist.end();
- if (!notfound && fontlist[i].font == font)
+ if (!notfound && fontlist[i].font() == font)
return;
bool begin = pos == 0 || notfound ||
- (i > 0 && fontlist[i-1].pos == pos - 1);
+ (i > 0 && fontlist[i-1].pos() == pos - 1);
// Is position pos is a beginning of a font block?
- bool end = !notfound && fontlist[i].pos == pos;
+ bool end = !notfound && fontlist[i].pos() == pos;
// Is position pos is the end of a font block?
if (begin && end) { // A single char block
if (i + 1 < fontlist.size() &&
- fontlist[i + 1].font == font) {
+ fontlist[i + 1].font() == font) {
// Merge the singleton block with the next block
fontlist.erase(fontlist.begin() + i);
- if (i > 0 && fontlist[i - 1].font == font)
+ if (i > 0 && fontlist[i - 1].font() == font)
fontlist.erase(fontlist.begin() + i-1);
- } else if (i > 0 && fontlist[i - 1].font == font) {
+ } else if (i > 0 && fontlist[i - 1].font() == font) {
// Merge the singleton block with the previous block
- fontlist[i - 1].pos = pos;
+ fontlist[i - 1].pos(pos);
fontlist.erase(fontlist.begin() + i);
} else
- fontlist[i].font = font;
+ fontlist[i].font(font);
} else if (begin) {
- if (i > 0 && fontlist[i - 1].font == font)
- fontlist[i - 1].pos = pos;
+ if (i > 0 && fontlist[i - 1].font() == font)
+ fontlist[i - 1].pos(pos);
else
fontlist.insert(fontlist.begin() + i,
FontTable(pos, font));
} else if (end) {
- fontlist[i].pos = pos - 1;
+ fontlist[i].pos(pos - 1);
if (!(i + 1 < fontlist.size() &&
- fontlist[i + 1].font == font))
+ fontlist[i + 1].font() == font))
fontlist.insert(fontlist.begin() + i + 1,
FontTable(pos, font));
} else { // The general case. The block is splitted into 3 blocks
fontlist.insert(fontlist.begin() + i,
- FontTable(pos - 1, fontlist[i].font));
+ FontTable(pos - 1, fontlist[i].font()));
fontlist.insert(fontlist.begin() + i + 1,
FontTable(pos, font));
}
}
-
+
+
+void LyXParagraph::next(LyXParagraph * p)
+{
+ next_ = p;
+}
+
+
// This function is able to hide closed footnotes.
-LyXParagraph * LyXParagraph::Next()
+LyXParagraph * LyXParagraph::next()
+{
+#ifndef NEW_INSETS
+ if (next_ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
+ LyXParagraph * tmp = next_;
+ while (tmp
+ && tmp->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ tmp = tmp->next_;
+ if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
+ return tmp->next(); /* there can be more than one
+ footnote in a logical
+ paragraph */
+ else
+ return next_; // This should never happen!
+ } else
+#endif
+ return next_;
+}
+
+
+LyXParagraph const * LyXParagraph::next() const
{
#ifndef NEW_INSETS
- if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
- LyXParagraph * tmp = next;
+ if (next_ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
+ LyXParagraph * tmp = next_;
while (tmp
&& tmp->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
- tmp = tmp->next;
+ tmp = tmp->next_;
if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
- return tmp->Next(); /* there can be more than one
+ return tmp->next(); /* there can be more than one
footnote in a logical
paragraph */
else
- return next; // This should never happen!
+ return next_; // This should never happen!
} else
#endif
- return next;
+ return next_;
}
#ifndef NEW_INSETS
LyXParagraph * LyXParagraph::NextAfterFootnote()
{
- if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
- LyXParagraph * tmp = next;
+ if (next_ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
+ LyXParagraph * tmp = next_;
while (tmp && tmp->footnoteflag != LyXParagraph::NO_FOOTNOTE)
- tmp = tmp->next;
+ tmp = tmp->next_;
if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
return tmp; /* there can be more than one footnote
in a logical paragraph */
else
- return next; // This should never happen!
+ return next_; // This should never happen!
} else
- return next;
+ return next_;
}
#endif
#ifndef NEW_INSETS
LyXParagraph const * LyXParagraph::NextAfterFootnote() const
{
- if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
- LyXParagraph * tmp = next;
+ if (next_ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
+ LyXParagraph * tmp = next_;
while (tmp && tmp->footnoteflag != LyXParagraph::NO_FOOTNOTE)
- tmp = tmp->next;
+ tmp = tmp->next_;
if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
return tmp; /* there can be more than one footnote
in a logical paragraph */
else
- return next; // This should never happen!
+ return next_; // This should never happen!
} else
- return next;
+ return next_;
}
#endif
LyXParagraph * LyXParagraph::PreviousBeforeFootnote()
{
LyXParagraph * tmp;
- if (previous && previous->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
- tmp = previous;
+ if (previous_ && previous_->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
+ tmp = previous_;
while (tmp && tmp->footnoteflag != LyXParagraph::NO_FOOTNOTE)
- tmp = tmp->previous;
+ tmp = tmp->previous_;
if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
return tmp; /* there can be more than one footnote
in a logical paragraph */
else
- return previous; // This should never happen!
+ return previous_; // This should never happen!
} else
- return previous;
+ return previous_;
}
#endif
return this;
LyXParagraph * tmp = this;
- while (tmp->next
- && tmp->next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
+ while (tmp->next_
+ && tmp->next_->footnoteflag != LyXParagraph::NO_FOOTNOTE)
tmp = tmp->NextAfterFootnote();
return tmp;
return this;
LyXParagraph const * tmp = this;
- while (tmp->next
- && tmp->next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
+ while (tmp->next_
+ && tmp->next_->footnoteflag != LyXParagraph::NO_FOOTNOTE)
tmp = tmp->NextAfterFootnote();
return tmp;
while (tmppar &&
(tmppar->IsDummy()
|| tmppar->footnoteflag != LyXParagraph::NO_FOOTNOTE))
- tmppar = tmppar->previous;
+ tmppar = tmppar->previous_;
if (!tmppar) {
return this;
while (tmppar &&
(tmppar->IsDummy()
|| tmppar->footnoteflag != LyXParagraph::NO_FOOTNOTE))
- tmppar = tmppar->previous;
+ tmppar = tmppar->previous_;
if (!tmppar) {
return this;
#endif
+void LyXParagraph::previous(LyXParagraph * p)
+{
+ previous_ = p;
+}
+
+
// This function is able to hide closed footnotes.
-LyXParagraph * LyXParagraph::Previous()
+LyXParagraph * LyXParagraph::previous()
{
#ifndef NEW_INSETS
- LyXParagraph * tmp = previous;
+ LyXParagraph * tmp = previous_;
if (!tmp)
return tmp;
- if (tmp->previous
- && tmp->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
- tmp = tmp->previous;
+ if (tmp->previous_
+ && tmp->previous_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
+ tmp = tmp->previous_;
while (tmp
&& tmp->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
- tmp = tmp->previous;
+ tmp = tmp->previous_;
if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
- return tmp->next->Previous();
+ return tmp->next_->previous();
else
- return previous;
+ return previous_;
} else
#endif
- return previous;
+ return previous_;
}
// This function is able to hide closed footnotes.
-LyXParagraph const * LyXParagraph::Previous() const
+LyXParagraph const * LyXParagraph::previous() const
{
#ifndef NEW_INSETS
- LyXParagraph * tmp = previous;
+ LyXParagraph * tmp = previous_;
if (!tmp)
return tmp;
- if (tmp->previous
- && tmp->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
- tmp = tmp->previous;
+ if (tmp->previous_
+ && tmp->previous_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
+ tmp = tmp->previous_;
while (tmp
&& tmp->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
- tmp = tmp->previous;
+ tmp = tmp->previous_;
if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
- return tmp->next->Previous();
+ return tmp->next_->previous();
else
- return previous;
+ return previous_;
} else
#endif
- return previous;
+ return previous_;
}
// layout stays the same with latex-environments
if (flag) {
tmp->SetOnlyLayout(bparams, firstpar->layout);
- tmp->SetLabelWidthString(firstpar->labelwidthstring);
+ tmp->SetLabelWidthString(firstpar->params.labelWidthString());
}
#else
// layout stays the same with latex-environments
if (flag) {
tmp->SetOnlyLayout(bparams, layout);
- tmp->SetLabelWidthString(labelwidthstring);
+ tmp->SetLabelWidthString(params.labelWidthString());
}
#endif
#ifndef NEW_INSETS
if (Last() > pos || !Last() || flag == 2) {
tmp->SetOnlyLayout(bparams, firstpar->layout);
- tmp->align = firstpar->align;
- tmp->SetLabelWidthString(firstpar->labelwidthstring);
+ tmp->params.align(firstpar->params.align());
+ tmp->SetLabelWidthString(firstpar->params.labelWidthString());
- tmp->line_bottom = firstpar->line_bottom;
- firstpar->line_bottom = false;
- tmp->pagebreak_bottom = firstpar->pagebreak_bottom;
- firstpar->pagebreak_bottom = false;
- tmp->added_space_bottom = firstpar->added_space_bottom;
- firstpar->added_space_bottom = VSpace(VSpace::NONE);
+ tmp->params.lineBottom(firstpar->params.lineBottom());
+ firstpar->params.lineBottom(false);
+ tmp->params.pagebreakBottom(firstpar->params.pagebreakBottom());
+ firstpar->params.pagebreakBottom(false);
+ tmp->params.spaceBottom(firstpar->params.spaceBottom());
+ firstpar->params.spaceBottom(VSpace(VSpace::NONE));
- tmp->depth = firstpar->depth;
- tmp->noindent = firstpar->noindent;
+ tmp->params.depth(firstpar->params.depth());
+ tmp->params.noindent(firstpar->params.noindent());
#else
- if (Last() > pos || !Last() || flag == 2) {
+ if (size() > pos || !size() || flag == 2) {
tmp->SetOnlyLayout(bparams, layout);
- tmp->align = align;
- tmp->SetLabelWidthString(labelwidthstring);
+ tmp->params.align(params.align());
+ tmp->SetLabelWidthString(params.labelWidthString());
- tmp->line_bottom = line_bottom;
- line_bottom = false;
- tmp->pagebreak_bottom = pagebreak_bottom;
- pagebreak_bottom = false;
- tmp->added_space_bottom = added_space_bottom;
- added_space_bottom = VSpace(VSpace::NONE);
+ tmp->params.lineBottom(params.lineBottom());
+ params.lineBottom(false);
+ tmp->params.pagebreakBottom(params.pagebreakBottom());
+ params.pagebreakBottom(false);
+ tmp->params.spaceBottom(params.spaceBottom());
+ params.spaceBottom(VSpace(VSpace::NONE));
- tmp->depth = depth;
- tmp->noindent = noindent;
+ tmp->params.depth(params.depth());
+ tmp->params.noindent(params.noindent());
#endif
// copy everything behind the break-position
// to the new paragraph
#ifndef NEW_INSETS
// just an idea of me
if (!pos) {
- tmp->line_top = firstpar->line_top;
- tmp->pagebreak_top = firstpar->pagebreak_top;
- tmp->added_space_top = firstpar->added_space_top;
+ tmp->params.lineTop(firstpar->params.lineTop());
+ tmp->params.pagebreakTop(firstpar->params.pagebreakTop());
+ tmp->params.spaceTop(firstpar->params.spaceTop());
tmp->bibkey = firstpar->bibkey;
firstpar->Clear();
// layout stays the same with latex-environments
if (flag) {
firstpar->SetOnlyLayout(bparams, tmp->layout);
- firstpar->SetLabelWidthString(tmp->labelwidthstring);
- firstpar->depth = tmp->depth;
+ firstpar->SetLabelWidthString(tmp->params.labelWidthString());
+ firstpar->params.depth(tmp->params.depth());
}
}
#else
// just an idea of me
if (!pos) {
- tmp->line_top = line_top;
- tmp->pagebreak_top = pagebreak_top;
- tmp->added_space_top = added_space_top;
+ tmp->params.lineTop(params.lineTop());
+ tmp->params.pagebreakTop(params.pagebreakTop());
+ tmp->params.spaceTop(params.spaceTop());
tmp->bibkey = bibkey;
Clear();
// layout stays the same with latex-environments
if (flag) {
SetOnlyLayout(bparams, tmp->layout);
- SetLabelWidthString(tmp->labelwidthstring);
- depth = tmp->depth;
+ SetLabelWidthString(tmp->params.labelWidthString());
+ params.depth(tmp->params.depth());
}
}
#endif
footnotekind = par->footnotekind;
#endif
layout = par->layout;
- align = par-> align;
- SetLabelWidthString(par->labelwidthstring);
-
- line_bottom = par->line_bottom;
- pagebreak_bottom = par->pagebreak_bottom;
- added_space_bottom = par->added_space_bottom;
-
- line_top = par->line_top;
- pagebreak_top = par->pagebreak_top;
- added_space_top = par->added_space_top;
-
- spacing = par->spacing;
+ params.makeSame(par->params);
- pextra_type = par->pextra_type;
- pextra_width = par->pextra_width;
- pextra_widthp = par->pextra_widthp;
- pextra_alignment = par->pextra_alignment;
- pextra_hfill = par->pextra_hfill;
- pextra_start_minipage = par->pextra_start_minipage;
-
- noindent = par->noindent;
- depth = par->depth;
+ // This can be changed after NEW_INSETS is in effect. (Lgb)
+ SetLabelWidthString(par->params.labelWidthString());
}
LyXParagraph * tmppar = this;
while (tmppar && (
(tmppar->IsDummy()
- && tmppar->previous->footnoteflag ==
+ && tmppar->previous_->footnoteflag ==
LyXParagraph::CLOSED_FOOTNOTE)
|| tmppar->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE))
- tmppar = tmppar->previous;
+ tmppar = tmppar->previous_;
if (!tmppar)
return this; // This should never happen!
int i = 0;
#ifndef NEW_INSETS
if (!IsDummy()) {
-#endif
while (Last()
+#else
+ while (size()
+#endif
&& (IsNewline(0) || IsLineSeparator(0))){
Erase(0);
++i;
par = par->FirstPhysicalPar();
#endif
- return (
+ return
#ifndef NEW_INSETS
par->footnoteflag == footnoteflag &&
par->footnotekind == footnotekind &&
#endif
par->layout == layout &&
-
- par->align == align &&
-
- par->line_bottom == line_bottom &&
- par->pagebreak_bottom == pagebreak_bottom &&
- par->added_space_bottom == added_space_bottom &&
-
- par->line_top == line_top &&
- par->pagebreak_top == pagebreak_top &&
- par->added_space_top == added_space_top &&
-
- par->spacing == spacing &&
-
- par->pextra_type == pextra_type &&
- par->pextra_width == pextra_width &&
- par->pextra_widthp == pextra_widthp &&
- par->pextra_alignment == pextra_alignment &&
- par->pextra_hfill == pextra_hfill &&
- par->pextra_start_minipage == pextra_start_minipage &&
- par->noindent == noindent &&
- par->depth == depth);
+ params.sameLayout(par->params);
}
// When can pos > Last()?
// I guess pos == Last() is possible.
- if (Last() > pos) {
+ if (size() > pos) {
// copy everything behind the break-position to the new
// paragraph
size_type pos_end = text.size() - 1;
void LyXParagraph::PasteParagraph(BufferParams const & bparams)
{
// copy the next paragraph to this one
- LyXParagraph * the_next = Next();
-#ifndef NEW_INSETS
- LyXParagraph * firstpar = FirstPhysicalPar();
-#endif
+ LyXParagraph * the_next = next();
// first the DTP-stuff
#ifndef NEW_INSETS
- firstpar->line_bottom = the_next->line_bottom;
- firstpar->added_space_bottom = the_next->added_space_bottom;
- firstpar->pagebreak_bottom = the_next->pagebreak_bottom;
-#else
- line_bottom = the_next->line_bottom;
- added_space_bottom = the_next->added_space_bottom;
- pagebreak_bottom = the_next->pagebreak_bottom;
-#endif
+ LyXParagraph * firstpar = FirstPhysicalPar();
+ firstpar->params.lineBottom(the_next->params.lineBottom());
+ firstpar->params.spaceBottom(the_next->params.spaceBottom());
+ firstpar->params.pagebreakBottom(the_next->params.pagebreakBottom());
size_type pos_end = the_next->text.size() - 1;
size_type pos_insert = Last();
+#else
+ params.lineBottom(the_next->params.lineBottom());
+ params.spaceBottom(the_next->params.spaceBottom());
+ params.pagebreakBottom(the_next->params.pagebreakBottom());
+
+ size_type pos_end = the_next->text.size() - 1;
+ size_type pos_insert = size();
+#endif
// ok, now copy the paragraph
size_type i, j;
}
// delete the next paragraph
- LyXParagraph * ppar = the_next->previous;
- LyXParagraph * npar = the_next->next;
+ LyXParagraph * ppar = the_next->previous_;
+ LyXParagraph * npar = the_next->next_;
delete the_next;
- ppar->next = npar;
+ ppar->next(npar);
}
void LyXParagraph::OpenFootnote(LyXParagraph::size_type pos)
{
LyXParagraph * par = ParFromPos(pos);
- par = par->next;
+ par = par->next_;
while (par && par->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
par->footnoteflag = LyXParagraph::OPEN_FOOTNOTE;
- par = par->next;
+ par = par->next_;
}
}
void LyXParagraph::CloseFootnote(LyXParagraph::size_type pos)
{
LyXParagraph * par = ParFromPos(pos);
- par = par->next;
+ par = par->next_;
while (par && par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
par->footnoteflag = LyXParagraph::CLOSED_FOOTNOTE;
- par = par->next;
+ par = par->next_;
}
}
#endif
#ifndef NEW_INSETS
if (footnoteflag == NO_FOOTNOTE)
last = LastPhysicalPar();
- else if (next->footnoteflag == NO_FOOTNOTE)
+ else if (next_->footnoteflag == NO_FOOTNOTE)
return endlabeltype;
#else
last = this;
#endif
- if (!last || !last->next)
+ if (!last || !last->next_)
return endlabeltype;
- int next_depth = last->next->GetDepth();
+ int next_depth = last->next_->GetDepth();
if (par_depth > next_depth ||
- (par_depth == next_depth && layout != last->next->GetLayout() ))
+ (par_depth == next_depth && layout != last->next_->GetLayout() ))
return endlabeltype;
break;
}
char LyXParagraph::GetDepth() const
{
#ifndef NEW_INSETS
- return FirstPhysicalPar()->depth;
+ return FirstPhysicalPar()->params.depth();
#else
- return depth;
+ return params.depth();
#endif
}
char LyXParagraph::GetAlign() const
{
#ifndef NEW_INSETS
- return FirstPhysicalPar()->align;
+ return FirstPhysicalPar()->params.align();
#else
- return align;
+ return params.align();
#endif
}
string const & LyXParagraph::GetLabelstring() const
{
#ifndef NEW_INSETS
- return FirstPhysicalPar()->labelstring;
+ return FirstPhysicalPar()->params.labelString();
#else
- return labelstring;
+ return params.labelString();
#endif
}
string const LyXParagraph::GetLabelWidthString() const
{
#ifndef NEW_INSETS
- if (!FirstPhysicalPar()->labelwidthstring.empty())
- return FirstPhysicalPar()->labelwidthstring;
+ if (!FirstPhysicalPar()->params.labelWidthString().empty())
+ return FirstPhysicalPar()->params.labelWidthString();
#else
- if (!labelwidthstring.empty())
- return labelwidthstring;
+ if (!params.labelWidthString().empty())
+ return params.labelWidthString();
#endif
else
return _("Senseless with this layout!");
#ifndef NEW_INSETS
LyXParagraph * par = FirstPhysicalPar();
- par->labelwidthstring = s;
+ par->params.labelWidthString(s);
#else
- labelwidthstring = s;
+ params.labelWidthString(s);
#endif
}
par->layout = new_layout;
- if (par->pextra_type == PEXTRA_NONE) {
- if (par->Previous()) {
+#ifndef NO_PEXTRA
+ if (par->params.pextraType() == PEXTRA_NONE) {
+#endif
+ if (par->previous()) {
#ifndef NEW_INSETS
- ppar = par->Previous()->FirstPhysicalPar();
+ ppar = par->previous()->FirstPhysicalPar();
#else
- ppar = par->Previous();
+ ppar = par->previous();
#endif
while(ppar
- && ppar->Previous()
- && (ppar->depth > par->depth))
+ && ppar->previous()
+ && (ppar->params.depth() > par->params.depth()))
#ifndef NEW_INSETS
- ppar = ppar->Previous()->FirstPhysicalPar();
+ ppar = ppar->previous()->FirstPhysicalPar();
#else
- ppar = ppar->Previous();
+ ppar = ppar->previous();
#endif
}
- if (par->Next()) {
+ if (par->next()) {
#ifndef NEW_INSETS
- npar = par->Next()->NextAfterFootnote();
+ npar = par->next()->NextAfterFootnote();
#else
- npar = par->Next();
+ npar = par->next();
#endif
while(npar
- && npar->Next()
- && (npar->depth > par->depth))
+ && npar->next()
+ && (npar->params.depth() > par->params.depth()))
#ifndef NEW_INSETS
- npar = npar->Next()->NextAfterFootnote();
+ npar = npar->next()->NextAfterFootnote();
#else
- npar = npar->Next();
+ npar = npar->next();
#endif
}
- if (ppar && (ppar->pextra_type != PEXTRA_NONE)) {
- string
- p1 = ppar->pextra_width,
- p2 = ppar->pextra_widthp;
- ppar->SetPExtraType(bparams, ppar->pextra_type,
+#ifndef NO_PEXTRA
+ if (ppar && (ppar->params.pextraType() != PEXTRA_NONE)) {
+ string p1 = ppar->params.pextraWidth();
+ string p2 = ppar->params.pextraWidthp();
+ ppar->SetPExtraType(bparams,
+ ppar->params.pextraType(),
p1, p2);
}
- if ((par->pextra_type == PEXTRA_NONE) &&
- npar && (npar->pextra_type != PEXTRA_NONE)) {
- string const p1 = npar->pextra_width;
- string const p2 = npar->pextra_widthp;
- npar->SetPExtraType(bparams, npar->pextra_type,
+ if ((par->params.pextraType() == PEXTRA_NONE) &&
+ npar && (npar->params.pextraType() != PEXTRA_NONE)) {
+ string const p1 = npar->params.pextraWidth();
+ string const p2 = npar->params.pextraWidthp();
+ npar->SetPExtraType(bparams, npar->params.pextraType(),
p1, p2);
}
}
+#endif
}
* npar = 0;
par->layout = new_layout;
- par->labelwidthstring.erase();
- par->align = LYX_ALIGN_LAYOUT;
- par->added_space_top = VSpace(VSpace::NONE);
- par->added_space_bottom = VSpace(VSpace::NONE);
- par->spacing.set(Spacing::Default);
-
- if (par->pextra_type == PEXTRA_NONE) {
- if (par->Previous()) {
+ par->params.labelWidthString(string());
+ par->params.align(LYX_ALIGN_LAYOUT);
+ par->params.spaceTop(VSpace(VSpace::NONE));
+ par->params.spaceBottom(VSpace(VSpace::NONE));
+ par->params.spacing(Spacing(Spacing::Default));
+
+#ifndef NO_PEXTRA
+ if (par->params.pextraType() == PEXTRA_NONE) {
+#endif
+ if (par->previous()) {
#ifndef NEW_INSETS
- ppar = par->Previous()->FirstPhysicalPar();
+ ppar = par->previous()->FirstPhysicalPar();
#else
- ppar = par->Previous();
+ ppar = par->previous();
#endif
while(ppar
- && ppar->Previous()
- && (ppar->depth > par->depth))
+ && ppar->previous()
+ && (ppar->params.depth() > par->params.depth()))
#ifndef NEW_INSETS
- ppar = ppar->Previous()->FirstPhysicalPar();
+ ppar = ppar->previous()->FirstPhysicalPar();
#else
- ppar = ppar->Previous();
+ ppar = ppar->previous();
#endif
}
- if (par->Next()) {
+ if (par->next()) {
#ifndef NEW_INSETS
- npar = par->Next()->NextAfterFootnote();
+ npar = par->next()->NextAfterFootnote();
#else
- npar = par->Next();
+ npar = par->next();
#endif
while(npar
- && npar->Next()
- && (npar->depth > par->depth))
+ && npar->next()
+ && (npar->params.depth() > par->params.depth()))
#ifndef NEW_INSETS
- npar = npar->Next()->NextAfterFootnote();
+ npar = npar->next()->NextAfterFootnote();
#else
- npar = npar->Next();
+ npar = npar->next();
#endif
}
- if (ppar && (ppar->pextra_type != PEXTRA_NONE)) {
- string const p1 = ppar->pextra_width;
- string const p2 = ppar->pextra_widthp;
- ppar->SetPExtraType(bparams, ppar->pextra_type,
+#ifndef NO_PEXTRA
+ if (ppar && (ppar->params.pextraType() != PEXTRA_NONE)) {
+ string const p1 = ppar->params.pextraWidth();
+ string const p2 = ppar->params.pextraWidthp();
+ ppar->SetPExtraType(bparams, ppar->params.pextraType(),
p1, p2);
}
- if ((par->pextra_type == PEXTRA_NONE) &&
- npar && (npar->pextra_type != PEXTRA_NONE)) {
- string const p1 = npar->pextra_width;
- string const p2 = npar->pextra_widthp;
- npar->SetPExtraType(bparams, npar->pextra_type,
+ if ((par->params.pextraType() == PEXTRA_NONE) &&
+ npar && (npar->params.pextraType() != PEXTRA_NONE)) {
+ string const p1 = npar->params.pextraWidth();
+ string const p2 = npar->params.pextraWidthp();
+ npar->SetPExtraType(bparams, npar->params.pextraType(),
p1, p2);
}
}
+#endif
}
#ifndef NEW_INSETS
if (i == 0 && i == size() &&
!(footnoteflag == LyXParagraph::NO_FOOTNOTE
- && next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE))
+ && next_ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE))
++i; /* the cursor should not jump
* to the main body if there
* is nothing in! */
do {
#ifndef NEW_INSETS
- newpar = newpar->FirstPhysicalPar()->Previous();
+ newpar = newpar->FirstPhysicalPar()->previous();
#else
- newpar = newpar->Previous();
+ newpar = newpar->previous();
#endif
} while (newpar && newpar->GetDepth() > deth
#ifndef NEW_INSETS
);
if (!newpar) {
- if (Previous() || GetDepth())
+ if (previous() || GetDepth())
lyxerr << "ERROR (LyXParagraph::DepthHook): "
"no hook." << endl;
newpar = this;
do {
#ifndef NEW_INSETS
- newpar = newpar->FirstPhysicalPar()->Previous();
+ newpar = newpar->FirstPhysicalPar()->previous();
#else
- newpar = newpar->Previous();
+ newpar = newpar->previous();
#endif
} while (newpar && newpar->GetDepth() > deth
#ifndef NEW_INSETS
);
if (!newpar) {
- if (Previous() || GetDepth())
+ if (previous() || GetDepth())
lyxerr << "ERROR (LyXParagraph::DepthHook): "
"no hook." << endl;
newpar = this;
#ifndef NEW_INSETS
// Think about footnotes.
if (footnoteflag == LyXParagraph::NO_FOOTNOTE
- && next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
+ && next_ && next_->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
int const further =
NextAfterFootnote()->GetPositionOfInset(inset);
if (further != -1)
lyxerr << "ERROR (LyXParagraph::TeXOnePar) is dummy." << endl;
#endif
- if (start_of_appendix) {
+ if (params.startOfAppendix()) {
os << "\\appendix\n";
texrow.newline();
}
- if (!spacing.isDefault()
- && (!Previous() || !Previous()->HasSameLayout(this))) {
- os << spacing.writeEnvirBegin() << "\n";
+ if (!params.spacing().isDefault()
+ && (!previous() || !previous()->HasSameLayout(this))) {
+ os << params.spacing().writeEnvirBegin() << "\n";
texrow.newline();
}
texrow.newline();
}
- if (pagebreak_top) {
+ if (params.pagebreakTop()) {
os << "\\newpage";
further_blank_line = true;
}
- if (added_space_top.kind() != VSpace::NONE) {
- os << added_space_top.asLatexCommand(bparams);
+ if (params.spaceTop().kind() != VSpace::NONE) {
+ os << params.spaceTop().asLatexCommand(bparams);
further_blank_line = true;
}
- if (line_top) {
+ if (params.lineTop()) {
os << "\\lyxline{\\" << getFont(bparams, 0).latexSize() << '}'
<< "\\vspace{-1\\parskip}";
further_blank_line = true;
Language const * language = getParLanguage(bparams);
Language const * doc_language = bparams.language;
- Language const * previous_language = previous
- ? previous->getParLanguage(bparams) : doc_language;
+ Language const * previous_language = previous_
+ ? previous_->getParLanguage(bparams) : doc_language;
if (language->babel() != doc_language->babel() &&
language->babel() != previous_language->babel()) {
os << subst(lyxrc.language_command_begin, "$$lang",
bool need_par = SimpleTeXOnePar(buf, bparams, os, texrow, moving_arg);
- LyXParagraph * par = next;
+ LyXParagraph * par = next_;
#ifndef NEW_INSETS
// Spit out footnotes
if (lyxrc.rtl_support) {
- if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE
- && next->footnoteflag != footnoteflag) {
+ if (next_ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE
+ && next_->footnoteflag != footnoteflag) {
LyXParagraph * p = 0;
bool is_rtl = (size() > 0)
? GetFontSettings(bparams,
? par->GetFontSettings(bparams,
par->size()-1).isRightToLeft()
: language->RightToLeft();
- if (par->next &&
- par->next->footnoteflag != LyXParagraph::NO_FOOTNOTE &&
+ if (par->next_ &&
+ par->next_->footnoteflag != LyXParagraph::NO_FOOTNOTE &&
(p = par->NextAfterFootnote()) != 0 &&
p->size() > 0 &&
p->GetFontSettings(bparams, 0).isRightToLeft() != is_rtl)
is_rtl = language->RightToLeft();
- par = par->next;
+ par = par->next_;
}
}
} else {
foot, foot_texrow, foot_count,
false);
par->SimpleTeXOnePar(buf, bparams, os, texrow, moving_arg);
- par = par->next;
+ par = par->next_;
}
}
#endif
// Is this really needed ? (Dekel)
// We do not need to use to change the font for the last paragraph
// or for a command.
+#ifndef NEW_INSETS
LyXFont font = getFont(bparams, Last() - 1);
+#else
+ LyXFont font = getFont(bparams, size() - 1);
+#endif
bool is_command = textclasslist.Style(bparams.textclass,
GetLayout()).isCommand();
- if (style.resfont.size() != font.size() && next && !is_command) {
+ if (style.resfont.size() != font.size() && next_ && !is_command) {
if (!need_par)
os << "{";
os << "\\" << font.latexSize() << " \\par}";
switch (style.latextype) {
case LATEX_ITEM_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT:
- if (par && (depth < par->depth)) {
+ if (par && (params.depth() < par->params.depth())) {
os << '\n';
texrow.newline();
}
// skip it otherwise fall through
if (par
&& (par->layout != layout
- || par->depth != depth
- || par->pextra_type != pextra_type))
+ || par->params.depth() != params.depth()
+#ifndef NO_PEXTRA
+ || par->params.pextraType() != params.pextraType()
+#endif
+ ))
break;
default:
// we don't need it for the last paragraph!!!
// or for tables in floats
// -- effectively creates a \par where there isn't one which
// breaks a \subfigure or \subtable.
- if (next) {
+ if (next_) {
// && footnoteflag == LyXParagraph::NO_FOOTNOTE) {
os << '\n';
texrow.newline();
}
further_blank_line = false;
- if (line_bottom) {
- os << "\\lyxline{\\" << getFont(bparams, Last() - 1).latexSize() << '}';
+ if (params.lineBottom()) {
+#ifndef NEW_INSETS
+ os << "\\lyxline{\\" << getFont(bparams,
+ Last() - 1).latexSize() << '}';
+#else
+ os << "\\lyxline{\\" << getFont(bparams,
+ size() - 1).latexSize() << '}';
+#endif
further_blank_line = true;
}
- if (added_space_bottom.kind() != VSpace::NONE) {
- os << added_space_bottom.asLatexCommand(bparams);
+ if (params.spaceBottom().kind() != VSpace::NONE) {
+ os << params.spaceBottom().asLatexCommand(bparams);
further_blank_line = true;
}
- if (pagebreak_bottom) {
+ if (params.pagebreakBottom()) {
os << "\\newpage";
further_blank_line = true;
}
texrow.newline();
}
- if (!spacing.isDefault()
+ if (!params.spacing().isDefault()
&& (!par || !par->HasSameLayout(this))) {
- os << spacing.writeEnvirEnd() << "\n";
+ os << params.spacing().writeEnvirEnd() << "\n";
texrow.newline();
}
// we don't need it for the last paragraph!!!
- if (next
+ if (next_
#ifndef NEW_INSETS
&& !(footnoteflag != LyXParagraph::NO_FOOTNOTE && par &&
par->footnoteflag == LyXParagraph::NO_FOOTNOTE)
if (style.isCommand()) {
os << '{';
++column;
- } else if (align != LYX_ALIGN_LAYOUT) {
+ } else if (params.align() != LYX_ALIGN_LAYOUT) {
os << '{';
++column;
return_value = true;
if (style.isCommand()) {
os << '{';
++column;
- } else if (align != LYX_ALIGN_LAYOUT && next) {
+ } else if (params.align() != LYX_ALIGN_LAYOUT && next_) {
// We do not need \par here (Dekel)
// os << "{\\par";
os << "{";
return_value = true;
}
- if (noindent) {
+ if (params.noindent()) {
os << "\\noindent ";
column += 10;
}
- switch (align) {
+ switch (params.align()) {
case LYX_ALIGN_NONE:
case LYX_ALIGN_BLOCK:
case LYX_ALIGN_LAYOUT:
#ifndef NEW_INSETS
LyXParagraph * p = 0;
if (i == 0
- && previous &&
- previous->footnoteflag != LyXParagraph::NO_FOOTNOTE &&
+ && previous_ &&
+ previous_->footnoteflag != LyXParagraph::NO_FOOTNOTE &&
(p = PreviousBeforeFootnote()) != 0)
last_font = p->getFont(bparams, p->size() - 1);
else
// If we have an open font definition, we have to close it
if (open_font) {
LyXParagraph * p = 0;
- if (next
+ if (next_
#ifndef NEW_INSETS
- && next->footnoteflag != LyXParagraph::NO_FOOTNOTE
+ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& (p = NextAfterFootnote()) != 0
#else
- && (p = next)
+ && (p = next_)
#endif
)
running_font.latexWriteEndChanges(os, basefont,
if (inset) {
bool close = false;
int const len = os.tellp();
+ //ostream::pos_type const len = os.tellp();
if ((inset->LyxCode() == Inset::GRAPHICS_CODE
|| inset->LyxCode() == Inset::MATH_CODE
|| inset->LyxCode() == Inset::URL_CODE)
if (tmp) {
column = 0;
} else {
- column += os.tellp() - len;
+ column += int(os.tellp()) - len;
}
for (; tmp--;) {
texrow.newline();
LyXParagraph * par = this;
while (par &&
- (par->depth == depth)
+ (par->params.depth() == params.depth())
#ifndef NEW_INSETS
&& (par->footnoteflag == footnoteflag)
#endif
#endif
if (textclasslist.Style(bparams.textclass,
par->layout).isEnvironment()
- || par->pextra_type != PEXTRA_NONE) {
+#ifndef NO_PEXTRA
+ || par->params.pextraType() != PEXTRA_NONE
+#endif
+ ) {
par = par->TeXEnvironment(buf, bparams,
os, texrow
#ifndef NEW_INSETS
#endif
)
{
+#ifndef NO_PEXTRA
bool eindent_open = false;
+#endif
#ifndef NEW_INSETS
bool foot_this_level = false;
#endif
+#ifndef NO_PEXTRA
// flags when footnotetext should be appended to file.
static bool minipage_open = false;
static int minipage_open_depth = 0;
char par_sep = bparams.paragraph_separation;
+#endif
lyxerr[Debug::LATEX] << "TeXEnvironment... " << this << endl;
#ifndef NEW_INSETS
LyXLayout const & style =
textclasslist.Style(bparams.textclass,
layout);
-
- if (pextra_type == PEXTRA_INDENT) {
- if (!pextra_width.empty()) {
+
+#ifndef NO_PEXTRA
+ if (params.pextraType() == PEXTRA_INDENT) {
+ if (!params.pextraWidth().empty()) {
os << "\\begin{LyXParagraphIndent}{"
- << pextra_width << "}\n";
+ << params.pextraWidth() << "}\n";
} else {
//float ib = atof(pextra_widthp.c_str())/100;
// string can't handle floats at present (971109)
// so I'll do a conversion by hand knowing that
// the limits are 0.0 to 1.0. ARRae.
os << "\\begin{LyXParagraphIndent}{";
- switch (pextra_widthp.length()) {
+ switch (params.pextraWidthp().length()) {
case 3:
os << "1.00";
break;
case 2:
os << "0."
- << pextra_widthp;
+ << params.pextraWidthp();
break;
case 1:
os << "0.0"
- << pextra_widthp;
+ << params.pextraWidthp();
}
os << "\\columnwidth}\n";
}
texrow.newline();
eindent_open = true;
}
- if ((pextra_type == PEXTRA_MINIPAGE) && !minipage_open) {
- if (pextra_hfill && Previous() &&
- (Previous()->pextra_type == PEXTRA_MINIPAGE)) {
+ if ((params.pextraType() == PEXTRA_MINIPAGE) && !minipage_open) {
+ if (params.pextraHfill() && previous() &&
+ (previous()->params.pextraType() == PEXTRA_MINIPAGE)) {
os << "\\hfill{}\n";
texrow.newline();
}
texrow.newline();
}
os << "\\begin{minipage}";
- switch (pextra_alignment) {
+ switch (params.pextraAlignment()) {
case MINIPAGE_ALIGN_TOP:
os << "[t]";
break;
os << "[b]";
break;
}
- if (!pextra_width.empty()) {
- os << '{' << pextra_width << "}\n";
+ if (!params.pextraWidth().empty()) {
+ os << '{' << params.pextraWidth() << "}\n";
} else {
//float ib = atof(par->pextra_width.c_str())/100;
// string can't handle floats at present
// so I'll do a conversion by hand knowing that
// the limits are 0.0 to 1.0. ARRae.
os << '{';
- switch (pextra_widthp.length()) {
+ switch (params.pextraWidthp().length()) {
case 3:
os << "1.00";
break;
case 2:
os << "0."
- << pextra_widthp;
+ << params.pextraWidthp();
break;
case 1:
os << "0.0"
- << pextra_widthp;
+ << params.pextraWidthp();
}
os << "\\columnwidth}\n";
}
texrow.newline();
}
minipage_open = true;
- minipage_open_depth = depth;
+ minipage_open_depth = params.depth();
}
-
+#endif
#ifdef WITH_WARNINGS
#warning Define FANCY_FOOTNOTE_CODE to re-enable Allan footnote code
//I disabled it because it breaks when lists span on several
}
#endif
os << "\\begin{" << style.latexname() << "}{"
- << labelwidthstring << "}\n";
+ << params.labelWidthString() << "}\n";
} else if (style.labeltype == LABEL_BIBLIO) {
// ale970405
os << "\\begin{" << style.latexname() << "}{"
foot, foot_texrow, foot_count
#endif
);
-
+#ifndef NO_PEXTRA
if (minipage_open && par && !style.isEnvironment() &&
- (par->pextra_type == PEXTRA_MINIPAGE) &&
- par->pextra_start_minipage) {
+ (par->params.pextraType() == PEXTRA_MINIPAGE) &&
+ par->params.pextraStartMinipage()) {
os << "\\end{minipage}\n";
texrow.newline();
if (par_sep == BufferParams::PARSEP_INDENT) {
}
minipage_open = false;
}
- if (par && par->depth > depth) {
+#endif
+ if (par && par->params.depth() > params.depth()) {
if (textclasslist.Style(bparams.textclass,
par->layout).isParagraph()
// Thinko!
#endif
);
}
- if (par && par->layout == layout && par->depth == depth &&
- (par->pextra_type == PEXTRA_MINIPAGE) && !minipage_open) {
- if (par->pextra_hfill && par->Previous() &&
- (par->Previous()->pextra_type == PEXTRA_MINIPAGE)){
+#ifndef NO_PEXTRA
+ if (par && par->layout == layout && par->params.depth() == params.depth() &&
+ (par->params.pextraType() == PEXTRA_MINIPAGE) && !minipage_open) {
+ if (par->params.pextraHfill() && par->previous() &&
+ (par->previous()->params.pextraType() == PEXTRA_MINIPAGE)){
os << "\\hfill{}\n";
texrow.newline();
}
texrow.newline();
}
os << "\\begin{minipage}";
- switch (par->pextra_alignment) {
+ switch (par->params.pextraAlignment()) {
case MINIPAGE_ALIGN_TOP:
os << "[t]";
break;
os << "[b]";
break;
}
- if (!par->pextra_width.empty()) {
- os << '{' << par->pextra_width << "}\n";
+ if (!par->params.pextraWidth().empty()) {
+ os << '{' << par->params.pextraWidth() << "}\n";
} else {
//float ib = atof(par->pextra_widthp.c_str())/100;
// string can't handle floats at present
// so I'll do a conversion by hand knowing that
// the limits are 0.0 to 1.0. ARRae.
os << '{';
- switch (par->pextra_widthp.length()) {
+ switch (par->params.pextraWidthp().length()) {
case 3:
os << "1.00";
break;
case 2:
- os << "0." << par->pextra_widthp;
+ os << "0." << par->params.pextraWidthp();
break;
case 1:
- os << "0.0" << par->pextra_widthp;
+ os << "0.0" << par->params.pextraWidthp();
}
os << "\\columnwidth}\n";
}
texrow.newline();
}
minipage_open = true;
- minipage_open_depth = par->depth;
+ minipage_open_depth = par->params.depth();
}
+#endif
} while (par
&& par->layout == layout
- && par->depth == depth
- && par->pextra_type == pextra_type
+ && par->params.depth() == params.depth()
+#ifndef NO_PEXTRA
+ && par->params.pextraType() == params.pextraType()
+#endif
#ifndef NEW_INSETS
&& par->footnoteflag == footnoteflag
#endif
);
if (style.isEnvironment()) {
- os << "\\end{" << style.latexname() << '}';
+ os << "\\end{" << style.latexname() << "}\n";
+
#ifndef NEW_INSETS
// maybe this should go after the minipage closes?
if (foot_this_level) {
}
#endif
}
- if (minipage_open && (minipage_open_depth == depth) &&
- (!par || par->pextra_start_minipage ||
- par->pextra_type != PEXTRA_MINIPAGE)) {
+#ifndef NO_PEXTRA
+ if (minipage_open && (minipage_open_depth == params.depth()) &&
+ (!par || par->params.pextraStartMinipage() ||
+ par->params.pextraType() != PEXTRA_MINIPAGE)) {
os << "\\end{minipage}\n";
texrow.newline();
if (par_sep == BufferParams::PARSEP_INDENT) {
os << "}\n";
texrow.newline();
}
- if (par && par->pextra_type != PEXTRA_MINIPAGE) {
+ if (par && par->params.pextraType() != PEXTRA_MINIPAGE) {
os << "\\medskip\n\n";
texrow.newline();
texrow.newline();
os << "\\end{LyXParagraphIndent}\n";
texrow.newline();
}
- if (!(par && (par->pextra_type == PEXTRA_MINIPAGE)
- && par->pextra_hfill)) {
+ if (!(par && (par->params.pextraType() == PEXTRA_MINIPAGE)
+ && par->params.pextraHfill())) {
os << '\n';
texrow.newline();
}
+#endif
lyxerr[Debug::LATEX] << "TeXEnvironment...done " << par << endl;
return par; // ale970302
}
LyXParagraph * par = this;
LyXLayout const & style =
textclasslist.Style(bparams.textclass,
- previous->GetLayout());
+ previous_->GetLayout());
if (style.needprotect && footnotekind != LyXParagraph::FOOTNOTE){
lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
os << "\\marginpar{\n";
break;
case LyXParagraph::FIG:
- if (pextra_type == PEXTRA_FLOATFLT
- && (!pextra_width.empty()
- || !pextra_widthp.empty())) {
- if (!pextra_width.empty())
+ if (params.pextraType() == PEXTRA_FLOATFLT
+ && (!params.pextraWidth().empty()
+ || !params.pextraWidthp().empty())) {
+ if (!params.pextraWidth().empty())
os << "\\begin{floatingfigure}{"
- << pextra_width << "}\n";
+ << params.pextraWidth() << "}\n";
else
os << "\\begin{floatingfigure}{"
- << lyx::atoi(pextra_widthp) / 100.0
+ << lyx::atoi(params.pextraWidthp()) / 100.0
<< "\\textwidth}\n";
} else {
os << "\\begin{figure}";
lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
<< endl;
if (style.isEnvironment()
- || par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
+ || par->params.pextraType() == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
// Allows the use of minipages within float
// environments. Shouldn't be circular because
// we don't support footnotes inside
foot_count);
}
- if (par && !par->IsDummy() && par->depth > depth) {
+ if (par && !par->IsDummy() && par->params.depth() > params.depth()) {
par = par->TeXDeeper(buf, bparams, os, texrow,
foot, foot_texrow,
foot_count);
lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
<< endl;
if (style.isEnvironment()
- || par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
+ || par->params.pextraType() == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
// Allows the use of minipages within float
// environments. Shouldn't be circular because
// we don't support footnotes inside
dummy_count);
}
- if (par && !par->IsDummy() && par->depth > depth) {
+ if (par && !par->IsDummy() && par->params.depth() > params.depth()) {
par = par->TeXDeeper(buf, bparams,
foot, foot_texrow,
dummy, dummy_texrow,
os << '}';
break;
case LyXParagraph::FIG:
- if (pextra_type == PEXTRA_FLOATFLT
- && (!pextra_width.empty()
- || !pextra_widthp.empty()))
+ if (params.pextraType() == PEXTRA_FLOATFLT
+ && (!params.pextraWidth().empty()
+ || !params.pextraWidthp().empty()))
os << "\\end{floatingfigure}";
else
os << "\\end{figure}";
texrow.newline();
}
- lyxerr[Debug::LATEX] << "TeXFootnote...done " << par->next << endl;
+ lyxerr[Debug::LATEX] << "TeXFootnote...done " << par->next_ << endl;
return par;
}
bool LyXParagraph::IsDummy() const
{
- return (footnoteflag == LyXParagraph::NO_FOOTNOTE && previous
- && previous->footnoteflag != LyXParagraph::NO_FOOTNOTE);
+ return (footnoteflag == LyXParagraph::NO_FOOTNOTE && previous_
+ && previous_->footnoteflag != LyXParagraph::NO_FOOTNOTE);
}
#endif
+#ifndef NO_PEXTRA
void LyXParagraph::SetPExtraType(BufferParams const & bparams,
int type, string const & width,
string const & widthp)
{
- pextra_type = type;
- pextra_width = width;
- pextra_widthp = widthp;
+ params.pextraType(type);
+ params.pextraWidth(width);
+ params.pextraWidthp(widthp);
if (textclasslist.Style(bparams.textclass,
layout).isEnvironment()) {
LyXParagraph * ppar = par;
while (par && (par->layout == layout)
- && (par->depth == depth)) {
+ && (par->params.depth() == params.depth())) {
ppar = par;
- par = par->Previous();
+ par = par->previous();
#ifndef NEW_INSETS
if (par)
par = par->FirstPhysicalPar();
#endif
- while (par && par->depth > depth) {
- par = par->Previous();
+ while (par && par->params.depth() > params.depth()) {
+ par = par->previous();
#ifndef NEW_INSETS
if (par)
par = par->FirstPhysicalPar();
}
par = ppar;
while (par && (par->layout == layout)
- && (par->depth == depth)) {
- par->pextra_type = type;
- par->pextra_width = width;
- par->pextra_widthp = widthp;
+ && (par->params.depth() == params.depth())) {
+ par->params.pextraType(type);
+ par->params.pextraWidth(width);
+ par->params.pextraWidthp(widthp);
#ifndef NEW_INSETS
par = par->NextAfterFootnote();
#else
- par = par->Next();
+ par = par->next();
#endif
- if (par && (par->depth > depth))
+ if (par && (par->params.depth() > params.depth()))
par->SetPExtraType(bparams,
type, width, widthp);
#ifndef NEW_INSETS
- while (par && ((par->depth > depth) || par->IsDummy()))
+ while (par && ((par->params.depth() > params.depth()) || par->IsDummy()))
par = par->NextAfterFootnote();
#else
- while (par && ((par->depth > depth)))
- par = par->Next();
+ while (par && par->params.depth() > params.depth())
+ par = par->next();
#endif
}
}
void LyXParagraph::UnsetPExtraType(BufferParams const & bparams)
{
- if (pextra_type == PEXTRA_NONE)
+ if (params.pextraType() == PEXTRA_NONE)
return;
- pextra_type = PEXTRA_NONE;
- pextra_width.erase();
- pextra_widthp.erase();
+ params.pextraType(PEXTRA_NONE);
+ params.pextraWidth(string());
+ params.pextraWidthp(string());
if (textclasslist.Style(bparams.textclass,
layout).isEnvironment()) {
LyXParagraph * ppar = par;
while (par && (par->layout == layout)
- && (par->depth == depth)) {
+ && (par->params.depth() == params.depth())) {
ppar = par;
- par = par->Previous();
+ par = par->previous();
#ifndef NEW_INSETS
if (par)
par = par->FirstPhysicalPar();
#endif
- while (par && par->depth > depth) {
- par = par->Previous();
+ while (par && par->params.depth() > params.depth()) {
+ par = par->previous();
#ifndef NEW_INSETS
if (par)
par = par->FirstPhysicalPar();
}
par = ppar;
while (par && (par->layout == layout)
- && (par->depth == depth)) {
- par->pextra_type = PEXTRA_NONE;
- par->pextra_width.erase();
- par->pextra_widthp.erase();
+ && (par->params.depth() == params.depth())) {
+ par->params.pextraType(PEXTRA_NONE);
+ par->params.pextraWidth(string());
+ par->params.pextraWidthp(string());
#ifndef NEW_INSETS
par = par->NextAfterFootnote();
#else
- par = par->Next();
+ par = par->next();
#endif
- if (par && (par->depth > depth))
+ if (par && (par->params.depth() > params.depth()))
par->UnsetPExtraType(bparams);
#ifndef NEW_INSETS
- while (par && ((par->depth > depth) || par->IsDummy()))
+ while (par && ((par->params.depth() > params.depth()) || par->IsDummy()))
par = par->NextAfterFootnote();
#else
- while (par && ((par->depth > depth)))
- par = par->Next();
+ while (par && par->params.depth() > params.depth())
+ par = par->next();
#endif
}
}
}
+#endif
bool LyXParagraph::IsHfill(size_type pos) const
return FirstPhysicalPar()->getParLanguage(bparams);
else
#endif
- if (size() > 0) {
-#ifdef DO_USE_DEFAULT_LANGUAGE
- Language const * lang = GetFirstFontSettings().language();
-
- if (lang->lang() == "default")
- return bparams.language;
- return lang;
-#else
+ if (size() > 0)
return GetFirstFontSettings().language();
-#endif
- } else if (previous)
- return previous->getParLanguage(bparams);
+ else if (previous_)
+ return previous_->getParLanguage(bparams);
else
return bparams.language;
}
Language const * doc_language = bparams.language;
for (FontList::const_iterator cit = fontlist.begin();
cit != fontlist.end(); ++cit)
- if ((*cit).font.language() != doc_language)
+ if ((*cit).font().language() != doc_language)
return true;
return false;
}
BufferParams const & bparams = buffer->params;
string s;
#ifndef NEW_INSETS
- if (label && !IsDummy() && !labelstring.empty())
+ if (label && !IsDummy() && !params.labelString().empty())
#else
- if (label && !labelstring.empty())
+ if (label && !params.labelString().empty())
#endif
- s += labelstring + ' ';
+ s += params.labelString() + ' ';
string::size_type const len = s.size();
for (LyXParagraph::size_type i = 0; i < size(); ++i) {
}
#ifndef NEW_INSETS
- if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE
+ if (next_ && next_->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& footnoteflag == LyXParagraph::NO_FOOTNOTE)
s += NextAfterFootnote()->String(buffer, false);
string s;
#ifndef NEW_INSETS
- if (beg == 0 && !IsDummy() && !labelstring.empty())
+ if (beg == 0 && !IsDummy() && !params.labelString().empty())
#else
- if (beg == 0 && !labelstring.empty())
+ if (beg == 0 && !params.labelString().empty())
#endif
- s += labelstring + ' ';
+ s += params.labelString() + ' ';
for (LyXParagraph::size_type i = beg; i < end; ++i) {
- value_type c = GetChar(i);
+ value_type c = GetUChar(buffer->params, i);
if (IsPrintable(c))
s += c;
else if (c == META_INSET) {
}
}
}
+
+
+void LyXParagraph::fitToSize()
+{
+ TextContainer tmp(text.begin(), text.end());
+ text.swap(tmp);
+}
+
+
+void LyXParagraph::setContentsFromPar(LyXParagraph * par)
+{
+ text = par->text;
+}