r16069 by craig - #9552: Apply StoryText::nrOfParagraph

scribus-commit scribus-commit at lists.scribus.net
Sun Dec 5 22:04:36 CET 2010


Author: craig
Date: Sun Dec  5 21:04:36 2010
New Revision: 16069

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16069
Log:
#9552: Apply StoryText::nrOfParagraph

Modified:
    trunk/Scribus/scribus/text/storytext.cpp
    trunk/Scribus/scribus/text/storytext.h

Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16069&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Sun Dec  5 21:04:36 2010
@@ -849,13 +849,14 @@
 }
 
 
-int StoryText::nrOfParagraph(uint index) const
-{
-	int result = 0;
+uint StoryText::nrOfParagraph(int pos) const
+{
+	uint result = 0;
 	StoryText* that = const_cast<StoryText *>(this);
 	bool lastWasPARSEP = true;
-	index = qMin(index, (uint) that->length());
-	for (uint i=0; i < index; ++i) {
+	pos = qMin(pos, that->length());
+	for (int i=0; i < pos; ++i)
+	{
 		lastWasPARSEP = that->d->at(i)->ch == SpecialChars::PARSEP;
 		if (lastWasPARSEP)
 			++result;
@@ -868,7 +869,8 @@
 	uint result = 0;
 	StoryText* that = const_cast<StoryText *>(this);
 	bool lastWasPARSEP = true;
-	for (int i=0; i < length(); ++i) {
+	for (int i=0; i < length(); ++i)
+	{
 		lastWasPARSEP = that->d->at(i)->ch == SpecialChars::PARSEP;
 		if (lastWasPARSEP)
 			++result;
@@ -882,7 +884,8 @@
 		return 0;
 
 	StoryText* that = const_cast<StoryText *>(this);
-	for (int i=0; i < length(); ++i) {
+	for (int i=0; i < length(); ++i)
+	{
 		if (that->d->at(i)->ch == SpecialChars::PARSEP && ! --index)
 			return i + 1;
 	}
@@ -893,7 +896,8 @@
 {
 	++index;
 	StoryText* that = const_cast<StoryText *>(this);
-	for (int i=0; i < length(); ++i) {
+	for (int i=0; i < length(); ++i)
+	{
 		if (that->d->at(i)->ch == SpecialChars::PARSEP && ! --index)
 			return i;
 	}

Modified: trunk/Scribus/scribus/text/storytext.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16069&path=/trunk/Scribus/scribus/text/storytext.h
==============================================================================
--- trunk/Scribus/scribus/text/storytext.h (original)
+++ trunk/Scribus/scribus/text/storytext.h Sun Dec  5 21:04:36 2010
@@ -147,7 +147,7 @@
  	uint nrOfParagraphs() const;
  	int startOfParagraph(uint index) const;
  	int endOfParagraph(uint index) const;
-	int nrOfParagraph(uint index) const;
+	uint nrOfParagraph(int pos) const;
 
  	uint nrOfRuns() const;
  	int startOfRun(uint index) const;




More information about the scribus-commit mailing list