Kaydet (Commit) 245dddf1 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#704280 Logically dead code

Change-Id: I4ba45a63373d5edf709688594cd25be4ff1385ec
üst eae56604
......@@ -176,7 +176,7 @@ private:
void InitScrollBar( ScrollBar& rScrollBar, long nMaxVal );
DECL_LINK( ScrollHdl, ScrollBar* );
DECL_LINK( EndScrollHdl, ScrollBar* );
DECL_LINK( EndScrollHdl, void* );
DECL_LINK( SplitHdl, Splitter* );
void DoHSplit(long nSplitPos);
......
......@@ -979,7 +979,7 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
return bDone;
}
IMPL_LINK( ScTabView, EndScrollHdl, ScrollBar*, pScroll )
IMPL_LINK_NOARG(ScTabView, EndScrollHdl)
{
if ( bDragging )
{
......@@ -991,8 +991,6 @@ IMPL_LINK( ScTabView, EndScrollHdl, ScrollBar*, pScroll )
IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
{
sal_Bool bOnlineScroll = sal_True; //! Optionen
bool bHoriz = ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight );
long nViewPos;
if ( bHoriz )
......@@ -1071,73 +1069,70 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
}
}
if ( bOnlineScroll || eType != SCROLL_DRAG )
long nDelta = pScroll->GetDelta();
switch ( eType )
{
long nDelta = pScroll->GetDelta();
switch ( eType )
{
case SCROLL_LINEUP:
nDelta = -1;
break;
case SCROLL_LINEDOWN:
nDelta = 1;
break;
case SCROLL_PAGEUP:
if ( pScroll == &aHScrollLeft ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT );
if ( pScroll == &aHScrollRight ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT );
if ( pScroll == &aVScrollTop ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP );
if ( pScroll == &aVScrollBottom ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM );
if (nDelta==0) nDelta=-1;
break;
case SCROLL_PAGEDOWN:
if ( pScroll == &aHScrollLeft ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT );
if ( pScroll == &aHScrollRight ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT );
if ( pScroll == &aVScrollTop ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP );
if ( pScroll == &aVScrollBottom ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM );
if (nDelta==0) nDelta=1;
break;
case SCROLL_DRAG:
case SCROLL_LINEUP:
nDelta = -1;
break;
case SCROLL_LINEDOWN:
nDelta = 1;
break;
case SCROLL_PAGEUP:
if ( pScroll == &aHScrollLeft ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT );
if ( pScroll == &aHScrollRight ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT );
if ( pScroll == &aVScrollTop ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP );
if ( pScroll == &aVScrollBottom ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM );
if (nDelta==0) nDelta=-1;
break;
case SCROLL_PAGEDOWN:
if ( pScroll == &aHScrollLeft ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT );
if ( pScroll == &aHScrollRight ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT );
if ( pScroll == &aVScrollTop ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP );
if ( pScroll == &aVScrollBottom ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM );
if (nDelta==0) nDelta=1;
break;
case SCROLL_DRAG:
{
// nur in die richtige Richtung scrollen, nicht um ausgeblendete
// Bereiche herumzittern
long nScrollMin = 0; // RangeMin simulieren
if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
nScrollMin = aViewData.GetFixPosX();
if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
nScrollMin = aViewData.GetFixPosY();
long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin;
nDelta = nScrollPos - nViewPos;
if ( nScrollPos > nPrevDragPos )
{
// nur in die richtige Richtung scrollen, nicht um ausgeblendete
// Bereiche herumzittern
long nScrollMin = 0; // RangeMin simulieren
if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
nScrollMin = aViewData.GetFixPosX();
if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
nScrollMin = aViewData.GetFixPosY();
long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin;
nDelta = nScrollPos - nViewPos;
if ( nScrollPos > nPrevDragPos )
{
if (nDelta<0) nDelta=0;
}
else if ( nScrollPos < nPrevDragPos )
{
if (nDelta>0) nDelta=0;
}
else
nDelta = 0;
nPrevDragPos = nScrollPos;
if (nDelta<0) nDelta=0;
}
break;
default:
{
// added to avoid warnings
else if ( nScrollPos < nPrevDragPos )
{
if (nDelta>0) nDelta=0;
}
else
nDelta = 0;
nPrevDragPos = nScrollPos;
}
}
if (nDelta)
break;
default:
{
sal_Bool bUpdate = ( eType != SCROLL_DRAG ); // bei Drag die Ranges nicht aendern
if ( bHoriz )
ScrollX( nDelta, (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate );
else
ScrollY( nDelta, (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate );
// added to avoid warnings
}
}
if (nDelta)
{
sal_Bool bUpdate = ( eType != SCROLL_DRAG ); // bei Drag die Ranges nicht aendern
if ( bHoriz )
ScrollX( nDelta, (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate );
else
ScrollY( nDelta, (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate );
}
return 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