}
-Paragraph::Pimpl::Pimpl(Paragraph::Pimpl const & p, Paragraph * owner)
- : owner_(owner)
+Paragraph::Pimpl::Pimpl(Paragraph::Pimpl const & p, Paragraph * owner,
+ bool same_ids)
+ : params(p.params), owner_(owner)
{
inset_owner = p.inset_owner;
text = p.text;
fontlist = p.fontlist;
+ if (same_ids)
+ id_ = p.id_;
+ else
+ id_ = paragraph_id++;
}
fontlist.end(),
search_font, matchFT());
it != fontlist.end(); ++it)
- (*it).pos((*it).pos() + 1);
+ it->pos(it->pos() + 1);
// Update the inset table.
InsetTable search_inset(pos, 0);
owner_->insetlist.end(),
search_inset, matchIT());
it != owner_->insetlist.end(); ++it)
- ++(*it).pos;
+ ++it->pos;
owner_->setFont(pos, font);
}
InsetList::iterator it = std::lower_bound(owner_->insetlist.begin(),
owner_->insetlist.end(),
search_inset, matchIT());
- if (it != owner_->insetlist.end() && (*it).pos == pos) {
+ if (it != owner_->insetlist.end() && it->pos == pos) {
lyxerr << "ERROR (Paragraph::InsertInset): "
"there is an inset in position: " << pos << std::endl;
} else {
std::lower_bound(owner_->insetlist.begin(),
owner_->insetlist.end(),
search_inset, matchIT());
- if (it != owner_->insetlist.end() && (*it).pos == pos) {
- delete (*it).inset;
+ if (it != owner_->insetlist.end() && it->pos == pos) {
+ delete it->inset;
owner_->insetlist.erase(it);
}
}
std::lower_bound(fontlist.begin(),
fontlist.end(),
search_font, matchFT());
- if (it != fontlist.end() && (*it).pos() == pos &&
+ if (it != fontlist.end() && it->pos() == pos &&
(pos == 0 ||
(it != fontlist.begin()
- && (*(it - 1)).pos() == pos - 1))) {
+ && boost::prior(it)->pos() == pos - 1))) {
// If it is a multi-character font
// entry, we just make it smaller
// (see update below), otherwise we
// Update all other entries.
FontList::iterator fend = fontlist.end();
for (; it != fend; ++it)
- (*it).pos((*it).pos() - 1);
+ it->pos(it->pos() - 1);
// Update the inset table.
InsetTable search_inset(pos, 0);
lend,
search_inset, matchIT());
it != lend; ++it)
- --(*it).pos;
+ --it->pos;
}
int & column, LyXFont const & font,
LyXLayout const & style)
{
+ if (style.pass_thru) return;
if (column > tex_code_break_column
&& i
- && owner_->getChar(i - 1) != ' '
- && (i < owner_->size() - 1)
+ && getChar(i - 1) != ' '
+ && (i < size() - 1)
#ifndef NO_LATEX
// In LaTeX mode, we don't want to
// break lines since some commands
// In typewriter mode, we want to avoid
// ! . ? : at the end of a line
&& !(font.family() == LyXFont::TYPEWRITER_FAMILY
- && (owner_->getChar(i-1) == '.'
- || owner_->getChar(i-1) == '?'
- || owner_->getChar(i-1) == ':'
- || owner_->getChar(i-1) == '!'))) {
+ && (getChar(i - 1) == '.'
+ || getChar(i - 1) == '?'
+ || getChar(i - 1) == ':'
+ || getChar(i - 1) == '!'))) {
if (tex_code_break_column == 0) {
// in batchmode we need LaTeX to still
// see it as a space not as an extra '\n'
int & column,
Paragraph::value_type const c)
{
+ if (style.pass_thru) {
+ if (c != '\0') os << c;
+ return;
+ }
// Two major modes: LaTeX or plain
// Handle here those cases common to both modes
// and then split to handle the two modes separately.
os << c;
//... but we should avoid ligatures
if ((c == '>' || c == '<')
- && i <= owner_->size() - 2
- && owner_->getChar(i + 1) == c) {
+ && i <= size() - 2
+ && getChar(i + 1) == c) {
//os << "\\textcompwordmark{}";
// Jean-Marc, have a look at
// this. I think this works
break;
case '-': // "--" in Typewriter mode -> "-{}-"
- if (i <= owner_->size() - 2
- && owner_->getChar(i + 1) == '-'
+ if (i <= size() - 2
+ && getChar(i + 1) == '-'
&& font.family() == LyXFont::TYPEWRITER_FAMILY) {
os << "-{}";
column += 2;
/* idea for labels --- begin*/
// Check for "LyX"
if (c == 'L'
- && i <= owner_->size() - 3
+ && i <= size() - 3
&& font.family() != LyXFont::TYPEWRITER_FAMILY
- && owner_->getChar(i + 1) == 'y'
- && owner_->getChar(i + 2) == 'X') {
+ && getChar(i + 1) == 'y'
+ && getChar(i + 2) == 'X') {
os << "\\LyX{}";
i += 2;
column += 5;
}
// Check for "TeX"
else if (c == 'T'
- && i <= owner_->size() - 3
+ && i <= size() - 3
&& font.family() != LyXFont::TYPEWRITER_FAMILY
- && owner_->getChar(i + 1) == 'e'
- && owner_->getChar(i + 2) == 'X') {
+ && getChar(i + 1) == 'e'
+ && getChar(i + 2) == 'X') {
os << "\\TeX{}";
i += 2;
column += 5;
}
// Check for "LaTeX2e"
else if (c == 'L'
- && i <= owner_->size() - 7
+ && i <= size() - 7
&& font.family() != LyXFont::TYPEWRITER_FAMILY
- && owner_->getChar(i + 1) == 'a'
- && owner_->getChar(i + 2) == 'T'
- && owner_->getChar(i + 3) == 'e'
- && owner_->getChar(i + 4) == 'X'
- && owner_->getChar(i + 5) == '2'
- && owner_->getChar(i + 6) == 'e') {
+ && getChar(i + 1) == 'a'
+ && getChar(i + 2) == 'T'
+ && getChar(i + 3) == 'e'
+ && getChar(i + 4) == 'X'
+ && getChar(i + 5) == '2'
+ && getChar(i + 6) == 'e') {
os << "\\LaTeXe{}";
i += 6;
column += 8;
}
// Check for "LaTeX"
else if (c == 'L'
- && i <= owner_->size() - 5
+ && i <= size() - 5
&& font.family() != LyXFont::TYPEWRITER_FAMILY
- && owner_->getChar(i + 1) == 'a'
- && owner_->getChar(i + 2) == 'T'
- && owner_->getChar(i + 3) == 'e'
- && owner_->getChar(i + 4) == 'X') {
+ && getChar(i + 1) == 'a'
+ && getChar(i + 2) == 'T'
+ && getChar(i + 3) == 'e'
+ && getChar(i + 4) == 'X') {
os << "\\LaTeX{}";
i += 4;
column += 7;
}
+Paragraph * Paragraph::Pimpl::getParFromID(int id) const
+{
+ InsetList::const_iterator cit = owner_->insetlist.begin();
+ InsetList::const_iterator lend = owner_->insetlist.end();
+ Paragraph * result;
+ for (; cit != lend; ++cit) {
+ if ((result = cit->inset->getParFromID(id)))
+ return result;
+ }
+ return 0;
+}
+