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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
// 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_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_
#define XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_
#include "xfa/fxfa/parser/xfa_script.h"
#include "xfa/fxjse/cfxjse_arguments.h"
class CXFA_FM2JSContext {
public:
static void Abs(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Avg(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Ceil(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Count(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Floor(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Max(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Min(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Mod(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Round(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Sum(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Date(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Date2Num(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void DateFmt(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void IsoDate2Num(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void IsoTime2Num(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void LocalDateFmt(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void LocalTimeFmt(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Num2Date(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Num2GMTime(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Num2Time(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Time(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Time2Num(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void TimeFmt(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static FX_BOOL IsIsoDateFormat(const FX_CHAR* pData,
int32_t iLength,
int32_t& iStyle,
int32_t& iYear,
int32_t& iMonth,
int32_t& iDay);
static FX_BOOL IsIsoTimeFormat(const FX_CHAR* pData,
int32_t iLength,
int32_t& iHour,
int32_t& iMinute,
int32_t& iSecond,
int32_t& iMilliSecond,
int32_t& iZoneHour,
int32_t& iZoneMinute);
static FX_BOOL IsIsoDateTimeFormat(const FX_CHAR* pData,
int32_t iLength,
int32_t& iYear,
int32_t& iMonth,
int32_t& iDay,
int32_t& iHour,
int32_t& iMinute,
int32_t& iSecond,
int32_t& iMillionSecond,
int32_t& iZoneHour,
int32_t& iZoneMinute);
static FX_BOOL Local2IsoDate(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szDate,
const CFX_ByteStringC& szFormat,
const CFX_ByteStringC& szLocale,
CFX_ByteString& strIsoDate);
static FX_BOOL Local2IsoTime(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szTime,
const CFX_ByteStringC& szFormat,
const CFX_ByteStringC& szLocale,
CFX_ByteString& strIsoTime);
static FX_BOOL IsoDate2Local(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szDate,
const CFX_ByteStringC& szFormat,
const CFX_ByteStringC& szLocale,
CFX_ByteString& strLocalDate);
static FX_BOOL IsoTime2Local(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szTime,
const CFX_ByteStringC& szFormat,
const CFX_ByteStringC& szLocale,
CFX_ByteString& strLocalTime);
static FX_BOOL GetGMTTime(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szTime,
const CFX_ByteStringC& szFormat,
const CFX_ByteStringC& szLocale,
CFX_ByteString& strGMTTime);
static int32_t DateString2Num(const CFX_ByteStringC& szDateString);
static void GetLocalDateFormat(FXJSE_HOBJECT hThis,
int32_t iStyle,
const CFX_ByteStringC& szLocalStr,
CFX_ByteString& strFormat,
FX_BOOL bStandard);
static void GetLocalTimeFormat(FXJSE_HOBJECT hThis,
int32_t iStyle,
const CFX_ByteStringC& szLocalStr,
CFX_ByteString& strFormat,
FX_BOOL bStandard);
static void GetStandardDateFormat(FXJSE_HOBJECT hThis,
int32_t iStyle,
const CFX_ByteStringC& szLocalStr,
CFX_ByteString& strFormat);
static void GetStandardTimeFormat(FXJSE_HOBJECT hThis,
int32_t iStyle,
const CFX_ByteStringC& szLocalStr,
CFX_ByteString& strFormat);
static void Num2AllTime(FXJSE_HOBJECT hThis,
int32_t iTime,
const CFX_ByteStringC& szFormat,
const CFX_ByteStringC& szLocale,
FX_BOOL bGM,
CFX_ByteString& strTime);
static void GetLocalTimeZone(int32_t& iHour, int32_t& iMin, int32_t& iSec);
static void Apr(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void CTerm(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void FV(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void IPmt(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void NPV(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Pmt(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void PPmt(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void PV(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Rate(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Term(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Choose(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Exists(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void HasValue(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Oneof(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Within(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void If(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Eval(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Ref(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void UnitType(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void UnitValue(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void At(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Concat(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Decode(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void DecodeURL(const CFX_ByteStringC& szURLString,
CFX_ByteTextBuf& szResultBuf);
static void DecodeHTML(const CFX_ByteStringC& szHTMLString,
CFX_ByteTextBuf& szResultBuf);
static void DecodeXML(const CFX_ByteStringC& szXMLString,
CFX_ByteTextBuf& szResultBuf);
static void Encode(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void EncodeURL(const CFX_ByteStringC& szURLString,
CFX_ByteTextBuf& szResultBuf);
static void EncodeHTML(const CFX_ByteStringC& szHTMLString,
CFX_ByteTextBuf& szResultBuf);
static void EncodeXML(const CFX_ByteStringC& szXMLString,
CFX_ByteTextBuf& szResultBuf);
static FX_BOOL HTMLSTR2Code(const CFX_WideStringC& pData, uint32_t& iCode);
static FX_BOOL HTMLCode2STR(uint32_t iCode, CFX_WideString& wsHTMLReserve);
static void Format(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Left(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Len(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Lower(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Ltrim(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Parse(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Replace(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Right(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Rtrim(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Space(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Str(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Stuff(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Substr(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Uuid(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Upper(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void WordNum(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void TrillionUS(const CFX_ByteStringC& szData,
CFX_ByteTextBuf& strBuf);
static void WordUS(const CFX_ByteStringC& szData,
int32_t iStyle,
CFX_ByteTextBuf& strBuf);
static void Get(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Post(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void Put(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void assign_value_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void logical_or_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void logical_and_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void equality_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void notequality_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static FX_BOOL fm_ref_equal(FXJSE_HOBJECT hThis, CFXJSE_Arguments& args);
static void less_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void lessequal_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void greater_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void greaterequal_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void plus_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void minus_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void multiple_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void divide_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void positive_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void negative_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void logical_not_operator(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void dot_accessor(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void dotdot_accessor(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void eval_translation(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void is_fm_object(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void is_fm_array(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void get_fm_value(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void get_fm_jsobj(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void fm_var_filter(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static void concat_fm_object(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
static int32_t hvalue_get_array_length(FXJSE_HOBJECT hThis, FXJSE_HVALUE arg);
static FX_BOOL simpleValueCompare(FXJSE_HOBJECT hThis,
FXJSE_HVALUE firstValue,
FXJSE_HVALUE secondValue);
static void unfoldArgs(FXJSE_HOBJECT hThis,
CFXJSE_Arguments& args,
FXJSE_HVALUE*& resultValues,
int32_t& iCount,
int32_t iStart = 0);
static void GetObjectDefaultValue(FXJSE_HVALUE hObjectValue,
FXJSE_HVALUE hDefaultValue);
static FX_BOOL SetObjectDefaultValue(FXJSE_HVALUE hObjectValue,
FXJSE_HVALUE hNewValue);
static void GenerateSomExpression(const CFX_ByteStringC& szName,
int32_t iIndexFlags,
int32_t iIndexValue,
FX_BOOL bIsStar,
CFX_ByteString& szSomExp);
static FX_BOOL GetObjectByName(FXJSE_HOBJECT hThis,
FXJSE_HVALUE accessorValue,
const CFX_ByteStringC& szAccessorName);
static int32_t ResolveObjects(FXJSE_HOBJECT hThis,
FXJSE_HVALUE hParentValue,
const CFX_ByteStringC& bsSomExp,
XFA_RESOLVENODE_RS& resoveNodeRS,
FX_BOOL bdotAccessor = TRUE,
FX_BOOL bHasNoResolveName = FALSE);
static void ParseResolveResult(FXJSE_HOBJECT hThis,
const XFA_RESOLVENODE_RS& resoveNodeRS,
FXJSE_HVALUE hParentValue,
FXJSE_HVALUE*& resultValues,
int32_t& iSize,
FX_BOOL& bAttribute);
static FXJSE_HVALUE GetSimpleHValue(FXJSE_HOBJECT hThis,
CFXJSE_Arguments& args,
uint32_t index);
static FX_BOOL HValueIsNull(FXJSE_HOBJECT hThis, FXJSE_HVALUE hValue);
static int32_t HValueToInteger(FXJSE_HOBJECT hThis, FXJSE_HVALUE hValue);
static FX_DOUBLE StringToDouble(const CFX_ByteStringC& szStringVal);
static FX_FLOAT HValueToFloat(FXJSE_HOBJECT hThis, FXJSE_HVALUE hValue);
static FX_DOUBLE HValueToDouble(FXJSE_HOBJECT hThis, FXJSE_HVALUE hValue);
static void HValueToUTF8String(FXJSE_HVALUE hValue,
CFX_ByteString& outputValue);
CXFA_FM2JSContext();
~CXFA_FM2JSContext();
void Initialize(v8::Isolate* pScriptRuntime,
FXJSE_HCONTEXT hScriptContext,
CXFA_Document* pDoc);
void GlobalPropertyGetter(FXJSE_HVALUE hValue);
v8::Isolate* GetScriptRuntime() const { return m_pIsolate; }
CXFA_Document* GetDocument() const { return m_pDocument; }
void ThrowScriptErrorMessage(int32_t iStringID, ...);
private:
v8::Isolate* m_pIsolate;
FXJSE_CLASS m_fmClass;
FXJSE_HCLASS m_hFMClass;
FXJSE_HVALUE m_hValue;
CXFA_Document* m_pDocument;
};
#endif // XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_
|