[Libreoffice-commits] core.git: sc/source

Noel Grandin noelgrandin at gmail.com
Fri Apr 1 08:09:06 UTC 2016


 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |   30 +++++++------------
 1 file changed, 12 insertions(+), 18 deletions(-)

New commits:
commit a18ec9d947aa49b7c98d52d5f24971ab326c4f7f
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Tue Mar 8 20:49:52 2016 +0200

    cleanup ScAccessibleSpreadsheet::getSelectedAccessibleColumns
    
    use early return
    
    Change-Id: I8dea61cb095ae31ad7deb8c4191c5ecf9810d9cd

diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index e1a56c5..5ea343a 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -848,29 +848,23 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib
 {
     SolarMutexGuard aGuard;
     IsObjectValid();
+    if (IsFormulaMode() || !mpViewShell)
+        return uno::Sequence<sal_Int32>();
+
     uno::Sequence<sal_Int32> aSequence;
-    if (IsFormulaMode())
-    {
-        return aSequence;
-    }
-    if (mpViewShell)
+    aSequence.realloc(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
+    sal_Int32* pSequence = aSequence.getArray();
+    sal_Int32 nCount(0);
+    const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
+    for (SCCOL i = maRange.aStart.Col(); i <= maRange.aEnd.Col(); ++i)
     {
-        aSequence.realloc(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
-        const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
-        sal_Int32* pSequence = aSequence.getArray();
-        sal_Int32 nCount(0);
-        for (SCCOL i = maRange.aStart.Col(); i <= maRange.aEnd.Col(); ++i)
+        if (rMarkdata.IsColumnMarked(i))
         {
-            if (rMarkdata.IsColumnMarked(i))
-            {
-                pSequence[nCount] = i;
-                ++nCount;
-            }
+            pSequence[nCount] = i;
+            ++nCount;
         }
-        aSequence.realloc(nCount);
     }
-    else
-        aSequence.realloc(0);
+    aSequence.realloc(nCount);
     return aSequence;
 }
 


More information about the Libreoffice-commits mailing list