From 276f258e5dfbe286db4cc4b48c6bc82d6b96a0d0 Mon Sep 17 00:00:00 2001 From: jghali Date: Tue, 3 Jul 2012 21:45:33 +0000 Subject: #9110: Non-breakable spaces export as underscores git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17673 11d20701-8431-0410-a711-e3c959e3b870 --- scribus/text/storytext.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'scribus/text/storytext.cpp') diff --git a/scribus/text/storytext.cpp b/scribus/text/storytext.cpp index 76285a9..062015a 100644 --- a/scribus/text/storytext.cpp +++ b/scribus/text/storytext.cpp @@ -637,6 +637,28 @@ int StoryText::length() const return d->len; } +QString StoryText::plainText() const +{ + if (length() <= 0) + return QString(); + + QChar ch; + QString result; + + uint len = length(); + result.reserve(len); + + StoryText* that(const_cast(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; +} + QChar StoryText::text() const { return text(d->cursorPosition); -- cgit