diff options
author | Tor Lillqvist <tml@collabora.com> | 2013-11-29 00:04:35 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2013-11-29 00:05:01 +0200 |
commit | 47fbe385f55c05935c87610b987724e5fb4752c0 (patch) | |
tree | c4a617bc13ba5d4eea0caaced65014cbc48a5e78 /vcl | |
parent | 0379f8b6393e99667584a2964bedf82e4306c2fa (diff) |
Avoid pointless class derivation for the CoreText SystemFontList
Change-Id: Ib3e6705d166dec9d7db8787496947faf73e3cfb3
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/coretext/ctfonts.cxx | 39 | ||||
-rw-r--r-- | vcl/coretext/salgdi2.cxx | 6 | ||||
-rw-r--r-- | vcl/inc/coretext/salgdi2.h | 17 |
3 files changed, 22 insertions, 40 deletions
diff --git a/vcl/coretext/ctfonts.cxx b/vcl/coretext/ctfonts.cxx index bdfcfc6e5803..f7fdc8e2f1c9 100644 --- a/vcl/coretext/ctfonts.cxx +++ b/vcl/coretext/ctfonts.cxx @@ -36,29 +36,6 @@ // ======================================================================= -class CTFontList -: public SystemFontList -{ -public: - explicit CTFontList( void ); - virtual ~CTFontList( void ); - - bool Init( void ); - void AddFont( CoreTextFontData* ); - - virtual void AnnounceFonts( ImplDevFontList& ) const; - virtual CoreTextFontData* GetFontDataFromId( sal_IntPtr ) const; - -private: - CTFontCollectionRef mpCTFontCollection; - CFArrayRef mpCTFontArray; - - typedef boost::unordered_map<sal_IntPtr,CoreTextFontData*> CTFontContainer; - CTFontContainer maFontContainer; -}; - -// ======================================================================= - inline double toRadian(int nDegree) { return nDegree * (M_PI / 1800.0); @@ -411,21 +388,21 @@ static void CTFontEnumCallBack( const void* pValue, void* pContext ) { const sal_IntPtr nFontId = (sal_IntPtr)pValue; CoreTextFontData* pFontData = new CoreTextFontData( rDFA, nFontId ); - CTFontList* pFontList = (CTFontList*)pContext; + SystemFontList* pFontList = (SystemFontList*)pContext; pFontList->AddFont( pFontData ); } } // ======================================================================= -CTFontList::CTFontList() +SystemFontList::SystemFontList() : mpCTFontCollection( NULL ) , mpCTFontArray( NULL ) {} // ----------------------------------------------------------------------- -CTFontList::~CTFontList() +SystemFontList::~SystemFontList() { CTFontContainer::const_iterator it = maFontContainer.begin(); for(; it != maFontContainer.end(); ++it ) @@ -440,7 +417,7 @@ CTFontList::~CTFontList() // ----------------------------------------------------------------------- -void CTFontList::AddFont( CoreTextFontData* pFontData ) +void SystemFontList::AddFont( CoreTextFontData* pFontData ) { sal_IntPtr nFontId = pFontData->GetFontId(); maFontContainer[ nFontId ] = pFontData; @@ -448,7 +425,7 @@ void CTFontList::AddFont( CoreTextFontData* pFontData ) // ----------------------------------------------------------------------- -void CTFontList::AnnounceFonts( ImplDevFontList& rFontList ) const +void SystemFontList::AnnounceFonts( ImplDevFontList& rFontList ) const { CTFontContainer::const_iterator it = maFontContainer.begin(); for(; it != maFontContainer.end(); ++it ) @@ -457,7 +434,7 @@ void CTFontList::AnnounceFonts( ImplDevFontList& rFontList ) const // ----------------------------------------------------------------------- -CoreTextFontData* CTFontList::GetFontDataFromId( sal_IntPtr nFontId ) const +CoreTextFontData* SystemFontList::GetFontDataFromId( sal_IntPtr nFontId ) const { CTFontContainer::const_iterator it = maFontContainer.find( nFontId ); if( it == maFontContainer.end() ) @@ -467,7 +444,7 @@ CoreTextFontData* CTFontList::GetFontDataFromId( sal_IntPtr nFontId ) const // ----------------------------------------------------------------------- -bool CTFontList::Init( void ) +bool SystemFontList::Init( void ) { // enumerate available system fonts static const int nMaxDictEntries = 8; @@ -489,7 +466,7 @@ bool CTFontList::Init( void ) SystemFontList* GetCoretextFontList( void ) { - CTFontList* pList = new CTFontList(); + SystemFontList* pList = new SystemFontList(); if( !pList->Init() ) { delete pList; return NULL; diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx index c15e4aa24237..801548a59d4e 100644 --- a/vcl/coretext/salgdi2.cxx +++ b/vcl/coretext/salgdi2.cxx @@ -61,12 +61,6 @@ using namespace vcl; // ======================================================================= -SystemFontList::~SystemFontList( void ) -{} - - -// ======================================================================= - CoreTextFontData::CoreTextFontData( const CoreTextFontData& rSrc ) : PhysicalFontFace( rSrc ) , mnFontId( rSrc.mnFontId ) diff --git a/vcl/inc/coretext/salgdi2.h b/vcl/inc/coretext/salgdi2.h index 3186461c0c02..b121f7153f9a 100644 --- a/vcl/inc/coretext/salgdi2.h +++ b/vcl/inc/coretext/salgdi2.h @@ -119,10 +119,21 @@ private: class SystemFontList { public: - virtual ~SystemFontList( void ); + SystemFontList( void ); + ~SystemFontList( void ); - virtual void AnnounceFonts( ImplDevFontList& ) const = 0; - virtual CoreTextFontData* GetFontDataFromId( sal_IntPtr nFontId ) const = 0; + bool Init( void ); + void AddFont( CoreTextFontData* ); + + void AnnounceFonts( ImplDevFontList& ) const; + CoreTextFontData* GetFontDataFromId( sal_IntPtr nFontId ) const; + +private: + CTFontCollectionRef mpCTFontCollection; + CFArrayRef mpCTFontArray; + + typedef boost::unordered_map<sal_IntPtr,CoreTextFontData*> CTFontContainer; + CTFontContainer maFontContainer; }; #ifdef MACOSX |