* src/paragraph.h: rename acceptChange() to acceptChanges()
* src/insets/insetbase.h:
* src/insets/insettext.h:
* src/insets/insettabular.h: add acceptChanges()
* src/*.C: fix acceptChanges() (& also accept changes in nested
insets)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15520
a592a061-630c-0410-9148-
cb99ea01b6c8
/// set the change for the entire inset
virtual void setChange(Change const &) {}
+ /// accept the changes within the inset
+ virtual void acceptChanges() {};
/// pretty arbitrary
virtual int width() const { return 10; }
}
+void InsetTabular::acceptChanges()
+{
+ for (idx_type idx = 0; idx < nargs(); ++idx)
+ cell(idx)->acceptChanges();
+}
+
+
bool InsetTabular::forceDefaultParagraphs(idx_type cell) const
{
return tabular.getPWidth(cell).zero();
/// set the change for the entire inset
void setChange(Change const & change);
+ /// accept the changes within the inset
+ void acceptChanges();
// this should return true if we have a "normal" cell, otherwise false.
// "normal" means without width set!
}
+void InsetText::acceptChanges()
+{
+ ParagraphList::iterator pit = paragraphs().begin();
+ ParagraphList::iterator end = paragraphs().end();
+ for (; pit != end; ++pit) {
+ // FIXME: change tracking (MG)
+ // we must handle end-of-par chars!
+ pit->acceptChanges(0, pit->size() + 1);
+ }
+}
+
+
int InsetText::latex(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
/// set the change for the entire inset
void setChange(Change const & change);
+ /// accept the changes within the inset
+ void acceptChanges();
/// append text onto the existing text
void appendParagraphs(Buffer * bp, ParagraphList &);
}
-void Paragraph::acceptChange(pos_type start, pos_type end)
+void Paragraph::acceptChanges(pos_type start, pos_type end)
{
- return pimpl_->acceptChange(start, end);
+ return pimpl_->acceptChanges(start, end);
}
/// set change at given pos
void setChange(pos_type pos, Change const & change);
- /// accept change
- void acceptChange(pos_type start, pos_type end);
+ /// accept changes within the given range
+ void acceptChanges(pos_type start, pos_type end);
/// reject change
void rejectChange(pos_type start, pos_type end);
}
-void Paragraph::Pimpl::acceptChange(pos_type start, pos_type end)
+void Paragraph::Pimpl::acceptChanges(pos_type start, pos_type end)
{
- // FIXME: change tracking (MG)
- return;
-
- // care for empty pars
-
- lyxerr[Debug::CHANGES] << "acceptchange" << endl;
- pos_type i = start;
-
- for (; i < end; ++i) {
- switch (lookupChange(i).type) {
+ for (pos_type pos = start; pos < end; ++pos) {
+ switch (lookupChange(pos).type) {
case Change::UNCHANGED:
break;
case Change::INSERTED:
- // FIXME: change tracking (MG)
- changes_.set(Change(Change::UNCHANGED), i);
+ changes_.set(Change(Change::UNCHANGED), pos);
break;
case Change::DELETED:
// Suppress access to nonexistent
// "end-of-paragraph char":
- if (i < size()) {
- eraseChar(i, false);
+ if (pos < size()) {
+ eraseChar(pos, false);
--end;
- --i;
+ --pos;
}
break;
}
- }
- lyxerr[Debug::CHANGES] << "endacceptchange" << endl;
- // FIXME: change tracking (MG)
- // changes_.reset(Change::UNCHANGED);
+ // also accept changes in nested insets
+ if (pos < size() && owner_->isInset(pos)) {
+ owner_->getInset(pos)->acceptChanges();
+ }
+ }
}
void setChange(Change const & change);
/// set change at given pos
void setChange(pos_type pos, Change const & change);
- /// accept change
- void acceptChange(pos_type start, pos_type end);
+ /// accept changes within the given range
+ void acceptChanges(pos_type start, pos_type end);
/// reject change
void rejectChange(pos_type start, pos_type end);
pos_type left = ( pit == it.pit() ? it.pos() : 0 );
pos_type right =
( pit == et.pit() ? et.pos() : pars_[pit].size() + 1 );
- pars_[pit].acceptChange(left, right);
+ pars_[pit].acceptChanges(left, right);
}
if (isDeleted) {
ParagraphList & plist = paragraphs();