r16059 by avox - fix paragraph counting
scribus-commit
scribus-commit at lists.scribus.net
Sun Dec 5 11:43:27 CET 2010
Author: avox
Date: Sun Dec 5 10:43:27 2010
New Revision: 16059
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16059
Log:
fix paragraph counting
Modified:
branches/ScribusOIF/scribus/text/textlayout.cpp
Modified: branches/ScribusOIF/scribus/text/textlayout.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16059&path=/branches/ScribusOIF/scribus/text/textlayout.cpp
==============================================================================
--- branches/ScribusOIF/scribus/text/textlayout.cpp (original)
+++ branches/ScribusOIF/scribus/text/textlayout.cpp Sun Dec 5 10:43:27 2010
@@ -361,33 +361,33 @@
// We run each paragraph through the block layouter and adjust m_lastInFrame
int parIdx(m_story->nrOfParagraph(m_firstInFrame));
Shaper *shaper = new Shaper(this);
- while(parIdx >= 0)
+ while(parIdx < m_story->nrOfParagraphs())
{
int parSep = -1;
- int startOfPar(qMax(m_story->startOfParagraph(parIdx), m_firstInFrame));
- int endOfPar(m_story->endOfParagraph(parIdx) - 1);
-
- if(endOfPar < startOfPar)
- {
- parIdx = m_story->nrOfParagraph(endOfPar + 1);
+ int firstInPar(qMax(m_story->startOfParagraph(parIdx), m_firstInFrame));
+ int lastInPar(m_story->endOfParagraph(parIdx) - 1);
+
+ if(lastInPar < firstInPar)
+ {
+ ++parIdx;
continue;
}
- qDebug()<< "StartOfPar:"<<startOfPar << "EndOfPar:"<<endOfPar ;
- if(m_story->text(endOfPar,1).at(0) == SpecialChars::PARSEP)
- {
- parSep = endOfPar;
- --endOfPar;
+ qDebug()<< "FirstInPar:"<<firstInPar << "lastInPar:"<<lastInPar ;
+ if(m_story->text(lastInPar,1).at(0) == SpecialChars::PARSEP)
+ {
+ parSep = lastInPar;
+ --lastInPar;
}
BlockLayouterBase::BlockResult result(0, -1, false);
- if((parSep >= 0) && (endOfPar == startOfPar)) // only a parsep in the paragraph
- {
- result = BlockLayouterBase::BlockResult(0, endOfPar, true);
+ if((parSep >= 0) && (lastInPar == firstInPar)) // only a parsep in the paragraph
+ {
+ result = BlockLayouterBase::BlockResult(0, lastInPar, true);
}
else
{
// We prepare the GlyphStore per paragraph
- shaper->shape(startOfPar, endOfPar);
- result = m_blockLayouter->layoutBlock(startOfPar, endOfPar);
+ shaper->shape(firstInPar, lastInPar);
+ result = m_blockLayouter->layoutBlock(firstInPar, lastInPar);
}
if(result.lastPos >= 0)
{
@@ -406,7 +406,7 @@
int psItem(m_story->glyphStore()->addItem(parSep, 1));
m_story->glyphStore()->itemSetGlyphCount(psItem, 1);
m_story->glyphStore()->itemGlyphStart(psItem)->glyph = ScFace::CONTROL_GLYPHS + SpecialChars::PARSEP.unicode();
- psGlyph = new GlyphBox(m_story->glyphStore(), m_frame->doc()->PageColors, psItem, endOfPar, endOfPar);
+ psGlyph = new GlyphBox(m_story->glyphStore(), m_frame->doc()->PageColors, psItem, firstInPar, lastInPar+1);
psGlyph->setWidth(0);
psGlyph->setAscent(0);
psGlyph->setDescent(0);
@@ -418,17 +418,7 @@
qDebug()<<"Add Par Box:"<<result.box->toString();
m_lastInFrame = result.lastPos;
// seek next paragraph, if any
- int nextPar(parIdx);
- for(int lp(result.lastPos + 1); lp <= storyLen; ++lp)
- {
- nextPar = m_story->nrOfParagraph(lp);
- if(nextPar > parIdx)
- break;
- }
- if(nextPar > parIdx)
- parIdx = nextPar;
- else
- break; // end of par? ###
+ ++parIdx;
}
else
break;
More information about the scribus-commit
mailing list