#include "support/lstrings.h"
#include "support/Messages.h"
#include "support/textutils.h"
-#include "support/unicode.h"
#include <sstream>
#include <vector>
}
-bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const {
+bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const
+{
// keep the logic here in sync with the logic of eraseChars()
-
- if (!trackChanges) {
+ if (!trackChanges)
return true;
- }
-
- Change change = d->changes_.lookup(size());
+ Change const change = d->changes_.lookup(size());
return change.type == Change::INSERTED && change.author == 0;
}
void Paragraph::setChange(pos_type pos, Change const & change)
{
BOOST_ASSERT(pos >= 0 && pos <= size());
-
d->changes_.set(change, pos);
// see comment in setChange(Change const &) above
-
- if (change.type != Change::DELETED &&
- pos < size() && isInset(pos)) {
+ if (change.type != Change::DELETED && pos < size() && isInset(pos))
getInset(pos)->setChange(change);
- }
}
Change const & Paragraph::lookupChange(pos_type pos) const
{
BOOST_ASSERT(pos >= 0 && pos <= size());
-
return d->changes_.lookup(pos);
}
// then the layouts
features.useLayout(layout.name());
+ if (!layout.requires().empty()) {
+ vector<string> req = layout.requires();
+ for (vector<string>::const_iterator it = req.begin();
+ it != req.end(); ++it) {
+ features.require(*it);
+ }
+ }
// then the fonts
fontlist_.validate(features);
}
// this check is to amend a bug. LyX sometimes
// inserts '\0' this could cause problems.
- if (c != '\0') {
- vector<char> tmp = ucs4_to_utf8(c);
- tmp.push_back('\0');
- os << &tmp[0];
- } else
+ if (c != '\0')
+ os << to_utf8(docstring(1, c));
+ else
lyxerr << "ERROR (Paragraph::writeFile):"
" NULL char in structure." << endl;
++column;
bool Paragraph::isHfill(pos_type pos) const
{
- return isInset(pos)
- && getInset(pos)->lyxCode() == HFILL_CODE;
+ return isInset(pos) && getInset(pos)->lyxCode() == HFILL_CODE;
}
bool Paragraph::isNewline(pos_type pos) const
{
- return isInset(pos)
- && getInset(pos)->lyxCode() == NEWLINE_CODE;
+ return isInset(pos) && getInset(pos)->lyxCode() == NEWLINE_CODE;
}
{
if (isInset(pos))
return getInset(pos)->isLetter();
- else {
- char_type const c = d->text_[pos];
- return isLetterChar(c) || isDigit(c);
- }
+ char_type const c = d->text_[pos];
+ return isLetterChar(c) || isDigit(c);
}
InsetCode Paragraph::ownerCode() const
{
- return d->inset_owner_ ?
- d->inset_owner_->lyxCode() : NO_CODE;
+ return d->inset_owner_ ? d->inset_owner_->lyxCode() : NO_CODE;
}