summaryrefslogtreecommitdiff
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-04-02 15:42:56 +0200
commitf1470c8a58b6954c95c473b1072840415d52ccc9 (patch)
treeb976d7660d863421cfa92863828d69108e4381b5
parente8387897bba3ba2863a0975a106486d852dc67db (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
-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 112ef1fc23a4..e066a14e4350 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -191,6 +191,7 @@ private:
void ReleaseFocus_Impl();
void EnableControls_Impl();
+ void CheckAndMarkUnknownFont( const XubString& 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 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();
@@ -802,6 +805,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 )