Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 21733 → Rev 21732

/trunk/Scribus/scribus/text/storytext.cpp
82,6 → 82,7
{
d = other.d;
d->refs++;
m_text = other.m_text;
if (m_doc) {
m_doc->paragraphStyles().connect(this, SLOT(invalidateAll()));
156,6 → 157,7
m_doc = other.m_doc;
d = other.d;
m_text = other.m_text;
if (m_doc) {
m_doc->paragraphStyles().connect(this, SLOT(invalidateAll()));
308,6 → 310,7
 
d->clear();
d->len = 0;
m_text.clear();
invalidateAll();
}
 
524,7 → 527,7
if (pos + static_cast<int>(len) > length())
len = length() - pos;
 
for (int i = pos + static_cast<int>(len) - 1; i >= pos; --i)
for ( int i = pos + static_cast<int>(len) - 1; i >= pos; --i )
{
ScText *it = d->at(i);
if ((it->ch == SpecialChars::PARSEP))
550,6 → 553,7
m_selLast = -1;
}
invalidate(pos, length());
m_text.remove(pos, len);
}
 
void StoryText::trim()
606,7 → 610,8
 
for (int i = 0; i < txt.length(); ++i) {
ScText * item = new ScText(clone);
item->ch= txt.at(i);
QChar tmpch = txt.at(i);
item->ch = tmpch;
item->setContext(cStyleContext);
d->insert(pos + i, item);
d->len++;
613,10 → 618,12
if (item->ch == SpecialChars::PARSEP) {
// qDebug() << QString("new PARSEP %2 at %1").arg(pos).arg(paragraphStyle(pos).name());
insertParSep(pos + i);
tmpch = QLatin1Char('\n');
}
if (d->cursorPosition >= static_cast<uint>(pos + i)) {
d->cursorPosition += 1;
}
m_text += tmpch;
}
 
d->len = d->count();
669,10 → 676,14
d->insert(index, item);
d->len++;
if (item->ch == SpecialChars::PARSEP)
{
insertParSep(index);
ch = QLatin1Char('\n');
}
if (d->cursorPosition >= static_cast<uint>(index))
d->cursorPosition += 1;
++inserted;
m_text += ch;
}
}
 
701,6 → 712,9
}
invalidate(pos, pos + 1);
if (ch == SpecialChars::PARSEP)
ch = QLatin1Char('\n');
m_text[pos] = ch;
}
 
int StoryText::replaceWord(int pos, QString newWord)
806,24 → 820,7
 
QString StoryText::plainText() const
{
if (length() <= 0)
return QString();
 
QChar ch;
QString result;
 
int len = length();
result.reserve(len);
 
StoryText* that(const_cast<StoryText*>(this));
for (int i = 0; i < len; ++i) {
ch = that->d->at(i)->ch;
if (ch == SpecialChars::PARSEP)
ch = QLatin1Char('\n');
result += ch;
}
 
return result;
return m_text;
}
#if 0
QChar StoryText::text() const
/trunk/Scribus/scribus/text/storytext.h
281,6 → 281,8
ScText * item(uint index);
const ScText * item(uint index) const;
void fixSurrogateSelection();
// storage for plain text
QString m_text;
 
//public:
// ScText * item_p(uint index) { return item(index); }