Kaydet (Commit) fa83f16b authored tarafından Noel Power's avatar Noel Power

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.
üst 400b4589
......@@ -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)
......
......@@ -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;
......
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