Kaydet (Commit) 0432f847 authored tarafından Rodolfo Ribeiro Gomes's avatar Rodolfo Ribeiro Gomes Kaydeden (comit) Markus Mohrhard

minor cleanup in ScHeaderControl: nCount is always greater than 0

Change-Id: Ia50265e397704131dc948bc2bcbf80a442054b71
Signed-off-by: 's avatarRodolfo Ribeiro Gomes <rodolforg@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/6538Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst b64d19a6
...@@ -563,9 +563,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect ) ...@@ -563,9 +563,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const
{ {
bool bFound = false; bool bFound = false;
SCCOLROW nCount = 1;
SCCOLROW nPos = GetPos(); SCCOLROW nPos = GetPos();
SCCOLROW nHitNo = nPos; SCCOLROW nHitNo = nPos;
SCCOLROW nEntryNo = 1 + nPos;
long nScrPos; long nScrPos;
long nMousePos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X(); long nMousePos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X();
long nDif; long nDif;
...@@ -579,22 +579,20 @@ SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) ...@@ -579,22 +579,20 @@ SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder )
nScrPos = GetScrPos( nPos ) - nLayoutSign; nScrPos = GetScrPos( nPos ) - nLayoutSign;
do do
{ {
SCCOLROW nEntryNo = nCount + nPos;
if (nEntryNo > nSize) if (nEntryNo > nSize)
nScrPos = nEndPos + nLayoutSign; nScrPos = nEndPos + nLayoutSign;
else else
nScrPos += GetEntrySize( nEntryNo - 1 ) * nLayoutSign; //! GetHiddenCount() ?? nScrPos += GetEntrySize( nEntryNo - 1 ) * nLayoutSign; //! GetHiddenCount() ??
nDif = nMousePos - nScrPos; nDif = nMousePos - nScrPos;
if (nDif >= -2 && nDif <= 2 && nCount > 0) if (nDif >= -2 && nDif <= 2)
{ {
bFound = true; bFound = true;
nHitNo=nEntryNo-1; nHitNo=nEntryNo-1;
} }
else if (nDif * nLayoutSign >= 0 && nEntryNo < nSize) else if (nDif * nLayoutSign >= 0 && nEntryNo < nSize)
nHitNo = nEntryNo; nHitNo = nEntryNo;
++nCount; ++nEntryNo;
} }
while ( nScrPos * nLayoutSign < nEndPos * nLayoutSign && nDif * nLayoutSign > 0 ); while ( nScrPos * nLayoutSign < nEndPos * nLayoutSign && nDif * nLayoutSign > 0 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment