OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ | 7 #ifndef XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ |
8 #define XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ | 8 #define XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ |
9 | 9 |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 }; | 91 }; |
92 #define FDE_CSSSWITCHDEFAULTS() \ | 92 #define FDE_CSSSWITCHDEFAULTS() \ |
93 case FDE_CSSSYNTAXSTATUS_EOS: \ | 93 case FDE_CSSSYNTAXSTATUS_EOS: \ |
94 return FDE_CSSSYNTAXSTATUS_EOS; \ | 94 return FDE_CSSSYNTAXSTATUS_EOS; \ |
95 case FDE_CSSSYNTAXSTATUS_Error: \ | 95 case FDE_CSSSYNTAXSTATUS_Error: \ |
96 default: \ | 96 default: \ |
97 return FDE_CSSSYNTAXSTATUS_Error; | 97 return FDE_CSSSYNTAXSTATUS_Error; |
98 class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { | 98 class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { |
99 public: | 99 public: |
100 CFDE_CSSStyleSheet(uint32_t dwMediaList); | 100 CFDE_CSSStyleSheet(uint32_t dwMediaList); |
101 ~CFDE_CSSStyleSheet(); | 101 ~CFDE_CSSStyleSheet() override; |
102 virtual uint32_t AddRef(); | |
103 virtual uint32_t Release(); | |
104 | 102 |
105 virtual FX_BOOL GetUrl(CFX_WideString& szUrl) { | 103 // IFX_Retainable: |
| 104 uint32_t Retain() override; |
| 105 uint32_t Release() override; |
| 106 |
| 107 // IFDE_CSSStyleSheet: |
| 108 FX_BOOL GetUrl(CFX_WideString& szUrl) override { |
106 szUrl = m_szUrl; | 109 szUrl = m_szUrl; |
107 return szUrl.GetLength() > 0; | 110 return szUrl.GetLength() > 0; |
108 } | 111 } |
109 virtual uint32_t GetMediaList() const { return m_dwMediaList; } | 112 uint32_t GetMediaList() const override { return m_dwMediaList; } |
110 virtual uint16_t GetCodePage() const { return m_wCodePage; } | 113 uint16_t GetCodePage() const override { return m_wCodePage; } |
111 virtual int32_t CountRules() const; | 114 int32_t CountRules() const override; |
112 virtual IFDE_CSSRule* GetRule(int32_t index); | 115 IFDE_CSSRule* GetRule(int32_t index) override; |
| 116 |
113 FX_BOOL LoadFromStream(const CFX_WideString& szUrl, | 117 FX_BOOL LoadFromStream(const CFX_WideString& szUrl, |
114 IFX_Stream* pStream, | 118 IFX_Stream* pStream, |
115 uint16_t wCodePage); | 119 uint16_t wCodePage); |
116 FX_BOOL LoadFromBuffer(const CFX_WideString& szUrl, | 120 FX_BOOL LoadFromBuffer(const CFX_WideString& szUrl, |
117 const FX_WCHAR* pBuffer, | 121 const FX_WCHAR* pBuffer, |
118 int32_t iBufSize, | 122 int32_t iBufSize, |
119 uint16_t wCodePage); | 123 uint16_t wCodePage); |
120 | 124 |
121 protected: | 125 protected: |
122 void Reset(); | 126 void Reset(); |
(...skipping 10 matching lines...) Expand all Loading... |
133 uint16_t m_wRefCount; | 137 uint16_t m_wRefCount; |
134 uint32_t m_dwMediaList; | 138 uint32_t m_dwMediaList; |
135 IFX_MemoryAllocator* m_pAllocator; | 139 IFX_MemoryAllocator* m_pAllocator; |
136 CFDE_CSSRuleArray m_RuleArray; | 140 CFDE_CSSRuleArray m_RuleArray; |
137 CFX_WideString m_szUrl; | 141 CFX_WideString m_szUrl; |
138 CFDE_CSSSelectorArray m_Selectors; | 142 CFDE_CSSSelectorArray m_Selectors; |
139 std::unordered_map<uint32_t, FX_WCHAR*> m_StringCache; | 143 std::unordered_map<uint32_t, FX_WCHAR*> m_StringCache; |
140 }; | 144 }; |
141 | 145 |
142 #endif // XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ | 146 #endif // XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ |
OLD | NEW |