Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp

Issue 2123133004: Remove IXFA_Parser, cleanup XFA parser code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp ('k') | xfa/fxfa/parser/xfa_script_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" 7 #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h"
8 8
9 #include "fxjse/include/cfxjse_arguments.h" 9 #include "fxjse/include/cfxjse_arguments.h"
10 #include "xfa/fxfa/app/xfa_ffnotify.h" 10 #include "xfa/fxfa/app/xfa_ffnotify.h"
11 #include "xfa/fxfa/parser/xfa_doclayout.h" 11 #include "xfa/fxfa/parser/xfa_doclayout.h"
12 #include "xfa/fxfa/parser/xfa_document.h" 12 #include "xfa/fxfa/parser/xfa_document.h"
13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" 13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
14 #include "xfa/fxfa/parser/xfa_localemgr.h" 14 #include "xfa/fxfa/parser/xfa_localemgr.h"
15 #include "xfa/fxfa/parser/xfa_object.h" 15 #include "xfa/fxfa/parser/xfa_object.h"
16 #include "xfa/fxfa/parser/xfa_parser.h"
17 #include "xfa/fxfa/parser/xfa_parser_imp.h" 16 #include "xfa/fxfa/parser/xfa_parser_imp.h"
18 #include "xfa/fxfa/parser/xfa_script.h" 17 #include "xfa/fxfa/parser/xfa_script.h"
19 #include "xfa/fxfa/parser/xfa_script_imp.h" 18 #include "xfa/fxfa/parser/xfa_script_imp.h"
20 #include "xfa/fxfa/parser/xfa_utils.h" 19 #include "xfa/fxfa/parser/xfa_utils.h"
21 20
22 namespace { 21 namespace {
23 22
24 CXFA_Node* ToNode(CFXJSE_Value* pValue, CFXJSE_Class* pClass) { 23 CXFA_Node* ToNode(CFXJSE_Value* pValue, CFXJSE_Class* pClass) {
25 return static_cast<CXFA_Node*>(pValue->ToHostObject(pClass)); 24 return static_cast<CXFA_Node*>(pValue->ToHostObject(pClass));
26 } 25 }
27 26
28 } // namespace 27 } // namespace
29 28
30 CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) 29 CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument)
31 : CXFA_Object(pDocument, 30 : CXFA_Object(pDocument,
32 XFA_ObjectType::Object, 31 XFA_ObjectType::Object,
33 XFA_Element::HostPseudoModel) {} 32 XFA_Element::HostPseudoModel) {}
34 CScript_HostPseudoModel::~CScript_HostPseudoModel() {} 33 CScript_HostPseudoModel::~CScript_HostPseudoModel() {}
35 void CScript_HostPseudoModel::LoadString(CFXJSE_Value* pValue, 34 void CScript_HostPseudoModel::LoadString(CFXJSE_Value* pValue,
36 CXFA_FFNotify* pNotify, 35 CXFA_FFNotify* pNotify,
37 uint32_t dwFlag) { 36 uint32_t dwFlag) {
38 CFX_WideString wsValue; 37 CFX_WideString wsValue;
39 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); 38 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue);
40 pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); 39 pValue->SetString(FX_UTF8Encode(wsValue).AsStringC());
41 } 40 }
41
42 void CScript_HostPseudoModel::AppType(CFXJSE_Value* pValue, 42 void CScript_HostPseudoModel::AppType(CFXJSE_Value* pValue,
43 FX_BOOL bSetting, 43 FX_BOOL bSetting,
44 XFA_ATTRIBUTE eAttribute) { 44 XFA_ATTRIBUTE eAttribute) {
45 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 45 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
46 if (!pNotify) { 46 if (!pNotify) {
47 return; 47 return;
48 } 48 }
49 if (bSetting) { 49 if (bSetting) {
50 ThrowException(XFA_IDS_INVAlID_PROP_SET); 50 ThrowException(XFA_IDS_INVAlID_PROP_SET);
51 return; 51 return;
52 } 52 }
53 CFX_WideString wsAppType; 53 CFX_WideString wsAppType;
54 pNotify->GetAppProvider()->GetAppType(wsAppType); 54 pNotify->GetAppProvider()->GetAppType(wsAppType);
55 pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); 55 pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC());
56 } 56 }
57
57 void CScript_HostPseudoModel::FoxitAppType(CFXJSE_Value* pValue, 58 void CScript_HostPseudoModel::FoxitAppType(CFXJSE_Value* pValue,
58 FX_BOOL bSetting, 59 FX_BOOL bSetting,
59 XFA_ATTRIBUTE eAttribute) { 60 XFA_ATTRIBUTE eAttribute) {
60 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 61 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
61 if (!pNotify) { 62 if (!pNotify) {
62 return; 63 return;
63 } 64 }
64 if (bSetting) { 65 if (bSetting) {
65 ThrowException(XFA_IDS_INVAlID_PROP_SET); 66 ThrowException(XFA_IDS_INVAlID_PROP_SET);
66 return; 67 return;
67 } 68 }
68 CFX_WideString wsAppType; 69 CFX_WideString wsAppType;
69 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); 70 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType);
70 pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); 71 pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC());
71 } 72 }
73
72 void CScript_HostPseudoModel::CalculationsEnabled(CFXJSE_Value* pValue, 74 void CScript_HostPseudoModel::CalculationsEnabled(CFXJSE_Value* pValue,
73 FX_BOOL bSetting, 75 FX_BOOL bSetting,
74 XFA_ATTRIBUTE eAttribute) { 76 XFA_ATTRIBUTE eAttribute) {
75 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 77 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
76 if (!pNotify) { 78 if (!pNotify) {
77 return; 79 return;
78 } 80 }
79 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 81 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
80 if (bSetting) { 82 if (bSetting) {
81 pNotify->GetDocProvider()->SetCalculationsEnabled(hDoc, 83 pNotify->GetDocProvider()->SetCalculationsEnabled(hDoc,
82 pValue->ToBoolean()); 84 pValue->ToBoolean());
83 return; 85 return;
84 } 86 }
85 pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc)); 87 pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc));
86 } 88 }
89
87 void CScript_HostPseudoModel::CurrentPage(CFXJSE_Value* pValue, 90 void CScript_HostPseudoModel::CurrentPage(CFXJSE_Value* pValue,
88 FX_BOOL bSetting, 91 FX_BOOL bSetting,
89 XFA_ATTRIBUTE eAttribute) { 92 XFA_ATTRIBUTE eAttribute) {
90 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 93 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
91 if (!pNotify) { 94 if (!pNotify) {
92 return; 95 return;
93 } 96 }
94 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 97 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
95 if (bSetting) { 98 if (bSetting) {
96 pNotify->GetDocProvider()->SetCurrentPage(hDoc, pValue->ToInteger()); 99 pNotify->GetDocProvider()->SetCurrentPage(hDoc, pValue->ToInteger());
97 return; 100 return;
98 } 101 }
99 pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc)); 102 pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc));
100 } 103 }
104
101 void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, 105 void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue,
102 FX_BOOL bSetting, 106 FX_BOOL bSetting,
103 XFA_ATTRIBUTE eAttribute) { 107 XFA_ATTRIBUTE eAttribute) {
104 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 108 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
105 if (!pNotify) { 109 if (!pNotify) {
106 return; 110 return;
107 } 111 }
108 if (bSetting) { 112 if (bSetting) {
109 ThrowException(XFA_IDS_UNABLE_SET_LANGUAGE); 113 ThrowException(XFA_IDS_UNABLE_SET_LANGUAGE);
110 return; 114 return;
111 } 115 }
112 CFX_WideString wsLanguage; 116 CFX_WideString wsLanguage;
113 pNotify->GetAppProvider()->GetLanguage(wsLanguage); 117 pNotify->GetAppProvider()->GetLanguage(wsLanguage);
114 pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC()); 118 pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC());
115 } 119 }
120
116 void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, 121 void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue,
117 FX_BOOL bSetting, 122 FX_BOOL bSetting,
118 XFA_ATTRIBUTE eAttribute) { 123 XFA_ATTRIBUTE eAttribute) {
119 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 124 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
120 if (!pNotify) { 125 if (!pNotify) {
121 return; 126 return;
122 } 127 }
123 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 128 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
124 if (bSetting) { 129 if (bSetting) {
125 ThrowException(XFA_IDS_UNABLE_SET_NUMPAGES); 130 ThrowException(XFA_IDS_UNABLE_SET_NUMPAGES);
126 return; 131 return;
127 } 132 }
128 pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc)); 133 pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc));
129 } 134 }
135
130 void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue, 136 void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue,
131 FX_BOOL bSetting, 137 FX_BOOL bSetting,
132 XFA_ATTRIBUTE eAttribute) { 138 XFA_ATTRIBUTE eAttribute) {
133 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 139 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
134 if (!pNotify) { 140 if (!pNotify) {
135 return; 141 return;
136 } 142 }
137 if (bSetting) { 143 if (bSetting) {
138 ThrowException(XFA_IDS_UNABLE_SET_PLATFORM); 144 ThrowException(XFA_IDS_UNABLE_SET_PLATFORM);
139 return; 145 return;
140 } 146 }
141 CFX_WideString wsPlatform; 147 CFX_WideString wsPlatform;
142 pNotify->GetAppProvider()->GetPlatform(wsPlatform); 148 pNotify->GetAppProvider()->GetPlatform(wsPlatform);
143 pValue->SetString(FX_UTF8Encode(wsPlatform).AsStringC()); 149 pValue->SetString(FX_UTF8Encode(wsPlatform).AsStringC());
144 } 150 }
145 void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, 151 void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue,
146 FX_BOOL bSetting, 152 FX_BOOL bSetting,
147 XFA_ATTRIBUTE eAttribute) { 153 XFA_ATTRIBUTE eAttribute) {
148 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 154 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
149 return; 155 return;
150 } 156 }
151 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 157 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
152 if (!pNotify) { 158 if (!pNotify) {
153 return; 159 return;
154 } 160 }
155 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 161 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
156 if (bSetting) { 162 if (bSetting) {
157 pNotify->GetDocProvider()->SetTitle(hDoc, pValue->ToWideString()); 163 pNotify->GetDocProvider()->SetTitle(hDoc, pValue->ToWideString());
158 return; 164 return;
159 } 165 }
160 CFX_WideString wsTitle; 166 CFX_WideString wsTitle;
161 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); 167 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle);
162 pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC()); 168 pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC());
163 } 169 }
170
164 void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue, 171 void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue,
165 FX_BOOL bSetting, 172 FX_BOOL bSetting,
166 XFA_ATTRIBUTE eAttribute) { 173 XFA_ATTRIBUTE eAttribute) {
167 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 174 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
168 if (!pNotify) { 175 if (!pNotify) {
169 return; 176 return;
170 } 177 }
171 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 178 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
172 if (bSetting) { 179 if (bSetting) {
173 pNotify->GetDocProvider()->SetValidationsEnabled(hDoc, pValue->ToBoolean()); 180 pNotify->GetDocProvider()->SetValidationsEnabled(hDoc, pValue->ToBoolean());
174 return; 181 return;
175 } 182 }
176 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc); 183 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc);
177 pValue->SetBoolean(bEnabled); 184 pValue->SetBoolean(bEnabled);
178 } 185 }
179 void CScript_HostPseudoModel::Variation(CFXJSE_Value* pValue, 186 void CScript_HostPseudoModel::Variation(CFXJSE_Value* pValue,
180 FX_BOOL bSetting, 187 FX_BOOL bSetting,
181 XFA_ATTRIBUTE eAttribute) { 188 XFA_ATTRIBUTE eAttribute) {
182 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 189 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
183 return; 190 return;
184 } 191 }
185 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 192 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
186 if (!pNotify) { 193 if (!pNotify) {
187 return; 194 return;
188 } 195 }
189 if (bSetting) { 196 if (bSetting) {
190 ThrowException(XFA_IDS_UNABLE_SET_VARIATION); 197 ThrowException(XFA_IDS_UNABLE_SET_VARIATION);
191 return; 198 return;
192 } 199 }
193 CFX_WideString wsVariation; 200 CFX_WideString wsVariation;
194 pNotify->GetAppProvider()->GetVariation(wsVariation); 201 pNotify->GetAppProvider()->GetVariation(wsVariation);
195 pValue->SetString(FX_UTF8Encode(wsVariation).AsStringC()); 202 pValue->SetString(FX_UTF8Encode(wsVariation).AsStringC());
196 } 203 }
204
197 void CScript_HostPseudoModel::Version(CFXJSE_Value* pValue, 205 void CScript_HostPseudoModel::Version(CFXJSE_Value* pValue,
198 FX_BOOL bSetting, 206 FX_BOOL bSetting,
199 XFA_ATTRIBUTE eAttribute) { 207 XFA_ATTRIBUTE eAttribute) {
200 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 208 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
201 if (!pNotify) { 209 if (!pNotify) {
202 return; 210 return;
203 } 211 }
204 if (bSetting) { 212 if (bSetting) {
205 ThrowException(XFA_IDS_UNABLE_SET_VERSION); 213 ThrowException(XFA_IDS_UNABLE_SET_VERSION);
206 return; 214 return;
207 } 215 }
208 CFX_WideString wsVersion; 216 CFX_WideString wsVersion;
209 pNotify->GetAppProvider()->GetVersion(wsVersion); 217 pNotify->GetAppProvider()->GetVersion(wsVersion);
210 pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); 218 pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC());
211 } 219 }
220
212 void CScript_HostPseudoModel::FoxitVersion(CFXJSE_Value* pValue, 221 void CScript_HostPseudoModel::FoxitVersion(CFXJSE_Value* pValue,
213 FX_BOOL bSetting, 222 FX_BOOL bSetting,
214 XFA_ATTRIBUTE eAttribute) { 223 XFA_ATTRIBUTE eAttribute) {
215 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 224 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
216 if (!pNotify) { 225 if (!pNotify) {
217 return; 226 return;
218 } 227 }
219 if (bSetting) { 228 if (bSetting) {
220 ThrowException(XFA_IDS_UNABLE_SET_VERSION); 229 ThrowException(XFA_IDS_UNABLE_SET_VERSION);
221 return; 230 return;
222 } 231 }
223 CFX_WideString wsVersion; 232 CFX_WideString wsVersion;
224 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); 233 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion);
225 pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); 234 pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC());
226 } 235 }
236
227 void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue, 237 void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue,
228 FX_BOOL bSetting, 238 FX_BOOL bSetting,
229 XFA_ATTRIBUTE eAttribute) { 239 XFA_ATTRIBUTE eAttribute) {
230 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 240 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
231 if (!pNotify) { 241 if (!pNotify) {
232 return; 242 return;
233 } 243 }
234 if (bSetting) { 244 if (bSetting) {
235 ThrowException(XFA_IDS_INVAlID_PROP_SET); 245 ThrowException(XFA_IDS_INVAlID_PROP_SET);
236 return; 246 return;
237 } 247 }
238 CFX_WideString wsAppName; 248 CFX_WideString wsAppName;
239 pNotify->GetAppProvider()->GetAppName(wsAppName); 249 pNotify->GetAppProvider()->GetAppName(wsAppName);
240 pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC()); 250 pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC());
241 } 251 }
252
242 void CScript_HostPseudoModel::FoxitName(CFXJSE_Value* pValue, 253 void CScript_HostPseudoModel::FoxitName(CFXJSE_Value* pValue,
243 FX_BOOL bSetting, 254 FX_BOOL bSetting,
244 XFA_ATTRIBUTE eAttribute) { 255 XFA_ATTRIBUTE eAttribute) {
245 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 256 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
246 if (!pNotify) { 257 if (!pNotify) {
247 return; 258 return;
248 } 259 }
249 if (bSetting) { 260 if (bSetting) {
250 ThrowException(XFA_IDS_INVAlID_PROP_SET); 261 ThrowException(XFA_IDS_INVAlID_PROP_SET);
251 return; 262 return;
252 } 263 }
253 CFX_WideString wsFoxitAppName; 264 CFX_WideString wsFoxitAppName;
254 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); 265 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName);
255 pValue->SetString(FX_UTF8Encode(wsFoxitAppName).AsStringC()); 266 pValue->SetString(FX_UTF8Encode(wsFoxitAppName).AsStringC());
256 } 267 }
257 void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { 268 void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) {
258 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 269 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
259 return; 270 return;
260 } 271 }
261 int32_t iLength = pArguments->GetLength(); 272 int32_t iLength = pArguments->GetLength();
262 if (iLength != 1) { 273 if (iLength != 1) {
263 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); 274 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL");
264 return; 275 return;
265 } 276 }
266 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 277 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
267 if (!pNotify) { 278 if (!pNotify) {
268 return; 279 return;
269 } 280 }
270 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 281 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
271 CFX_WideString wsURL; 282 CFX_WideString wsURL;
272 if (iLength >= 1) { 283 if (iLength >= 1) {
273 CFX_ByteString bsURL = pArguments->GetUTF8String(0); 284 CFX_ByteString bsURL = pArguments->GetUTF8String(0);
274 wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC()); 285 wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC());
275 } 286 }
276 pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); 287 pNotify->GetDocProvider()->GotoURL(hDoc, wsURL);
277 } 288 }
278 void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { 289 void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) {
279 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 290 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
280 return; 291 return;
281 } 292 }
282 int32_t iLength = pArguments->GetLength(); 293 int32_t iLength = pArguments->GetLength();
283 if (iLength != 1) { 294 if (iLength != 1) {
284 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); 295 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList");
285 return; 296 return;
286 } 297 }
287 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 298 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
288 if (!pNotify) { 299 if (!pNotify) {
289 return; 300 return;
290 } 301 }
291 CXFA_Node* pNode = nullptr; 302 CXFA_Node* pNode = nullptr;
292 if (iLength >= 1) { 303 if (iLength >= 1) {
293 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0)); 304 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0));
294 if (pValue->IsObject()) { 305 if (pValue->IsObject()) {
295 pNode = ToNode(pValue.get(), nullptr); 306 pNode = ToNode(pValue.get(), nullptr);
296 } else if (pValue->IsString()) { 307 } else if (pValue->IsString()) {
297 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 308 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
(...skipping 26 matching lines...) Expand all
324 } 335 }
325 pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget); 336 pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget);
326 pNotify->OpenDropDownList(hWidget); 337 pNotify->OpenDropDownList(hWidget);
327 } 338 }
328 void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { 339 void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) {
329 int32_t iLength = pArguments->GetLength(); 340 int32_t iLength = pArguments->GetLength();
330 if (iLength < 1 || iLength > 4) { 341 if (iLength < 1 || iLength > 4) {
331 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response"); 342 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response");
332 return; 343 return;
333 } 344 }
334 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 345 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
335 if (!pNotify) { 346 if (!pNotify) {
336 return; 347 return;
337 } 348 }
338 CFX_WideString wsQuestion; 349 CFX_WideString wsQuestion;
339 CFX_WideString wsTitle; 350 CFX_WideString wsTitle;
340 CFX_WideString wsDefaultAnswer; 351 CFX_WideString wsDefaultAnswer;
341 FX_BOOL bMark = FALSE; 352 FX_BOOL bMark = FALSE;
342 if (iLength >= 1) { 353 if (iLength >= 1) {
343 CFX_ByteString bsQuestion = pArguments->GetUTF8String(0); 354 CFX_ByteString bsQuestion = pArguments->GetUTF8String(0);
344 wsQuestion = CFX_WideString::FromUTF8(bsQuestion.AsStringC()); 355 wsQuestion = CFX_WideString::FromUTF8(bsQuestion.AsStringC());
345 } 356 }
346 if (iLength >= 2) { 357 if (iLength >= 2) {
347 CFX_ByteString bsTitle = pArguments->GetUTF8String(1); 358 CFX_ByteString bsTitle = pArguments->GetUTF8String(1);
348 wsTitle = CFX_WideString::FromUTF8(bsTitle.AsStringC()); 359 wsTitle = CFX_WideString::FromUTF8(bsTitle.AsStringC());
349 } 360 }
350 if (iLength >= 3) { 361 if (iLength >= 3) {
351 CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2); 362 CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2);
352 wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer.AsStringC()); 363 wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer.AsStringC());
353 } 364 }
354 if (iLength >= 4) { 365 if (iLength >= 4) {
355 bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; 366 bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE;
356 } 367 }
357 CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response( 368 CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response(
358 wsQuestion, wsTitle, wsDefaultAnswer, bMark); 369 wsQuestion, wsTitle, wsDefaultAnswer, bMark);
359 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 370 CFXJSE_Value* pValue = pArguments->GetReturnValue();
360 if (pValue) 371 if (pValue)
361 pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC()); 372 pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC());
362 } 373 }
374
363 void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) { 375 void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) {
364 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 376 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
365 if (!pNotify) { 377 if (!pNotify) {
366 return; 378 return;
367 } 379 }
368 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch(); 380 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch();
369 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 381 CFXJSE_Value* pValue = pArguments->GetReturnValue();
370 if (pValue) 382 if (pValue)
371 pValue->SetInteger(iCur); 383 pValue->SetInteger(iCur);
372 } 384 }
373 static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, 385 static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression,
374 int32_t nStart, 386 int32_t nStart,
(...skipping 18 matching lines...) Expand all
393 wsFilter.TrimLeft(); 405 wsFilter.TrimLeft();
394 wsFilter.TrimRight(); 406 wsFilter.TrimRight();
395 return nStart; 407 return nStart;
396 } 408 }
397 void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { 409 void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) {
398 int32_t iLength = pArguments->GetLength(); 410 int32_t iLength = pArguments->GetLength();
399 if (iLength < 0 || iLength > 1) { 411 if (iLength < 0 || iLength > 1) {
400 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); 412 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData");
401 return; 413 return;
402 } 414 }
403 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 415 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
404 if (!pNotify) { 416 if (!pNotify) {
405 return; 417 return;
406 } 418 }
407 CFX_WideString wsExpression; 419 CFX_WideString wsExpression;
408 if (iLength >= 1) { 420 if (iLength >= 1) {
409 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 421 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
410 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); 422 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
411 } 423 }
412 if (wsExpression.IsEmpty()) { 424 if (wsExpression.IsEmpty()) {
413 pNotify->ResetData(); 425 pNotify->ResetData();
(...skipping 30 matching lines...) Expand all
444 } 456 }
445 void CScript_HostPseudoModel::Beep(CFXJSE_Arguments* pArguments) { 457 void CScript_HostPseudoModel::Beep(CFXJSE_Arguments* pArguments) {
446 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 458 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
447 return; 459 return;
448 } 460 }
449 int32_t iLength = pArguments->GetLength(); 461 int32_t iLength = pArguments->GetLength();
450 if (iLength < 0 || iLength > 1) { 462 if (iLength < 0 || iLength > 1) {
451 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep"); 463 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep");
452 return; 464 return;
453 } 465 }
454 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 466 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
455 if (!pNotify) { 467 if (!pNotify) {
456 return; 468 return;
457 } 469 }
458 uint32_t dwType = 4; 470 uint32_t dwType = 4;
459 if (iLength >= 1) { 471 if (iLength >= 1) {
460 dwType = pArguments->GetInt32(0); 472 dwType = pArguments->GetInt32(0);
461 } 473 }
462 pNotify->GetAppProvider()->Beep(dwType); 474 pNotify->GetAppProvider()->Beep(dwType);
463 } 475 }
464 void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { 476 void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) {
465 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 477 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
466 return; 478 return;
467 } 479 }
468 int32_t iLength = pArguments->GetLength(); 480 int32_t iLength = pArguments->GetLength();
469 if (iLength != 1) { 481 if (iLength != 1) {
470 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus"); 482 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus");
471 return; 483 return;
472 } 484 }
473 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 485 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
474 if (!pNotify) { 486 if (!pNotify) {
475 return; 487 return;
476 } 488 }
477 CXFA_Node* pNode = nullptr; 489 CXFA_Node* pNode = nullptr;
478 if (iLength >= 1) { 490 if (iLength >= 1) {
479 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0)); 491 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0));
480 if (pValue->IsObject()) { 492 if (pValue->IsObject()) {
481 pNode = ToNode(pValue.get(), nullptr); 493 pNode = ToNode(pValue.get(), nullptr);
482 } else if (pValue->IsString()) { 494 } else if (pValue->IsString()) {
483 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 495 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
(...skipping 10 matching lines...) Expand all
494 int32_t iRet = pScriptContext->ResolveObjects( 506 int32_t iRet = pScriptContext->ResolveObjects(
495 pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag); 507 pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag);
496 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) 508 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode())
497 return; 509 return;
498 510
499 pNode = resoveNodeRS.nodes[0]->AsNode(); 511 pNode = resoveNodeRS.nodes[0]->AsNode();
500 } 512 }
501 } 513 }
502 pNotify->SetFocusWidgetNode(pNode); 514 pNotify->SetFocusWidgetNode(pNode);
503 } 515 }
516
504 void CScript_HostPseudoModel::GetFocus(CFXJSE_Arguments* pArguments) { 517 void CScript_HostPseudoModel::GetFocus(CFXJSE_Arguments* pArguments) {
505 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 518 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
506 if (!pNotify) { 519 if (!pNotify) {
507 return; 520 return;
508 } 521 }
509 CXFA_Node* pNode = pNotify->GetFocusWidgetNode(); 522 CXFA_Node* pNode = pNotify->GetFocusWidgetNode();
510 if (!pNode) { 523 if (!pNode) {
511 return; 524 return;
512 } 525 }
513 pArguments->GetReturnValue()->Assign( 526 pArguments->GetReturnValue()->Assign(
514 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 527 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
515 } 528 }
516 void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { 529 void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) {
517 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 530 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
518 return; 531 return;
519 } 532 }
520 int32_t iLength = pArguments->GetLength(); 533 int32_t iLength = pArguments->GetLength();
521 if (iLength < 1 || iLength > 4) { 534 if (iLength < 1 || iLength > 4) {
522 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox"); 535 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox");
523 return; 536 return;
524 } 537 }
525 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 538 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
526 if (!pNotify) { 539 if (!pNotify) {
527 return; 540 return;
528 } 541 }
529 CFX_WideString wsMessage; 542 CFX_WideString wsMessage;
530 CFX_WideString bsTitle; 543 CFX_WideString bsTitle;
531 uint32_t dwMessageType = XFA_MBICON_Error; 544 uint32_t dwMessageType = XFA_MBICON_Error;
532 uint32_t dwButtonType = XFA_MB_OK; 545 uint32_t dwButtonType = XFA_MB_OK;
533 if (iLength >= 1) { 546 if (iLength >= 1) {
534 if (!ValidateArgsForMsg(pArguments, 0, wsMessage)) { 547 if (!ValidateArgsForMsg(pArguments, 0, wsMessage)) {
535 return; 548 return;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 590 }
578 if (pValueArg->IsNull()) { 591 if (pValueArg->IsNull()) {
579 wsValue = FX_WSTRC(L""); 592 wsValue = FX_WSTRC(L"");
580 } else { 593 } else {
581 wsValue = pValueArg->ToWideString(); 594 wsValue = pValueArg->ToWideString();
582 } 595 }
583 return TRUE; 596 return TRUE;
584 } 597 }
585 void CScript_HostPseudoModel::DocumentCountInBatch( 598 void CScript_HostPseudoModel::DocumentCountInBatch(
586 CFXJSE_Arguments* pArguments) { 599 CFXJSE_Arguments* pArguments) {
587 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 600 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
588 if (!pNotify) { 601 if (!pNotify) {
589 return; 602 return;
590 } 603 }
591 int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch(); 604 int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch();
592 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 605 CFXJSE_Value* pValue = pArguments->GetReturnValue();
593 if (pValue) 606 if (pValue)
594 pValue->SetInteger(iValue); 607 pValue->SetInteger(iValue);
595 } 608 }
596 void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { 609 void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) {
597 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 610 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
598 return; 611 return;
599 } 612 }
600 int32_t iLength = pArguments->GetLength(); 613 int32_t iLength = pArguments->GetLength();
601 if (iLength != 8) { 614 if (iLength != 8) {
602 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); 615 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print");
603 return; 616 return;
604 } 617 }
605 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 618 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
606 if (!pNotify) { 619 if (!pNotify) {
607 return; 620 return;
608 } 621 }
609 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 622 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
610 uint32_t dwOptions = 0; 623 uint32_t dwOptions = 0;
611 FX_BOOL bShowDialog = TRUE; 624 FX_BOOL bShowDialog = TRUE;
612 if (iLength >= 1) { 625 if (iLength >= 1) {
613 bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; 626 bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE;
614 } 627 }
615 if (bShowDialog) { 628 if (bShowDialog) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 dwOptions |= XFA_PRINTOPT_PrintAnnot; 673 dwOptions |= XFA_PRINTOPT_PrintAnnot;
661 } 674 }
662 pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); 675 pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions);
663 } 676 }
664 void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { 677 void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) {
665 int32_t iLength = pArguments->GetLength(); 678 int32_t iLength = pArguments->GetLength();
666 if (iLength < 0 || iLength > 1) { 679 if (iLength < 0 || iLength > 1) {
667 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); 680 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData");
668 return; 681 return;
669 } 682 }
670 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 683 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
671 if (!pNotify) { 684 if (!pNotify) {
672 return; 685 return;
673 } 686 }
674 CFX_WideString wsFilePath; 687 CFX_WideString wsFilePath;
675 if (iLength > 0) { 688 if (iLength > 0) {
676 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); 689 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
677 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); 690 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC());
678 } 691 }
679 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 692 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
680 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); 693 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath);
681 } 694 }
682 void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { 695 void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) {
683 int32_t iLength = pArguments->GetLength(); 696 int32_t iLength = pArguments->GetLength();
684 if (iLength < 0 || iLength > 2) { 697 if (iLength < 0 || iLength > 2) {
685 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); 698 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData");
686 return; 699 return;
687 } 700 }
688 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 701 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
689 if (!pNotify) { 702 if (!pNotify) {
690 return; 703 return;
691 } 704 }
692 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 705 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
693 CFX_WideString wsFilePath; 706 CFX_WideString wsFilePath;
694 FX_BOOL bXDP = TRUE; 707 FX_BOOL bXDP = TRUE;
695 if (iLength >= 1) { 708 if (iLength >= 1) {
696 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); 709 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
697 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); 710 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC());
698 } 711 }
699 if (iLength >= 2) { 712 if (iLength >= 2) {
700 bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 713 bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
701 } 714 }
702 pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); 715 pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP);
703 } 716 }
717
704 void CScript_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) { 718 void CScript_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) {
705 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 719 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
706 if (!pNotify) { 720 if (!pNotify) {
707 return; 721 return;
708 } 722 }
709 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 723 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
710 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); 724 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc);
711 int32_t nNewPage = 0; 725 int32_t nNewPage = 0;
712 if (nCurPage <= 1) { 726 if (nCurPage <= 1) {
713 return; 727 return;
714 } 728 }
715 nNewPage = nCurPage - 1; 729 nNewPage = nCurPage - 1;
716 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); 730 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage);
717 } 731 }
732
718 void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { 733 void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) {
719 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 734 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
720 if (!pNotify) { 735 if (!pNotify) {
721 return; 736 return;
722 } 737 }
723 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 738 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
724 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); 739 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc);
725 int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc); 740 int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc);
726 if (!nPageCount || nCurPage == nPageCount) { 741 if (!nPageCount || nCurPage == nPageCount) {
727 return; 742 return;
728 } 743 }
729 int32_t nNewPage = 0; 744 int32_t nNewPage = 0;
730 if (nCurPage >= nPageCount) { 745 if (nCurPage >= nPageCount) {
731 nNewPage = nPageCount - 1; 746 nNewPage = nPageCount - 1;
732 } else { 747 } else {
733 nNewPage = nCurPage + 1; 748 nNewPage = nCurPage + 1;
734 } 749 }
735 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); 750 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage);
736 } 751 }
752
737 void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { 753 void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) {
738 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 754 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
739 if (!pNotify) { 755 if (!pNotify) {
740 return; 756 return;
741 } 757 }
742 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); 758 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime();
743 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 759 CFXJSE_Value* pValue = pArguments->GetReturnValue();
744 if (pValue) 760 if (pValue)
745 pValue->SetString(FX_UTF8Encode(wsDataTime).AsStringC()); 761 pValue->SetString(FX_UTF8Encode(wsDataTime).AsStringC());
746 } 762 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp ('k') | xfa/fxfa/parser/xfa_script_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698