}
-bool getTokenValue(string const & str, char const * token, Change & change, BufferParams bp)
+bool getTokenValue(string const & str, char const * token, Change & change, BufferParams & bp)
{
// set the change to be Change() as default as this it should be if not
// in the file format.
template <>
string const write_attribute(string const & name, Length const & value)
{
- // we write only the value if we really have one same reson as above.
+ // we write only the value if we really have one same reason as above.
return value.zero() ? string() : write_attribute(name, value.asString());
}
-string const write_attribute(string const & name, Change const & change, BufferParams const bp)
+string const write_attribute(string const & name, Change const & change, BufferParams const & bp)
{
odocstringstream ods;
if (change.inserted())
DocIterator const dit = separatorPos(&head, align_d);
hassep = (bool)dit;
if (hassep) {
- pit_type const psize = head.paragraphs().front().size();
+ pos_type const psize = head.paragraphs().front().size();
head.paragraphs().front().eraseChars(dit.pos(), psize, false);
tail.paragraphs().front().eraseChars(0,
dit.pos() < psize ? dit.pos() + 1 : psize, false);
continue;
}
cell_info[row][column].inset->toggleMultiCol(false);
- // columnofcell needs to be called before setting width and aligment
+ // columnofcell needs to be called before setting width and alignment
// multirow cells inherit the width from the column width
if (!isPartOfMultiRow(row, column)) {
columnofcell[i] = column;
int restwidth = -1;
if (!tab_width.zero()) {
restwidth = mi.base.inPixels(tab_width);
- // Substract the fixed widths from the table width
+ // Subtract the fixed widths from the table width
for (auto const w : max_pwidth)
restwidth -= w.second;
}
}
-docstring Tabular::xhtmlRow(XHTMLStream & xs, row_type row,
+docstring Tabular::xhtmlRow(XMLStream & xs, row_type row,
OutputParams const & runparams, bool header) const
{
docstring ret;
string const celltag = header ? "th" : "td";
idx_type cell = getFirstCellInRow(row);
- xs << html::StartTag("tr");
+ xs << xml::StartTag("tr");
for (col_type c = 0; c < ncols(); ++c) {
if (isPartOfMultiColumn(row, c) || isPartOfMultiRow(row, c))
continue;
else if (isMultiRow(cell))
attr << " rowspan='" << rowSpan(cell) << "'";
- xs << html::StartTag(celltag, attr.str(), true) << html::CR();
+ xs << xml::StartTag(celltag, attr.str(), true) << xml::CR();
ret += cellInset(cell)->xhtml(xs, runparams);
- xs << html::EndTag(celltag) << html::CR();
+ xs << xml::EndTag(celltag) << xml::CR();
++cell;
}
- xs << html::EndTag("tr");
+ xs << xml::EndTag("tr");
return ret;
}
-docstring Tabular::xhtml(XHTMLStream & xs, OutputParams const & runparams) const
+docstring Tabular::xhtml(XMLStream & xs, OutputParams const & runparams) const
{
docstring ret;
align = "right";
break;
}
- xs << html::StartTag("div", "class='longtable' style='text-align: " + align + ";'")
- << html::CR();
+ xs << xml::StartTag("div", "class='longtable' style='text-align: " + align + ";'")
+ << xml::CR();
// The caption flag wins over head/foot
if (haveLTCaption()) {
- xs << html::StartTag("div", "class='longtable-caption' style='text-align: " + align + ";'")
- << html::CR();
+ xs << xml::StartTag("div", "class='longtable-caption' style='text-align: " + align + ";'")
+ << xml::CR();
for (row_type r = 0; r < nrows(); ++r)
if (row_info[r].caption)
ret += xhtmlRow(xs, r, runparams);
- xs << html::EndTag("div") << html::CR();
+ xs << xml::EndTag("div") << xml::CR();
}
}
- xs << html::StartTag("table") << html::CR();
+ xs << xml::StartTag("table") << xml::CR();
// output header info
bool const havefirsthead = haveLTFirstHead(false);
// in XHTML. this test accomplishes that.
bool const havehead = !havefirsthead && haveLTHead(false);
if (havehead || havefirsthead) {
- xs << html::StartTag("thead") << html::CR();
+ xs << xml::StartTag("thead") << xml::CR();
for (row_type r = 0; r < nrows(); ++r) {
if (((havefirsthead && row_info[r].endfirsthead) ||
(havehead && row_info[r].endhead)) &&
ret += xhtmlRow(xs, r, runparams, true);
}
}
- xs << html::EndTag("thead") << html::CR();
+ xs << xml::EndTag("thead") << xml::CR();
}
// output footer info
bool const havelastfoot = haveLTLastFoot(false);
// as before.
bool const havefoot = !havelastfoot && haveLTFoot(false);
if (havefoot || havelastfoot) {
- xs << html::StartTag("tfoot") << html::CR();
+ xs << xml::StartTag("tfoot") << xml::CR();
for (row_type r = 0; r < nrows(); ++r) {
if (((havelastfoot && row_info[r].endlastfoot) ||
(havefoot && row_info[r].endfoot)) &&
ret += xhtmlRow(xs, r, runparams);
}
}
- xs << html::EndTag("tfoot") << html::CR();
+ xs << xml::EndTag("tfoot") << xml::CR();
}
- xs << html::StartTag("tbody") << html::CR();
+ xs << xml::StartTag("tbody") << xml::CR();
for (row_type r = 0; r < nrows(); ++r) {
if (isValidRow(r)) {
ret += xhtmlRow(xs, r, runparams);
}
}
- xs << html::EndTag("tbody")
- << html::CR()
- << html::EndTag("table")
- << html::CR();
+ xs << xml::EndTag("tbody")
+ << xml::CR()
+ << xml::EndTag("table")
+ << xml::CR();
if (is_long_tabular)
- xs << html::EndTag("div") << html::CR();
+ xs << xml::EndTag("div") << xml::CR();
return ret;
}
}
-docstring InsetTableCell::xhtml(XHTMLStream & xs, OutputParams const & rp) const
+docstring InsetTableCell::xhtml(XMLStream & xs, OutputParams const & rp) const
{
if (!isFixedWidth)
return InsetText::insetAsXHTML(xs, rp, InsetText::JustText);
}
-
/////////////////////////////////////////////////////////////////////
//
// InsetTabular
docstring const align_d = tabular.column_info[c].decimal_point;
dit = separatorPos(&tail, align_d);
- pit_type const psize = tail.paragraphs().front().size();
+ pos_type const psize = tail.paragraphs().front().size();
if (dit) {
tail.paragraphs().front().eraseChars(0,
dit.pos() < psize ? dit.pos() + 1 : psize, false);
}
-void InsetTabular::updateBuffer(ParIterator const & it, UpdateType utype)
+void InsetTabular::updateBuffer(ParIterator const & it, UpdateType utype, bool const /*deleted*/)
{
// In a longtable, tell captions what the current float is
Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
}
-Inset::DisplayType InsetTabular::display() const
+Inset::RowFlags InsetTabular::rowFlags() const
{
if (tabular.is_long_tabular) {
switch (tabular.longtabular_alignment) {
case Tabular::LYX_LONGTABULAR_ALIGN_LEFT:
- return AlignLeft;
+ return Display | AlignLeft;
case Tabular::LYX_LONGTABULAR_ALIGN_CENTER:
- return AlignCenter;
+ return Display;
case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT:
- return AlignRight;
+ return Display | AlignRight;
default:
- return AlignCenter;
+ return Display;
}
} else
return Inline;
}
-docstring InsetTabular::xhtml(XHTMLStream & xs, OutputParams const & rp) const
+docstring InsetTabular::xhtml(XMLStream & xs, OutputParams const & rp) const
{
return tabular.xhtml(xs, rp);
}
paste_tabular.reset(new Tabular(tabular));
for (row_type r = 0; r < rs; ++r)
- paste_tabular->deleteRow(0);
+ paste_tabular->deleteRow(0, true);
row_type const rows = re - rs + 1;
while (paste_tabular->nrows() > rows)
- paste_tabular->deleteRow(rows);
+ paste_tabular->deleteRow(rows, true);
for (col_type c = 0; c < cs; ++c)
- paste_tabular->deleteColumn(0);
+ paste_tabular->deleteColumn(0, true);
col_type const columns = ce - cs + 1;
while (paste_tabular->ncols() > columns)
- paste_tabular->deleteColumn(columns);
+ paste_tabular->deleteColumn(columns, true);
paste_tabular->setBuffer(tabular.buffer());
// FIXME?: why do we need to do this explicitly? (EL)
tabular.cellInset(r2, c2)->setBuffer(tabular.buffer());
- // FIXME: change tracking (MG)
- inset->setChange(Change(buffer().params().track_changes ?
+ if (!lyxrc.ct_markup_copied) {
+ // do not paste deleted text
+ inset->acceptChanges();
+ inset->setChange(Change(buffer().params().track_changes ?
Change::INSERTED : Change::UNCHANGED));
+ }
cur.pos() = 0;
cur.pit() = 0;
}