Kaydet (Commit) 20800ebc authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt Kaydeden (comit) Tomaž Vajngerl

Move the scrollbar and layer tabs in a separate row in Draw

The reason for this is that the height of the scrollbar is theme-dependent
and makes the tabs unreadable if it's too small.

The same has already been done for Calc (fdo#36772).

Change-Id: Ibe22cf5e7d5863ccf276c19bfa969f5b5fc16a5a
Reviewed-on: https://gerrit.libreoffice.org/11480Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
Tested-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst ffeac200
...@@ -45,7 +45,7 @@ namespace sd { ...@@ -45,7 +45,7 @@ namespace sd {
* default constructor * default constructor
*/ */
LayerTabBar::LayerTabBar(DrawViewShell* pViewSh, Window* pParent) LayerTabBar::LayerTabBar(DrawViewShell* pViewSh, Window* pParent)
: TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_SIZEABLE ) ), : TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL ) ),
DropTargetHelper( this ), DropTargetHelper( this ),
pDrViewSh(pViewSh) pDrViewSh(pViewSh)
{ {
......
...@@ -163,9 +163,6 @@ public: ...@@ -163,9 +163,6 @@ public:
void SetDrawMode(sal_uLong nNewDrawMode) { mnDrawMode = nNewDrawMode; }; void SetDrawMode(sal_uLong nNewDrawMode) { mnDrawMode = nNewDrawMode; };
sal_uLong GetDrawMode() const { return mnDrawMode; }; sal_uLong GetDrawMode() const { return mnDrawMode; };
void SetTabCtrlPercent( double nPercent ) { mnTabCtrlPercent = nPercent; }
double GetTabCtrlPercent() const { return mnTabCtrlPercent; }
void SetIsNavigatorShowingAllShapes (const bool bIsNavigatorShowingAllShapes); void SetIsNavigatorShowingAllShapes (const bool bIsNavigatorShowingAllShapes);
bool IsNavigatorShowingAllShapes (void) const { return mbIsNavigatorShowingAllShapes;} bool IsNavigatorShowingAllShapes (void) const { return mbIsNavigatorShowingAllShapes;}
...@@ -200,7 +197,6 @@ private: ...@@ -200,7 +197,6 @@ private:
sal_uInt16 mnSlotId; ///< SlotId, which was initial mentioned sal_uInt16 mnSlotId; ///< SlotId, which was initial mentioned
sal_uInt16 mnSlidesPerRow; ///< slides per row on the slide-desk sal_uInt16 mnSlidesPerRow; ///< slides per row on the slide-desk
sal_uLong mnDrawMode; ///< draw mode for the normal window sal_uLong mnDrawMode; ///< draw mode for the normal window
double mnTabCtrlPercent;
/** Remember whether the navigator shows all shapes (<TRUE/>) or only /** Remember whether the navigator shows all shapes (<TRUE/>) or only
the names ones (<FALSE/>). Not persistent. the names ones (<FALSE/>). Not persistent.
*/ */
......
...@@ -72,9 +72,6 @@ public: ...@@ -72,9 +72,6 @@ public:
protected: protected:
void ConstructGraphicViewShell (void); void ConstructGraphicViewShell (void);
virtual void ArrangeGUIElements (void) SAL_OVERRIDE; virtual void ArrangeGUIElements (void) SAL_OVERRIDE;
private:
DECL_LINK(TabBarSplitHandler, TabBar*);
}; };
} // end of namespace sd } // end of namespace sd
......
...@@ -106,8 +106,7 @@ void DrawViewShell::ArrangeGUIElements (void) ...@@ -106,8 +106,7 @@ void DrawViewShell::ArrangeGUIElements (void)
// Retrieve the current size (thickness) of the scroll bars. That is // Retrieve the current size (thickness) of the scroll bars. That is
// the width of the vertical and the height of the horizontal scroll // the width of the vertical and the height of the horizontal scroll
// bar. // bar.
int nScrollBarSize = int nScrollBarSize = GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
maScrBarWH = Size (nScrollBarSize, nScrollBarSize); maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
Point aHPos = maViewPos; Point aHPos = maViewPos;
......
...@@ -192,7 +192,6 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK * ...@@ -192,7 +192,6 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK *
mbClickChangeRotation = pFrameView->IsClickChangeRotation(); mbClickChangeRotation = pFrameView->IsClickChangeRotation();
mnSlidesPerRow = pFrameView->GetSlidesPerRow(); mnSlidesPerRow = pFrameView->GetSlidesPerRow();
mnDrawMode = pFrameView->GetDrawMode(); mnDrawMode = pFrameView->GetDrawMode();
mnTabCtrlPercent = pFrameView->GetTabCtrlPercent();
mbIsNavigatorShowingAllShapes = pFrameView->IsNavigatorShowingAllShapes(); mbIsNavigatorShowingAllShapes = pFrameView->IsNavigatorShowingAllShapes();
SetPreviousViewShellType (pFrameView->GetPreviousViewShellType()); SetPreviousViewShellType (pFrameView->GetPreviousViewShellType());
SetViewShellTypeOnLoad (pFrameView->GetViewShellTypeOnLoad()); SetViewShellTypeOnLoad (pFrameView->GetViewShellTypeOnLoad());
...@@ -226,7 +225,6 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK * ...@@ -226,7 +225,6 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK *
bool bUseContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); bool bUseContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
mnDrawMode = bUseContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR; mnDrawMode = bUseContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR;
} }
mnTabCtrlPercent = 0.0;
mbIsNavigatorShowingAllShapes = false; mbIsNavigatorShowingAllShapes = false;
SetPreviousViewShellType (ViewShell::ST_NONE); SetPreviousViewShellType (ViewShell::ST_NONE);
SetViewShellTypeOnLoad (ViewShell::ST_IMPRESS); SetViewShellTypeOnLoad (ViewShell::ST_IMPRESS);
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
namespace sd { namespace sd {
static const int TABCONTROL_INITIAL_SIZE = 350;
GraphicViewShell::GraphicViewShell ( GraphicViewShell::GraphicViewShell (
SfxViewFrame* pFrame, SfxViewFrame* pFrame,
ViewShellBase& rViewShellBase, ViewShellBase& rViewShellBase,
...@@ -54,10 +52,9 @@ void GraphicViewShell::ConstructGraphicViewShell(void) ...@@ -54,10 +52,9 @@ void GraphicViewShell::ConstructGraphicViewShell(void)
{ {
meShellType = ST_DRAW; meShellType = ST_DRAW;
mpLayerTabBar.reset (new LayerTabBar(this,GetParentWindow())); mpLayerTabBar.reset (new LayerTabBar(this, GetParentWindow()));
mpLayerTabBar->SetSplitHdl(LINK(this,GraphicViewShell,TabBarSplitHandler));
// pb: #i67363# no layer tabbar on preview mode // #i67363# no layer tabbar in preview mode
if ( !GetObjectShell()->IsPreview() ) if ( !GetObjectShell()->IsPreview() )
mpLayerTabBar->Show(); mpLayerTabBar->Show();
} }
...@@ -77,55 +74,19 @@ void GraphicViewShell::ArrangeGUIElements (void) ...@@ -77,55 +74,19 @@ void GraphicViewShell::ArrangeGUIElements (void)
if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible()) if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
{ {
Size aSize = mpLayerTabBar->GetSizePixel(); Size aSize = mpLayerTabBar->GetSizePixel();
const Size aFrameSize ( const Size aFrameSize (GetViewFrame()->GetWindow().GetOutputSizePixel());
GetViewFrame()->GetWindow().GetOutputSizePixel());
if (aSize.Width() == 0) aSize.Height() = GetParentWindow()->GetFont().GetHeight() + 4;
{ aSize.Width() = aFrameSize.Width();
if (mpFrameView->GetTabCtrlPercent() == 0.0)
aSize.Width() = TABCONTROL_INITIAL_SIZE;
else
aSize.Width() = FRound(aFrameSize.Width()
* mpFrameView->GetTabCtrlPercent());
}
aSize.Height() = GetParentWindow()->GetSettings().GetStyleSettings()
.GetScrollBarSize();
Point aPos (0, maViewSize.Height() - aSize.Height()); Point aPos (0, maViewSize.Height() - aSize.Height());
mpLayerTabBar->SetPosSizePixel (aPos, aSize); mpLayerTabBar->SetPosSizePixel (aPos, aSize);
if (aFrameSize.Width() > 0)
mpFrameView->SetTabCtrlPercent (
(double) maTabControl.GetSizePixel().Width()
/ aFrameSize.Width());
else
mpFrameView->SetTabCtrlPercent( 0.0 );
} }
DrawViewShell::ArrangeGUIElements(); DrawViewShell::ArrangeGUIElements();
} }
IMPL_LINK(GraphicViewShell, TabBarSplitHandler, TabBar*, pTabBar)
{
const long int nMax = maViewSize.Width()
- maScrBarWH.Width()
- pTabBar->GetPosPixel().X();
Size aTabSize = pTabBar->GetSizePixel();
aTabSize.Width() = std::min(pTabBar->GetSplitSize(), (long)(nMax-1));
pTabBar->SetSizePixel (aTabSize);
Point aPos = pTabBar->GetPosPixel();
aPos.X() += aTabSize.Width();
Size aScrSize (nMax - aTabSize.Width(), maScrBarWH.Height());
mpHorizontalScrollBar->SetPosSizePixel(aPos, aScrSize);
return 0;
}
} // end of namespace sd } // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -873,13 +873,12 @@ void ViewShell::ArrangeGUIElements (void) ...@@ -873,13 +873,12 @@ void ViewShell::ArrangeGUIElements (void)
if (mpHorizontalScrollBar.get()!=NULL if (mpHorizontalScrollBar.get()!=NULL
&& mpHorizontalScrollBar->IsVisible()) && mpHorizontalScrollBar->IsVisible())
{ {
int nLocalLeft = nLeft;
if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
nLocalLeft += mpLayerTabBar->GetSizePixel().Width();
nBottom -= maScrBarWH.Height(); nBottom -= maScrBarWH.Height();
if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
nBottom -= mpLayerTabBar->GetSizePixel().Height();
mpHorizontalScrollBar->SetPosSizePixel ( mpHorizontalScrollBar->SetPosSizePixel (
Point(nLocalLeft,nBottom), Point(nLeft, nBottom),
Size(nRight-nLocalLeft-maScrBarWH.Width(),maScrBarWH.Height())); Size(nRight - nLeft - maScrBarWH.Width(), maScrBarWH.Height()));
} }
// Vertical scrollbar. // Vertical scrollbar.
...@@ -889,7 +888,7 @@ void ViewShell::ArrangeGUIElements (void) ...@@ -889,7 +888,7 @@ void ViewShell::ArrangeGUIElements (void)
nRight -= maScrBarWH.Width(); nRight -= maScrBarWH.Width();
mpVerticalScrollBar->SetPosSizePixel ( mpVerticalScrollBar->SetPosSizePixel (
Point(nRight,nTop), Point(nRight,nTop),
Size (maScrBarWH.Width(),nBottom-nTop)); Size (maScrBarWH.Width(), nBottom-nTop));
} }
// Filler in the lower right corner. // Filler in the lower right corner.
......
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