summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2011-12-07 15:40:28 +0000
committerNoel Power <noel.power@novell.com>2011-12-07 15:46:14 +0000
commitfa83f16b4e3c42d102dd5b9edffe0732ea46b897 (patch)
treef7b67ad7eef84896d78a37fee8d70ce3886a1cb9 /sc
parent400b458911a777dfb0d504ba65ed9496c441e556 (diff)
better sizing of inputbar ( removed weird calculations I didn't understand )
gsoc input bar now (should) snuggly wrap the text when collapsed, if multilines exist then scrolling with the keys should be clean and no spill from upper or lower lines visible. Removed some strange ( pseudo padding ) apparently for taking into account the window border and reorganized the resize logic so the padding is added ( and commented why ) in just one place.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/app/inputwin.cxx25
-rw-r--r--sc/source/ui/inc/inputwin.hxx2
2 files changed, 12 insertions, 15 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 8b32bc9129a3..a04451f15e42 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -864,7 +864,7 @@ ScInputBarGroup::ScInputBarGroup(Window* pParent)
// 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(), TBX_WINDOW_HEIGHT) );
+ aButton.SetSizePixel(Size(GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd.GetPixelHeightForLines(1)) );
aButton.Enable();
aButton.SetSymbol( SYMBOL_SPIN_DOWN );
aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) );
@@ -1123,18 +1123,16 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec )
}
}
-long ScMultiTextWnd::GetPixelTextHeight()
+
+long ScMultiTextWnd::GetPixelHeightForLines( long nLines )
{
long height = ( LogicToPixel(Size(0,GetTextHeight())).Height() );
// need to figure out why GetTextHeight is not set up when I need it
// some initialisation timing issue ?
- return Max ( long( 14 ), height );
-}
-
-
-long ScMultiTextWnd::GetPixelHeightForLines( long nLines )
-{
- return nLines * GetPixelTextHeight();
+ height = Max ( long( 14 ), height );
+ // add padding ( for the borders of the window I guess ) otherwise we
+ // chop slightly the top and bottom of whatever is in the inputbox
+ return ( nLines * height ) + 4;
}
void ScMultiTextWnd::SetNumLines( long nLines )
@@ -1153,14 +1151,14 @@ void ScMultiTextWnd::Resize()
// parent/container window
Size aTextBoxSize = GetSizePixel();
- aTextBoxSize.Height()=( GetPixelHeightForLines( mnLines ) ) + 8;
+ aTextBoxSize.Height()=( GetPixelHeightForLines( mnLines ) );
+ SetSizePixel(aTextBoxSize);
if(pEditView)
{
Size aOutputSize = GetOutputSizePixel();
- Size aLineSize = Size(0,GetPixelTextHeight());
- int nDiff = (aOutputSize.Height() - ( mnLines *aLineSize.Height()))/2;
- Point aPos1(TEXT_STARTPOS,nDiff);
+ Size aLineSize = Size(0,aTextBoxSize.Height());
+ Point aPos1(TEXT_STARTPOS,0);
Point aPos2(aOutputSize.Width(),aOutputSize.Height());
pEditView->SetOutputArea(
@@ -1170,7 +1168,6 @@ void ScMultiTextWnd::Resize()
}
SetScrollBarRange();
- SetSizePixel(aTextBoxSize);
}
IMPL_LINK(ScMultiTextWnd, ModifyHdl, EENotify*, pNotify)
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 76730b699355..7a1da054614c 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -176,7 +176,6 @@ public:
virtual void StopEditEngine( sal_Bool bAll );
int GetLineCount();
virtual void Resize();
- long GetPixelTextHeight();
long GetPixelHeightForLines( long nLines );
long GetEditEngTxtHeight();
@@ -193,6 +192,7 @@ protected:
DECL_LINK( NotifyHdl, EENotify* );
DECL_LINK( ModifyHdl, EENotify* );
private:
+ long GetPixelTextHeight();
ScInputBarGroup& mrGroupBar;
long mnLines;
long mnLastExpandedLines;