diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-11-20 21:20:25 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-11-21 15:45:02 +0100 |
commit | 75e7d9cdc976c1efd0db7d0b8f325759ad5da68b (patch) | |
tree | b29f7da1f2cc2d493b2afcd74be56b388cd3d975 | |
parent | 4ea7a6f4f4a885dbf7c17e0738df45396da685bf (diff) |
expand complex cascading conditional operator
Change-Id: I523399c04e1535e546e31e67107e8dfd7372396c
-rw-r--r-- | sw/source/uibase/table/tablemgr.cxx | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index c20ea83d4a4a..3f48722aeac5 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -69,10 +69,15 @@ SwTwips SwTableFUNC::GetColWidth(sal_uInt16 nNum) const { if(aCols.Count() == GetColCount()) { - nWidth = (SwTwips)((nNum == aCols.Count()) ? - aCols.GetRight() - aCols[nNum-1] : - nNum == 0 ? aCols[nNum] - aCols.GetLeft() : - aCols[nNum] - aCols[nNum-1]); + if(nNum == aCols.Count()) + nWidth = aCols.GetRight() - aCols[nNum-1]; + else + { + if(nNum == 0) + nWidth = aCols[nNum] - aCols.GetLeft(); + else + nWidth = aCols[nNum] - aCols[nNum-1]; + } } else { @@ -87,7 +92,6 @@ SwTwips SwTableFUNC::GetColWidth(sal_uInt16 nNum) const } else nWidth = aCols.GetRight(); - return nWidth; } @@ -99,13 +103,18 @@ SwTwips SwTableFUNC::GetMaxColWidth( sal_uInt16 nNum ) const { // The maximum width arises from the own width and // the width each of the neighbor cells reduced by MINLAY. - SwTwips nMax = nNum == 0 ? - GetColWidth(1) - MINLAY : - nNum == GetColCount() ? - GetColWidth( nNum-1 ) - MINLAY : - GetColWidth(nNum - 1) + GetColWidth( nNum + 1 ) - 2 * MINLAY; - - return nMax + GetColWidth(nNum) ; + SwTwips nMax; + if(nNum == 0) + nMax = GetColWidth(1) - MINLAY; + else + { + nMax = GetColWidth(nNum-1); + if(nNum == GetColCount()) + nMax -= MINLAY; + else + nMax += GetColWidth(nNum+1) - 2 * MINLAY; + } + return nMax + GetColWidth(nNum); } else return GetColWidth(nNum); |