From 0c56d6362b95fe0181be2c2ac66db1c3ab73552b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 2 Oct 2018 22:40:06 +0000 Subject: Make CFGAS_DefaultFontManager a class with only static methods. It has no member variables. Change-Id: I25b333e201d76e90d25e3f526cf23bccd2b4687a Reviewed-on: https://pdfium-review.googlesource.com/c/43315 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- xfa/fgas/font/cfgas_defaultfontmanager.cpp | 6 ++---- xfa/fgas/font/cfgas_defaultfontmanager.h | 16 +++++++++------- xfa/fxfa/cxfa_ffapp.h | 3 --- xfa/fxfa/cxfa_fontmgr.cpp | 12 +++++++----- xfa/fxfa/cxfa_fontmgr.h | 2 -- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp index fcaf6fdffe..4380c4e4df 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp +++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp @@ -9,10 +9,7 @@ #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fgas/font/fgas_fontutils.h" -CFGAS_DefaultFontManager::CFGAS_DefaultFontManager() {} - -CFGAS_DefaultFontManager::~CFGAS_DefaultFontManager() {} - +// static RetainPtr CFGAS_DefaultFontManager::GetFont( CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, @@ -55,6 +52,7 @@ RetainPtr CFGAS_DefaultFontManager::GetFont( return pFont; } +// static RetainPtr CFGAS_DefaultFontManager::GetDefaultFont( CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.h b/xfa/fgas/font/cfgas_defaultfontmanager.h index 3d723d5e14..e1b36be386 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.h +++ b/xfa/fgas/font/cfgas_defaultfontmanager.h @@ -15,15 +15,17 @@ class CFGAS_FontMgr; class CFGAS_DefaultFontManager { public: - CFGAS_DefaultFontManager(); - ~CFGAS_DefaultFontManager(); - - RetainPtr GetFont(CFGAS_FontMgr* pFontMgr, - const WideStringView& wsFontFamily, - uint32_t dwFontStyles); - RetainPtr GetDefaultFont(CFGAS_FontMgr* pFontMgr, + static RetainPtr GetFont(CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, uint32_t dwFontStyles); + static RetainPtr GetDefaultFont( + CFGAS_FontMgr* pFontMgr, + const WideStringView& wsFontFamily, + uint32_t dwFontStyles); + + CFGAS_DefaultFontManager() = delete; + CFGAS_DefaultFontManager(const CFGAS_DefaultFontManager&) = delete; + CFGAS_DefaultFontManager& operator=(const CFGAS_DefaultFontManager&) = delete; }; #endif // XFA_FGAS_FONT_CFGAS_DEFAULTFONTMANAGER_H_ diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h index a729560e9b..4a93780657 100644 --- a/xfa/fxfa/cxfa_ffapp.h +++ b/xfa/fxfa/cxfa_ffapp.h @@ -17,7 +17,6 @@ #include "xfa/fxfa/cxfa_fontmgr.h" #include "xfa/fxfa/fxfa.h" -class CFGAS_DefaultFontManager; class CFGAS_FontMgr; class CFWL_WidgetMgr; class CPDF_Document; @@ -33,8 +32,6 @@ class CXFA_FFApp { explicit CXFA_FFApp(IXFA_AppProvider* pProvider); ~CXFA_FFApp(); - void SetDefaultFontMgr(std::unique_ptr pFontMgr); - CXFA_FWLAdapterWidgetMgr* GetFWLAdapterWidgetMgr(); CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); } diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp index 7abf720b50..92fe77a52c 100644 --- a/xfa/fxfa/cxfa_fontmgr.cpp +++ b/xfa/fxfa/cxfa_fontmgr.cpp @@ -16,6 +16,7 @@ #include "core/fxge/cfx_fontmgr.h" #include "core/fxge/cfx_gemodule.h" #include "third_party/base/ptr_util.h" +#include "xfa/fgas/font/cfgas_defaultfontmanager.h" #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fgas/font/fgas_fontutils.h" #include "xfa/fxfa/cxfa_ffapp.h" @@ -44,9 +45,10 @@ RetainPtr CXFA_FontMgr::GetFont( if (pFont) return pFont; } - if (!pFont) - pFont = m_pDefFontMgr.GetFont(hDoc->GetApp()->GetFDEFontMgr(), wsFontFamily, - dwFontStyles); + if (!pFont) { + pFont = CFGAS_DefaultFontManager::GetFont(hDoc->GetApp()->GetFDEFontMgr(), + wsFontFamily, dwFontStyles); + } if (!pFont && pMgr) { pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, false); @@ -55,8 +57,8 @@ RetainPtr CXFA_FontMgr::GetFont( } if (!pFont) { - pFont = m_pDefFontMgr.GetDefaultFont(hDoc->GetApp()->GetFDEFontMgr(), - wsFontFamily, dwFontStyles); + pFont = CFGAS_DefaultFontManager::GetDefaultFont( + hDoc->GetApp()->GetFDEFontMgr(), wsFontFamily, dwFontStyles); } if (!pFont) { diff --git a/xfa/fxfa/cxfa_fontmgr.h b/xfa/fxfa/cxfa_fontmgr.h index c009598e06..082c0641bc 100644 --- a/xfa/fxfa/cxfa_fontmgr.h +++ b/xfa/fxfa/cxfa_fontmgr.h @@ -10,7 +10,6 @@ #include #include "core/fxcrt/fx_string.h" -#include "xfa/fgas/font/cfgas_defaultfontmanager.h" class CFGAS_GEFont; class CXFA_FFDoc; @@ -25,7 +24,6 @@ class CXFA_FontMgr { uint32_t dwFontStyles); private: - CFGAS_DefaultFontManager m_pDefFontMgr; std::map> m_FontMap; }; -- cgit v1.2.3