summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2011-12-14 10:49:10 +0000
committerNoel Power <noel.power@novell.com>2011-12-14 11:02:26 +0000
commitcefd323936db42b3414c01c4a6dfe1550b364ed3 (patch)
treedce40ef007ad79431ddd8caf04a022374a80b37f /sc/source/ui
parentf33773c414f8ed6b470e66da6cf83716989c488e (diff)
stop formulabar controls being repositioned vertically in multiline mode
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputwin.cxx24
-rw-r--r--sc/source/ui/inc/inputwin.hxx4
2 files changed, 25 insertions, 3 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a324994f1a69..b9ab4127b6cf 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 1e896e7c0740..1f200c12ba06 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* );