Text & Buffer::text() const
{
- return d->inset->text_;
+ return d->inset->text();
}
}
}
+ InsetText in(buffer);
// Make sure there is no class difference.
- InsetText in;
+ in.paragraphs().clear();
// This works without copying any paragraph data because we have
// a specialized swap method for ParagraphList. This is important
// since we store pointers to insets at some places and we don't
if (edit)
inset->edit(cur, true);
// Now put this into inset
- static_cast<InsetCollapsable *>(inset)->text_.insertStringAsParagraphs(cur, ds);
+ static_cast<InsetCollapsable *>(inset)->text().insertStringAsParagraphs(cur, ds);
return true;
}
pit.push_back(CursorSlice(*this));
Toc & toc = buffer().tocBackend().toc("branch");
- docstring const str = params_.branch + ": " + text_.getPar(0).asString();
+ docstring const str = params_.branch + ": " + text().getPar(0).asString();
toc.push_back(TocItem(pit, 0, str));
// Proceed with the rest of the inset.
InsetCollapsable::addToToc(cpit);
void InsetCaption::write(ostream & os) const
{
os << "Caption\n";
- text_.write(buffer(), os);
+ text().write(buffer(), os);
}
pit.push_back(CursorSlice(*this));
Toc & toc = buffer().tocBackend().toc(type_);
- docstring const str = full_label_ + ". " + text_.getPar(0).asString();
+ docstring const str = full_label_ + ". " + text().getPar(0).asString();
toc.push_back(TocItem(pit, 0, str));
// Proceed with the rest of the inset.
break;
}
os << "\n";
- text_.write(buffer(), os);
+ text().write(buffer(), os);
}
cur.push(*this);
cur.idx() = getNearestCell(cur.bv(), x, y);
resetPos(cur);
- return cur.bv().textMetrics(&cell(cur.idx())->text_).editXY(cur, x, y);
+ return cur.bv().textMetrics(&cell(cur.idx())->text()).editXY(cur, x, y);
}
void InsetTabular::setCursorFromCoordinates(Cursor & cur, int x, int y) const
{
cur.idx() = getNearestCell(cur.bv(), x, y);
- cur.bv().textMetrics(&cell(cur.idx())->text_).setCursorFromCoordinates(cur, x, y);
+ cur.bv().textMetrics(&cell(cur.idx())->text()).setCursorFromCoordinates(cur, x, y);
}
// we can only set this if we are not too far right
if (cols < columns) {
shared_ptr<InsetTableCell> inset = loctab->cellInset(cell);
- Font const font = bv.textMetrics(&inset->text_).
+ Font const font = bv.textMetrics(&inset->text()).
displayFont(0, 0);
inset->setText(buf.substr(op, p - op), font,
buffer().params().trackChanges);
// we can only set this if we are not too far right
if (cols < columns) {
shared_ptr<InsetTableCell> inset = tabular.cellInset(cell);
- Font const font = bv.textMetrics(&inset->text_).
+ Font const font = bv.textMetrics(&inset->text()).
displayFont(0, 0);
inset->setText(buf.substr(op, p - op), font,
buffer().params().trackChanges);
// check for the last cell if there is no trailing '\n'
if (cell < cells && op < len) {
shared_ptr<InsetTableCell> inset = loctab->cellInset(cell);
- Font const font = bv.textMetrics(&inset->text_).displayFont(0, 0);
+ Font const font = bv.textMetrics(&inset->text()).displayFont(0, 0);
inset->setText(buf.substr(op, len - op), font,
buffer().params().trackChanges);
}
InsetText::InsetText(Buffer const & buf)
: drawFrame_(false), frame_color_(Color_insetframe)
{
- initParagraphs(buf);
+ initParagraphs(buf.params());
+ setBuffer(const_cast<Buffer &>(buf));
}
}
-InsetText::InsetText()
-{}
-
-
void InsetText::setBuffer(Buffer & buf)
{
ParagraphList::iterator end = paragraphs().end();
}
-void InsetText::initParagraphs(Buffer const & buf)
+void InsetText::initParagraphs(BufferParams const & bparams)
{
LASSERT(paragraphs().empty(), /**/);
- buffer_ = const_cast<Buffer *>(&buf);
paragraphs().push_back(Paragraph());
Paragraph & ourpar = paragraphs().back();
- ourpar.setPlainOrDefaultLayout(buf.params().documentClass());
+ ourpar.setPlainOrDefaultLayout(bparams.documentClass());
ourpar.setInsetOwner(this);
}
+
void InsetText::setParagraphOwner()
{
for_each(paragraphs().begin(), paragraphs().end(),
///
explicit InsetText(Buffer const & buffer);
///
- InsetText();
- ///
InsetText(InsetText const &);
///
- void initParagraphs(Buffer const & buffer);
- ///
void setBuffer(Buffer &);
///
///
InsetText const * asInsetText() const { return this; }
///
+ Text & text() { return text_; }
+ Text const & text() const { return text_; }
+ ///
int latex(odocstream &, OutputParams const &) const;
///
int plaintext(odocstream &, OutputParams const &) const;
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
+ ///
+ void initParagraphs(BufferParams const &);
///
void setParagraphOwner();
///
ColorCode frame_color_;
///
mutable pit_type old_pit;
-
-public:
///
mutable Text text_;
};