Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 16058 → Rev 16059

/branches/ScribusOIF/scribus/text/textlayout.cpp
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);
int firstInPar(qMax(m_story->startOfParagraph(parIdx), m_firstInFrame));
int lastInPar(m_story->endOfParagraph(parIdx) - 1);
 
if(endOfPar < startOfPar)
if(lastInPar < firstInPar)
{
parIdx = m_story->nrOfParagraph(endOfPar + 1);
++parIdx;
continue;
}
qDebug()<< "StartOfPar:"<<startOfPar << "EndOfPar:"<<endOfPar ;
if(m_story->text(endOfPar,1).at(0) == SpecialChars::PARSEP)
qDebug()<< "FirstInPar:"<<firstInPar << "lastInPar:"<<lastInPar ;
if(m_story->text(lastInPar,1).at(0) == SpecialChars::PARSEP)
{
parSep = endOfPar;
--endOfPar;
parSep = lastInPar;
--lastInPar;
}
BlockLayouterBase::BlockResult result(0, -1, false);
if((parSep >= 0) && (endOfPar == startOfPar)) // only a parsep in the paragraph
if((parSep >= 0) && (lastInPar == firstInPar)) // only a parsep in the paragraph
{
result = BlockLayouterBase::BlockResult(0, endOfPar, true);
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;