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 < m_story->nrOfParagraphs()) |
while(parIdx >= 0) |
{ |
int parSep = -1; |
int firstInPar(qMax(m_story->startOfParagraph(parIdx), m_firstInFrame)); |
int lastInPar(m_story->endOfParagraph(parIdx) - 1); |
int startOfPar(qMax(m_story->startOfParagraph(parIdx), m_firstInFrame)); |
int endOfPar(m_story->endOfParagraph(parIdx) - 1); |
|
if(lastInPar < firstInPar) |
if(endOfPar < startOfPar) |
{ |
++parIdx; |
parIdx = m_story->nrOfParagraph(endOfPar + 1); |
continue; |
} |
qDebug()<< "FirstInPar:"<<firstInPar << "lastInPar:"<<lastInPar ; |
if(m_story->text(lastInPar,1).at(0) == SpecialChars::PARSEP) |
qDebug()<< "StartOfPar:"<<startOfPar << "EndOfPar:"<<endOfPar ; |
if(m_story->text(endOfPar,1).at(0) == SpecialChars::PARSEP) |
{ |
parSep = lastInPar; |
--lastInPar; |
parSep = endOfPar; |
--endOfPar; |
} |
BlockLayouterBase::BlockResult result(0, -1, false); |
if((parSep >= 0) && (lastInPar == firstInPar)) // only a parsep in the paragraph |
if((parSep >= 0) && (endOfPar == startOfPar)) // only a parsep in the paragraph |
{ |
result = BlockLayouterBase::BlockResult(0, lastInPar, true); |
result = BlockLayouterBase::BlockResult(0, endOfPar, true); |
} |
else |
{ |
// We prepare the GlyphStore per paragraph |
shaper->shape(firstInPar, lastInPar); |
result = m_blockLayouter->layoutBlock(firstInPar, lastInPar); |
shaper->shape(startOfPar, endOfPar); |
result = m_blockLayouter->layoutBlock(startOfPar, endOfPar); |
} |
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, firstInPar, lastInPar+1); |
psGlyph = new GlyphBox(m_story->glyphStore(), m_frame->doc()->PageColors, psItem, endOfPar, endOfPar); |
psGlyph->setWidth(0); |
psGlyph->setAscent(0); |
psGlyph->setDescent(0); |
418,9 → 418,19 |
qDebug()<<"Add Par Box:"<<result.box->toString(); |
m_lastInFrame = result.lastPos; |
// seek next paragraph, if any |
++parIdx; |
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? ### |
} |
else |
break; |
} |
delete shaper; |