}
+bool Paragraph::isChanged() const
+{
+ return d->changes_.isChanged();
+}
+
+
bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const
{
// keep the logic here in sync with the logic of eraseChars()
bool isChanged(pos_type start, pos_type end) const;
/// is there an unchanged char at the given pos ?
bool isChanged(pos_type pos) const;
+ /// is there a change in the paragraph ?
+ bool isChanged() const;
/// is there an insertion at the given pos ?
bool isInserted(pos_type pos) const;
e.dim = dim;
elements_.push_back(e);
dim_.wid += dim.wid;
+ changebar_ |= ins->isChanged();
}
*/
virtual bool resetFontEdit() const;
+ /// does the inset contain changes ?
+ virtual bool isChanged() const { return false; }
/// set the change for the entire inset
virtual void setChange(Change const &) {}
/// accept the changes within the inset
pos_type const n = min(max_length, p_siz);
pos_type i = 0;
pos_type j = 0;
- bool changed_content = false;
for (; i < n && j < p_siz; ++j) {
- if (paragraphs().begin()->isChanged(j)) {
- changed_content = true;
- if (paragraphs().begin()->isDeleted(j))
- continue;
- }
+ if (paragraphs().begin()->isDeleted(j))
+ continue;
if (paragraphs().begin()->isInset(j)) {
if (!paragraphs().begin()->getInset(j)->isChar())
continue;
if (paragraphs().size() > 1 || (i > 0 && j < p_siz)) {
label << "...";
}
- docstring lbl;
- // indicate changed content in label (#8645)
- if (changed_content)
- lbl = char_type(0x270E);// ✎ U+270E LOWER RIGHT PENCIL
- lbl += label.str();
- return lbl.empty() ? l : lbl;
+ return label.str().empty() ? l : label.str();
}
docstring const InsetCollapsible::buttonLabel(BufferView const & bv) const
{
+ // indicate changed content in label (#8645)
+ // ✎ U+270E LOWER RIGHT PENCIL
+ docstring indicator = isChanged() ? docstring(1, 0x270E) : docstring();
InsetLayout const & il = getLayout();
docstring const label = getLabel();
if (!il.contentaslabel() || geometry(bv) != ButtonOnly)
- return label;
- return getNewLabel(label);
+ return indicator + label;
+ return indicator + getNewLabel(label);
}
}
+bool InsetText::isChanged() const
+{
+ ParagraphList::const_iterator pit = paragraphs().begin();
+ ParagraphList::const_iterator end = paragraphs().end();
+ for (; pit != end; ++pit) {
+ if (pit->isChanged())
+ return true;
+ }
+ return false;
+}
+
+
void InsetText::setChange(Change const & change)
{
ParagraphList::iterator pit = paragraphs().begin();
ParagraphList::const_iterator end = paragraphs().end();
ParagraphList::const_iterator it = beg;
bool ref_printed = false;
- bool changed_content = false;
for (; it != end; ++it) {
if (it != beg)
if ((*it).isRTL(buffer().params()))
oss << "<div dir=\"rtl\">";
writePlaintextParagraph(buffer(), *it, oss, rp, ref_printed, len);
- if ((*it).isChanged(0, (*it).size()))
- changed_content = true;
if (oss.tellp() >= 0 && size_t(oss.tellp()) > len)
break;
}
docstring str = oss.str();
- if (changed_content)
+ if (isChanged())
str += from_ascii("\n\n") + _("[contains tracked changes]");
support::truncateWithEllipsis(str, len);
return str;
///
void fixParagraphsFont();
+ /// does the inset contain changes ?
+ bool isChanged() const;
/// set the change for the entire inset
void setChange(Change const & change);
/// accept the changes within the inset