Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1777

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/77/1777/1

Replace the frequent functioncalls

The function getHorizontalEdge contains more function calls to the
getRowCount().  Instead we store the return value of getRowCount()
value in a const integer varible nRowCount and use it.

Change-Id: I3e1460913099d1060d5005329e0b63e5ebcd362c
---
M svx/source/table/tablelayouter.cxx
1 file changed, 6 insertions(+), 5 deletions(-)



diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 27bf185..d01a993 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -222,15 +222,16 @@
 sal_Int32 TableLayouter::getHorizontalEdge( int nEdgeY, sal_Int32* pnMin /*= 0*/, sal_Int32* pnMax 
/*= 0*/ )
 {
     sal_Int32 nRet = 0;
-    if( (nEdgeY >= 0) && (nEdgeY <= getRowCount() ) )
-        nRet = maRows[std::min((sal_Int32)nEdgeY,getRowCount()-1)].mnPos;
+    const sal_Int32 nRowCount = getRowCount();
+    if( (nEdgeY >= 0) && (nEdgeY <= nRowCount ) )
+        nRet = maRows[std::min((sal_Int32)nEdgeY,nRowCount-1)].mnPos;
 
-    if( nEdgeY == getRowCount() )
+    if( nEdgeY == nRowCount )
         nRet += maRows[nEdgeY - 1].mnSize;
 
     if( pnMin )
     {
-        if( (nEdgeY > 0) && (nEdgeY <= getRowCount() ) )
+        if( (nEdgeY > 0) && (nEdgeY <= nRowCount ) )
         {
             *pnMin = maRows[nEdgeY-1].mnPos + 600; // todo
         }
@@ -265,7 +266,7 @@
     }
     else
     {
-        if( nEdgeX == getColumnCount() )
+        if( nEdgeX == nColCount )
             nRet += maColumns[nEdgeX - 1].mnSize;
     }
 

-- 
To view, visit https://gerrit.libreoffice.org/1777
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e1460913099d1060d5005329e0b63e5ebcd362c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Karthikeyan Krishnamurthi <karthikeyan@kacst.edu.sa>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.