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

Rodolfo Ribeiro Gomes rodolforg at gmail.com
Mon Nov 4 11:11:17 CET 2013


 sc/source/ui/view/hdrcont.cxx |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 0432f847bba2e2d074d72a9ff794d680e0f46785
Author: Rodolfo Ribeiro Gomes <rodolforg at gmail.com>
Date:   Sun Nov 3 22:57:26 2013 -0200

    minor cleanup in ScHeaderControl: nCount is always greater than 0
    
    Change-Id: Ia50265e397704131dc948bc2bcbf80a442054b71
    Signed-off-by: Rodolfo Ribeiro Gomes <rodolforg at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/6538
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 93b5794..d536780 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -563,9 +563,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
 SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const
 {
     bool        bFound = false;
-    SCCOLROW    nCount = 1;
     SCCOLROW    nPos = GetPos();
     SCCOLROW    nHitNo = nPos;
+    SCCOLROW    nEntryNo = 1 + nPos;
     long    nScrPos;
     long    nMousePos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X();
     long    nDif;
@@ -579,22 +579,20 @@ SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder )
     nScrPos = GetScrPos( nPos ) - nLayoutSign;
     do
     {
-        SCCOLROW nEntryNo = nCount + nPos;
-
         if (nEntryNo > nSize)
             nScrPos = nEndPos + nLayoutSign;
         else
             nScrPos += GetEntrySize( nEntryNo - 1 ) * nLayoutSign;      //! GetHiddenCount() ??
 
         nDif = nMousePos - nScrPos;
-        if (nDif >= -2 && nDif <= 2 && nCount > 0)
+        if (nDif >= -2 && nDif <= 2)
         {
             bFound = true;
             nHitNo=nEntryNo-1;
         }
         else if (nDif * nLayoutSign >= 0 && nEntryNo < nSize)
             nHitNo = nEntryNo;
-        ++nCount;
+        ++nEntryNo;
     }
     while ( nScrPos * nLayoutSign < nEndPos * nLayoutSign && nDif * nLayoutSign > 0 );
 


More information about the Libreoffice-commits mailing list