diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 3e80d552d7b1..34a78599293b 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -198,6 +198,7 @@ private: void ReleaseFocus_Impl(); void EnableControls_Impl(); + void CheckAndMarkUnknownFont( const XubString& fontname ); protected: virtual void Select(); @@ -215,6 +216,8 @@ public: void Fill( const FontList* pList ) { FontNameBox::Fill( pList ); nFtCount = pList->GetFontNameCount(); } + virtual void SetText( const XubString& rStr ); + virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); virtual long PreNotify( NotifyEvent& rNEvt ); virtual long Notify( NotifyEvent& rNEvt ); virtual Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); @@ -644,6 +647,43 @@ void SvxFontNameBox_Impl::FillList() SetSelection( aOldSel ); } +void SvxFontNameBox_Impl::SetText( const XubString& rStr ) +{ + CheckAndMarkUnknownFont( rStr ); + return FontNameBox::SetText( rStr ); +} + +void SvxFontNameBox_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) +{ + CheckAndMarkUnknownFont( rStr ); + return FontNameBox::SetText( rStr, rNewSelection ); +} + +void SvxFontNameBox_Impl::CheckAndMarkUnknownFont( const XubString& 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 ) |