1 // Copyright 2014 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef XFA_FXFA_CXFA_FWLTHEME_H_ 8 #define XFA_FXFA_CXFA_FWLTHEME_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/retain_ptr.h" 13 #include "core/fxcrt/widestring.h" 14 #include "fxjs/gc/heap.h" 15 #include "v8/include/cppgc/garbage-collected.h" 16 #include "v8/include/cppgc/member.h" 17 #include "v8/include/cppgc/prefinalizer.h" 18 #include "xfa/fwl/ifwl_themeprovider.h" 19 20 class CXFA_FFApp; 21 class CXFA_FFDoc; 22 23 namespace pdfium { 24 25 class CFDE_TextOut; 26 27 class CXFA_FWLTheme final : public cppgc::GarbageCollected<CXFA_FWLTheme>, 28 public IFWL_ThemeProvider { 29 CPPGC_USING_PRE_FINALIZER(CXFA_FWLTheme, PreFinalize); 30 31 public: 32 CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED; 33 ~CXFA_FWLTheme() override; 34 35 void PreFinalize(); 36 37 // IFWL_ThemeProvider: 38 void Trace(cppgc::Visitor* visitor) const override; 39 void DrawBackground(const CFWL_ThemeBackground& pParams) override; 40 void DrawText(const CFWL_ThemeText& pParams) override; 41 void CalcTextRect(const CFWL_ThemeText& pParams, CFX_RectF* pRect) override; 42 float GetCXBorderSize() const override; 43 float GetCYBorderSize() const override; 44 CFX_RectF GetUIMargin(const CFWL_ThemePart& pThemePart) const override; 45 float GetFontSize(const CFWL_ThemePart& pThemePart) const override; 46 RetainPtr<CFGAS_GEFont> GetFont(const CFWL_ThemePart& pThemePart) override; 47 RetainPtr<CFGAS_GEFont> GetFWLFont() override; 48 float GetLineHeight(const CFWL_ThemePart& pThemePart) const override; 49 float GetScrollBarWidth() const override; 50 FX_COLORREF GetTextColor(const CFWL_ThemePart& pThemePart) const override; 51 CFX_SizeF GetSpaceAboveBelow(const CFWL_ThemePart& pThemePart) const override; 52 53 bool LoadCalendarFont(CXFA_FFDoc* doc); 54 55 private: 56 CXFA_FWLTheme(cppgc::Heap* pHeap, CXFA_FFApp* pApp); 57 58 std::unique_ptr<CFDE_TextOut> m_pTextOut; 59 RetainPtr<CFGAS_GEFont> m_pFWLFont; 60 RetainPtr<CFGAS_GEFont> m_pCalendarFont; 61 cppgc::Member<CXFA_FFApp> const m_pApp; 62 WideString m_wsResource; 63 CFX_RectF m_Rect; 64 }; 65 66 } // namespace pdfium 67 68 // TODO(crbug.com/42271761): Remove. 69 using pdfium::CXFA_FWLTheme; 70 71 #endif // XFA_FXFA_CXFA_FWLTHEME_H_ 72