sc/source/ui/app/inputwin.cxx | 29 +++++++++++++++++++++++++---- sc/source/ui/inc/inputwin.hxx | 4 +++- vcl/inc/vcl/toolbox.hxx | 11 +++++------ vcl/source/window/toolbox.cxx | 6 ++++-- 4 files changed, 37 insertions(+), 13 deletions(-)
New commits: commit cefd323936db42b3414c01c4a6dfe1550b364ed3 Author: Noel Power <noel.po...@novell.com> Date: Wed Dec 14 10:49:10 2011 +0000 stop formulabar controls being repositioned vertically in multiline mode diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index a324994..b9ab412 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -534,6 +534,18 @@ void ScInputWindow::Resize() aTextWindow.Resize(); Size aSize = GetSizePixel(); aSize.Height() = CalcWindowSizePixel().Height(); + ScInputBarGroup* pGroupBar = dynamic_cast< ScInputBarGroup* > ( pRuntimeWindow.get() ); + if ( pGroupBar ) + { + // To ensure smooth display and prevent the items in the toolbar being + // repositioned ( vertically ) we lock the vertical positioning of the toolbox + // items when we are displaying > 1 line. + // So, we need to adjust the height of the toolbox accordingly. If we don't + // then the largest item ( e.g. the GroupBar window ) will actually be + // positioned such that the toolbar will cut off the bottom of that item + if ( pGroupBar->GetNumLines() > 1 ) + aSize.Height() += pGroupBar->GetVertOffset(); + } SetSizePixel(aSize); Invalidate(); } @@ -861,7 +873,8 @@ ScInputBarGroup::ScInputBarGroup(Window* pParent, ScTabViewShell* pViewSh) : ScTextWndBase ( pParent, WinBits(WB_HIDE | WB_TABSTOP ) ), aMultiTextWnd ( this, pViewSh ), aButton ( this, WB_TABSTOP | WB_RECTSTYLE ), - aScrollBar ( this, WB_TABSTOP | WB_VERT | WB_DRAG ) + aScrollBar ( this, WB_TABSTOP | WB_VERT | WB_DRAG ), + nVertOffset ( 0 ) { aMultiTextWnd.Show(); aMultiTextWnd.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); @@ -1057,6 +1070,13 @@ void ScInputBarGroup::TriggerToolboxLayout() ScInputWindow *pParent; pParent=dynamic_cast<ScInputWindow*>(w); SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + + // Capture the vertical position of this window in the toolbar, when we increase + // the size of the toolbar to accomadate expanded line input we need to take this + // into account + if ( !nVertOffset ) + nVertOffset = pParent->GetItemPosRect( pParent->GetItemCount() - 1 ).Top(); + if ( pViewFrm ) { Reference< com::sun::star::beans::XPropertySet > xPropSet( pViewFrm->GetFrame().GetFrameInterface(), UNO_QUERY ); @@ -1071,7 +1091,7 @@ void ScInputBarGroup::TriggerToolboxLayout() if ( xLayoutManager.is() ) { if ( aMultiTextWnd.GetNumLines() > 1) - pParent->SetToolbarLayoutMode( TBX_LAYOUT_TOP ); + pParent->SetToolbarLayoutMode( TBX_LAYOUT_LOCKVERT ); else pParent->SetToolbarLayoutMode( TBX_LAYOUT_NORMAL ); xLayoutManager->lock(); diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index 1e896e7..1f200c1 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -231,12 +231,14 @@ public: ScrollBar& GetScrollBar() { return aScrollBar; } void IncrementVerticalSize(); void DecrementVerticalSize(); + long GetNumLines() { return aMultiTextWnd.GetNumLines(); } + long GetVertOffset() { return nVertOffset; } private: void TriggerToolboxLayout(); ScMultiTextWnd aMultiTextWnd; PushButton aButton; ScrollBar aScrollBar; - + long nVertOffset; DECL_LINK( ClickHdl, PushButton* ); DECL_LINK( Impl_ScrollHdl, ScrollBar* ); diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx index 8b39005..039a0e3 100644 --- a/vcl/inc/vcl/toolbox.hxx +++ b/vcl/inc/vcl/toolbox.hxx @@ -160,12 +160,11 @@ enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL, // used for internal sizing calculations enum FloatingSizeMode { FSMODE_AUTO, FSMODE_FAVOURWIDTH, FSMODE_FAVOURHEIGHT }; -// TBX_LAYOUT_NORMAL - traditional layout, items are centered in the toolbar -// TBX_LAYOUT_TOP - special mode (currently used for calc input/formula bar) -// where items are aligned with the top of highest item -// ( currently only valid for docked, single line, horizontal -// toolbars ) -enum ToolBoxLayoutMode { TBX_LAYOUT_NORMAL, TBX_LAYOUT_TOP }; +// TBX_LAYOUT_NORMAL - traditional layout, items are centered in the toolbar +// TBX_LAYOUT_LOCKVERT - special mode (currently used for calc input/formula +// bar) where item's vertical position is locked, e.g. +// toolbox is prevented from centering the items +enum ToolBoxLayoutMode { TBX_LAYOUT_NORMAL, TBX_LAYOUT_LOCKVERT }; // ----------- // - ToolBox - // ----------- diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index af88334..2a0a089 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -2719,8 +2719,10 @@ void ToolBox::ImplFormat( sal_Bool bResize ) if ( mbHorz ) { it->maCalcRect.Left() = nX; - if ( meLayoutMode == TBX_LAYOUT_TOP && mnLines == 1 ) - it->maCalcRect.Top() = nY/2; + // if special TBX_LAYOUT_LOCKVERT lock vertical position + // don't recalulate the vertical position of the item + if ( meLayoutMode == TBX_LAYOUT_LOCKVERT && mnLines == 1 ) + it->maCalcRect.Top() = it->maRect.Top(); else it->maCalcRect.Top() = nY+(nLineSize-aCurrentItemSize.Height())/2; it->maCalcRect.Right() = nX+aCurrentItemSize.Width()-1; commit f33773c414f8ed6b470e66da6cf83716989c488e Author: Noel Power <noel.po...@novell.com> Date: Tue Dec 13 17:48:22 2011 +0000 adjust multiline button and scrollbar size/positions diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 5843cda..a324994 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -873,7 +873,8 @@ ScInputBarGroup::ScInputBarGroup(Window* pParent, ScTabViewShell* pViewSh) // too bad at the size from 'Settings' for me // set button width to scrollbar width then for the moment aButton.SetClickHdl ( LINK( this, ScInputBarGroup, ClickHdl ) ); - aButton.SetSizePixel(Size(GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd.GetPixelHeightForLines(1)) ); + // Add 2 pixels to compensate for the fact that scrollbar of the same width doesn't quite match + aButton.SetSizePixel(Size(GetSettings().GetStyleSettings().GetScrollBarSize() + 2, aMultiTextWnd.GetPixelHeightForLines(1)) ); aButton.Enable(); aButton.SetSymbol( SYMBOL_SPIN_DOWN ); aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); @@ -928,7 +929,7 @@ void ScInputBarGroup::Resize() Size aSize = GetSizePixel(); aSize.Width() = Max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 ); - aScrollBar.SetPosPixel(Point(aSize.Width()- ( aButton.GetSizePixel().Width() ) + 1, aButton.GetSizePixel().Height() - 1 )); + aScrollBar.SetPosPixel(Point( aSize.Width() - aButton.GetSizePixel().Width() + 2, aButton.GetSizePixel().Height() ) ); Size aTmpSize( aSize ); aTmpSize.Width() = aTmpSize.Width() - aButton.GetSizePixel().Width(); _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits