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

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

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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_hostpseudomodel.h ('k') | xfa/fxfa/parser/xfa_script_imp.h » ('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 "xfa/fxfa/app/xfa_ffnotify.h"
9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
10 #include "xfa/fxfa/parser/xfa_docdata.h" 11 #include "xfa/fxfa/parser/xfa_docdata.h"
11 #include "xfa/fxfa/parser/xfa_doclayout.h" 12 #include "xfa/fxfa/parser/xfa_doclayout.h"
12 #include "xfa/fxfa/parser/xfa_document.h" 13 #include "xfa/fxfa/parser/xfa_document.h"
14 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
13 #include "xfa/fxfa/parser/xfa_localemgr.h" 15 #include "xfa/fxfa/parser/xfa_localemgr.h"
14 #include "xfa/fxfa/parser/xfa_object.h" 16 #include "xfa/fxfa/parser/xfa_object.h"
15 #include "xfa/fxfa/parser/xfa_parser.h" 17 #include "xfa/fxfa/parser/xfa_parser.h"
18 #include "xfa/fxfa/parser/xfa_parser_imp.h"
16 #include "xfa/fxfa/parser/xfa_script.h" 19 #include "xfa/fxfa/parser/xfa_script.h"
20 #include "xfa/fxfa/parser/xfa_script_imp.h"
17 #include "xfa/fxfa/parser/xfa_utils.h" 21 #include "xfa/fxfa/parser/xfa_utils.h"
18 #include "xfa/fxjse/cfxjse_arguments.h" 22 #include "xfa/fxjse/cfxjse_arguments.h"
19 23
20 CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) 24 CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument)
21 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) { 25 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) {
22 m_uScriptHash = XFA_HASHCODE_Host; 26 m_uScriptHash = XFA_HASHCODE_Host;
23 } 27 }
24 CScript_HostPseudoModel::~CScript_HostPseudoModel() {} 28 CScript_HostPseudoModel::~CScript_HostPseudoModel() {}
25 void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( 29 void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString(
26 FXJSE_HVALUE hValue, 30 FXJSE_HVALUE hValue,
27 IXFA_Notify* pNotify, 31 CXFA_FFNotify* pNotify,
28 uint32_t dwFlag) { 32 uint32_t dwFlag) {
29 CFX_WideString wsValue; 33 CFX_WideString wsValue;
30 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); 34 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue);
31 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue)); 35 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
32 } 36 }
33 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( 37 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType(
34 FXJSE_HVALUE hValue, 38 FXJSE_HVALUE hValue,
35 FX_BOOL bSetting, 39 FX_BOOL bSetting,
36 XFA_ATTRIBUTE eAttribute) { 40 XFA_ATTRIBUTE eAttribute) {
37 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 41 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
38 if (!pNotify) { 42 if (!pNotify) {
39 return; 43 return;
40 } 44 }
41 if (bSetting) { 45 if (bSetting) {
42 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 46 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
43 return; 47 return;
44 } 48 }
45 CFX_WideString wsAppType; 49 CFX_WideString wsAppType;
46 pNotify->GetAppProvider()->GetAppType(wsAppType); 50 pNotify->GetAppProvider()->GetAppType(wsAppType);
47 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType)); 51 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType));
48 } 52 }
49 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( 53 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType(
50 FXJSE_HVALUE hValue, 54 FXJSE_HVALUE hValue,
51 FX_BOOL bSetting, 55 FX_BOOL bSetting,
52 XFA_ATTRIBUTE eAttribute) { 56 XFA_ATTRIBUTE eAttribute) {
53 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 57 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
54 if (!pNotify) { 58 if (!pNotify) {
55 return; 59 return;
56 } 60 }
57 if (bSetting) { 61 if (bSetting) {
58 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 62 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
59 return; 63 return;
60 } 64 }
61 CFX_WideString wsAppType; 65 CFX_WideString wsAppType;
62 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); 66 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType);
63 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType)); 67 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType));
64 } 68 }
65 void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( 69 void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled(
66 FXJSE_HVALUE hValue, 70 FXJSE_HVALUE hValue,
67 FX_BOOL bSetting, 71 FX_BOOL bSetting,
68 XFA_ATTRIBUTE eAttribute) { 72 XFA_ATTRIBUTE eAttribute) {
69 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 73 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
70 if (!pNotify) { 74 if (!pNotify) {
71 return; 75 return;
72 } 76 }
73 IXFA_Doc* hDoc = pNotify->GetHDOC(); 77 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
74 if (bSetting) { 78 if (bSetting) {
75 pNotify->GetDocProvider()->SetCalculationsEnabled( 79 pNotify->GetDocProvider()->SetCalculationsEnabled(
76 hDoc, FXJSE_Value_ToBoolean(hValue)); 80 hDoc, FXJSE_Value_ToBoolean(hValue));
77 return; 81 return;
78 } 82 }
79 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc); 83 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc);
80 FXJSE_Value_SetBoolean(hValue, bEnabled); 84 FXJSE_Value_SetBoolean(hValue, bEnabled);
81 } 85 }
82 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( 86 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage(
83 FXJSE_HVALUE hValue, 87 FXJSE_HVALUE hValue,
84 FX_BOOL bSetting, 88 FX_BOOL bSetting,
85 XFA_ATTRIBUTE eAttribute) { 89 XFA_ATTRIBUTE eAttribute) {
86 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 90 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
87 if (!pNotify) { 91 if (!pNotify) {
88 return; 92 return;
89 } 93 }
90 IXFA_Doc* hDoc = pNotify->GetHDOC(); 94 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
91 if (bSetting) { 95 if (bSetting) {
92 pNotify->GetDocProvider()->SetCurrentPage(hDoc, 96 pNotify->GetDocProvider()->SetCurrentPage(hDoc,
93 FXJSE_Value_ToInteger(hValue)); 97 FXJSE_Value_ToInteger(hValue));
94 return; 98 return;
95 } 99 }
96 int32_t iCurrentPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); 100 int32_t iCurrentPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc);
97 FXJSE_Value_SetInteger(hValue, iCurrentPage); 101 FXJSE_Value_SetInteger(hValue, iCurrentPage);
98 } 102 }
99 void CScript_HostPseudoModel::Script_HostPseudoModel_Language( 103 void CScript_HostPseudoModel::Script_HostPseudoModel_Language(
100 FXJSE_HVALUE hValue, 104 FXJSE_HVALUE hValue,
101 FX_BOOL bSetting, 105 FX_BOOL bSetting,
102 XFA_ATTRIBUTE eAttribute) { 106 XFA_ATTRIBUTE eAttribute) {
103 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 107 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
104 if (!pNotify) { 108 if (!pNotify) {
105 return; 109 return;
106 } 110 }
107 if (bSetting) { 111 if (bSetting) {
108 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_LANGUAGE); 112 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_LANGUAGE);
109 return; 113 return;
110 } 114 }
111 CFX_WideString wsLanguage; 115 CFX_WideString wsLanguage;
112 pNotify->GetAppProvider()->GetLanguage(wsLanguage); 116 pNotify->GetAppProvider()->GetLanguage(wsLanguage);
113 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsLanguage)); 117 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsLanguage));
114 } 118 }
115 void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( 119 void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages(
116 FXJSE_HVALUE hValue, 120 FXJSE_HVALUE hValue,
117 FX_BOOL bSetting, 121 FX_BOOL bSetting,
118 XFA_ATTRIBUTE eAttribute) { 122 XFA_ATTRIBUTE eAttribute) {
119 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 123 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
120 if (!pNotify) { 124 if (!pNotify) {
121 return; 125 return;
122 } 126 }
123 IXFA_Doc* hDoc = pNotify->GetHDOC(); 127 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
124 if (bSetting) { 128 if (bSetting) {
125 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_NUMPAGES); 129 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_NUMPAGES);
126 return; 130 return;
127 } 131 }
128 int32_t iNumPages = pNotify->GetDocProvider()->CountPages(hDoc); 132 int32_t iNumPages = pNotify->GetDocProvider()->CountPages(hDoc);
129 FXJSE_Value_SetInteger(hValue, iNumPages); 133 FXJSE_Value_SetInteger(hValue, iNumPages);
130 } 134 }
131 void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( 135 void CScript_HostPseudoModel::Script_HostPseudoModel_Platform(
132 FXJSE_HVALUE hValue, 136 FXJSE_HVALUE hValue,
133 FX_BOOL bSetting, 137 FX_BOOL bSetting,
134 XFA_ATTRIBUTE eAttribute) { 138 XFA_ATTRIBUTE eAttribute) {
135 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 139 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
136 if (!pNotify) { 140 if (!pNotify) {
137 return; 141 return;
138 } 142 }
139 if (bSetting) { 143 if (bSetting) {
140 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_PLATFORM); 144 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_PLATFORM);
141 return; 145 return;
142 } 146 }
143 CFX_WideString wsPlatform; 147 CFX_WideString wsPlatform;
144 pNotify->GetAppProvider()->GetPlatform(wsPlatform); 148 pNotify->GetAppProvider()->GetPlatform(wsPlatform);
145 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsPlatform)); 149 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsPlatform));
146 } 150 }
147 void CScript_HostPseudoModel::Script_HostPseudoModel_Title( 151 void CScript_HostPseudoModel::Script_HostPseudoModel_Title(
148 FXJSE_HVALUE hValue, 152 FXJSE_HVALUE hValue,
149 FX_BOOL bSetting, 153 FX_BOOL bSetting,
150 XFA_ATTRIBUTE eAttribute) { 154 XFA_ATTRIBUTE eAttribute) {
151 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 155 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
152 return; 156 return;
153 } 157 }
154 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 158 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
155 if (!pNotify) { 159 if (!pNotify) {
156 return; 160 return;
157 } 161 }
158 IXFA_Doc* hDoc = pNotify->GetHDOC(); 162 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
159 if (bSetting) { 163 if (bSetting) {
160 CFX_ByteString bsValue; 164 CFX_ByteString bsValue;
161 FXJSE_Value_ToUTF8String(hValue, bsValue); 165 FXJSE_Value_ToUTF8String(hValue, bsValue);
162 pNotify->GetDocProvider()->SetTitle( 166 pNotify->GetDocProvider()->SetTitle(
163 hDoc, CFX_WideString::FromUTF8(bsValue, bsValue.GetLength())); 167 hDoc, CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()));
164 return; 168 return;
165 } 169 }
166 CFX_WideString wsTitle; 170 CFX_WideString wsTitle;
167 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); 171 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle);
168 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle)); 172 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle));
169 } 173 }
170 void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( 174 void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled(
171 FXJSE_HVALUE hValue, 175 FXJSE_HVALUE hValue,
172 FX_BOOL bSetting, 176 FX_BOOL bSetting,
173 XFA_ATTRIBUTE eAttribute) { 177 XFA_ATTRIBUTE eAttribute) {
174 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 178 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
175 if (!pNotify) { 179 if (!pNotify) {
176 return; 180 return;
177 } 181 }
178 IXFA_Doc* hDoc = pNotify->GetHDOC(); 182 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
179 if (bSetting) { 183 if (bSetting) {
180 pNotify->GetDocProvider()->SetValidationsEnabled( 184 pNotify->GetDocProvider()->SetValidationsEnabled(
181 hDoc, FXJSE_Value_ToBoolean(hValue)); 185 hDoc, FXJSE_Value_ToBoolean(hValue));
182 return; 186 return;
183 } 187 }
184 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc); 188 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc);
185 FXJSE_Value_SetBoolean(hValue, bEnabled); 189 FXJSE_Value_SetBoolean(hValue, bEnabled);
186 } 190 }
187 void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( 191 void CScript_HostPseudoModel::Script_HostPseudoModel_Variation(
188 FXJSE_HVALUE hValue, 192 FXJSE_HVALUE hValue,
189 FX_BOOL bSetting, 193 FX_BOOL bSetting,
190 XFA_ATTRIBUTE eAttribute) { 194 XFA_ATTRIBUTE eAttribute) {
191 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 195 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
192 return; 196 return;
193 } 197 }
194 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 198 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
195 if (!pNotify) { 199 if (!pNotify) {
196 return; 200 return;
197 } 201 }
198 if (bSetting) { 202 if (bSetting) {
199 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VARIATION); 203 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VARIATION);
200 return; 204 return;
201 } 205 }
202 CFX_WideString wsVariation; 206 CFX_WideString wsVariation;
203 pNotify->GetAppProvider()->GetVariation(wsVariation); 207 pNotify->GetAppProvider()->GetVariation(wsVariation);
204 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVariation)); 208 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVariation));
205 } 209 }
206 void CScript_HostPseudoModel::Script_HostPseudoModel_Version( 210 void CScript_HostPseudoModel::Script_HostPseudoModel_Version(
207 FXJSE_HVALUE hValue, 211 FXJSE_HVALUE hValue,
208 FX_BOOL bSetting, 212 FX_BOOL bSetting,
209 XFA_ATTRIBUTE eAttribute) { 213 XFA_ATTRIBUTE eAttribute) {
210 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 214 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
211 if (!pNotify) { 215 if (!pNotify) {
212 return; 216 return;
213 } 217 }
214 if (bSetting) { 218 if (bSetting) {
215 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); 219 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION);
216 return; 220 return;
217 } 221 }
218 CFX_WideString wsVersion; 222 CFX_WideString wsVersion;
219 pNotify->GetAppProvider()->GetVersion(wsVersion); 223 pNotify->GetAppProvider()->GetVersion(wsVersion);
220 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion)); 224 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion));
221 } 225 }
222 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( 226 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion(
223 FXJSE_HVALUE hValue, 227 FXJSE_HVALUE hValue,
224 FX_BOOL bSetting, 228 FX_BOOL bSetting,
225 XFA_ATTRIBUTE eAttribute) { 229 XFA_ATTRIBUTE eAttribute) {
226 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 230 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
227 if (!pNotify) { 231 if (!pNotify) {
228 return; 232 return;
229 } 233 }
230 if (bSetting) { 234 if (bSetting) {
231 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); 235 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION);
232 return; 236 return;
233 } 237 }
234 CFX_WideString wsVersion; 238 CFX_WideString wsVersion;
235 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); 239 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion);
236 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion)); 240 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion));
237 } 241 }
238 void CScript_HostPseudoModel::Script_HostPseudoModel_Name( 242 void CScript_HostPseudoModel::Script_HostPseudoModel_Name(
239 FXJSE_HVALUE hValue, 243 FXJSE_HVALUE hValue,
240 FX_BOOL bSetting, 244 FX_BOOL bSetting,
241 XFA_ATTRIBUTE eAttribute) { 245 XFA_ATTRIBUTE eAttribute) {
242 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 246 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
243 if (!pNotify) { 247 if (!pNotify) {
244 return; 248 return;
245 } 249 }
246 if (bSetting) { 250 if (bSetting) {
247 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 251 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
248 return; 252 return;
249 } 253 }
250 CFX_WideString wsAppName; 254 CFX_WideString wsAppName;
251 pNotify->GetAppProvider()->GetAppName(wsAppName); 255 pNotify->GetAppProvider()->GetAppName(wsAppName);
252 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppName)); 256 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppName));
253 } 257 }
254 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( 258 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName(
255 FXJSE_HVALUE hValue, 259 FXJSE_HVALUE hValue,
256 FX_BOOL bSetting, 260 FX_BOOL bSetting,
257 XFA_ATTRIBUTE eAttribute) { 261 XFA_ATTRIBUTE eAttribute) {
258 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 262 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
259 if (!pNotify) { 263 if (!pNotify) {
260 return; 264 return;
261 } 265 }
262 if (bSetting) { 266 if (bSetting) {
263 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 267 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
264 return; 268 return;
265 } 269 }
266 CFX_WideString wsFoxitAppName; 270 CFX_WideString wsFoxitAppName;
267 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); 271 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName);
268 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsFoxitAppName)); 272 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsFoxitAppName));
269 } 273 }
270 void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( 274 void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL(
271 CFXJSE_Arguments* pArguments) { 275 CFXJSE_Arguments* pArguments) {
272 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 276 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
273 return; 277 return;
274 } 278 }
275 int32_t iLength = pArguments->GetLength(); 279 int32_t iLength = pArguments->GetLength();
276 if (iLength != 1) { 280 if (iLength != 1) {
277 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); 281 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL");
278 return; 282 return;
279 } 283 }
280 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 284 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
281 if (!pNotify) { 285 if (!pNotify) {
282 return; 286 return;
283 } 287 }
284 IXFA_Doc* hDoc = pNotify->GetHDOC(); 288 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
285 CFX_WideString wsURL; 289 CFX_WideString wsURL;
286 if (iLength >= 1) { 290 if (iLength >= 1) {
287 CFX_ByteString bsURL = pArguments->GetUTF8String(0); 291 CFX_ByteString bsURL = pArguments->GetUTF8String(0);
288 wsURL = CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()); 292 wsURL = CFX_WideString::FromUTF8(bsURL, bsURL.GetLength());
289 } 293 }
290 pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); 294 pNotify->GetDocProvider()->GotoURL(hDoc, wsURL);
291 } 295 }
292 void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( 296 void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList(
293 CFXJSE_Arguments* pArguments) { 297 CFXJSE_Arguments* pArguments) {
294 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 298 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
295 return; 299 return;
296 } 300 }
297 int32_t iLength = pArguments->GetLength(); 301 int32_t iLength = pArguments->GetLength();
298 if (iLength != 1) { 302 if (iLength != 1) {
299 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); 303 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList");
300 return; 304 return;
301 } 305 }
302 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 306 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
303 if (!pNotify) { 307 if (!pNotify) {
304 return; 308 return;
305 } 309 }
306 CXFA_Node* pNode = NULL; 310 CXFA_Node* pNode = NULL;
307 if (iLength >= 1) { 311 if (iLength >= 1) {
308 FXJSE_HVALUE hValue = pArguments->GetValue(0); 312 FXJSE_HVALUE hValue = pArguments->GetValue(0);
309 if (FXJSE_Value_IsObject(hValue)) { 313 if (FXJSE_Value_IsObject(hValue)) {
310 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, nullptr)); 314 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, nullptr));
311 } else if (FXJSE_Value_IsUTF8String(hValue)) { 315 } else if (FXJSE_Value_IsUTF8String(hValue)) {
312 CFX_ByteString bsString; 316 CFX_ByteString bsString;
313 FXJSE_Value_ToUTF8String(hValue, bsString); 317 FXJSE_Value_ToUTF8String(hValue, bsString);
314 CFX_WideString wsExpression = 318 CFX_WideString wsExpression =
315 CFX_WideString::FromUTF8(bsString, bsString.GetLength()); 319 CFX_WideString::FromUTF8(bsString, bsString.GetLength());
316 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 320 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
317 if (!pScriptContext) { 321 if (!pScriptContext) {
318 FXJSE_Value_Release(hValue); 322 FXJSE_Value_Release(hValue);
319 return; 323 return;
320 } 324 }
321 CXFA_Object* pObject = pScriptContext->GetThisObject(); 325 CXFA_Object* pObject = pScriptContext->GetThisObject();
322 if (!pObject) { 326 if (!pObject) {
323 FXJSE_Value_Release(hValue); 327 FXJSE_Value_Release(hValue);
324 return; 328 return;
325 } 329 }
326 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | 330 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
327 XFA_RESOLVENODE_Siblings; 331 XFA_RESOLVENODE_Siblings;
328 XFA_RESOLVENODE_RS resoveNodeRS; 332 XFA_RESOLVENODE_RS resoveNodeRS;
329 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, 333 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression,
330 resoveNodeRS, dwFlag); 334 resoveNodeRS, dwFlag);
331 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { 335 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
332 FXJSE_Value_Release(hValue); 336 FXJSE_Value_Release(hValue);
333 return; 337 return;
334 } 338 }
335 pNode = resoveNodeRS.nodes[0]->AsNode(); 339 pNode = resoveNodeRS.nodes[0]->AsNode();
336 } 340 }
337 FXJSE_Value_Release(hValue); 341 FXJSE_Value_Release(hValue);
338 } 342 }
339 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); 343 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout();
340 if (!pDocLayout) { 344 if (!pDocLayout) {
341 return; 345 return;
342 } 346 }
343 IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); 347 CXFA_FFWidget* hWidget =
348 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode));
344 if (!hWidget) { 349 if (!hWidget) {
345 return; 350 return;
346 } 351 }
347 pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget); 352 pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget);
348 pNotify->OpenDropDownList(hWidget); 353 pNotify->OpenDropDownList(hWidget);
349 } 354 }
350 void CScript_HostPseudoModel::Script_HostPseudoModel_Response( 355 void CScript_HostPseudoModel::Script_HostPseudoModel_Response(
351 CFXJSE_Arguments* pArguments) { 356 CFXJSE_Arguments* pArguments) {
352 int32_t iLength = pArguments->GetLength(); 357 int32_t iLength = pArguments->GetLength();
353 if (iLength < 1 || iLength > 4) { 358 if (iLength < 1 || iLength > 4) {
354 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response"); 359 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response");
355 return; 360 return;
356 } 361 }
357 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 362 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
358 if (!pNotify) { 363 if (!pNotify) {
359 return; 364 return;
360 } 365 }
361 CFX_WideString wsQuestion; 366 CFX_WideString wsQuestion;
362 CFX_WideString wsTitle; 367 CFX_WideString wsTitle;
363 CFX_WideString wsDefaultAnswer; 368 CFX_WideString wsDefaultAnswer;
364 FX_BOOL bMark = FALSE; 369 FX_BOOL bMark = FALSE;
365 if (iLength >= 1) { 370 if (iLength >= 1) {
366 CFX_ByteString bsQuestion = pArguments->GetUTF8String(0); 371 CFX_ByteString bsQuestion = pArguments->GetUTF8String(0);
367 wsQuestion = CFX_WideString::FromUTF8(bsQuestion, bsQuestion.GetLength()); 372 wsQuestion = CFX_WideString::FromUTF8(bsQuestion, bsQuestion.GetLength());
(...skipping 13 matching lines...) Expand all
381 CFX_WideString wsAnswer; 386 CFX_WideString wsAnswer;
382 pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion, wsTitle, 387 pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion, wsTitle,
383 wsDefaultAnswer, bMark); 388 wsDefaultAnswer, bMark);
384 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 389 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
385 if (hValue) { 390 if (hValue) {
386 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer)); 391 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer));
387 } 392 }
388 } 393 }
389 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( 394 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch(
390 CFXJSE_Arguments* pArguments) { 395 CFXJSE_Arguments* pArguments) {
391 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 396 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
392 if (!pNotify) { 397 if (!pNotify) {
393 return; 398 return;
394 } 399 }
395 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch(); 400 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch();
396 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 401 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
397 if (hValue) { 402 if (hValue) {
398 FXJSE_Value_SetInteger(hValue, iCur); 403 FXJSE_Value_SetInteger(hValue, iCur);
399 } 404 }
400 } 405 }
401 static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, 406 static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression,
(...skipping 20 matching lines...) Expand all
422 wsFilter.TrimRight(); 427 wsFilter.TrimRight();
423 return nStart; 428 return nStart;
424 } 429 }
425 void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( 430 void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData(
426 CFXJSE_Arguments* pArguments) { 431 CFXJSE_Arguments* pArguments) {
427 int32_t iLength = pArguments->GetLength(); 432 int32_t iLength = pArguments->GetLength();
428 if (iLength < 0 || iLength > 1) { 433 if (iLength < 0 || iLength > 1) {
429 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); 434 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData");
430 return; 435 return;
431 } 436 }
432 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 437 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
433 if (!pNotify) { 438 if (!pNotify) {
434 return; 439 return;
435 } 440 }
436 CFX_WideString wsExpression; 441 CFX_WideString wsExpression;
437 if (iLength >= 1) { 442 if (iLength >= 1) {
438 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 443 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
439 wsExpression = 444 wsExpression =
440 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); 445 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
441 } 446 }
442 if (wsExpression.IsEmpty()) { 447 if (wsExpression.IsEmpty()) {
443 pNotify->ResetData(); 448 pNotify->ResetData();
444 return; 449 return;
445 } 450 }
446 int32_t iStart = 0; 451 int32_t iStart = 0;
447 CFX_WideString wsName; 452 CFX_WideString wsName;
448 CXFA_Node* pNode = NULL; 453 CXFA_Node* pNode = NULL;
449 int32_t iExpLength = wsExpression.GetLength(); 454 int32_t iExpLength = wsExpression.GetLength();
450 while (iStart < iExpLength) { 455 while (iStart < iExpLength) {
451 iStart = XFA_FilterName(wsExpression, iStart, wsName); 456 iStart = XFA_FilterName(wsExpression, iStart, wsName);
452 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 457 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
453 if (!pScriptContext) { 458 if (!pScriptContext) {
454 return; 459 return;
455 } 460 }
456 CXFA_Object* pObject = pScriptContext->GetThisObject(); 461 CXFA_Object* pObject = pScriptContext->GetThisObject();
457 if (!pObject) { 462 if (!pObject) {
458 return; 463 return;
459 } 464 }
460 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | 465 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
461 XFA_RESOLVENODE_Siblings; 466 XFA_RESOLVENODE_Siblings;
462 XFA_RESOLVENODE_RS resoveNodeRS; 467 XFA_RESOLVENODE_RS resoveNodeRS;
(...skipping 12 matching lines...) Expand all
475 void CScript_HostPseudoModel::Script_HostPseudoModel_Beep( 480 void CScript_HostPseudoModel::Script_HostPseudoModel_Beep(
476 CFXJSE_Arguments* pArguments) { 481 CFXJSE_Arguments* pArguments) {
477 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 482 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
478 return; 483 return;
479 } 484 }
480 int32_t iLength = pArguments->GetLength(); 485 int32_t iLength = pArguments->GetLength();
481 if (iLength < 0 || iLength > 1) { 486 if (iLength < 0 || iLength > 1) {
482 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep"); 487 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep");
483 return; 488 return;
484 } 489 }
485 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 490 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
486 if (!pNotify) { 491 if (!pNotify) {
487 return; 492 return;
488 } 493 }
489 uint32_t dwType = 4; 494 uint32_t dwType = 4;
490 if (iLength >= 1) { 495 if (iLength >= 1) {
491 dwType = pArguments->GetInt32(0); 496 dwType = pArguments->GetInt32(0);
492 } 497 }
493 pNotify->GetAppProvider()->Beep(dwType); 498 pNotify->GetAppProvider()->Beep(dwType);
494 } 499 }
495 void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( 500 void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus(
496 CFXJSE_Arguments* pArguments) { 501 CFXJSE_Arguments* pArguments) {
497 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 502 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
498 return; 503 return;
499 } 504 }
500 int32_t iLength = pArguments->GetLength(); 505 int32_t iLength = pArguments->GetLength();
501 if (iLength != 1) { 506 if (iLength != 1) {
502 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus"); 507 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus");
503 return; 508 return;
504 } 509 }
505 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 510 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
506 if (!pNotify) { 511 if (!pNotify) {
507 return; 512 return;
508 } 513 }
509 CXFA_Node* pNode = NULL; 514 CXFA_Node* pNode = NULL;
510 if (iLength >= 1) { 515 if (iLength >= 1) {
511 FXJSE_HVALUE hValue = pArguments->GetValue(0); 516 FXJSE_HVALUE hValue = pArguments->GetValue(0);
512 if (FXJSE_Value_IsObject(hValue)) { 517 if (FXJSE_Value_IsObject(hValue)) {
513 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, NULL)); 518 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, NULL));
514 } else if (FXJSE_Value_IsUTF8String(hValue)) { 519 } else if (FXJSE_Value_IsUTF8String(hValue)) {
515 CFX_ByteString bsString; 520 CFX_ByteString bsString;
516 FXJSE_Value_ToUTF8String(hValue, bsString); 521 FXJSE_Value_ToUTF8String(hValue, bsString);
517 CFX_WideString wsExpression = 522 CFX_WideString wsExpression =
518 CFX_WideString::FromUTF8(bsString, bsString.GetLength()); 523 CFX_WideString::FromUTF8(bsString, bsString.GetLength());
519 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 524 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
520 if (!pScriptContext) { 525 if (!pScriptContext) {
521 FXJSE_Value_Release(hValue); 526 FXJSE_Value_Release(hValue);
522 return; 527 return;
523 } 528 }
524 CXFA_Object* pObject = pScriptContext->GetThisObject(); 529 CXFA_Object* pObject = pScriptContext->GetThisObject();
525 if (!pObject) { 530 if (!pObject) {
526 FXJSE_Value_Release(hValue); 531 FXJSE_Value_Release(hValue);
527 return; 532 return;
528 } 533 }
529 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | 534 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
530 XFA_RESOLVENODE_Siblings; 535 XFA_RESOLVENODE_Siblings;
531 XFA_RESOLVENODE_RS resoveNodeRS; 536 XFA_RESOLVENODE_RS resoveNodeRS;
532 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, 537 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression,
533 resoveNodeRS, dwFlag); 538 resoveNodeRS, dwFlag);
534 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { 539 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
535 FXJSE_Value_Release(hValue); 540 FXJSE_Value_Release(hValue);
536 return; 541 return;
537 } 542 }
538 pNode = resoveNodeRS.nodes[0]->AsNode(); 543 pNode = resoveNodeRS.nodes[0]->AsNode();
539 } 544 }
540 FXJSE_Value_Release(hValue); 545 FXJSE_Value_Release(hValue);
541 } 546 }
542 pNotify->SetFocusWidgetNode(pNode); 547 pNotify->SetFocusWidgetNode(pNode);
543 } 548 }
544 void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( 549 void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus(
545 CFXJSE_Arguments* pArguments) { 550 CFXJSE_Arguments* pArguments) {
546 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 551 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
547 if (!pNotify) { 552 if (!pNotify) {
548 return; 553 return;
549 } 554 }
550 CXFA_Node* pNode = pNotify->GetFocusWidgetNode(); 555 CXFA_Node* pNode = pNotify->GetFocusWidgetNode();
551 if (!pNode) { 556 if (!pNode) {
552 return; 557 return;
553 } 558 }
554 FXJSE_Value_Set(pArguments->GetReturnValue(), 559 FXJSE_Value_Set(pArguments->GetReturnValue(),
555 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 560 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
556 } 561 }
557 void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( 562 void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox(
558 CFXJSE_Arguments* pArguments) { 563 CFXJSE_Arguments* pArguments) {
559 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 564 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
560 return; 565 return;
561 } 566 }
562 int32_t iLength = pArguments->GetLength(); 567 int32_t iLength = pArguments->GetLength();
563 if (iLength < 1 || iLength > 4) { 568 if (iLength < 1 || iLength > 4) {
564 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox"); 569 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox");
565 return; 570 return;
566 } 571 }
567 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 572 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
568 if (!pNotify) { 573 if (!pNotify) {
569 return; 574 return;
570 } 575 }
571 CFX_WideString wsMessage; 576 CFX_WideString wsMessage;
572 CFX_WideString bsTitle; 577 CFX_WideString bsTitle;
573 uint32_t dwMessageType = XFA_MBICON_Error; 578 uint32_t dwMessageType = XFA_MBICON_Error;
574 uint32_t dwButtonType = XFA_MB_OK; 579 uint32_t dwButtonType = XFA_MB_OK;
575 if (iLength >= 1) { 580 if (iLength >= 1) {
576 if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 0, wsMessage)) { 581 if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 0, wsMessage)) {
577 return; 582 return;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } else { 629 } else {
625 CFX_ByteString byMessage; 630 CFX_ByteString byMessage;
626 FXJSE_Value_ToUTF8String(hValueArg, byMessage); 631 FXJSE_Value_ToUTF8String(hValueArg, byMessage);
627 wsValue = CFX_WideString::FromUTF8(byMessage, byMessage.GetLength()); 632 wsValue = CFX_WideString::FromUTF8(byMessage, byMessage.GetLength());
628 } 633 }
629 FXJSE_Value_Release(hValueArg); 634 FXJSE_Value_Release(hValueArg);
630 return TRUE; 635 return TRUE;
631 } 636 }
632 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( 637 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch(
633 CFXJSE_Arguments* pArguments) { 638 CFXJSE_Arguments* pArguments) {
634 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 639 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
635 if (!pNotify) { 640 if (!pNotify) {
636 return; 641 return;
637 } 642 }
638 int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch(); 643 int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch();
639 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 644 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
640 if (hValue) { 645 if (hValue) {
641 FXJSE_Value_SetInteger(hValue, iValue); 646 FXJSE_Value_SetInteger(hValue, iValue);
642 } 647 }
643 } 648 }
644 void CScript_HostPseudoModel::Script_HostPseudoModel_Print( 649 void CScript_HostPseudoModel::Script_HostPseudoModel_Print(
645 CFXJSE_Arguments* pArguments) { 650 CFXJSE_Arguments* pArguments) {
646 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 651 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
647 return; 652 return;
648 } 653 }
649 int32_t iLength = pArguments->GetLength(); 654 int32_t iLength = pArguments->GetLength();
650 if (iLength != 8) { 655 if (iLength != 8) {
651 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); 656 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print");
652 return; 657 return;
653 } 658 }
654 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 659 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
655 if (!pNotify) { 660 if (!pNotify) {
656 return; 661 return;
657 } 662 }
658 IXFA_Doc* hDoc = pNotify->GetHDOC(); 663 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
659 uint32_t dwOptions = 0; 664 uint32_t dwOptions = 0;
660 FX_BOOL bShowDialog = TRUE; 665 FX_BOOL bShowDialog = TRUE;
661 if (iLength >= 1) { 666 if (iLength >= 1) {
662 bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; 667 bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE;
663 } 668 }
664 if (bShowDialog) { 669 if (bShowDialog) {
665 dwOptions |= XFA_PRINTOPT_ShowDialog; 670 dwOptions |= XFA_PRINTOPT_ShowDialog;
666 } 671 }
667 int32_t nStartPage = 0; 672 int32_t nStartPage = 0;
668 if (iLength >= 2) { 673 if (iLength >= 2) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 } 715 }
711 pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); 716 pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions);
712 } 717 }
713 void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( 718 void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData(
714 CFXJSE_Arguments* pArguments) { 719 CFXJSE_Arguments* pArguments) {
715 int32_t iLength = pArguments->GetLength(); 720 int32_t iLength = pArguments->GetLength();
716 if (iLength < 0 || iLength > 1) { 721 if (iLength < 0 || iLength > 1) {
717 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); 722 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData");
718 return; 723 return;
719 } 724 }
720 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 725 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
721 if (!pNotify) { 726 if (!pNotify) {
722 return; 727 return;
723 } 728 }
724 CFX_WideString wsFilePath; 729 CFX_WideString wsFilePath;
725 if (iLength > 0) { 730 if (iLength > 0) {
726 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); 731 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
727 wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength()); 732 wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength());
728 } 733 }
729 IXFA_Doc* hDoc = pNotify->GetHDOC(); 734 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
730 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); 735 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath);
731 } 736 }
732 void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( 737 void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData(
733 CFXJSE_Arguments* pArguments) { 738 CFXJSE_Arguments* pArguments) {
734 int32_t iLength = pArguments->GetLength(); 739 int32_t iLength = pArguments->GetLength();
735 if (iLength < 0 || iLength > 2) { 740 if (iLength < 0 || iLength > 2) {
736 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); 741 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData");
737 return; 742 return;
738 } 743 }
739 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 744 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
740 if (!pNotify) { 745 if (!pNotify) {
741 return; 746 return;
742 } 747 }
743 IXFA_Doc* hDoc = pNotify->GetHDOC(); 748 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
744 CFX_WideString wsFilePath; 749 CFX_WideString wsFilePath;
745 FX_BOOL bXDP = TRUE; 750 FX_BOOL bXDP = TRUE;
746 if (iLength >= 1) { 751 if (iLength >= 1) {
747 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); 752 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
748 wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength()); 753 wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength());
749 } 754 }
750 if (iLength >= 2) { 755 if (iLength >= 2) {
751 bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 756 bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
752 } 757 }
753 pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); 758 pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP);
754 } 759 }
755 void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( 760 void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp(
756 CFXJSE_Arguments* pArguments) { 761 CFXJSE_Arguments* pArguments) {
757 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 762 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
758 if (!pNotify) { 763 if (!pNotify) {
759 return; 764 return;
760 } 765 }
761 IXFA_Doc* hDoc = pNotify->GetHDOC(); 766 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
762 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); 767 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc);
763 int32_t nNewPage = 0; 768 int32_t nNewPage = 0;
764 if (nCurPage <= 1) { 769 if (nCurPage <= 1) {
765 return; 770 return;
766 } 771 }
767 nNewPage = nCurPage - 1; 772 nNewPage = nCurPage - 1;
768 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); 773 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage);
769 } 774 }
770 void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( 775 void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown(
771 CFXJSE_Arguments* pArguments) { 776 CFXJSE_Arguments* pArguments) {
772 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 777 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
773 if (!pNotify) { 778 if (!pNotify) {
774 return; 779 return;
775 } 780 }
776 IXFA_Doc* hDoc = pNotify->GetHDOC(); 781 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
777 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); 782 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc);
778 int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc); 783 int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc);
779 if (!nPageCount || nCurPage == nPageCount) { 784 if (!nPageCount || nCurPage == nPageCount) {
780 return; 785 return;
781 } 786 }
782 int32_t nNewPage = 0; 787 int32_t nNewPage = 0;
783 if (nCurPage >= nPageCount) { 788 if (nCurPage >= nPageCount) {
784 nNewPage = nPageCount - 1; 789 nNewPage = nPageCount - 1;
785 } else { 790 } else {
786 nNewPage = nCurPage + 1; 791 nNewPage = nCurPage + 1;
787 } 792 }
788 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); 793 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage);
789 } 794 }
790 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( 795 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime(
791 CFXJSE_Arguments* pArguments) { 796 CFXJSE_Arguments* pArguments) {
792 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 797 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
793 if (!pNotify) { 798 if (!pNotify) {
794 return; 799 return;
795 } 800 }
796 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); 801 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime();
797 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 802 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
798 if (hValue) { 803 if (hValue) {
799 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime)); 804 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime));
800 } 805 }
801 } 806 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_script_hostpseudomodel.h ('k') | xfa/fxfa/parser/xfa_script_imp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698