Kaydet (Commit) 780eb9f7 authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: fdo#73051 make font size drop down of optimal width

presumably keithcu felt the font size was too wide, so lets
try and implement the desired effect of an optimal width.

Change-Id: Idc1741de04b3559fa415ebcf2289f96ba240ca8f
üst 677a4230
......@@ -92,6 +92,7 @@ public:
void statusChanged_Impl( long nHeight, bool bErase = false );
void UpdateFont( const ::com::sun::star::awt::FontDescriptor& rCurrentFont );
void SetOptimalSize();
virtual bool Notify( NotifyEvent& rNEvt );
......@@ -124,12 +125,11 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl(
FontSizeBox( _pParent, WinBits( WB_DROPDOWN ) ),
m_pCtrl ( &_rCtrl ),
m_aLogicalSize ( 30,100 ),
m_aLogicalSize ( 0,100 ),
m_bRelease ( true ),
m_xDispatchProvider ( _rDispatchProvider ),
m_xFrame ( _xFrame )
{
SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT ));
SetValue( 0 );
SetText( "" );
}
......@@ -260,6 +260,16 @@ bool SvxFontSizeBox_Impl::Notify( NotifyEvent& rNEvt )
return nHandled || FontSizeBox::Notify( rNEvt );
}
void SvxFontSizeBox_Impl::SetOptimalSize()
{
Size aPrefSize(LogicToPixel(m_aLogicalSize, MAP_APPFONT));
aPrefSize.Width() = get_preferred_size().Width();
SetSizePixel(aPrefSize);
Size aDropSize(LogicToPixel(Size(0, LOGICAL_EDIT_HEIGHT), MAP_APPFONT));
aDropSize.Width() = aPrefSize.Width();
SetDropDownSizePixel(aDropSize);
}
// ---------------------------------------------------------------------------
void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
......@@ -267,9 +277,7 @@ void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
(rDCEvt.GetFlags() & SETTINGS_STYLE) )
{
SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT ));
Size aDropSize( m_aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT );
SetDropDownSizePixel( LogicToPixel( aDropSize, MAP_APPFONT ));
SetOptimalSize();
}
FontSizeBox::DataChanged( rDCEvt );
......@@ -413,6 +421,10 @@ uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWind
uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
m_xFrame,
*this );
//Get the box to fill itself with all its sizes
m_pBox->UpdateFont(m_aCurrentFont);
//Make it size itself to its optimal size re above sizes
m_pBox->SetOptimalSize();
xItemWindow = VCLUnoHelper::GetInterface( m_pBox );
}
......
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