summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2014-03-29 22:06:03 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2014-03-30 16:37:54 +0200
commitb50155ae687f640ffdd68beae06442a4d0b0083c (patch)
tree9043a8e8169b556892e7fb23eb3c810a9b378997
parent84ee76302fd1d6800d289ba45d96f5e861744416 (diff)
Do not evaluate the same expression 10 times
Change-Id: I3feb440e0013ba75b738e4110315c7034ef29639
-rw-r--r--sw/source/ui/frmdlg/column.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index f708407c03b7..de4ed2ca8fb1 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -1016,12 +1016,12 @@ IMPL_LINK( SwColumnPage, GapModify, MetricField*, pMetricFld )
}
else
{
- const sal_uInt16 nOffset = (pFld == &aDistEd2) ? 1 : 0;
- long nDiff = nActValue - nColDist[nFirstVis + nOffset];
+ const sal_uInt16 nVis = nFirstVis + (pFld == &aDistEd2) ? 1 : 0;
+ long nDiff = nActValue - nColDist[nVis];
if(nDiff)
{
- long nLeft = nColWidth[nFirstVis + nOffset];
- long nRight = nColWidth[nFirstVis + nOffset + 1];
+ long nLeft = nColWidth[nVis];
+ long nRight = nColWidth[nVis + 1];
if(nLeft + nRight + 2 * MINLAY < nDiff)
nDiff = nLeft + nRight - 2 * MINLAY;
if(nDiff < nRight - MINLAY)
@@ -1044,13 +1044,13 @@ IMPL_LINK( SwColumnPage, GapModify, MetricField*, pMetricFld )
}
nDiff = nTemp;
}
- nColWidth[nFirstVis + nOffset] = nLeft;
- nColWidth[nFirstVis + nOffset + 1] = nRight;
- nColDist[nFirstVis + nOffset] += nDiff;
+ nColWidth[nVis] = nLeft;
+ nColWidth[nVis + 1] = nRight;
+ nColDist[nVis] += nDiff;
- pColMgr->SetColWidth( nFirstVis + nOffset, sal_uInt16(nLeft) );
- pColMgr->SetColWidth( nFirstVis + nOffset + 1, sal_uInt16(nRight) );
- pColMgr->SetGutterWidth( sal_uInt16(nColDist[nFirstVis + nOffset]), nFirstVis + nOffset );
+ pColMgr->SetColWidth( nVis, sal_uInt16(nLeft) );
+ pColMgr->SetColWidth( nVis + 1, sal_uInt16(nRight) );
+ pColMgr->SetGutterWidth( sal_uInt16(nColDist[nVis]), nVis );
}
}