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

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: Missing include 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
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 }
(...skipping 10 matching lines...) Expand all
37 CXFA_FFNotify* pNotify, 36 CXFA_FFNotify* pNotify,
38 uint32_t dwFlag) { 37 uint32_t dwFlag) {
39 CFX_WideString wsValue; 38 CFX_WideString wsValue;
40 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); 39 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue);
41 pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); 40 pValue->SetString(FX_UTF8Encode(wsValue).AsStringC());
42 } 41 }
43 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( 42 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType(
44 CFXJSE_Value* pValue, 43 CFXJSE_Value* pValue,
45 FX_BOOL bSetting, 44 FX_BOOL bSetting,
46 XFA_ATTRIBUTE eAttribute) { 45 XFA_ATTRIBUTE eAttribute) {
47 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 46 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
48 if (!pNotify) { 47 if (!pNotify) {
49 return; 48 return;
50 } 49 }
51 if (bSetting) { 50 if (bSetting) {
52 ThrowException(XFA_IDS_INVAlID_PROP_SET); 51 ThrowException(XFA_IDS_INVAlID_PROP_SET);
53 return; 52 return;
54 } 53 }
55 CFX_WideString wsAppType; 54 CFX_WideString wsAppType;
56 pNotify->GetAppProvider()->GetAppType(wsAppType); 55 pNotify->GetAppProvider()->GetAppType(wsAppType);
57 pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); 56 pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC());
58 } 57 }
59 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( 58 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType(
60 CFXJSE_Value* pValue, 59 CFXJSE_Value* pValue,
61 FX_BOOL bSetting, 60 FX_BOOL bSetting,
62 XFA_ATTRIBUTE eAttribute) { 61 XFA_ATTRIBUTE eAttribute) {
63 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 62 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
64 if (!pNotify) { 63 if (!pNotify) {
65 return; 64 return;
66 } 65 }
67 if (bSetting) { 66 if (bSetting) {
68 ThrowException(XFA_IDS_INVAlID_PROP_SET); 67 ThrowException(XFA_IDS_INVAlID_PROP_SET);
69 return; 68 return;
70 } 69 }
71 CFX_WideString wsAppType; 70 CFX_WideString wsAppType;
72 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); 71 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType);
73 pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); 72 pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC());
74 } 73 }
75 void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( 74 void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled(
76 CFXJSE_Value* pValue, 75 CFXJSE_Value* pValue,
77 FX_BOOL bSetting, 76 FX_BOOL bSetting,
78 XFA_ATTRIBUTE eAttribute) { 77 XFA_ATTRIBUTE eAttribute) {
79 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 78 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
80 if (!pNotify) { 79 if (!pNotify) {
81 return; 80 return;
82 } 81 }
83 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 82 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
84 if (bSetting) { 83 if (bSetting) {
85 pNotify->GetDocProvider()->SetCalculationsEnabled(hDoc, 84 pNotify->GetDocProvider()->SetCalculationsEnabled(hDoc,
86 pValue->ToBoolean()); 85 pValue->ToBoolean());
87 return; 86 return;
88 } 87 }
89 pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc)); 88 pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc));
90 } 89 }
91 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( 90 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage(
92 CFXJSE_Value* pValue, 91 CFXJSE_Value* pValue,
93 FX_BOOL bSetting, 92 FX_BOOL bSetting,
94 XFA_ATTRIBUTE eAttribute) { 93 XFA_ATTRIBUTE eAttribute) {
95 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 94 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
96 if (!pNotify) { 95 if (!pNotify) {
97 return; 96 return;
98 } 97 }
99 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 98 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
100 if (bSetting) { 99 if (bSetting) {
101 pNotify->GetDocProvider()->SetCurrentPage(hDoc, pValue->ToInteger()); 100 pNotify->GetDocProvider()->SetCurrentPage(hDoc, pValue->ToInteger());
102 return; 101 return;
103 } 102 }
104 pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc)); 103 pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc));
105 } 104 }
106 void CScript_HostPseudoModel::Script_HostPseudoModel_Language( 105 void CScript_HostPseudoModel::Script_HostPseudoModel_Language(
107 CFXJSE_Value* pValue, 106 CFXJSE_Value* pValue,
108 FX_BOOL bSetting, 107 FX_BOOL bSetting,
109 XFA_ATTRIBUTE eAttribute) { 108 XFA_ATTRIBUTE eAttribute) {
110 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 109 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
111 if (!pNotify) { 110 if (!pNotify) {
112 return; 111 return;
113 } 112 }
114 if (bSetting) { 113 if (bSetting) {
115 ThrowException(XFA_IDS_UNABLE_SET_LANGUAGE); 114 ThrowException(XFA_IDS_UNABLE_SET_LANGUAGE);
116 return; 115 return;
117 } 116 }
118 CFX_WideString wsLanguage; 117 CFX_WideString wsLanguage;
119 pNotify->GetAppProvider()->GetLanguage(wsLanguage); 118 pNotify->GetAppProvider()->GetLanguage(wsLanguage);
120 pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC()); 119 pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC());
121 } 120 }
122 void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( 121 void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages(
123 CFXJSE_Value* pValue, 122 CFXJSE_Value* pValue,
124 FX_BOOL bSetting, 123 FX_BOOL bSetting,
125 XFA_ATTRIBUTE eAttribute) { 124 XFA_ATTRIBUTE eAttribute) {
126 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 125 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
127 if (!pNotify) { 126 if (!pNotify) {
128 return; 127 return;
129 } 128 }
130 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 129 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
131 if (bSetting) { 130 if (bSetting) {
132 ThrowException(XFA_IDS_UNABLE_SET_NUMPAGES); 131 ThrowException(XFA_IDS_UNABLE_SET_NUMPAGES);
133 return; 132 return;
134 } 133 }
135 pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc)); 134 pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc));
136 } 135 }
137 void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( 136 void CScript_HostPseudoModel::Script_HostPseudoModel_Platform(
138 CFXJSE_Value* pValue, 137 CFXJSE_Value* pValue,
139 FX_BOOL bSetting, 138 FX_BOOL bSetting,
140 XFA_ATTRIBUTE eAttribute) { 139 XFA_ATTRIBUTE eAttribute) {
141 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 140 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
142 if (!pNotify) { 141 if (!pNotify) {
143 return; 142 return;
144 } 143 }
145 if (bSetting) { 144 if (bSetting) {
146 ThrowException(XFA_IDS_UNABLE_SET_PLATFORM); 145 ThrowException(XFA_IDS_UNABLE_SET_PLATFORM);
147 return; 146 return;
148 } 147 }
149 CFX_WideString wsPlatform; 148 CFX_WideString wsPlatform;
150 pNotify->GetAppProvider()->GetPlatform(wsPlatform); 149 pNotify->GetAppProvider()->GetPlatform(wsPlatform);
151 pValue->SetString(FX_UTF8Encode(wsPlatform).AsStringC()); 150 pValue->SetString(FX_UTF8Encode(wsPlatform).AsStringC());
152 } 151 }
153 void CScript_HostPseudoModel::Script_HostPseudoModel_Title( 152 void CScript_HostPseudoModel::Script_HostPseudoModel_Title(
154 CFXJSE_Value* pValue, 153 CFXJSE_Value* pValue,
155 FX_BOOL bSetting, 154 FX_BOOL bSetting,
156 XFA_ATTRIBUTE eAttribute) { 155 XFA_ATTRIBUTE eAttribute) {
157 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 156 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
158 return; 157 return;
159 } 158 }
160 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 159 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
161 if (!pNotify) { 160 if (!pNotify) {
162 return; 161 return;
163 } 162 }
164 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 163 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
165 if (bSetting) { 164 if (bSetting) {
166 pNotify->GetDocProvider()->SetTitle(hDoc, pValue->ToWideString()); 165 pNotify->GetDocProvider()->SetTitle(hDoc, pValue->ToWideString());
167 return; 166 return;
168 } 167 }
169 CFX_WideString wsTitle; 168 CFX_WideString wsTitle;
170 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); 169 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle);
171 pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC()); 170 pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC());
172 } 171 }
173 void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( 172 void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled(
174 CFXJSE_Value* pValue, 173 CFXJSE_Value* pValue,
175 FX_BOOL bSetting, 174 FX_BOOL bSetting,
176 XFA_ATTRIBUTE eAttribute) { 175 XFA_ATTRIBUTE eAttribute) {
177 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 176 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
178 if (!pNotify) { 177 if (!pNotify) {
179 return; 178 return;
180 } 179 }
181 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 180 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
182 if (bSetting) { 181 if (bSetting) {
183 pNotify->GetDocProvider()->SetValidationsEnabled(hDoc, pValue->ToBoolean()); 182 pNotify->GetDocProvider()->SetValidationsEnabled(hDoc, pValue->ToBoolean());
184 return; 183 return;
185 } 184 }
186 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc); 185 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc);
187 pValue->SetBoolean(bEnabled); 186 pValue->SetBoolean(bEnabled);
188 } 187 }
189 void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( 188 void CScript_HostPseudoModel::Script_HostPseudoModel_Variation(
190 CFXJSE_Value* pValue, 189 CFXJSE_Value* pValue,
191 FX_BOOL bSetting, 190 FX_BOOL bSetting,
192 XFA_ATTRIBUTE eAttribute) { 191 XFA_ATTRIBUTE eAttribute) {
193 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 192 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
194 return; 193 return;
195 } 194 }
196 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 195 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
197 if (!pNotify) { 196 if (!pNotify) {
198 return; 197 return;
199 } 198 }
200 if (bSetting) { 199 if (bSetting) {
201 ThrowException(XFA_IDS_UNABLE_SET_VARIATION); 200 ThrowException(XFA_IDS_UNABLE_SET_VARIATION);
202 return; 201 return;
203 } 202 }
204 CFX_WideString wsVariation; 203 CFX_WideString wsVariation;
205 pNotify->GetAppProvider()->GetVariation(wsVariation); 204 pNotify->GetAppProvider()->GetVariation(wsVariation);
206 pValue->SetString(FX_UTF8Encode(wsVariation).AsStringC()); 205 pValue->SetString(FX_UTF8Encode(wsVariation).AsStringC());
207 } 206 }
208 void CScript_HostPseudoModel::Script_HostPseudoModel_Version( 207 void CScript_HostPseudoModel::Script_HostPseudoModel_Version(
209 CFXJSE_Value* pValue, 208 CFXJSE_Value* pValue,
210 FX_BOOL bSetting, 209 FX_BOOL bSetting,
211 XFA_ATTRIBUTE eAttribute) { 210 XFA_ATTRIBUTE eAttribute) {
212 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 211 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
213 if (!pNotify) { 212 if (!pNotify) {
214 return; 213 return;
215 } 214 }
216 if (bSetting) { 215 if (bSetting) {
217 ThrowException(XFA_IDS_UNABLE_SET_VERSION); 216 ThrowException(XFA_IDS_UNABLE_SET_VERSION);
218 return; 217 return;
219 } 218 }
220 CFX_WideString wsVersion; 219 CFX_WideString wsVersion;
221 pNotify->GetAppProvider()->GetVersion(wsVersion); 220 pNotify->GetAppProvider()->GetVersion(wsVersion);
222 pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); 221 pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC());
223 } 222 }
224 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( 223 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion(
225 CFXJSE_Value* pValue, 224 CFXJSE_Value* pValue,
226 FX_BOOL bSetting, 225 FX_BOOL bSetting,
227 XFA_ATTRIBUTE eAttribute) { 226 XFA_ATTRIBUTE eAttribute) {
228 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 227 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
229 if (!pNotify) { 228 if (!pNotify) {
230 return; 229 return;
231 } 230 }
232 if (bSetting) { 231 if (bSetting) {
233 ThrowException(XFA_IDS_UNABLE_SET_VERSION); 232 ThrowException(XFA_IDS_UNABLE_SET_VERSION);
234 return; 233 return;
235 } 234 }
236 CFX_WideString wsVersion; 235 CFX_WideString wsVersion;
237 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); 236 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion);
238 pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); 237 pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC());
239 } 238 }
240 void CScript_HostPseudoModel::Script_HostPseudoModel_Name( 239 void CScript_HostPseudoModel::Script_HostPseudoModel_Name(
241 CFXJSE_Value* pValue, 240 CFXJSE_Value* pValue,
242 FX_BOOL bSetting, 241 FX_BOOL bSetting,
243 XFA_ATTRIBUTE eAttribute) { 242 XFA_ATTRIBUTE eAttribute) {
244 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 243 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
245 if (!pNotify) { 244 if (!pNotify) {
246 return; 245 return;
247 } 246 }
248 if (bSetting) { 247 if (bSetting) {
249 ThrowException(XFA_IDS_INVAlID_PROP_SET); 248 ThrowException(XFA_IDS_INVAlID_PROP_SET);
250 return; 249 return;
251 } 250 }
252 CFX_WideString wsAppName; 251 CFX_WideString wsAppName;
253 pNotify->GetAppProvider()->GetAppName(wsAppName); 252 pNotify->GetAppProvider()->GetAppName(wsAppName);
254 pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC()); 253 pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC());
255 } 254 }
256 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( 255 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName(
257 CFXJSE_Value* pValue, 256 CFXJSE_Value* pValue,
258 FX_BOOL bSetting, 257 FX_BOOL bSetting,
259 XFA_ATTRIBUTE eAttribute) { 258 XFA_ATTRIBUTE eAttribute) {
260 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 259 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
261 if (!pNotify) { 260 if (!pNotify) {
262 return; 261 return;
263 } 262 }
264 if (bSetting) { 263 if (bSetting) {
265 ThrowException(XFA_IDS_INVAlID_PROP_SET); 264 ThrowException(XFA_IDS_INVAlID_PROP_SET);
266 return; 265 return;
267 } 266 }
268 CFX_WideString wsFoxitAppName; 267 CFX_WideString wsFoxitAppName;
269 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); 268 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName);
270 pValue->SetString(FX_UTF8Encode(wsFoxitAppName).AsStringC()); 269 pValue->SetString(FX_UTF8Encode(wsFoxitAppName).AsStringC());
271 } 270 }
272 void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( 271 void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL(
273 CFXJSE_Arguments* pArguments) { 272 CFXJSE_Arguments* pArguments) {
274 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 273 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
275 return; 274 return;
276 } 275 }
277 int32_t iLength = pArguments->GetLength(); 276 int32_t iLength = pArguments->GetLength();
278 if (iLength != 1) { 277 if (iLength != 1) {
279 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); 278 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL");
280 return; 279 return;
281 } 280 }
282 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 281 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
283 if (!pNotify) { 282 if (!pNotify) {
284 return; 283 return;
285 } 284 }
286 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 285 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
287 CFX_WideString wsURL; 286 CFX_WideString wsURL;
288 if (iLength >= 1) { 287 if (iLength >= 1) {
289 CFX_ByteString bsURL = pArguments->GetUTF8String(0); 288 CFX_ByteString bsURL = pArguments->GetUTF8String(0);
290 wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC()); 289 wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC());
291 } 290 }
292 pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); 291 pNotify->GetDocProvider()->GotoURL(hDoc, wsURL);
293 } 292 }
294 void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( 293 void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList(
295 CFXJSE_Arguments* pArguments) { 294 CFXJSE_Arguments* pArguments) {
296 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 295 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
297 return; 296 return;
298 } 297 }
299 int32_t iLength = pArguments->GetLength(); 298 int32_t iLength = pArguments->GetLength();
300 if (iLength != 1) { 299 if (iLength != 1) {
301 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); 300 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList");
302 return; 301 return;
303 } 302 }
304 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 303 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
305 if (!pNotify) { 304 if (!pNotify) {
306 return; 305 return;
307 } 306 }
308 CXFA_Node* pNode = nullptr; 307 CXFA_Node* pNode = nullptr;
309 if (iLength >= 1) { 308 if (iLength >= 1) {
310 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0)); 309 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0));
311 if (pValue->IsObject()) { 310 if (pValue->IsObject()) {
312 pNode = ToNode(pValue.get(), nullptr); 311 pNode = ToNode(pValue.get(), nullptr);
313 } else if (pValue->IsString()) { 312 } else if (pValue->IsString()) {
314 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 313 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
(...skipping 27 matching lines...) Expand all
342 pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget); 341 pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget);
343 pNotify->OpenDropDownList(hWidget); 342 pNotify->OpenDropDownList(hWidget);
344 } 343 }
345 void CScript_HostPseudoModel::Script_HostPseudoModel_Response( 344 void CScript_HostPseudoModel::Script_HostPseudoModel_Response(
346 CFXJSE_Arguments* pArguments) { 345 CFXJSE_Arguments* pArguments) {
347 int32_t iLength = pArguments->GetLength(); 346 int32_t iLength = pArguments->GetLength();
348 if (iLength < 1 || iLength > 4) { 347 if (iLength < 1 || iLength > 4) {
349 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response"); 348 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response");
350 return; 349 return;
351 } 350 }
352 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 351 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
353 if (!pNotify) { 352 if (!pNotify) {
354 return; 353 return;
355 } 354 }
356 CFX_WideString wsQuestion; 355 CFX_WideString wsQuestion;
357 CFX_WideString wsTitle; 356 CFX_WideString wsTitle;
358 CFX_WideString wsDefaultAnswer; 357 CFX_WideString wsDefaultAnswer;
359 FX_BOOL bMark = FALSE; 358 FX_BOOL bMark = FALSE;
360 if (iLength >= 1) { 359 if (iLength >= 1) {
361 CFX_ByteString bsQuestion = pArguments->GetUTF8String(0); 360 CFX_ByteString bsQuestion = pArguments->GetUTF8String(0);
362 wsQuestion = CFX_WideString::FromUTF8(bsQuestion.AsStringC()); 361 wsQuestion = CFX_WideString::FromUTF8(bsQuestion.AsStringC());
(...skipping 10 matching lines...) Expand all
373 bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; 372 bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE;
374 } 373 }
375 CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response( 374 CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response(
376 wsQuestion, wsTitle, wsDefaultAnswer, bMark); 375 wsQuestion, wsTitle, wsDefaultAnswer, bMark);
377 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 376 CFXJSE_Value* pValue = pArguments->GetReturnValue();
378 if (pValue) 377 if (pValue)
379 pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC()); 378 pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC());
380 } 379 }
381 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( 380 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch(
382 CFXJSE_Arguments* pArguments) { 381 CFXJSE_Arguments* pArguments) {
383 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 382 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
384 if (!pNotify) { 383 if (!pNotify) {
385 return; 384 return;
386 } 385 }
387 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch(); 386 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch();
388 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 387 CFXJSE_Value* pValue = pArguments->GetReturnValue();
389 if (pValue) 388 if (pValue)
390 pValue->SetInteger(iCur); 389 pValue->SetInteger(iCur);
391 } 390 }
392 static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, 391 static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression,
393 int32_t nStart, 392 int32_t nStart,
(...skipping 19 matching lines...) Expand all
413 wsFilter.TrimRight(); 412 wsFilter.TrimRight();
414 return nStart; 413 return nStart;
415 } 414 }
416 void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( 415 void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData(
417 CFXJSE_Arguments* pArguments) { 416 CFXJSE_Arguments* pArguments) {
418 int32_t iLength = pArguments->GetLength(); 417 int32_t iLength = pArguments->GetLength();
419 if (iLength < 0 || iLength > 1) { 418 if (iLength < 0 || iLength > 1) {
420 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); 419 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData");
421 return; 420 return;
422 } 421 }
423 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 422 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
424 if (!pNotify) { 423 if (!pNotify) {
425 return; 424 return;
426 } 425 }
427 CFX_WideString wsExpression; 426 CFX_WideString wsExpression;
428 if (iLength >= 1) { 427 if (iLength >= 1) {
429 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 428 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
430 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); 429 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
431 } 430 }
432 if (wsExpression.IsEmpty()) { 431 if (wsExpression.IsEmpty()) {
433 pNotify->ResetData(); 432 pNotify->ResetData();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 void CScript_HostPseudoModel::Script_HostPseudoModel_Beep( 464 void CScript_HostPseudoModel::Script_HostPseudoModel_Beep(
466 CFXJSE_Arguments* pArguments) { 465 CFXJSE_Arguments* pArguments) {
467 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 466 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
468 return; 467 return;
469 } 468 }
470 int32_t iLength = pArguments->GetLength(); 469 int32_t iLength = pArguments->GetLength();
471 if (iLength < 0 || iLength > 1) { 470 if (iLength < 0 || iLength > 1) {
472 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep"); 471 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep");
473 return; 472 return;
474 } 473 }
475 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 474 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
476 if (!pNotify) { 475 if (!pNotify) {
477 return; 476 return;
478 } 477 }
479 uint32_t dwType = 4; 478 uint32_t dwType = 4;
480 if (iLength >= 1) { 479 if (iLength >= 1) {
481 dwType = pArguments->GetInt32(0); 480 dwType = pArguments->GetInt32(0);
482 } 481 }
483 pNotify->GetAppProvider()->Beep(dwType); 482 pNotify->GetAppProvider()->Beep(dwType);
484 } 483 }
485 void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( 484 void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus(
486 CFXJSE_Arguments* pArguments) { 485 CFXJSE_Arguments* pArguments) {
487 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 486 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
488 return; 487 return;
489 } 488 }
490 int32_t iLength = pArguments->GetLength(); 489 int32_t iLength = pArguments->GetLength();
491 if (iLength != 1) { 490 if (iLength != 1) {
492 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus"); 491 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus");
493 return; 492 return;
494 } 493 }
495 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 494 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
496 if (!pNotify) { 495 if (!pNotify) {
497 return; 496 return;
498 } 497 }
499 CXFA_Node* pNode = nullptr; 498 CXFA_Node* pNode = nullptr;
500 if (iLength >= 1) { 499 if (iLength >= 1) {
501 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0)); 500 std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0));
502 if (pValue->IsObject()) { 501 if (pValue->IsObject()) {
503 pNode = ToNode(pValue.get(), nullptr); 502 pNode = ToNode(pValue.get(), nullptr);
504 } else if (pValue->IsString()) { 503 } else if (pValue->IsString()) {
505 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 504 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
(...skipping 12 matching lines...) Expand all
518 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) 517 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode())
519 return; 518 return;
520 519
521 pNode = resoveNodeRS.nodes[0]->AsNode(); 520 pNode = resoveNodeRS.nodes[0]->AsNode();
522 } 521 }
523 } 522 }
524 pNotify->SetFocusWidgetNode(pNode); 523 pNotify->SetFocusWidgetNode(pNode);
525 } 524 }
526 void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( 525 void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus(
527 CFXJSE_Arguments* pArguments) { 526 CFXJSE_Arguments* pArguments) {
528 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 527 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
529 if (!pNotify) { 528 if (!pNotify) {
530 return; 529 return;
531 } 530 }
532 CXFA_Node* pNode = pNotify->GetFocusWidgetNode(); 531 CXFA_Node* pNode = pNotify->GetFocusWidgetNode();
533 if (!pNode) { 532 if (!pNode) {
534 return; 533 return;
535 } 534 }
536 pArguments->GetReturnValue()->Assign( 535 pArguments->GetReturnValue()->Assign(
537 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 536 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
538 } 537 }
539 void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( 538 void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox(
540 CFXJSE_Arguments* pArguments) { 539 CFXJSE_Arguments* pArguments) {
541 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 540 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
542 return; 541 return;
543 } 542 }
544 int32_t iLength = pArguments->GetLength(); 543 int32_t iLength = pArguments->GetLength();
545 if (iLength < 1 || iLength > 4) { 544 if (iLength < 1 || iLength > 4) {
546 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox"); 545 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox");
547 return; 546 return;
548 } 547 }
549 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 548 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
550 if (!pNotify) { 549 if (!pNotify) {
551 return; 550 return;
552 } 551 }
553 CFX_WideString wsMessage; 552 CFX_WideString wsMessage;
554 CFX_WideString bsTitle; 553 CFX_WideString bsTitle;
555 uint32_t dwMessageType = XFA_MBICON_Error; 554 uint32_t dwMessageType = XFA_MBICON_Error;
556 uint32_t dwButtonType = XFA_MB_OK; 555 uint32_t dwButtonType = XFA_MB_OK;
557 if (iLength >= 1) { 556 if (iLength >= 1) {
558 if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 0, wsMessage)) { 557 if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 0, wsMessage)) {
559 return; 558 return;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } 600 }
602 if (pValueArg->IsNull()) { 601 if (pValueArg->IsNull()) {
603 wsValue = FX_WSTRC(L""); 602 wsValue = FX_WSTRC(L"");
604 } else { 603 } else {
605 wsValue = pValueArg->ToWideString(); 604 wsValue = pValueArg->ToWideString();
606 } 605 }
607 return TRUE; 606 return TRUE;
608 } 607 }
609 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( 608 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch(
610 CFXJSE_Arguments* pArguments) { 609 CFXJSE_Arguments* pArguments) {
611 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 610 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
612 if (!pNotify) { 611 if (!pNotify) {
613 return; 612 return;
614 } 613 }
615 int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch(); 614 int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch();
616 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 615 CFXJSE_Value* pValue = pArguments->GetReturnValue();
617 if (pValue) 616 if (pValue)
618 pValue->SetInteger(iValue); 617 pValue->SetInteger(iValue);
619 } 618 }
620 void CScript_HostPseudoModel::Script_HostPseudoModel_Print( 619 void CScript_HostPseudoModel::Script_HostPseudoModel_Print(
621 CFXJSE_Arguments* pArguments) { 620 CFXJSE_Arguments* pArguments) {
622 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 621 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
623 return; 622 return;
624 } 623 }
625 int32_t iLength = pArguments->GetLength(); 624 int32_t iLength = pArguments->GetLength();
626 if (iLength != 8) { 625 if (iLength != 8) {
627 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); 626 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print");
628 return; 627 return;
629 } 628 }
630 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 629 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
631 if (!pNotify) { 630 if (!pNotify) {
632 return; 631 return;
633 } 632 }
634 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 633 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
635 uint32_t dwOptions = 0; 634 uint32_t dwOptions = 0;
636 FX_BOOL bShowDialog = TRUE; 635 FX_BOOL bShowDialog = TRUE;
637 if (iLength >= 1) { 636 if (iLength >= 1) {
638 bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; 637 bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE;
639 } 638 }
640 if (bShowDialog) { 639 if (bShowDialog) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 } 685 }
687 pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); 686 pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions);
688 } 687 }
689 void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( 688 void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData(
690 CFXJSE_Arguments* pArguments) { 689 CFXJSE_Arguments* pArguments) {
691 int32_t iLength = pArguments->GetLength(); 690 int32_t iLength = pArguments->GetLength();
692 if (iLength < 0 || iLength > 1) { 691 if (iLength < 0 || iLength > 1) {
693 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); 692 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData");
694 return; 693 return;
695 } 694 }
696 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 695 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
697 if (!pNotify) { 696 if (!pNotify) {
698 return; 697 return;
699 } 698 }
700 CFX_WideString wsFilePath; 699 CFX_WideString wsFilePath;
701 if (iLength > 0) { 700 if (iLength > 0) {
702 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); 701 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
703 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); 702 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC());
704 } 703 }
705 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 704 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
706 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); 705 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath);
707 } 706 }
708 void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( 707 void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData(
709 CFXJSE_Arguments* pArguments) { 708 CFXJSE_Arguments* pArguments) {
710 int32_t iLength = pArguments->GetLength(); 709 int32_t iLength = pArguments->GetLength();
711 if (iLength < 0 || iLength > 2) { 710 if (iLength < 0 || iLength > 2) {
712 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); 711 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData");
713 return; 712 return;
714 } 713 }
715 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 714 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
716 if (!pNotify) { 715 if (!pNotify) {
717 return; 716 return;
718 } 717 }
719 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 718 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
720 CFX_WideString wsFilePath; 719 CFX_WideString wsFilePath;
721 FX_BOOL bXDP = TRUE; 720 FX_BOOL bXDP = TRUE;
722 if (iLength >= 1) { 721 if (iLength >= 1) {
723 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); 722 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
724 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); 723 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC());
725 } 724 }
726 if (iLength >= 2) { 725 if (iLength >= 2) {
727 bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 726 bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
728 } 727 }
729 pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); 728 pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP);
730 } 729 }
731 void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( 730 void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp(
732 CFXJSE_Arguments* pArguments) { 731 CFXJSE_Arguments* pArguments) {
733 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 732 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
734 if (!pNotify) { 733 if (!pNotify) {
735 return; 734 return;
736 } 735 }
737 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 736 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
738 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); 737 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc);
739 int32_t nNewPage = 0; 738 int32_t nNewPage = 0;
740 if (nCurPage <= 1) { 739 if (nCurPage <= 1) {
741 return; 740 return;
742 } 741 }
743 nNewPage = nCurPage - 1; 742 nNewPage = nCurPage - 1;
744 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); 743 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage);
745 } 744 }
746 void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( 745 void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown(
747 CFXJSE_Arguments* pArguments) { 746 CFXJSE_Arguments* pArguments) {
748 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 747 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
749 if (!pNotify) { 748 if (!pNotify) {
750 return; 749 return;
751 } 750 }
752 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); 751 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
753 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); 752 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc);
754 int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc); 753 int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc);
755 if (!nPageCount || nCurPage == nPageCount) { 754 if (!nPageCount || nCurPage == nPageCount) {
756 return; 755 return;
757 } 756 }
758 int32_t nNewPage = 0; 757 int32_t nNewPage = 0;
759 if (nCurPage >= nPageCount) { 758 if (nCurPage >= nPageCount) {
760 nNewPage = nPageCount - 1; 759 nNewPage = nPageCount - 1;
761 } else { 760 } else {
762 nNewPage = nCurPage + 1; 761 nNewPage = nCurPage + 1;
763 } 762 }
764 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); 763 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage);
765 } 764 }
766 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( 765 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime(
767 CFXJSE_Arguments* pArguments) { 766 CFXJSE_Arguments* pArguments) {
768 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 767 CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
769 if (!pNotify) { 768 if (!pNotify) {
770 return; 769 return;
771 } 770 }
772 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); 771 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime();
773 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 772 CFXJSE_Value* pValue = pArguments->GetReturnValue();
774 if (pValue) 773 if (pValue)
775 pValue->SetString(FX_UTF8Encode(wsDataTime).AsStringC()); 774 pValue->SetString(FX_UTF8Encode(wsDataTime).AsStringC());
776 } 775 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698