Kaydet (Commit) 0376a4c1 authored tarafından Luboš Luňák's avatar Luboš Luňák

if a font is not available, show its name in italic in the font combo

Change-Id: Ia7d0de2c3017f450b9ace31753a351601ca6f1f0
üst 624d4696
......@@ -191,6 +191,7 @@ private:
void ReleaseFocus_Impl();
void EnableControls_Impl();
void CheckAndMarkUnknownFont( const OUString& fontname );
protected:
virtual void Select();
......@@ -208,6 +209,8 @@ public:
void Fill( const FontList* pList )
{ FontNameBox::Fill( pList );
nFtCount = pList->GetFontNameCount(); }
virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) SAL_OVERRIDE;
virtual long PreNotify( NotifyEvent& rNEvt );
virtual long Notify( NotifyEvent& rNEvt );
virtual Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
......@@ -781,6 +784,43 @@ void SvxFontNameBox_Impl::FillList()
SetSelection( aOldSel );
}
void SvxFontNameBox_Impl::SetText( const OUString& rStr )
{
CheckAndMarkUnknownFont( rStr );
return FontNameBox::SetText( rStr );
}
void SvxFontNameBox_Impl::SetText( const OUString& rStr, const Selection& rNewSelection )
{
CheckAndMarkUnknownFont( rStr );
return FontNameBox::SetText( rStr, rNewSelection );
}
void SvxFontNameBox_Impl::CheckAndMarkUnknownFont( const OUString& fontname )
{
if( fontname == GetText())
return;
GetDocFontList_Impl( &pFontList, this );
// If the font is unknown, show it in italic.
Font font = GetControlFont();
if( pFontList != NULL && pFontList->IsAvailable( fontname ))
{
if( font.GetItalic() != ITALIC_NONE )
{
font.SetItalic( ITALIC_NONE );
SetControlFont( font );
}
}
else
{
if( font.GetItalic() != ITALIC_NORMAL )
{
font.SetItalic( ITALIC_NORMAL );
SetControlFont( font );
}
}
}
// -----------------------------------------------------------------------
void SvxFontNameBox_Impl::Update( const SvxFontItem* pFontItem )
......
......@@ -123,8 +123,8 @@ public:
void EnableDDAutoWidth( sal_Bool b );
void SetText( const OUString& rStr );
void SetText( const OUString& rStr, const Selection& rNewSelection );
virtual void SetText( const OUString& rStr );
virtual void SetText( const OUString& rStr, const Selection& rNewSelection );
sal_uInt16 InsertEntry( const XubString& rStr, sal_uInt16 nPos = COMBOBOX_APPEND );
sal_uInt16 InsertEntry( const XubString& rStr, const Image& rImage, sal_uInt16 nPos = COMBOBOX_APPEND );
......
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