font = Font(inherit_font, bp.language);
change = Change(Change::UNCHANGED);
- TextClass const & tclass = bp.textClass();
+ DocumentClass const & tclass = bp.documentClass();
if (layoutname.empty())
layoutname = tclass.defaultLayoutName();
tclass.defaultLayoutName();
}
- par.setLayout(bp.textClass()[layoutname]);
+ par.setLayout(bp.documentClass()[layoutname]);
// Test whether the layout is obsolete.
- LayoutPtr const & layout = par.layout();
- if (!layout->obsoleted_by().empty())
- par.setLayout(bp.textClass()[layout->obsoleted_by()]);
+ Layout const & layout = par.layout();
+ if (!layout.obsoleted_by().empty())
+ par.setLayout(bp.documentClass()[layout.obsoleted_by()]);
par.params().read(lex);
{
return pars_.empty() || (pars_.size() == 1 && pars_[0].empty()
// FIXME: Should we consider the labeled type as empty too?
- && pars_[0].layout()->labeltype == LABEL_NO_LABEL);
+ && pars_[0].layout().labeltype == LABEL_NO_LABEL);
}
Paragraph & cpar = cur.paragraph();
pit_type cpit = cur.pit();
- TextClass const & tclass = cur.buffer().params().textClass();
- LayoutPtr const & layout = cpar.layout();
+ DocumentClass const & tclass = cur.buffer().params().documentClass();
+ Layout const & layout = cpar.layout();
// this is only allowed, if the current paragraph is not empty
// or caption and if it has not the keepempty flag active
if (cur.lastpos() == 0 && !cpar.allowEmpty() &&
- layout->labeltype != LABEL_SENSITIVE)
+ layout.labeltype != LABEL_SENSITIVE)
return;
// a layout change may affect also the following paragraph
// What should the layout for the new paragraph be?
bool keep_layout = inverse_logic ?
- !layout->isEnvironment()
- : layout->isEnvironment();
+ !layout.isEnvironment()
+ : layout.isEnvironment();
// We need to remember this before we break the paragraph, because
// that invalidates the layout variable
- bool sensitive = layout->labeltype == LABEL_SENSITIVE;
+ bool sensitive = layout.labeltype == LABEL_SENSITIVE;
// we need to set this before we insert the paragraph.
bool const isempty = cpar.allowEmpty() && cpar.empty();
// try to remove this
pit_type const pit = cur.pit();
- bool const freeSpacing = par.layout()->free_spacing ||
+ bool const freeSpacing = par.layout().free_spacing ||
par.isFreeSpacing();
if (lyxrc.auto_number) {
&& !par.isLetter(cur.pos() - 1)) {
// get the word in front of cursor
BOOST_ASSERT(this == cur.text());
- cur.paragraph().updateWords(cur.buffer(), cur.top());
+ cur.paragraph().updateWords(cur.top());
}
}
bool Text::handleBibitems(Cursor & cur)
{
- if (cur.paragraph().layout()->labeltype != LABEL_BIBLIO)
+ if (cur.paragraph().layout().labeltype != LABEL_BIBLIO)
return false;
if (cur.pos() != 0)
}
// otherwise reset to default
- if (par.useEmptyLayout())
- cur.paragraph().setLayout(bufparams.textClass().emptyLayout());
- else
- cur.paragraph().setLayout(bufparams.textClass().defaultLayout());
+ cur.paragraph().setEmptyOrDefaultLayout(bufparams.documentClass());
return true;
}
bool needsUpdate = false;
BufferParams const & bufparams = cur.buffer().params();
- TextClass const & tclass = bufparams.textClass();
+ DocumentClass const & tclass = bufparams.documentClass();
ParagraphList & plist = cur.text()->paragraphs();
Paragraph const & par = cur.paragraph();
Cursor prevcur = cur;
// Correction: Pasting is always allowed with standard-layout
// or the empty layout.
else if (par.layout() == prevpar.layout()
- || par.layout() == tclass.defaultLayout()
- || par.layout() == tclass.emptyLayout()) {
+ || tclass.isDefaultLayout(par.layout())
+ || tclass.isEmptyLayout(par.layout())) {
cur.recordUndo(ATOMIC_UNDO, prevcur.pit());
mergeParagraph(bufparams, plist, prevcur.pit());
needsUpdate = true;
for (; it != it_end; it++)
it->changeLanguage(b.params(), latex_language, b.language());
- pasteParagraphList(cur, plist, b.params().textClassPtr(),
+ pasteParagraphList(cur, plist, b.params().documentClassPtr(),
b.errorList("Paste"));
// restore position
cur.pit() = min(cur.lastpit(), spit);
// register the words in the global word list
CursorSlice sl = CursorSlice(*insetPtr);
sl.pit() = pars_.size() - 1;
- pars_.back().updateWords(buf, sl);
+ pars_.back().updateWords(sl);
} else if (token == "\\begin_deeper") {
++depth;
} else if (token == "\\end_deeper") {
{
pit_type pit = cur.pit();
- LayoutPtr layout = pars_[pit].layout();
+ Layout const * layout = &(pars_[pit].layout());
docstring text;
docstring par_text = pars_[pit].asString(false);
// For section, subsection, etc...
if (layout->latextype == LATEX_PARAGRAPH && pit != 0) {
- LayoutPtr const & layout2 = pars_[pit - 1].layout();
+ Layout const * layout2 = &(pars_[pit - 1].layout());
if (layout2->latextype != LATEX_PARAGRAPH) {
--pit;
layout = layout2;