diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-04 18:42:14 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-04 20:40:43 +0900 |
commit | 12d37f92507ab66fd519a68a2479e1cd7136cf74 (patch) | |
tree | 2a0bf8bfbb573db9b8367aa9d1de9180e29d6247 /sc/source/ui/view | |
parent | d91926de43d2192759029f7124e4e515efc96ba7 (diff) |
fdo#87684 option to make tabbar inline with scrollbar again
This adds an option to move the tabbar back to be inline with
scrollbar. The option is only available in Expert Configuration
under key: /org.openoffice.Office.Calc/Layout/Other property
TabbarInlineWithScrollbar
Change-Id: I95491072ad1cc195f2d8b8d0fadbd5ef045767e7
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 83 | ||||
-rw-r--r-- | sc/source/ui/view/tabview5.cxx | 9 |
2 files changed, 75 insertions, 17 deletions
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index e734401f04cd..06367a65519f 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -59,6 +59,9 @@ #define SC_ICONSIZE 36 +#define SC_SCROLLBAR_MIN 30 +#define SC_TABBAR_MIN 6 + using namespace ::com::sun::star; // Corner-Button @@ -228,7 +231,8 @@ ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* bDragging( false ), bBlockNeg( false ), bBlockCols( false ), - bBlockRows( false ) + bBlockRows( false ), + mbInlineWithScrollbar( false ) { Init(); } @@ -377,7 +381,11 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) } if (bHScroll) { - nBarY = nScrollBarSize + nTabWidth; + nBarY = nTabWidth; + + if (!mbInlineWithScrollbar) + nBarY += nScrollBarSize; + nSizeY -= nBarY - nOverlap; } @@ -408,6 +416,8 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) } nSizeRt = nSizeX - nSizeLt - nSizeSp; + long nTabSize = 0; + if (bTabControl) { // pending relative tab bar width from extended document options @@ -416,26 +426,67 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) SetRelTabBarWidth( mfPendingTabBarWidth ); mfPendingTabBarWidth = -1.0; } - } - Point aTabPoint(nPosX - nOverlap, nPosY + nSizeY + nScrollBarSize); - Size aTabSize(nSizeX, nBarY - nScrollBarSize); - lcl_SetPosSize( *pTabControl, aTabPoint, aTabSize, nTotalWidth, bLayoutRTL ); - pTabControl->SetSheetLayoutRTL( bLayoutRTL ); + if (mbInlineWithScrollbar) + { + nTabSize = pTabControl->GetSizePixel().Width() - nOverlap; + + if ( aViewData.GetHSplitMode() != SC_SPLIT_FIX ) // left Scrollbar + { + if (nTabSize > nSizeLt-SC_SCROLLBAR_MIN) + nTabSize = nSizeLt-SC_SCROLLBAR_MIN; + if (nTabSize < SC_TABBAR_MIN) nTabSize = SC_TABBAR_MIN; + nSizeLt -= nTabSize; + } + else // right Scrollbar + { + if (nTabSize > nSizeRt-SC_SCROLLBAR_MIN) + nTabSize = nSizeRt-SC_SCROLLBAR_MIN; + if (nTabSize < SC_TABBAR_MIN) nTabSize = SC_TABBAR_MIN; + nSizeRt -= nTabSize; + } + } + } - Point aHScrollLeftPoint(nPosX - nOverlap, nPosY + nSizeY); - Size aHScrollLeftSize(nSizeLt + 2 * nOverlap, nScrollBarSize); - lcl_SetPosSize( aHScrollLeft, aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL ); + if (mbInlineWithScrollbar) + { + Point aTabPoint(nPosX - nOverlap, nPosY + nSizeY); + Size aTabSize(nTabSize + nOverlap, nBarY); + lcl_SetPosSize(*pTabControl, aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); + pTabControl->SetSheetLayoutRTL(bLayoutRTL); + + Point aHScrollLeftPoint(nPosX + nTabSize - nOverlap, nPosY + nSizeY); + Size aHScrollLeftSize(nSizeLt + 2 * nOverlap, nBarY); + lcl_SetPosSize( aHScrollLeft, aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); + + Point aHSplitterPoint(nPosX + nTabSize + nSizeLt, nPosY + nSizeY); + Size aHSplitterSize(nSizeSp, nBarY); + lcl_SetPosSize(*pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); + + Point aHScrollRightPoint(nPosX + nTabSize + nSizeLt + nSizeSp - nOverlap, nPosY + nSizeY); + Size aHScrollRightSize(nSizeRt + 2 * nOverlap, nBarY); + lcl_SetPosSize(aHScrollRight, aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); + } + else + { + Point aTabPoint(nPosX - nOverlap, nPosY + nSizeY + nScrollBarSize); + Size aTabSize(nSizeX, nTabWidth); + lcl_SetPosSize( *pTabControl, aTabPoint, aTabSize, nTotalWidth, bLayoutRTL ); + pTabControl->SetSheetLayoutRTL( bLayoutRTL ); - Point aHSplitterPoint(nPosX + nSizeLt, nPosY + nSizeY); - Size aHSplitterSize(nSizeSp, nScrollBarSize); - lcl_SetPosSize( *pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL ); + Point aHScrollLeftPoint(nPosX - nOverlap, nPosY + nSizeY); + Size aHScrollLeftSize(nSizeLt + 2 * nOverlap, nScrollBarSize); + lcl_SetPosSize( aHScrollLeft, aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL ); - Point aHScrollRightPoint(nPosX + nSizeLt + nSizeSp - nOverlap, nPosY + nSizeY); - Size aHScrollRightSize(nSizeRt + 2 * nOverlap, nScrollBarSize); + Point aHSplitterPoint(nPosX + nSizeLt, nPosY + nSizeY); + Size aHSplitterSize(nSizeSp, nScrollBarSize); + lcl_SetPosSize( *pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL ); - lcl_SetPosSize( aHScrollRight, aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL ); + Point aHScrollRightPoint(nPosX + nSizeLt + nSizeSp - nOverlap, nPosY + nSizeY); + Size aHScrollRightSize(nSizeRt + 2 * nOverlap, nScrollBarSize); + lcl_SetPosSize( aHScrollRight, aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL ); + } // SetDragRectPixel is done below } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 424e9bc76743..66ec1a8463e8 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -51,6 +51,8 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <officecfg/Office/Calc.hxx> + using namespace com::sun::star; // STATIC DATA ----------------------------------------------------------- @@ -65,6 +67,8 @@ void ScTabView::Init() sal_uInt16 i; + mbInlineWithScrollbar = officecfg::Office::Calc::Layout::Other::TabbarInlineWithScrollbar::get(); + aScrollTimer.SetTimeout(10); aScrollTimer.SetTimeoutHdl( LINK( this, ScTabView, TimerHdl ) ); @@ -94,7 +98,10 @@ void ScTabView::Init() pHSplitter->SetKeyboardStepSize( 1 ); pVSplitter->SetKeyboardStepSize( 1 ); - pTabControl = new ScTabControl( pFrameWin, &aViewData ); + pTabControl = new ScTabControl(pFrameWin, &aViewData); + if (mbInlineWithScrollbar) + pTabControl->SetStyle(pTabControl->GetStyle() | WB_SIZEABLE); + /* #i97900# The tab control has to remain in RTL mode if GUI is RTL, this is needed to draw the 3D effect correctly. The base TabBar implementes mirroring independent from the GUI direction. Have to set RTL mode |