summaryrefslogtreecommitdiff
path: root/xfa/src/fdp/src/css/fde_cssdeclaration.h
blob: 3cb6418a320629f64077d335939e4f6687210956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef XFA_SRC_FDP_SRC_CSS_FDE_CSSDECLARATION_H_
#define XFA_SRC_FDP_SRC_CSS_FDE_CSSDECLARATION_H_

#include "xfa/src/fdp/src/css/fde_cssdatatable.h"

typedef struct _FDE_CSSPROPERTYHOLDER : public CFX_Target {
  int16_t eProperty;
  int16_t bImportant;
  IFDE_CSSValue* pValue;
  _FDE_CSSPROPERTYHOLDER* pNext;
} FDE_CSSPROPERTYHOLDER, *FDE_LPCSSPROPERTYHOLDER;
typedef struct _FDE_CSSCUSTOMPROPERTY : public CFX_Target {
  const FX_WCHAR* pwsName;
  const FX_WCHAR* pwsValue;
  _FDE_CSSCUSTOMPROPERTY* pNext;
} FDE_CSSCUSTOMPROPERTY, *FDE_LPCSSCUSTOMPROPERTY;
typedef struct _FDE_CSSPROPERTYARGS : public CFX_Target {
  IFX_MEMAllocator* pStaticStore;
  CFX_MapPtrToPtr* pStringCache;
  FDE_LPCCSSPROPERTYTABLE pProperty;
} FDE_CSSPROPERTYARGS;
typedef FDE_CSSPROPERTYARGS const* FDE_LPCCSSPROPERTYARGS;
class CFDE_CSSDeclaration : public IFDE_CSSDeclaration, public CFX_Target {
 public:
  CFDE_CSSDeclaration()
      : m_pFirstProperty(NULL),
        m_pLastProperty(NULL),
        m_pFirstCustom(NULL),
        m_pLastCustom(NULL) {}
  virtual IFDE_CSSValue* GetProperty(FDE_CSSPROPERTY eProperty,
                                     FX_BOOL& bImportant) const;
  virtual FX_POSITION GetStartPosition() const;
  virtual void GetNextProperty(FX_POSITION& pos,
                               FDE_CSSPROPERTY& eProperty,
                               IFDE_CSSValue*& pValue,
                               FX_BOOL& bImportant) const;
  virtual FX_POSITION GetStartCustom() const;
  virtual void GetNextCustom(FX_POSITION& pos,
                             CFX_WideString& wsName,
                             CFX_WideString& wsValue) const;
  FX_BOOL AddProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                      const FX_WCHAR* pszValue,
                      int32_t iValueLen);
  FX_BOOL AddProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                      const FX_WCHAR* pszName,
                      int32_t iNameLen,
                      const FX_WCHAR* pszValue,
                      int32_t iValueLen);

 protected:
  FX_BOOL ParseTextEmphasisProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                                    const FX_WCHAR* pszValue,
                                    int32_t iValueLen,
                                    FX_BOOL bImportant);
  FX_BOOL ParseColumnsProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                               const FX_WCHAR* pszValue,
                               int32_t iValueLen,
                               FX_BOOL bImportant);
  FX_BOOL ParseColumnRuleProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                                  const FX_WCHAR* pszValue,
                                  int32_t iValueLen,
                                  FX_BOOL bImportant);
  FX_BOOL ParseOverflowProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                                const FX_WCHAR* pszValue,
                                int32_t iValueLen,
                                FX_BOOL bImportant);
  FX_BOOL ParseFontProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                            const FX_WCHAR* pszValue,
                            int32_t iValueLen,
                            FX_BOOL bImportant);
  FX_BOOL ParseBackgroundProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                                  const FX_WCHAR* pszValue,
                                  int32_t iValueLen,
                                  FX_BOOL bImportant);
  FX_BOOL ParseListStyleProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                                 const FX_WCHAR* pszValue,
                                 int32_t iValueLen,
                                 FX_BOOL bImportant);
  FX_BOOL ParseBorderPropoerty(IFX_MEMAllocator* pStaticStore,
                               const FX_WCHAR* pszValue,
                               int32_t iValueLen,
                               IFDE_CSSValue*& pColor,
                               IFDE_CSSValue*& pStyle,
                               IFDE_CSSValue*& pWidth) const;
  void AddBorderProperty(IFX_MEMAllocator* pStaticStore,
                         IFDE_CSSValue* pColor,
                         IFDE_CSSValue* pStyle,
                         IFDE_CSSValue* pWidth,
                         FX_BOOL bImportant,
                         FDE_CSSPROPERTY eColor,
                         FDE_CSSPROPERTY eStyle,
                         FDE_CSSPROPERTY eWidth);
  FX_BOOL ParseContentProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                               const FX_WCHAR* pszValue,
                               int32_t iValueLen,
                               FX_BOOL bImportant);
  FX_BOOL ParseCounterProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                               const FX_WCHAR* pszValue,
                               int32_t iValueLen,
                               FX_BOOL bImportant);
  FX_BOOL ParseValueListProperty(FDE_LPCCSSPROPERTYARGS pArgs,
                                 const FX_WCHAR* pszValue,
                                 int32_t iValueLen,
                                 FX_BOOL bImportant);
  FX_BOOL Add4ValuesProperty(IFX_MEMAllocator* pStaticStore,
                             const CFDE_CSSValueArray& list,
                             FX_BOOL bImportant,
                             FDE_CSSPROPERTY eLeft,
                             FDE_CSSPROPERTY eTop,
                             FDE_CSSPROPERTY eRight,
                             FDE_CSSPROPERTY eBottom);
  IFDE_CSSValue* ParseNumber(FDE_LPCCSSPROPERTYARGS pArgs,
                             const FX_WCHAR* pszValue,
                             int32_t iValueLen);
  IFDE_CSSValue* ParseEnum(FDE_LPCCSSPROPERTYARGS pArgs,
                           const FX_WCHAR* pszValue,
                           int32_t iValueLen);
  IFDE_CSSValue* ParseColor(FDE_LPCCSSPROPERTYARGS pArgs,
                            const FX_WCHAR* pszValue,
                            int32_t iValueLen);
  IFDE_CSSValue* ParseURI(FDE_LPCCSSPROPERTYARGS pArgs,
                          const FX_WCHAR* pszValue,
                          int32_t iValueLen);
  IFDE_CSSValue* ParseString(FDE_LPCCSSPROPERTYARGS pArgs,
                             const FX_WCHAR* pszValue,
                             int32_t iValueLen);
  IFDE_CSSValue* ParseFunction(FDE_LPCCSSPROPERTYARGS pArgs,
                               const FX_WCHAR* pszValue,
                               int32_t iValueLen);
  const FX_WCHAR* CopyToLocal(FDE_LPCCSSPROPERTYARGS pArgs,
                              const FX_WCHAR* pszValue,
                              int32_t iValueLen);
  void AddPropertyHolder(IFX_MEMAllocator* pStaticStore,
                         FDE_CSSPROPERTY eProperty,
                         IFDE_CSSValue* pValue,
                         FX_BOOL bImportant);
  IFDE_CSSPrimitiveValue* NewNumberValue(IFX_MEMAllocator* pStaticStore,
                                         FDE_CSSPRIMITIVETYPE eUnit,
                                         FX_FLOAT fValue) const;
  IFDE_CSSPrimitiveValue* NewEnumValue(IFX_MEMAllocator* pStaticStore,
                                       FDE_CSSPROPERTYVALUE eValue) const;
  FDE_LPCSSPROPERTYHOLDER m_pFirstProperty;
  FDE_LPCSSPROPERTYHOLDER m_pLastProperty;
  FDE_LPCSSCUSTOMPROPERTY m_pFirstCustom;
  FDE_LPCSSCUSTOMPROPERTY m_pLastCustom;
};

#endif  // XFA_SRC_FDP_SRC_CSS_FDE_CSSDECLARATION_H_