summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-02-05 16:40:29 +0100
committerLuboš Luňák <l.lunak@suse.cz>2013-02-07 18:29:20 +0100
commit00914dc9248760d62bea373f1fb4b78eece77dd7 (patch)
tree08cf968269dd84a1e8b06d03d8d6f9a5e32647d2 /svx
parent530bcf74fae4d576d7001a3b975134a48f1c9969 (diff)
if a font is not available, show its name in italic in font combo(fate#308255)
(cherry picked from commit 0376a4c13ccffa64c938c6361a337264ad8f2b67) Conflicts: vcl/inc/vcl/combobox.hxx Change-Id: Ia7d0de2c3017f450b9ace31753a351601ca6f1f0
Diffstat (limited to 'svx')
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx40
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 )