OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
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_SRC_FDE_CSS_FDE_CSSDECLARATION_H_ | |
8 #define XFA_SRC_FDE_CSS_FDE_CSSDECLARATION_H_ | |
9 | |
10 #include "xfa/src/fde/css/fde_cssdatatable.h" | |
11 | |
12 class FDE_CSSPropertyHolder : public CFX_Target { | |
13 public: | |
14 int16_t eProperty; | |
15 int16_t bImportant; | |
16 IFDE_CSSValue* pValue; | |
17 FDE_CSSPropertyHolder* pNext; | |
18 }; | |
19 | |
20 class FDE_CSSCustomProperty : public CFX_Target { | |
21 public: | |
22 const FX_WCHAR* pwsName; | |
23 const FX_WCHAR* pwsValue; | |
24 FDE_CSSCustomProperty* pNext; | |
25 }; | |
26 | |
27 struct FDE_CSSPROPERTYARGS { | |
28 IFX_MEMAllocator* pStaticStore; | |
29 CFX_MapPtrToPtr* pStringCache; | |
30 FDE_LPCCSSPROPERTYTABLE pProperty; | |
31 }; | |
32 | |
33 class CFDE_CSSDeclaration : public IFDE_CSSDeclaration, public CFX_Target { | |
34 public: | |
35 CFDE_CSSDeclaration() | |
36 : m_pFirstProperty(NULL), | |
37 m_pLastProperty(NULL), | |
38 m_pFirstCustom(NULL), | |
39 m_pLastCustom(NULL) {} | |
40 virtual IFDE_CSSValue* GetProperty(FDE_CSSPROPERTY eProperty, | |
41 FX_BOOL& bImportant) const; | |
42 virtual FX_POSITION GetStartPosition() const; | |
43 virtual void GetNextProperty(FX_POSITION& pos, | |
44 FDE_CSSPROPERTY& eProperty, | |
45 IFDE_CSSValue*& pValue, | |
46 FX_BOOL& bImportant) const; | |
47 virtual FX_POSITION GetStartCustom() const; | |
48 virtual void GetNextCustom(FX_POSITION& pos, | |
49 CFX_WideString& wsName, | |
50 CFX_WideString& wsValue) const; | |
51 FX_BOOL AddProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
52 const FX_WCHAR* pszValue, | |
53 int32_t iValueLen); | |
54 FX_BOOL AddProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
55 const FX_WCHAR* pszName, | |
56 int32_t iNameLen, | |
57 const FX_WCHAR* pszValue, | |
58 int32_t iValueLen); | |
59 | |
60 protected: | |
61 FX_BOOL ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, | |
62 const FX_WCHAR* pszValue, | |
63 int32_t iValueLen, | |
64 FX_BOOL bImportant); | |
65 FX_BOOL ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
66 const FX_WCHAR* pszValue, | |
67 int32_t iValueLen, | |
68 FX_BOOL bImportant); | |
69 FX_BOOL ParseColumnRuleProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
70 const FX_WCHAR* pszValue, | |
71 int32_t iValueLen, | |
72 FX_BOOL bImportant); | |
73 FX_BOOL ParseOverflowProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
74 const FX_WCHAR* pszValue, | |
75 int32_t iValueLen, | |
76 FX_BOOL bImportant); | |
77 FX_BOOL ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
78 const FX_WCHAR* pszValue, | |
79 int32_t iValueLen, | |
80 FX_BOOL bImportant); | |
81 FX_BOOL ParseBackgroundProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
82 const FX_WCHAR* pszValue, | |
83 int32_t iValueLen, | |
84 FX_BOOL bImportant); | |
85 FX_BOOL ParseListStyleProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
86 const FX_WCHAR* pszValue, | |
87 int32_t iValueLen, | |
88 FX_BOOL bImportant); | |
89 FX_BOOL ParseBorderPropoerty(IFX_MEMAllocator* pStaticStore, | |
90 const FX_WCHAR* pszValue, | |
91 int32_t iValueLen, | |
92 IFDE_CSSValue*& pColor, | |
93 IFDE_CSSValue*& pStyle, | |
94 IFDE_CSSValue*& pWidth) const; | |
95 void AddBorderProperty(IFX_MEMAllocator* pStaticStore, | |
96 IFDE_CSSValue* pColor, | |
97 IFDE_CSSValue* pStyle, | |
98 IFDE_CSSValue* pWidth, | |
99 FX_BOOL bImportant, | |
100 FDE_CSSPROPERTY eColor, | |
101 FDE_CSSPROPERTY eStyle, | |
102 FDE_CSSPROPERTY eWidth); | |
103 FX_BOOL ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
104 const FX_WCHAR* pszValue, | |
105 int32_t iValueLen, | |
106 FX_BOOL bImportant); | |
107 FX_BOOL ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
108 const FX_WCHAR* pszValue, | |
109 int32_t iValueLen, | |
110 FX_BOOL bImportant); | |
111 FX_BOOL ParseValueListProperty(const FDE_CSSPROPERTYARGS* pArgs, | |
112 const FX_WCHAR* pszValue, | |
113 int32_t iValueLen, | |
114 FX_BOOL bImportant); | |
115 FX_BOOL Add4ValuesProperty(IFX_MEMAllocator* pStaticStore, | |
116 const CFDE_CSSValueArray& list, | |
117 FX_BOOL bImportant, | |
118 FDE_CSSPROPERTY eLeft, | |
119 FDE_CSSPROPERTY eTop, | |
120 FDE_CSSPROPERTY eRight, | |
121 FDE_CSSPROPERTY eBottom); | |
122 IFDE_CSSValue* ParseNumber(const FDE_CSSPROPERTYARGS* pArgs, | |
123 const FX_WCHAR* pszValue, | |
124 int32_t iValueLen); | |
125 IFDE_CSSValue* ParseEnum(const FDE_CSSPROPERTYARGS* pArgs, | |
126 const FX_WCHAR* pszValue, | |
127 int32_t iValueLen); | |
128 IFDE_CSSValue* ParseColor(const FDE_CSSPROPERTYARGS* pArgs, | |
129 const FX_WCHAR* pszValue, | |
130 int32_t iValueLen); | |
131 IFDE_CSSValue* ParseURI(const FDE_CSSPROPERTYARGS* pArgs, | |
132 const FX_WCHAR* pszValue, | |
133 int32_t iValueLen); | |
134 IFDE_CSSValue* ParseString(const FDE_CSSPROPERTYARGS* pArgs, | |
135 const FX_WCHAR* pszValue, | |
136 int32_t iValueLen); | |
137 IFDE_CSSValue* ParseFunction(const FDE_CSSPROPERTYARGS* pArgs, | |
138 const FX_WCHAR* pszValue, | |
139 int32_t iValueLen); | |
140 const FX_WCHAR* CopyToLocal(const FDE_CSSPROPERTYARGS* pArgs, | |
141 const FX_WCHAR* pszValue, | |
142 int32_t iValueLen); | |
143 void AddPropertyHolder(IFX_MEMAllocator* pStaticStore, | |
144 FDE_CSSPROPERTY eProperty, | |
145 IFDE_CSSValue* pValue, | |
146 FX_BOOL bImportant); | |
147 IFDE_CSSPrimitiveValue* NewNumberValue(IFX_MEMAllocator* pStaticStore, | |
148 FDE_CSSPRIMITIVETYPE eUnit, | |
149 FX_FLOAT fValue) const; | |
150 IFDE_CSSPrimitiveValue* NewEnumValue(IFX_MEMAllocator* pStaticStore, | |
151 FDE_CSSPROPERTYVALUE eValue) const; | |
152 FDE_CSSPropertyHolder* m_pFirstProperty; | |
153 FDE_CSSPropertyHolder* m_pLastProperty; | |
154 FDE_CSSCustomProperty* m_pFirstCustom; | |
155 FDE_CSSCustomProperty* m_pLastCustom; | |
156 }; | |
157 | |
158 #endif // XFA_SRC_FDE_CSS_FDE_CSSDECLARATION_H_ | |
OLD | NEW |