editeng/source/editeng/impedit3.cxx | 78 +++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 36 deletions(-)
New commits: commit b57cb5326713da9e926bb2ad5a56dce90ac00a87 Author: Armin Le Grand <[email protected]> Date: Fri Jun 8 09:24:39 2012 +0000 Fix i#119756 Safer take care of empty paragraphs in EditEngine layouting This fixes fdo#59629 on our side. Conflicts: editeng/source/editeng/impedit3.cxx and moved sal_uInt16 nIndex back up in scope. Change-Id: Ie2b5dac48b10ff8c031f481f0a7ddde644694975 diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 86d2a88..ec6e823 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2880,6 +2880,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta pPDFExtOutDevData->BeginStructureElement( vcl::PDFWriter::Paragraph ); long nParaHeight = pPortion->GetHeight(); + sal_uInt16 nIndex = 0; if ( pPortion->IsVisible() && ( ( !IsVertical() && ( ( aStartPos.Y() + nParaHeight ) > aClipRec.Top() ) ) || ( IsVertical() && ( ( aStartPos.X() - nParaHeight ) < aClipRec.Right() ) ) ) ) @@ -2891,6 +2892,9 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta sal_uInt16 nLines = pPortion->GetLines().Count(); sal_uInt16 nLastLine = nLines-1; + // #108052# + bool bEndOfParagraphWritten(false); + if ( !IsVertical() ) aStartPos.Y() += pPortion->GetFirstLineOffset(); else @@ -2901,9 +2905,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta const SvxLineSpacingItem& rLSItem = ((const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL )); sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; + bool bPaintBullet (false); + for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) { pLine = pPortion->GetLines()[nLine]; + nIndex = pLine->GetStart(); DBG_ASSERT( pLine, "NULL-Pointer in the line iterator in UpdateViews" ); aTmpPos = aStartPos; if ( !IsVertical() ) @@ -2926,7 +2933,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta if ( ( !IsVertical() && ( aStartPos.Y() > aClipRec.Top() ) ) || ( IsVertical() && aStartPos.X() < aClipRec.Right() ) ) { - bool bPaintBullet (false); + bPaintBullet = false; // Why not just also call when stripping portions? This will give the correct values // and needs no position corrections in OutlinerEditEng::DrawingText which tries to call @@ -2945,37 +2952,9 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta // -------------------------------------------------- // Over the Portions of the line ... // -------------------------------------------------- - sal_uInt16 nIndex = pLine->GetStart(); bool bParsingFields = false; ::std::vector< sal_Int32 >::iterator itSubLines; - // #i108052# When stripping a callback for empty paragraphs is needed. This - // was somehow lost/removed/killed by making the TextPortions with empty - // paragraph to type PORTIONKIND_TAB instead of PORTIONKIND_TEXT. Adding here - - // since I could not find out who and why this has - // changed. - // #i118881#: Do not include the empty paragraph - // after a bullet. Otherwise the wrong paragraph - // indices will eventually find their way into - // metafiles and break the association between - // paragraphs and Impress animations. - if(!bPaintBullet && bStripOnly && pLine->GetStartPortion() == pLine->GetEndPortion()) - { - const Color aOverlineColor(pOutDev->GetOverlineColor()); - const Color aTextLineColor(pOutDev->GetTextLineColor()); - - GetEditEnginePtr()->DrawingText( - aTmpPos, String(), 0, 0, 0, - aTmpFont, n, nIndex, 0, - 0, - 0, - false, true, false, // support for EOL/EOP TEXT comments - 0, - aOverlineColor, - aTextLineColor); - } - for ( sal_uInt16 nPortion = pLine->GetStartPortion(); nPortion <= pLine->GetEndPortion(); nPortion++ ) { DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line without Textportion in Paint!" ); @@ -3330,6 +3309,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta &aLocale, aOverlineColor, aTextLineColor); + + // #108052# remember that EOP is written already for this ParaPortion + if(bEndOfParagraph) + { + bEndOfParagraphWritten = true; + } } else { @@ -3608,6 +3593,27 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta else aStartPos.X() -= nUL; } + + // #108052# Safer way for #i108052# and #i118881#: If for the current ParaPortion + // EOP is not written, do it now. This will be safer than before. It has shown + // that the reason for #i108052# was fixed/removed again, so this is a try to fix + // the number of paragraphs (and counting empty ones) now independent from the + // changes in EditEngine behaviour. + if(!bEndOfParagraphWritten && !bPaintBullet && bStripOnly) + { + const Color aOverlineColor(pOutDev->GetOverlineColor()); + const Color aTextLineColor(pOutDev->GetTextLineColor()); + + GetEditEnginePtr()->DrawingText( + aTmpPos, String(), 0, 0, 0, + aTmpFont, n, nIndex, 0, + 0, + 0, + false, true, false, // support for EOL/EOP TEXT comments + 0, + aOverlineColor, + aTextLineColor); + } } else { commit 455836cd81c0ca919016a4b415205ce21fad3612 Author: Thorsten Behrens <[email protected]> Date: Mon Feb 25 20:13:37 2013 +0100 Rename loop variable in ImpEditEngine::Paint This had nothing to do with y coordinates. Change-Id: I36baf05cd4c4a67b24574f6651b1c3f1eb12e22e diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 48b25f7..86d2a88 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2976,13 +2976,13 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta aTextLineColor); } - for ( sal_uInt16 y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ ) + for ( sal_uInt16 nPortion = pLine->GetStartPortion(); nPortion <= pLine->GetEndPortion(); nPortion++ ) { DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line without Textportion in Paint!" ); - const TextPortion* pTextPortion = pPortion->GetTextPortions()[y]; + const TextPortion* pTextPortion = pPortion->GetTextPortions()[nPortion]; DBG_ASSERT( pTextPortion, "NULL-Pointer in Portion iterator in UpdateViews" ); - long nPortionXOffset = GetPortionXOffset( pPortion, pLine, y ); + long nPortionXOffset = GetPortionXOffset( pPortion, pLine, nPortion ); if ( !IsVertical() ) { aTmpPos.X() = aStartPos.X() + nPortionXOffset; @@ -3306,7 +3306,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta const lang::Locale aLocale(GetLocale(EditPaM(pPortion->GetNode(), nIndex + 1))); // create EOL and EOP bools - const bool bEndOfLine(y == pLine->GetEndPortion()); + const bool bEndOfLine(nPortion == pLine->GetEndPortion()); const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines); // get Overline color (from ((const SvxOverlineItem*)GetItem())->GetColor() in @@ -3537,7 +3537,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta if ( bStripOnly ) { // create EOL and EOP bools - const bool bEndOfLine(y == pLine->GetEndPortion()); + const bool bEndOfLine(nPortion == pLine->GetEndPortion()); const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines); const Color aOverlineColor(pOutDev->GetOverlineColor()); @@ -3557,7 +3557,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta // #i108052# When stripping, a callback for _empty_ paragraphs is also needed. // This was optimized away (by not rendering the space-only tab portion), so do // it manually here. - const bool bEndOfLine(y == pLine->GetEndPortion()); + const bool bEndOfLine(nPortion == pLine->GetEndPortion()); const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines); const Color aOverlineColor(pOutDev->GetOverlineColor()); @@ -3577,7 +3577,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta break; } if( bParsingFields ) - y--; + nPortion--; else nIndex = nIndex + pTextPortion->GetLen(); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
