using cap::cutSelection;
using cap::pasteParagraphList;
-namespace {
+InsetText const & Text::inset() const
+{
+ return *owner_;
+}
-void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex,
+
+void Text::readParToken(Paragraph & par, Lexer & lex,
string const & token, Font & font, Change & change, ErrorList & errorList)
{
+ Buffer const & buf = owner_->buffer();
BufferParams const & bp = buf.params();
if (token[0] != '\\') {
if (layoutname.empty())
layoutname = tclass.defaultLayoutName();
- if (par.forcePlainLayout()) {
+ if (owner_->forcePlainLayout()) {
// in this case only the empty layout is allowed
layoutname = tclass.plainLayoutName();
} else if (par.usePlainLayout()) {
}
-void readParagraph(Buffer const & buf, Paragraph & par, Lexer & lex,
+void Text::readParagraph(Paragraph & par, Lexer & lex,
ErrorList & errorList)
{
lex.nextToken();
Change change(Change::UNCHANGED);
while (lex.isOK()) {
- readParToken(buf, par, lex, token, font, change, errorList);
+ readParToken(par, lex, token, font, change, errorList);
lex.nextToken();
token = lex.getString();
}
-} // namespace anon
-
class TextCompletionList : public CompletionList
{
public:
}
-double Text::spacing(Buffer const & buffer, Paragraph const & par) const
+double Text::spacing(Paragraph const & par) const
{
if (par.params().spacing().isDefault())
- return buffer.params().spacing().getValue();
+ return owner_->buffer().params().spacing().getValue();
return par.params().spacing().getValue();
}
|| par.isSeparator(cur.pos() - 2)
|| par.isNewline(cur.pos() - 2))
) {
- setCharFont(buffer, pit, cur.pos() - 1, cur.current_font,
+ setCharFont(pit, cur.pos() - 1, cur.current_font,
tm.font_);
} else if (contains(number_seperators, c)
&& cur.pos() >= 2
&& tm.displayFont(pit, cur.pos() - 2).fontInfo().number() == FONT_ON) {
- setCharFont(buffer, pit, cur.pos() - 1, cur.current_font,
+ setCharFont(pit, cur.pos() - 1, cur.current_font,
tm.font_);
}
}
LASSERT(this == cur.text(), /**/);
if (!cur.selection()) {
- Change const & change = cur.paragraph().lookupChange(cur.pos());
- if (!(change.changed() && findNextChange(&cur.bv())))
+ bool const changed = cur.paragraph().isChanged(cur.pos());
+ if (!(changed && findNextChange(&cur.bv())))
return;
}
}
-void Text::acceptChanges(BufferParams const & bparams)
+void Text::acceptChanges()
{
+ BufferParams const & bparams = owner_->buffer().params();
lyx::acceptChanges(pars_, bparams);
deleteEmptyParagraphMechanism(0, pars_.size() - 1, bparams.trackChanges);
}
-void Text::rejectChanges(BufferParams const & bparams)
+void Text::rejectChanges()
{
+ BufferParams const & bparams = owner_->buffer().params();
pit_type pars_size = static_cast<pit_type>(pars_.size());
// first, reject changes within each individual paragraph
{
LASSERT(this == cur.text(), return false);
- if (isMainText(cur.bv().buffer()) || cur.inset().nargs() != 1)
+ if (isMainText() || cur.inset().nargs() != 1)
return false;
cur.recordUndoInset();
// restore position
cur.pit() = min(cur.lastpit(), spit);
cur.pos() = min(cur.lastpos(), spos);
- }
+ } else
+ // this is the least that needs to be done (bug 6003)
+ // in the above case, pasteParagraphList handles this
+ cur.buffer()->updateLabels();
cur.clearSelection();
cur.resetAnchor();
return true;
}
-void Text::write(Buffer const & buf, ostream & os) const
+void Text::write(ostream & os) const
{
+ Buffer const & buf = owner_->buffer();
ParagraphList::const_iterator pit = paragraphs().begin();
ParagraphList::const_iterator end = paragraphs().end();
depth_type dth = 0;
}
-bool Text::read(Buffer const & buf, Lexer & lex,
+bool Text::read(Lexer & lex,
ErrorList & errorList, InsetText * insetPtr)
{
+ Buffer const & buf = owner_->buffer();
depth_type depth = 0;
bool res = true;
par.params().depth(depth);
par.setFont(0, Font(inherit_font, buf.params().language));
pars_.push_back(par);
-
- // FIXME: goddamn InsetTabular makes us pass a Buffer
- // not BufferParams
- lyx::readParagraph(buf, pars_.back(), lex, errorList);
+ readParagraph(pars_.back(), lex, errorList);
// register the words in the global word list
CursorSlice sl = CursorSlice(*insetPtr);
Change change = par.lookupChange(cur.pos());
- if (change.type != Change::UNCHANGED) {
+ if (change.changed()) {
Author const & a = buf.params().authors().get(change.author);
os << _("Change: ") << a.name();
if (!a.email().empty())