sc/source/core/units/unitsimpl.cxx |   37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

New commits:
commit aa81c5e795bac029964cab7708f3dab278ce236f
Author: Benjamin Ni <benjaminn...@hotmail.com>
Date:   Fri Jul 3 15:20:19 2015 +0100

    Coding style cleanup
    
    Change-Id: I6171ba59e4df40dfc4734204832857f0fe7637e9
    Reviewed-on: https://gerrit.libreoffice.org/16738
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/core/units/unitsimpl.cxx 
b/sc/source/core/units/unitsimpl.cxx
index 4f0057c..c2e39f9 100644
--- a/sc/source/core/units/unitsimpl.cxx
+++ b/sc/source/core/units/unitsimpl.cxx
@@ -751,19 +751,24 @@ bool UnitsImpl::convertCellUnitsForColumnRange(const 
ScRange& rRange,
         // It's possible that the header refers to an incompatible unit, hence
         // shouldn't be modified when we're converting.
         if (aCurrent == aHeader.address &&
-            aHeader.unit.areConvertibleTo(rOutputUnit)) {
+            aHeader.unit.areConvertibleTo(rOutputUnit) )
+        {
             OUString sHeader = pDoc->GetString(aCurrent);
             sHeader = sHeader.replaceAt(aHeader.unitStringPosition, 
aHeader.unitString.getLength(), *rOutputUnit.getInputString());
             pDoc->SetString(aCurrent, sHeader);
 
             aHeader.valid = false;
-        } else if (pDoc->GetCellType(aCurrent) != CELLTYPE_STRING) {
-            if (!aHeader.valid) {
+        }
+        else if (pDoc->GetCellType(aCurrent) != CELLTYPE_STRING)
+        {
+            if (!aHeader.valid)
+            {
                 aHeader = findHeaderUnitForCell(aCurrent, pDoc);
 
                 // If there is no header we get an invalid unit returned from 
findHeaderUnitForCell,
                 // and therfore assume the dimensionless unit 1.
-                if (!aHeader.valid) {
+                if (!aHeader.valid)
+                {
                     UtUnit::createUnit("", aHeader.unit, mpUnitSystem);
                     aHeader.valid = true;
                 }
@@ -771,10 +776,14 @@ bool UnitsImpl::convertCellUnitsForColumnRange(const 
ScRange& rRange,
 
             OUString sLocalUnit(extractUnitStringForCell(aCurrent, pDoc));
             UtUnit aLocalUnit;
-            if (sLocalUnit.isEmpty()) {
+            if (sLocalUnit.isEmpty())
+            {
                 aLocalUnit = aHeader.unit;
-            } else { // override header unit with annotation unit
-                if (!UtUnit::createUnit(sLocalUnit, aLocalUnit, mpUnitSystem)) 
{
+            }
+            else
+            { // override header unit with annotation unit
+                if (!UtUnit::createUnit(sLocalUnit, aLocalUnit, mpUnitSystem))
+                {
                     // but assume dimensionless if invalid
                     UtUnit::createUnit("", aLocalUnit, mpUnitSystem);
                 }
@@ -784,13 +793,17 @@ bool UnitsImpl::convertCellUnitsForColumnRange(const 
ScRange& rRange,
                 (rOutputUnit != aHeader.unit);
             double nValue = pDoc->GetValue(aCurrent);
 
-            if (!aLocalUnit.areConvertibleTo(rOutputUnit)) {
+            if (!aLocalUnit.areConvertibleTo(rOutputUnit))
+            {
                 bAllConverted = false;
-            } else {
+            }
+            else
+            {
                 double nNewValue = aLocalUnit.convertValueTo(nValue, 
rOutputUnit);
                 pDoc->SetValue(aCurrent, nNewValue);
 
-                if (bLocalAnnotationRequired) {
+                if (bLocalAnnotationRequired)
+                {
                     // All a local dirty hack too - needs to be refactored and 
improved.
                     // And ideally we should reuse the existing format.
                     OUString sNewFormat = "General\"" + 
*rOutputUnit.getInputString() + "\"";
@@ -801,7 +814,9 @@ bool UnitsImpl::convertCellUnitsForColumnRange(const 
ScRange& rRange,
                     SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
                     pFormatter->PutEntry(sNewFormat, nErrorPosition, nType, 
nFormatKey);
                     pDoc->SetNumberFormat(aCurrent, nFormatKey);
-                } else {
+                }
+                else
+                {
                     // The number formats will by definition be wrong once 
we've converted, so just reset completely.
                     pDoc->SetNumberFormat(aCurrent, 0);
                 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to