summaryrefslogtreecommitdiff
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 10:51:02 +0000
commita9e338a1cd445be29be199f3f9f292062d5c1938 (patch)
treef054636312373eb27e5dffc17c3ac6a1cc36bde1
parent5539e6cbf3bfcb67ebf5986d1c04e65277896df1 (diff)
stop formulabar controls being repositioned vertically in multiline mode
-rw-r--r--sc/source/ui/app/inputwin.cxx24
-rw-r--r--sc/source/ui/inc/inputwin.hxx4
-rw-r--r--vcl/inc/vcl/toolbox.hxx11
-rw-r--r--vcl/source/window/toolbox.cxx6
4 files changed, 34 insertions, 11 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* );
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 287d069ec4e7..c750eec1f08f 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 36b42e0035e2..217cac0776c7 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;