I think properly fixing this bug may involve doing something that probably ought to be done anyway: to invert the relationship between CellData and InsetTableCell in Tabular.

Right now, a CellData has an InsetTableCell, whereas one might have thought it should be the other way around. It is how it is because the inset used to be an InsetText, and of course that has what it has, and in particular not a CellData. But now this could be inverted, so that cell_vector, for example, would become a vector<InsetTableCell>, and the members of the CellData class (really, struct) could just become members of InsetTableCell.

In a way, this is easy, but let me ask a couple questions: (i) Why is CellData::inset a boost::shared_ptr? What is it shared with? (ii) Why is CellData::operator=() implemented the way it is? That looks very strange, since we're modifying the rhs! Why do we need a non-default implementation here at all? (iii) In InsetTabular::pasteClipboard(), we have this:
           shared_ptr<InsetTableCell> inset(
               new InsetTableCell(*paste_tabular->cellInset(r1, c1)));
           tabular.setCellInset(r2, c2, inset);
Could you do this instead?
           ParagraphList const & paras =
               *paste_tabular->cellInset(r1,c1).inset->paragraphs();
           tabular.cellInset(r2,c2).inset->paragraphs() = paras;
Do we have to copy the whole inset? Also, why aren't we copying the CellData?

rh

Reply via email to