summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-06-19 16:33:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-06-20 09:57:13 +0200
commit665ad1c749ec2748cd20c37203ec0592648ccb8b (patch)
tree2e8d9f5836e54cf42838154d3a2b4408c3216f63
parent34a11c40fbc1bf8f55df29c17227981206cf2426 (diff)
coverity#1437408 Uninitialized scalar field
Change-Id: I553198047d999be1cbaa20b1a1829ffc9e5197b5 Reviewed-on: https://gerrit.libreoffice.org/56116 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svx/source/dialog/paraprev.cxx51
1 files changed, 48 insertions, 3 deletions
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 );