summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2014-03-30 23:19:13 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2014-03-30 23:54:46 +0200
commit0d4f072d018d4b3764b91507bed778ff007f0153 (patch)
tree7fff26060aac99df607a2bddf283694163198e74 /sw/source/ui
parent53387dabd30c61ba9eb215f1432106f3ab3d98d4 (diff)
Constify
Change-Id: I8d215b0cea56cda55d8e991da1649fca765d149b
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/envelp/labfmt.cxx52
1 files changed, 23 insertions, 29 deletions
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index 6b184585ae7a..1e06a91085a8 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -92,14 +92,14 @@ void SwLabPreview::Paint(const Rectangle &)
{
const Size aSz(GetOutputSizePixel());
- long lOutWPix = aSz.Width ();
- long lOutHPix = aSz.Height();
+ const long lOutWPix = aSz.Width ();
+ const long lOutHPix = aSz.Height();
// Scale factor
- float fxpix = (float)(lOutWPix - (2 * (lLeftWidth + 15))) / (float)lOutWPix;
+ const float fxpix = (float)(lOutWPix - (2 * (lLeftWidth + 15))) / (float)lOutWPix;
- long lOutWPix23 = (long)((float)lOutWPix * fxpix);
- long lOutHPix23 = (long)((float)lOutHPix * fxpix);
+ const long lOutWPix23 = (long)((float)lOutWPix * fxpix);
+ const long lOutHPix23 = (long)((float)lOutHPix * fxpix);
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
const Color& rWinColor = rStyleSettings.GetWindowColor();
@@ -119,34 +119,28 @@ void SwLabPreview::Paint(const Rectangle &)
SetFont(aPaintFont);
// size of region to be displayed
- long lDispW = aItem.lLeft + aItem.lHDist;
- long lDispH = aItem.lUpper + aItem.lVDist;
- if (aItem.nCols == 1)
- lDispW += aItem.lLeft ;
- else
- lDispW += ROUND(aItem.lHDist / 10.0);
- if (aItem.nRows == 1)
- lDispH += aItem.lUpper;
- else
- lDispH += ROUND(aItem.lVDist / 10.0);
+ const long lDispW = aItem.lLeft + aItem.lHDist
+ + ((aItem.nCols == 1) ? aItem.lLeft : ROUND(aItem.lHDist/10.0));
+ const long lDispH = aItem.lUpper + aItem.lVDist
+ + ((aItem.nRows == 1) ? aItem.lUpper : ROUND(aItem.lVDist/10.0));
// Scale factor
- float fx = (float) lOutWPix23 / std::max(1L, lDispW),
- fy = (float) lOutHPix23 / std::max(1L, lDispH),
- f = fx < fy ? fx : fy;
+ const float fx = (float) lOutWPix23 / std::max(1L, lDispW);
+ const float fy = (float) lOutHPix23 / std::max(1L, lDispH);
+ const float f = fx < fy ? fx : fy;
// zero point
- long lOutlineW = ROUND(f * lDispW);
- long lOutlineH = ROUND(f * lDispH);
-
- long lX0 = (lOutWPix - lOutlineW) / 2;
- long lY0 = (lOutHPix - lOutlineH) / 2;
- long lX1 = lX0 + ROUND(f * aItem.lLeft );
- long lY1 = lY0 + ROUND(f * aItem.lUpper);
- long lX2 = lX0 + ROUND(f * (aItem.lLeft + aItem.lWidth ));
- long lY2 = lY0 + ROUND(f * (aItem.lUpper + aItem.lHeight));
- long lX3 = lX0 + ROUND(f * (aItem.lLeft + aItem.lHDist ));
- long lY3 = lY0 + ROUND(f * (aItem.lUpper + aItem.lVDist ));
+ const long lOutlineW = ROUND(f * lDispW);
+ const long lOutlineH = ROUND(f * lDispH);
+
+ const long lX0 = (lOutWPix - lOutlineW) / 2;
+ const long lY0 = (lOutHPix - lOutlineH) / 2;
+ const long lX1 = lX0 + ROUND(f * aItem.lLeft );
+ const long lY1 = lY0 + ROUND(f * aItem.lUpper);
+ const long lX2 = lX0 + ROUND(f * (aItem.lLeft + aItem.lWidth ));
+ const long lY2 = lY0 + ROUND(f * (aItem.lUpper + aItem.lHeight));
+ const long lX3 = lX0 + ROUND(f * (aItem.lLeft + aItem.lHDist ));
+ const long lY3 = lY0 + ROUND(f * (aItem.lUpper + aItem.lVDist ));
// draw outline (area)
DrawRect(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH)));