summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-01-28 16:53:55 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-01-28 16:55:18 +0000
commit780eb9f704e7a61f43624a2c03b4f6a15647a1a1 (patch)
tree77febb408ac9c2d48494a587e78dea498d999e06
parent677a42301e21f06b789f650d79fb5d60cb656aab (diff)
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
-rw-r--r--svx/source/tbxctrls/tbunocontroller.cxx22
1 files changed, 17 insertions, 5 deletions
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index a536a141a0e0..7e4a40f2a35d 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -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 );
}