r17674 by jghali - #9110: Non-breakable spaces export as underscores
scribus-commit
scribus-commit at lists.scribus.net
Tue Jul 3 21:46:09 UTC 2012
Author: jghali
Date: Tue Jul 3 21:46:09 2012
New Revision: 17674
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17674
Log:
#9110: Non-breakable spaces export as underscores
Modified:
trunk/Scribus/scribus/text/storytext.cpp
trunk/Scribus/scribus/text/storytext.h
trunk/Scribus/scribus/ui/storyeditor.cpp
Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17674&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Tue Jul 3 21:46:09 2012
@@ -647,6 +647,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<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;
}
QChar StoryText::text() const
Modified: trunk/Scribus/scribus/text/storytext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17674&path=/trunk/Scribus/scribus/text/storytext.h
==============================================================================
--- trunk/Scribus/scribus/text/storytext.h (original)
+++ trunk/Scribus/scribus/text/storytext.h Tue Jul 3 21:46:09 2012
@@ -139,7 +139,15 @@
void hyphenateWord(int pos, uint len, char* hyphens);
+ // Retrieve length of story text
int length() const;
+
+ // Get content at specific position as plain text
+ // Internal paragraph separator are converted to
+ // unix new lines for better compatibility with
+ // text editors
+ QString plainText() const;
+
// Get char at current cursor position
QChar text() const;
// Get char at specific position
Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17674&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Tue Jul 3 21:46:09 2012
@@ -3297,7 +3297,7 @@
if (!fileName.isEmpty())
{
dirs->set("story_save", fileName.left(fileName.lastIndexOf("/")));
- Serializer::writeWithEncoding(fileName, LoadEnc, Editor->toPlainText());
+ Serializer::writeWithEncoding(fileName, LoadEnc, Editor->StyledText.plainText());
}
blockUpdate = false;
}
More information about the scribus-commit
mailing list