svx/source/dialog/paraprev.cxx | 51 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-)
New commits: commit 665ad1c749ec2748cd20c37203ec0592648ccb8b Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jun 19 16:33:16 2018 +0100 coverity#1437408 Uninitialized scalar field Change-Id: I553198047d999be1cbaa20b1a1829ffc9e5197b5 Reviewed-on: https://gerrit.libreoffice.org/56116 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/svx/source/dialog/paraprev.cxx b/svx/source/dialog/paraprev.cxx index d10b11b28688..3a4d2bd14651 100644 --- a/svx/source/dialog/paraprev.cxx +++ b/svx/source/dialog/paraprev.cxx @@ -214,8 +214,12 @@ void SvxParaPrevWindow::DrawParagraph(vcl::RenderContext& rRenderContext) ParaPrevWindow::ParaPrevWindow() : nLeftMargin ( 0 ), nRightMargin ( 0 ), + nFirstLineOfst ( 0 ), + nUpper ( 0 ), + nLower ( 0 ), eAdjust ( SvxAdjust::Left ), - eLastLine ( SvxAdjust::Left ) + eLastLine ( SvxAdjust::Left ), + eLine ( SvxPrevLineSpace::N1 ) { aSize = Size(11905, 16837); } @@ -268,6 +272,8 @@ void ParaPrevWindow::DrawParagraph(vcl::RenderContext& rRenderContext) if (i == 3) { rRenderContext.SetFillColor(COL_GRAY); + auto nTop = nUpper * aLineSiz.Height() / aSize.Height(); + aPnt.AdjustY(nTop * 2 ); } if (i == 6 ) @@ -276,12 +282,45 @@ void ParaPrevWindow::DrawParagraph(vcl::RenderContext& rRenderContext) if (3 <= i && 6 > i) { long nLeft = nLeftMargin * aLineSiz.Width() / aSize.Width(); - aPnt.AdjustX(nLeft ); - aSiz.AdjustWidth( -nLeft ); + long nFirst = nFirstLineOfst * aLineSiz.Width() / aSize.Width(); + long nTmp = nLeft + nFirst; + + if (i == 3) + { + aPnt.AdjustX(nTmp ); + aSiz.AdjustWidth( -nTmp ); + } + else + { + aPnt.AdjustX(nLeft ); + aSiz.AdjustWidth( -nLeft ); + } long nRight = nRightMargin * aLineSiz.Width() / aSize.Width(); aSiz.AdjustWidth( -nRight ); } + if (4 == i || 5 == i || 6 == i) + { + switch (eLine) + { + case SvxPrevLineSpace::N1: + break; + case SvxPrevLineSpace::N115: + aPnt.AdjustY(nH / 6.67 ); // 1/.15 = 6.(6) + break; + case SvxPrevLineSpace::N15: + aPnt.AdjustY(nH / 2 ); + break; + case SvxPrevLineSpace::N2: + aPnt.AdjustY(nH ); + break; + case SvxPrevLineSpace::Prop: + case SvxPrevLineSpace::Min: + case SvxPrevLineSpace::Leading: + break; + } + } + aPnt.AdjustY(nH ); if (3 <= i && 5 >= i) @@ -346,6 +385,12 @@ void ParaPrevWindow::DrawParagraph(vcl::RenderContext& rRenderContext) rRenderContext.DrawRect( aRect ); Lines[i] = aRect; + if (5 == i) + { + auto nBottom = nLower * aLineSiz.Height() / aSize.Height(); + aPnt.AdjustY(nBottom * 2 ); + } + aPnt.AdjustY(nH ); // Reset, recalculate for each line aPnt.setX( DEF_MARGIN / 2 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits