summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2012-10-19 01:21:22 +0200
committerLior Kaplan <kaplanlior@gmail.com>2012-10-25 17:36:31 +0200
commitb1f308d96609bf6a6bd6b563dcbec246a6910b0f (patch)
treeab55d927391f1e7d5d79f7c24418a694449d513d /sc/source/ui
parent44653d129f909a026b91fa4df6e1bd931638d620 (diff)
fdo#44657 Remove hack that "simulates" a mirrored horizontal scrollbar.
We are able to paint mirrored scrolbars with the 'gen' plugin, so just fix the rendering of the scroolbar with the Gtk+ plugin. Change-Id: I5dbd13420c6290e165ed2f5827769979298abf37 (cherry picked from commit bfa21ce5fa08f2c634ccb6162914be55aef9f3c2) Signed-off-by: Lior Kaplan <kaplanlior@gmail.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/inc/tabview.hxx2
-rw-r--r--sc/source/ui/view/tabview.cxx27
-rw-r--r--sc/source/ui/view/tabview4.cxx36
3 files changed, 18 insertions, 47 deletions
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 8879b07dbf43..e090e72c72db 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -195,7 +195,7 @@ private:
void UpdateVarZoom();
static void SetScrollBar( ScrollBar& rScroll, long nRangeMax, long nVisible, long nPos, bool bLayoutRTL );
- static long GetScrollBarPos( ScrollBar& rScroll, bool bLayoutRTL );
+ static long GetScrollBarPos( ScrollBar& rScroll );
void GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPageX, SCsROW& rPageY);
void GetAreaMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 0a3ab2863051..0231f81ef9c3 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -342,6 +342,8 @@ void ScTabView::InitScrollBar( ScrollBar& rScrollBar, long nMaxVal )
rScrollBar.SetScrollHdl( LINK(this, ScTabView, ScrollHdl) );
rScrollBar.SetEndScrollHdl( LINK(this, ScTabView, EndScrollHdl) );
+
+ rScrollBar.EnableRTL( aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ) );
}
// Scroll-Timer
@@ -1095,15 +1097,14 @@ IMPL_LINK( ScTabView, EndScrollHdl, ScrollBar*, pScroll )
if ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight )
{
- bool bMirror = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ) != Application::GetSettings().GetLayoutRTL();
ScHSplitPos eWhich = (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
- long nDelta = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin - aViewData.GetPosX(eWhich);
+ long nDelta = GetScrollBarPos( *pScroll ) + nScrollMin - aViewData.GetPosX(eWhich);
if (nDelta) ScrollX( nDelta, eWhich );
}
else // VScroll...
{
ScVSplitPos eWhich = (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
- long nDelta = GetScrollBarPos( *pScroll, false ) + nScrollMin - aViewData.GetPosY(eWhich);
+ long nDelta = GetScrollBarPos( *pScroll ) + nScrollMin - aViewData.GetPosY(eWhich);
if (nDelta) ScrollY( nDelta, eWhich );
}
}
@@ -1126,7 +1127,6 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
SC_SPLIT_TOP : SC_SPLIT_BOTTOM );
bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
- bool bMirror = bHoriz && (bLayoutRTL != Application::GetSettings().GetLayoutRTL());
ScrollType eType = pScroll->GetType();
if ( eType == SCROLL_DRAG )
@@ -1164,7 +1164,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
nScrollMin = aViewData.GetFixPosX();
if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
nScrollMin = aViewData.GetFixPosY();
- long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin;
+ long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin;
String aHelpStr;
Rectangle aRect;
@@ -1199,21 +1199,6 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
if ( bOnlineScroll || eType != SCROLL_DRAG )
{
- if ( bMirror )
- {
- // change scroll type so visible/previous cells calculation below remains the same
- switch ( eType )
- {
- case SCROLL_LINEUP: eType = SCROLL_LINEDOWN; break;
- case SCROLL_LINEDOWN: eType = SCROLL_LINEUP; break;
- case SCROLL_PAGEUP: eType = SCROLL_PAGEDOWN; break;
- case SCROLL_PAGEDOWN: eType = SCROLL_PAGEUP; break;
- default:
- {
- // added to avoid warnings
- }
- }
- }
long nDelta = pScroll->GetDelta();
switch ( eType )
{
@@ -1248,7 +1233,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
nScrollMin = aViewData.GetFixPosY();
- long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin;
+ long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin;
nDelta = nScrollPos - nViewPos;
if ( nScrollPos > nPrevDragPos )
{
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index a00edef04513..064a6670d2ec 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -337,30 +337,16 @@ void ScTabView::SetScrollBar( ScrollBar& rScroll, long nRangeMax, long nVisible,
if ( nVisible == 0 )
nVisible = 1; // #i59893# don't use visible size 0
- // RTL layout uses a negative range to simulate a mirrored scroll bar.
- // SetScrollBar/GetScrollBarPos hide this so outside of these functions normal cell
- // addresses can be used.
+ rScroll.SetRange( Range( 0, nRangeMax ) );
+ rScroll.SetVisibleSize( nVisible );
+ rScroll.SetThumbPos( nPos );
- if ( bLayoutRTL )
- {
- rScroll.SetRange( Range( -nRangeMax, 0 ) );
- rScroll.SetVisibleSize( nVisible );
- rScroll.SetThumbPos( -nPos - nVisible );
- }
- else
- {
- rScroll.SetRange( Range( 0, nRangeMax ) );
- rScroll.SetVisibleSize( nVisible );
- rScroll.SetThumbPos( nPos );
- }
+ rScroll.EnableRTL( bLayoutRTL );
}
-long ScTabView::GetScrollBarPos( ScrollBar& rScroll, bool bLayoutRTL )
+long ScTabView::GetScrollBarPos( ScrollBar& rScroll )
{
- if ( bLayoutRTL )
- return -rScroll.GetThumbPos() - rScroll.GetVisibleSize();
- else
- return rScroll.GetThumbPos();
+ return rScroll.GetThumbPos();
}
// UpdateScrollBars - sichtbaren Bereich und Scrollweite der Scrollbars einstellen
@@ -400,7 +386,7 @@ void ScTabView::UpdateScrollBars()
sal_Bool bRight = ( aViewData.GetHSplitMode() != SC_SPLIT_NONE );
ScDocument* pDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
- sal_Bool bMirror = pDoc->IsLayoutRTL( nTab ) != Application::GetSettings().GetLayoutRTL();
+ bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
SCCOL nUsedX;
SCROW nUsedY;
pDoc->GetTableArea( nTab, nUsedX, nUsedY ); //! cachen !!!!!!!!!!!!!!!
@@ -419,24 +405,24 @@ void ScTabView::UpdateScrollBars()
nVisXL = aViewData.VisibleCellsX( SC_SPLIT_LEFT );
long nMaxXL = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_LEFT), nVisXL, MAXCOL, 0 );
- SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bMirror );
+ SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bLayoutRTL );
nVisYB = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM );
long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, MAXROW, nStartY );
- SetScrollBar( aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, false );
+ SetScrollBar( aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, bLayoutRTL );
if (bRight)
{
nVisXR = aViewData.VisibleCellsX( SC_SPLIT_RIGHT );
long nMaxXR = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_RIGHT), nVisXR, MAXCOL, nStartX );
- SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bMirror );
+ SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bLayoutRTL );
}
if (bTop)
{
nVisYT = aViewData.VisibleCellsY( SC_SPLIT_TOP );
long nMaxYT = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_TOP), nVisYT, MAXROW, 0 );
- SetScrollBar( aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), false );
+ SetScrollBar( aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), bLayoutRTL );
}
// Bereich testen