summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-03-29 15:07:55 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-03-29 18:12:05 +0000
commit245dddf171ae384ee8ec551d362db431f164c738 (patch)
treef34f246cb293f6e6a9e6d44f092147361060b0f6 /sc/source/ui
parenteae56604873d987d6da062c4882be04c68fffd92 (diff)
coverity#704280 Logically dead code
Change-Id: I4ba45a63373d5edf709688594cd25be4ff1385ec
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/inc/tabview.hxx2
-rw-r--r--sc/source/ui/view/tabview.cxx119
2 files changed, 58 insertions, 63 deletions
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 503edd28591b..5b814a32cbdf 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -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);
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 7aa8cee0e344..b9307f8f62ee 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -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;
}